2024-02-04 11:45:57 +05:00

2 lines
710 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*! For license information please see main.js.LICENSE.txt */
!function(){var t={5354:function(t,e,n){n(7327),t.exports=n(2649)("Array","filter")},3462:function(t,e,n){n(6699),t.exports=n(2649)("Array","includes")},9358:function(t,e,n){n(5827),t.exports=n(2649)("Array","reduce")},9116:function(t,e,n){n(9601),n(857)},4533:function(t,e,n){n(2023),t.exports=n(2649)("String","includes")},3099:function(t){t.exports=function(t){if("function"!=typeof t)throw TypeError(String(t)+" is not a function");return t}},1223:function(t,e,n){var i=n(5112)("unscopables"),r=n(30),o=n(5185),s=Array.prototype;null==s[i]&&o(s,i,r(null)),t.exports=function(t){s[i][t]=!0}},9670:function(t,e,n){var i=n(111);t.exports=function(t){if(!i(t))throw TypeError(String(t)+" is not an object");return t}},1318:function(t,e,n){var i=n(5656),r=n(7466),o=n(1400);t.exports=function(t){return function(e,n,s){var a,l=i(e),c=r(l.length),h=o(s,c);if(t&&n!=n){for(;c>h;)if((a=l[h++])!=a)return!0}else for(;c>h;h++)if((t||h in l)&&l[h]===n)return t||h||0;return!t&&-1}}},1194:function(t,e,n){var i=n(7293),r=n(5112)("species");t.exports=function(t){return!i((function(){var e=[];return(e.constructor={})[r]=function(){return{foo:1}},1!==e[t](Boolean).foo}))}},7550:function(t,e,n){var i=n(244),r=n(8361),o=n(7908),s=n(7466),a=n(5417);t.exports=function(t,e){var n=1==t,l=2==t,c=3==t,h=4==t,u=6==t,d=5==t||u,p=e||a;return function(e,a,f){for(var m,g,_=o(e),v=r(_),y=i(a,f,3),x=s(v.length),b=0,w=n?p(e,x):l?p(e,0):void 0;x>b;b++)if((d||b in v)&&(g=y(m=v[b],b,_),t))if(n)w[b]=g;else if(g)switch(t){case 3:return!0;case 5:return m;case 6:return b;case 2:w.push(m)}else if(h)return!1;return u?-1:c||h?h:w}}},3671:function(t,e,n){var i=n(3099),r=n(7908),o=n(8361),s=n(7466);t.exports=function(t,e,n,a,l){i(e);var c=r(t),h=o(c),u=s(c.length),d=l?u-1:0,p=l?-1:1;if(n<2)for(;;){if(d in h){a=h[d],d+=p;break}if(d+=p,l?d<0:u<=d)throw TypeError("Reduce of empty array with no initial value")}for(;l?d>=0:u>d;d+=p)d in h&&(a=e(a,h[d],d,c));return a}},5417:function(t,e,n){var i=n(111),r=n(3157),o=n(5112)("species");t.exports=function(t,e){var n;return r(t)&&("function"!=typeof(n=t.constructor)||n!==Array&&!r(n.prototype)?i(n)&&null===(n=n[o])&&(n=void 0):n=void 0),new(void 0===n?Array:n)(0===e?0:e)}},244:function(t,e,n){var i=n(3099);t.exports=function(t,e,n){if(i(t),void 0===e)return t;switch(n){case 0:return function(){return t.call(e)};case 1:return function(n){return t.call(e,n)};case 2:return function(n,i){return t.call(e,n,i)};case 3:return function(n,i,r){return t.call(e,n,i,r)}}return function(){return t.apply(e,arguments)}}},4326:function(t){var e={}.toString;t.exports=function(t){return e.call(t).slice(8,-1)}},9920:function(t,e,n){var i=n(6656),r=n(3887),o=n(1236),s=n(3070);t.exports=function(t,e){for(var n=r(e),a=s.f,l=o.f,c=0;c<n.length;c++){var h=n[c];i(t,h)||a(t,h,l(e,h))}}},4964:function(t,e,n){var i=n(5112)("match");t.exports=function(t){var e=/./;try{"/./"[t](e)}catch(n){try{return e[i]=!1,"/./"[t](e)}catch(t){}}return!1}},9114:function(t){t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},9781:function(t,e,n){t.exports=!n(7293)((function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}))},317:function(t,e,n){var i=n(111),r=n(7854).document,o=i(r)&&i(r.createElement);t.exports=function(t){return o?r.createElement(t):{}}},2649:function(t,e,n){var i=n(7854),r=n(244),o=Function.call;t.exports=function(t,e,n){return r(o,i[t].prototype[e],n)}},748:function(t){t.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},2109:function(t,e,n){var i=n(7854),r=n(1236).f,o=n(5185),s=n(1320),a=n(3505),l=n(9920),c=n(4705);t.exports=function(t,e){var n,h,u,d,p,f=t.target,m=t.global,g=t.stat;if(n=m?i:g?i[f]||a(f,{}):(i[f]||{}).prototype)for(h in e){if(d=e[h],u=t.noTargetGet?(p=r(n,h))&&p.value:n[h],!c(m?h:f+(g?".":"#")+h,t.forced)&&void 0!==u){if(typeof d==typeof u)continue;l(d,u)}(t.sham||u&&u.sham)&&o(d,"sham",!0),s(n,h,d,t)}}},7293:function(t){t.exports=function(t){try{return!!t()}catch(t){return!0}}},2521:function(t,e,n){t.exports=n(2309)("native-function-to-string",Function.toString)},7854:function(t){t.exports="object"==typeof window&&window&&window.Math==Math?window:"object"==typeof self&&self&&self.Math==Math?self:Function("return this")()},6656:function(t){var e={}.hasOwnProperty;t.exports=function(t,n){return e.call(t,n)}},3501:function(t){t.exports={}},5185:function(t,e,n){var i=n(3070),r=n(9114);t.exports=n(9781)?function(t,e,n){return i.f(t,e,r(1,n))}:function(t,e,n){return t[e]=n,t}},490:function(t,e,n){var i=n(7854).document;t.exports=i&&i.documentElement},4664:function(t,e,n){t.exports=!n(9781)&&!n(7293)((function(){return 7!=Object.defineProperty(n(317)("div"),"a",{get:function(){return 7}}).a}))},8361:function(t,e,n){var i=n(7293),r=n(4326),o="".split;t.exports=i((function(){return!Object("z").propertyIsEnumerable(0)}))?function(t){return"String"==r(t)?o.call(t,""):Object(t)}:Object},9909:function(t,e,n){var i,r,o,s=n(8536),a=n(111),l=n(5185),c=n(6656),h=n(6200),u=n(3501),d=n(7854).WeakMap;if(s){var p=new d,f=p.get,m=p.has,g=p.set;i=function(t,e){return g.call(p,t,e),e},r=function(t){return f.call(p,t)||{}},o=function(t){return m.call(p,t)}}else{var _=h("state");u[_]=!0,i=function(t,e){return l(t,_,e),e},r=function(t){return c(t,_)?t[_]:{}},o=function(t){return c(t,_)}}t.exports={set:i,get:r,has:o,enforce:function(t){return o(t)?r(t):i(t,{})},getterFor:function(t){return function(e){var n;if(!a(e)||(n=r(e)).type!==t)throw TypeError("Incompatible receiver, "+t+" required");return n}}}},3157:function(t,e,n){var i=n(4326);t.exports=Array.isArray||function(t){return"Array"==i(t)}},4705:function(t,e,n){var i=n(7293),r=/#|\.prototype\./,o=function(t,e){var n=a[s(t)];return n==c||n!=l&&("function"==typeof e?i(e):!!e)},s=o.normalize=function(t){return String(t).replace(r,".").toLowerCase()},a=o.data={},l=o.NATIVE="N",c=o.POLYFILL="P";t.exports=o},111:function(t){t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},1913:function(t){t.exports=!1},7850:function(t,e,n){var i=n(111),r=n(4326),o=n(5112)("match");t.exports=function(t){var e;return i(t)&&(void 0!==(e=t[o])?!!e:"RegExp"==r(t))}},133:function(t,e,n){t.exports=!n(7293)((function(){return!String(Symbol())}))},8536:function(t,e,n){var i=n(2521),r=n(7854).WeakMap;t.exports="function"==typeof r&&/native code/.test(i.call(r))},1574:function(t,e,n){"use strict";var i=n(1956),r=n(5181),o=n(5296),s=n(7908),a=n(8361),l=Object.assign;t.exports=!l||n(7293)((function(){var t={},e={},n=Symbol(),r="abcdefghijklmnopqrst";return t[n]=7,r.split("").forEach((function(t){e[t]=t})),7!=l({},t)[n]||i(l({},e)).join("")!=r}))?function(t,e){for(var n=s(t),l=arguments.length,c=1,h=r.f,u=o.f;l>c;)for(var d,p=a(arguments[c++]),f=h?i(p).concat(h(p)):i(p),m=f.length,g=0;m>g;)u.call(p,d=f[g++])&&(n[d]=p[d]);return n}:l},30:function(t,e,n){var i=n(9670),r=n(6048),o=n(748),s=n(490),a=n(317),l=n(6200)("IE_PROTO"),c=function(){},h=function(){var t,e=a("iframe"),n=o.length;for(e.style.display="none",s.appendChild(e),e.src=String("javascript:"),(t=e.contentWindow.document).open(),t.write("<script>document.F=Object<\/script>"),t.close(),h=t.F;n--;)delete h.prototype[o[n]];return h()};t.exports=Object.create||function(t,e){var n;return null!==t?(c.prototype=i(t),n=new c,c.prototype=null,n[l]=t):n=h(),void 0===e?n:r(n,e)},n(3501)[l]=!0},6048:function(t,e,n){var i=n(9781),r=n(3070),o=n(9670),s=n(1956);t.exports=i?Object.defineProperties:function(t,e){o(t);for(var n,i=s(e),a=i.length,l=0;a>l;)r.f(t,n=i[l++],e[n]);return t}},3070:function(t,e,n){var i=n(9781),r=n(4664),o=n(9670),s=n(7593),a=Object.defineProperty;e.f=i?a:function(t,e,n){if(o(t),e=s(e,!0),o(n),r)try{return a(t,e,n)}catch(t){}if("get"in n||"set"in n)throw TypeError("Accessors not supported");return"value"in n&&(t[e]=n.value),t}},1236:function(t,e,n){var i=n(9781),r=n(5296),o=n(9114),s=n(5656),a=n(7593),l=n(6656),c=n(4664),h=Object.getOwnPropertyDescriptor;e.f=i?h:function(t,e){if(t=s(t),e=a(e,!0),c)try{return h(t,e)}catch(t){}if(l(t,e))return o(!r.f.call(t,e),t[e])}},8006:function(t,e,n){var i=n(6324),r=n(748).concat("length","prototype");e.f=Object.getOwnPropertyNames||function(t){return i(t,r)}},5181:function(t,e){e.f=Object.getOwnPropertySymbols},6324:function(t,e,n){var i=n(6656),r=n(5656),o=n(1318)(!1),s=n(3501);t.exports=function(t,e){var n,a=r(t),l=0,c=[];for(n in a)!i(s,n)&&i(a,n)&&c.push(n);for(;e.length>l;)i(a,n=e[l++])&&(~o(c,n)||c.push(n));return c}},1956:function(t,e,n){var i=n(6324),r=n(748);t.exports=Object.keys||function(t){return i(t,r)}},5296:function(t,e){"use strict";var n={}.propertyIsEnumerable,i=Object.getOwnPropertyDescriptor,r=i&&!n.call({1:2},1);e.f=r?function(t){var e=i(this,t);return!!e&&e.enumerable}:n},3887:function(t,e,n){var i=n(8006),r=n(5181),o=n(9670),s=n(7854).Reflect;t.exports=s&&s.ownKeys||function(t){var e=i.f(o(t)),n=r.f;return n?e.concat(n(t)):e}},857:function(t,e,n){n(7854)},1320:function(t,e,n){var i=n(7854),r=n(5185),o=n(6656),s=n(3505),a=n(2521),l=n(9909),c=l.get,h=l.enforce,u=String(a).split("toString");n(2309)("inspectSource",(function(t){return a.call(t)})),(t.exports=function(t,e,n,a){var l=!!a&&!!a.unsafe,c=!!a&&!!a.enumerable,d=!!a&&!!a.noTargetGet;"function"==typeof n&&("string"!=typeof e||o(n,"name")||r(n,"name",e),h(n).source=u.join("string"==typeof e?e:"")),t!==i?(l?!d&&t[e]&&(c=!0):delete t[e],c?t[e]=n:r(t,e,n)):c?t[e]=n:s(e,n)})(Function.prototype,"toString",(function(){return"function"==typeof this&&c(this).source||a.call(this)}))},4488:function(t){t.exports=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t}},3505:function(t,e,n){var i=n(7854),r=n(5185);t.exports=function(t,e){try{r(i,t,e)}catch(n){i[t]=e}return e}},6200:function(t,e,n){var i=n(2309)("keys"),r=n(9711);t.exports=function(t){return i[t]||(i[t]=r(t))}},2309:function(t,e,n){var i=n(7854),r=n(3505),o="__core-js_shared__",s=i[o]||r(o,{});(t.exports=function(t,e){return s[t]||(s[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.0.1",mode:n(1913)?"pure":"global",copyright:"© 2019 Denis Pushkarev (zloirock.ru)"})},6637:function(t,e,n){"use strict";var i=n(7293);t.exports=function(t,e){var n=[][t];return!n||!i((function(){n.call(null,e||function(){throw 1},1)}))}},1400:function(t,e,n){var i=n(9958),r=Math.max,o=Math.min;t.exports=function(t,e){var n=i(t);return n<0?r(n+e,0):o(n,e)}},5656:function(t,e,n){var i=n(8361),r=n(4488);t.exports=function(t){return i(r(t))}},9958:function(t){var e=Math.ceil,n=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?n:e)(t)}},7466:function(t,e,n){var i=n(9958),r=Math.min;t.exports=function(t){return t>0?r(i(t),9007199254740991):0}},7908:function(t,e,n){var i=n(4488);t.exports=function(t){return Object(i(t))}},7593:function(t,e,n){var i=n(111);t.exports=function(t,e){if(!i(t))return t;var n,r;if(e&&"function"==typeof(n=t.toString)&&!i(r=n.call(t)))return r;if("function"==typeof(n=t.valueOf)&&!i(r=n.call(t)))return r;if(!e&&"function"==typeof(n=t.toString)&&!i(r=n.call(t)))return r;throw TypeError("Can't convert object to primitive value")}},9711:function(t){var e=0,n=Math.random();t.exports=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++e+n).toString(36))}},8468:function(t,e,n){var i=n(7850),r=n(4488);t.exports=function(t,e,n){if(i(e))throw TypeError("String.prototype."+n+" doesn't accept regex");return String(r(t))}},5112:function(t,e,n){var i=n(2309)("wks"),r=n(9711),o=n(7854).Symbol,s=n(133);t.exports=function(t){return i[t]||(i[t]=s&&o[t]||(s?o:r)("Symbol."+t))}},7327:function(t,e,n){"use strict";var i=n(7550)(2),r=n(1194)("filter");n(2109)({target:"Array",proto:!0,forced:!r},{filter:function(t){return i(this,t,arguments[1])}})},6699:function(t,e,n){"use strict";var i=n(1318)(!0);n(2109)({target:"Array",proto:!0},{includes:function(t){return i(this,t,arguments.length>1?arguments[1]:void 0)}}),n(1223)("includes")},5827:function(t,e,n){"use strict";var i=n(3671),r=n(6637)("reduce");n(2109)({target:"Array",proto:!0,forced:r},{reduce:function(t){return i(this,t,arguments.length,arguments[1],!1)}})},9601:function(t,e,n){var i=n(1574);n(2109)({target:"Object",stat:!0,forced:Object.assign!==i},{assign:i})},2023:function(t,e,n){"use strict";var i=n(8468),r="includes",o=n(4964)(r);n(2109)({target:"String",proto:!0,forced:!o},{includes:function(t){return!!~i(this,t,r).indexOf(t,arguments.length>1?arguments[1]:void 0)}})},6955:function(t,e){"use strict";e.Z="precision highp float;\n#define GLSLIFY 1\n\nvarying vec3 vFrontColor;\nvarying vec3 vBackColor;\n\nvoid main() {\n gl_FragColor = vec4(gl_FrontFacing ? vFrontColor : vBackColor, 1.0);\n}\n"},1290:function(t,e){"use strict";e.Z="precision highp float;\n\nmat2 rotate2d(float angle) {\n float c = cos(angle);\n float s = sin(angle);\n return mat2(\n c, -s,\n s, c\n );\n}\n\nmat3 rotate3d(float angle, vec3 axis) {\n vec3 a = normalize(axis);\n float s = sin(angle);\n float c = cos(angle);\n float r = 1.0 - c;\n mat3 m = mat3(\n a.x * a.x * r + c,\n a.y * a.x * r + a.z * s,\n a.z * a.x * r - a.y * s,\n a.x * a.y * r - a.z * s,\n a.y * a.y * r + c,\n a.z * a.y * r + a.x * s,\n a.x * a.z * r + a.y * s,\n a.y * a.z * r - a.x * s,\n a.z * a.z * r + c\n );\n return m;\n}\n\n \n\n//\n// Description : Array and textureless GLSL 2D/3D/4D simplex\n// noise functions.\n// Author : Ian McEwan, Ashima Arts.\n// Maintainer : ijm\n// Lastmod : 20110822 (ijm)\n// License : Copyright (C) 2011 Ashima Arts. All rights reserved.\n// Distributed under the MIT License. See LICENSE file.\n// https://github.com/ashima/webgl-noise\n//\n\nprecision highp float;\n#define GLSLIFY 1\n\nvec3 mod289(vec3 x) {\n return x - floor(x * (1.0 / 289.0)) * 289.0;\n}\n\nvec4 mod289(vec4 x) {\n return x - floor(x * (1.0 / 289.0)) * 289.0;\n}\n\nvec4 permute(vec4 x) {\n return mod289(((x*34.0)+1.0)*x);\n}\n\nvec4 taylorInvSqrt(vec4 r)\n{\n return 1.79284291400159 - 0.85373472095314 * r;\n}\n\nfloat snoise(vec3 v)\n{\n const vec2 C = vec2(1.0/6.0, 1.0/3.0);\n const vec4 D = vec4(0.0, 0.5, 1.0, 2.0);\n\n // First corner\n vec3 i = floor(v + dot(v, C.yyy));\n vec3 x0 = v - i + dot(i, C.xxx);\n\n // Other corners\n vec3 g = step(x0.yzx, x0.xyz);\n vec3 l = 1.0 - g;\n vec3 i1 = min(g.xyz, l.zxy);\n vec3 i2 = max(g.xyz, l.zxy);\n\n // x0 = x0 - 0.0 + 0.0 * C.xxx;\n // x1 = x0 - i1 + 1.0 * C.xxx;\n // x2 = x0 - i2 + 2.0 * C.xxx;\n // x3 = x0 - 1.0 + 3.0 * C.xxx;\n vec3 x1 = x0 - i1 + C.xxx;\n vec3 x2 = x0 - i2 + C.yyy;// 2.0*C.x = 1/3 = C.y\n vec3 x3 = x0 - D.yyy;// -1.0+3.0*C.x = -0.5 = -D.y\n\n // Permutations\n i = mod289(i);\n vec4 p = permute(permute(permute(\n i.z + vec4(0.0, i1.z, i2.z, 1.0))\n + i.y + vec4(0.0, i1.y, i2.y, 1.0))\n + i.x + vec4(0.0, i1.x, i2.x, 1.0));\n\n // Gradients: 7x7 points over a square, mapped onto an octahedron.\n // The ring size 17*17 = 289 is close to a multiple of 49 (49*6 = 294)\n float n_ = 0.142857142857;// 1.0/7.0\n vec3 ns = n_ * D.wyz - D.xzx;\n\n vec4 j = p - 49.0 * floor(p * ns.z * ns.z);// mod(p,7*7)\n\n vec4 x_ = floor(j * ns.z);\n vec4 y_ = floor(j - 7.0 * x_);// mod(j,N)\n\n vec4 x = x_ *ns.x + ns.yyyy;\n vec4 y = y_ *ns.x + ns.yyyy;\n vec4 h = 1.0 - abs(x) - abs(y);\n\n vec4 b0 = vec4(x.xy, y.xy);\n vec4 b1 = vec4(x.zw, y.zw);\n\n //vec4 s0 = vec4(lessThan(b0,0.0))*2.0 - 1.0;\n //vec4 s1 = vec4(lessThan(b1,0.0))*2.0 - 1.0;\n vec4 s0 = floor(b0)*2.0 + 1.0;\n vec4 s1 = floor(b1)*2.0 + 1.0;\n vec4 sh = -step(h, vec4(0.0));\n\n vec4 a0 = b0.xzyw + s0.xzyw*sh.xxyy;\n vec4 a1 = b1.xzyw + s1.xzyw*sh.zzww;\n\n vec3 p0 = vec3(a0.xy, h.x);\n vec3 p1 = vec3(a0.zw, h.y);\n vec3 p2 = vec3(a1.xy, h.z);\n vec3 p3 = vec3(a1.zw, h.w);\n\n //Normalise gradients\n vec4 norm = taylorInvSqrt(vec4(dot(p0, p0), dot(p1, p1), dot(p2, p2), dot(p3, p3)));\n p0 *= norm.x;\n p1 *= norm.y;\n p2 *= norm.z;\n p3 *= norm.w;\n\n // Mix final noise value\n vec4 m = max(0.6 - vec4(dot(x0, x0), dot(x1, x1), dot(x2, x2), dot(x3, x3)), 0.0);\n m = m * m;\n return 42.0 * dot(m*m, vec4(dot(p0, x0), dot(p1, x1),\n dot(p2, x2), dot(p3, x3)));\n}\n\n \n\nconst float PI = 3.14159265358979;\nconst float PI2 = PI * 2.0;\n\nuniform float uTime;\nuniform mat4 uBouquetIntroMatrix;\nuniform mat4 uRoadWrapMatrix;\nuniform mat4 uBouquetWrapMatrix;\nuniform mat4 uBouquetInnerMatrix;\nuniform mat4 uCenterMatrix;\nuniform float uCenterOpacity;\nuniform float uIsLowSpec;\nuniform float uIsBouquetVisible;\nuniform float uRoadBloomMax;\nuniform float uCenterBloomMax;\nuniform float uIsRoadHidden;\nuniform float uRoadWaveScale;\nuniform float uAccel;\nuniform vec3 uRoadAxis;\n\n#if IS_FLOWER == 1\n//flower\nattribute float part;\nattribute vec3 position_fl_flat_carn1;\nattribute vec3 position_fl_flat_carn2;\nattribute vec3 position_fl_flat_tulip;\nattribute vec3 position_fl_pon_asynL;\nattribute vec3 position_fl_pon_asynR;\nattribute vec3 position_fl_pon_five;\nattribute vec3 position_fl_pon_tong;\n#endif\n\n#if IS_FLOWER == 0\n//green\nattribute vec3 position_gr_leaf_waveM;\nattribute vec3 position_gr_leaf_waveS;\nattribute vec3 position_gr_stem1;\nattribute vec3 position_gr_stem3;\n#endif\n\nvarying vec3 vFrontColor;\nvarying vec3 vBackColor;\n\nconst vec3 UP = vec3(0.0, 1.0, 0.0);\nconst vec3 RIGHT = vec3(1.0, 0.0, 0.0);\nconst vec3 FRONT = vec3(0.0, 0.0, 1.0);\nconst vec3 BACK = vec3(0.0, 0.0, -1.0);\n\nfloat easeInOutSine(float t) {\n return -1.0 / 2.0 * (cos(PI * t) - 1.0);\n}\n\nvoid main() {\n vec3 rawPos = position;\n vec3 pos = position;\n\n bool isLowSpec = uIsLowSpec > 0.5;\n bool isBouquetVisible = uIsBouquetVisible > 0.5;\n bool isRoadHidden = uIsRoadHidden > 0.5;\n\n float fringe = 1.0 - abs(uv.y * 2.0 - 1.0);\n\n vec3 randoms = vec3(\n floor(instanceColor.r / 1000000.0) / 1000.0,\n floor(mod(instanceColor.r / 1000000.0, 1.0) * 1000.0) / 1000.0,\n floor(mod(instanceColor.r / 1000.0, 1.0) * 1000.0) / 1000.0\n );\n\n float bloom = instanceColor.b;\n\n bool isRoad = false;\n bool isRoadGarden = false;\n bool isCenter = false;\n bool isReverse = false;\n\n vec3 iPos = (instanceMatrix * vec4(vec3(0.0), 1.0)).xyz;\n\n vec3 frontColor = vec3(uv, 0.0);\n vec3 backColor = vec3(0.0);\n\n float huwaScale = 1.0;\n\n float heightForShake = 1.0;\n\n #if IS_FLOWER == 1\n //flower\n int shape = int(floor(instanceColor.g / 10000.0 + 0.1));//todo floor前にandroidで0.999みたいにずれちゃうことがあるようなので0.1足す\n int colorNum = int(floor(instanceColor.g / 1000.0 + 0.1) - floor(instanceColor.g / 10000.0 + 0.1) * 10.0);\n isRoad = int(floor(instanceColor.g / 100.0 + 0.1) - floor(instanceColor.g / 1000.0 + 0.1) * 10.0) == 1;\n isRoadGarden = int(floor(instanceColor.g / 10.0 + 0.1) - floor(instanceColor.g / 100.0 + 0.1) * 10.0) == 1;\n isCenter = int(floor(instanceColor.g / 1.0 + 0.1) - floor(instanceColor.g / 10.0 + 0.1) * 10.0) == 1;\n int partNum = int(floor(part + 0.1));\n bool isPon = true;\n bool isPetal = partNum == 0;\n bool isSub = partNum == 1;\n bool isStamen = partNum == 2;\n bool isSubPetal = false;\n bool isRoot = false;\n\n if (\n (!isBouquetVisible && !isRoad)\n || (!isCenter && isRoad && isRoadHidden)\n ) {\n gl_Position = vec4(0.0);\n return;\n }\n\n if (isRoad) {\n if (isCenter) {\n bloom = min(bloom, uCenterBloomMax);\n } else {\n bloom = min(bloom, uRoadBloomMax);\n }\n }\n\n float x = abs(uv.x * 2.0 - 1.0);\n\n float angle = uv.x * PI2;\n float radius = 1.0 - (uv.y-0.5) * 2.0;\n float cx = cos(angle) * radius;\n float cy = sin(angle) * radius;\n\n if (isStamen) huwaScale = 0.3;\n\n if (shape == 0) {\n //big\n heightForShake = 4.0;\n isPon = false;\n isRoot = isSub;\n pos = position;\n if (colorNum == 0) {\n if (isPetal) {\n frontColor = C_BIG_BLUE;\n backColor = C_BIG_BLUE_BACK;\n } else if (isStamen) frontColor = backColor = C_BIG_BLUE_STAMEN;\n } else if (colorNum == 1) {\n if (isPetal) {\n frontColor = C_BIG_RED;\n backColor = C_BIG_RED_BACK;\n } else if (isStamen) frontColor = backColor = C_BIG_RED_STAMEN;\n } else {\n if (isPetal) {\n frontColor = mix(C_BIG_WHITE_1, C_BIG_WHITE_2, x);\n backColor = C_BIG_WHITE_BACK;\n } else if (isStamen) frontColor = backColor = C_BIG_WHITE_STAMEN;\n }\n if (isSub) frontColor = backColor = C_BIG_ROOT;\n\n if (isRoad) {\n pos *= 0.7;\n }\n } else if (shape == 1 || shape == 2) {\n //carn\n heightForShake = 2.5;\n isPon = false;\n isRoot = isStamen;\n if (shape == 1) pos = position_fl_flat_carn1;\n else pos = position_fl_flat_carn2;\n float y = smoothstep(0.4, 1.0, fringe);\n float y2 = smoothstep(0.0, 1.0, fringe);\n isSubPetal = isSub;\n if (isStamen) huwaScale = 1.0;//carnの付け根は花とずれるので1\n if (colorNum == 0) {\n if (isPetal) frontColor = C_CARN_PINK_FRONT, backColor = mix(C_CARN_PINK_FRONT, C_CARN_PINK_BACK, y);\n else if (isSub) frontColor = mix(C_CARN_PINK_SUB_2, C_CARN_PINK_SUB_1, smoothstep(0.2, 1.0, x)), backColor = C_CARN_PINK_SUB_BACK;\n } else if (colorNum == 1) {\n if (isPetal) frontColor = C_CARN_WHITE_FRONT, backColor = mix(C_CARN_WHITE_FRONT, C_CARN_WHITE_BACK, y);\n else if (isSub) frontColor = mix(C_CARN_WHITE_SUB_2, C_CARN_WHITE_SUB_1, smoothstep(0.2, 1.0, x)), backColor = C_CARN_WHITE_SUB_BACK;\n //ちょい縦長に\n pos.y *= 1.2;\n } else if (colorNum == 2) {\n if (isPetal) frontColor = C_CARN_RED_FRONT, backColor = mix(C_CARN_RED_FRONT, C_CARN_RED_BACK, y);\n else if (isSub) frontColor = mix(C_CARN_RED_SUB_1, C_CARN_RED_SUB_2, x), backColor = C_CARN_RED_SUB_BACK;\n } else if (colorNum == 3) {\n if (isPetal) frontColor = mix(C_CARN_YELLOW_FRONT_1, C_CARN_YELLOW_FRONT_2, smoothstep(0.3, 1.0, x)), backColor = mix(C_CARN_YELLOW_BACK_1, C_CARN_YELLOW_BACK_2, x);\n else if (isSub) frontColor = mix(C_CARN_YELLOW_SUB_1, C_CARN_YELLOW_SUB_2, smoothstep(0.0, 0.6, x)), backColor = C_CARN_YELLOW_SUB_BACK;\n //黄色は左右反転(裏表も逆)\n if (isPetal || isSub) isReverse = true;\n vec3 tmpFront = frontColor;\n frontColor = backColor;\n backColor = tmpFront;\n }\n if (isStamen) frontColor = backColor = C_CARN_ROOT;\n } else if (shape == 3) {\n //tulip\n heightForShake = 1.5;\n isPon = false;\n pos = position_fl_flat_tulip;\n if (colorNum == 0) {\n frontColor = mix(C_TULIP_RED_1, C_TULIP_RED_2, x);\n backColor = C_TULIP_RED_BACK;\n } else {\n frontColor = mix(C_TULIP_WHITE_1, C_TULIP_WHITE_2, x);\n backColor = C_TULIP_WHITE_BACK;\n }\n } else if (shape == 4 || shape == 5) {\n //asyn\n heightForShake = 0.7;\n if (shape == 4) pos = position_fl_pon_asynL;\n else pos = position_fl_pon_asynR;\n if (colorNum == 0) {\n frontColor = backColor = mix(C_ASYN_RED_1, C_ASYN_RED_2, x);\n if (isStamen) frontColor = backColor = C_ASYN_RED_STAMEN;\n } else if (colorNum == 1) {\n frontColor = backColor = C_ASYN_YELLOW;\n if (isStamen) frontColor = backColor = C_ASYN_YELLOW_STAMEN;\n } else if (colorNum == 2) {\n frontColor = backColor = mix(C_ASYN_WHITE_2, C_ASYN_WHITE_1, x);\n if (isStamen) frontColor = backColor = C_ASYN_WHITE_STAMEN;\n } else if (colorNum == 3) {\n frontColor = backColor = C_ASYN_PINK;\n if (isStamen) frontColor = backColor = C_ASYN_PINK_STAMEN;\n } else {\n frontColor = backColor = C_ASYN_BLUE;\n if (isStamen) frontColor = backColor = C_ASYN_BLUE_STAMEN;\n }\n } else if (shape == 6) {\n //five\n heightForShake = 0.7;\n pos = position_fl_pon_five;\n if (colorNum == 0) {\n if (isPetal) frontColor = backColor = C_FIVE_BLUE;\n else frontColor = backColor = C_FIVE_BLUE_STAMEN;\n } else if (colorNum == 1) {\n if (isPetal) frontColor = backColor = C_FIVE_RED;\n else frontColor = backColor = C_FIVE_RED_STAMEN;\n } else {\n if (isPetal) frontColor = backColor = mix(C_FIVE_WHITE_1, C_FIVE_WHITE_2, smoothstep(0.2, 0.8, cy * 0.5 + 0.5));\n else frontColor = backColor = C_FIVE_WHITE_STAMEN;\n }\n } else {\n //tong\n heightForShake = 0.7;\n pos = position_fl_pon_tong;\n if (colorNum == 0) {\n if (isPetal) frontColor = backColor = C_TONG_BLUE;\n else frontColor = backColor = C_TONG_BLUE_STAMEN;\n } else if (colorNum == 1) {\n if (isPetal) frontColor = backColor = C_TONG_PINK;\n else frontColor = backColor = C_TONG_PINK_STAMEN;\n } else if (colorNum == 2) {\n if (isPetal) frontColor = backColor = C_TONG_GREEN;\n else frontColor = backColor = C_TONG_GREEN_STAMEN;\n } else if (colorNum == 3) {\n if (isPetal) frontColor = backColor = C_TONG_YELLOW;\n else frontColor = backColor = C_TONG_YELLOW_STAMEN;\n }\n }\n\n if (isRoad) {\n //wave\n float waveN = snoise(vec3(iPos.xz * 0.03, uTime * 0.12));\n pos.y += waveN * 0.5 * (isRoadGarden ? 0.6 : uRoadWaveScale);\n }\n\n //bloom\n vec2 bloomUv = uv;\n if (bloomUv.y > 0.95) bloomUv.y = min(1.0, 0.95 + (bloomUv.y - 0.95) * 3.0);//subdivideでpolarにできるシワをきれいにする\n bool isFlat = !isPon;\n float outPer = 1.0 - bloomUv.y * 2.0;\n float sphere = 1.0 - bloom;\n\n if (isPetal || isSubPetal) {\n //sphere\n float sphereAngle = -bloomUv.x * PI * 2.0;\n float sphereY = isFlat ? outPer : (1.0 - outPer);\n vec3 spherePos = UP * rotate3d(sphereY * PI, FRONT) * rotate3d(sphereAngle, UP);\n pos = mix(pos, spherePos, sphere) + (isFlat ? UP * 0.5 * sphere : vec3(0.0));\n if (isSubPetal) {\n pos *= mix(0.8, 1.0, bloom);\n }\n } else {\n //scale\n if (isRoot) {\n pos.xz *= 1.0 + 1.9 * (1.0 - bloom);\n pos.y *= bloom;\n pos *= smoothstep(0.5, 1.0, bloom);\n pos.y += -0.9 * (1.0 - bloom);\n } else {\n pos *= bloom;\n }\n }\n\n if (isRoad) {\n if (isCenter) {\n pos *= uCenterOpacity;\n } else {\n pos *= uRoadBloomMax;\n }\n }\n\n //bow\n float bowAsixAngle = uTime * (0.3 + 0.1 * randoms.z) + randoms.y * PI * 2.0;\n float bowAngle = (1.0 - bloom) * PI * mix(0.2, 0.5, randoms.x);\n pos *= rotate3d(bowAngle, normalize(vec3(cos(bowAsixAngle), 0.0, sin(bowAsixAngle))));\n\n //黄色carn左右反転\n if (isReverse) pos.x *= -1.0;\n\n #endif\n\n #if IS_FLOWER == 0\n //green\n if (!isBouquetVisible) {\n gl_Position = vec4(0.0);\n return;\n }\n\n int shape = int(floor(instanceColor.g + 0.1));\n\n vec2 rawUv = uv;\n\n vec2 uv = uv;\n uv.x = mod(uv.x + 0.25, 1.0);\n\n if (shape == 0) {\n //regular\n float leafY = clamp(rawPos.y / 1.6, 0.0, 1.0);\n if (uv.x < 0.5) leafY = 1.0 - leafY;\n heightForShake = 5.0;\n pos = position;\n frontColor = backColor = mix(C_REGULAR_1, C_REGULAR_2, leafY);\n } else if (shape == 1) {\n //waveMおおきいやつ\n float leafY = clamp(rawPos.y / 2.1, 0.0, 1.0);\n if (uv.x < 0.5) leafY = 1.0 - leafY;\n leafY = smoothstep(0.1, 0.9, leafY);\n heightForShake = 8.0;\n pos = position_gr_leaf_waveM;\n frontColor = backColor = mix(C_WAVE_M_1, C_WAVE_M_2, leafY);\n } else if (shape == 2) {\n //waveS\n float leafY = clamp(rawPos.y, 0.0, 1.0);\n if (uv.x < 0.5) leafY = 1.0 - leafY;\n heightForShake = 2.0;\n pos = position_gr_leaf_waveS;\n frontColor = backColor = mix(C_WAVE_S_1, C_WAVE_S_2, leafY);\n }\n\n //bloom\n float outPer = 1.0 - rawUv.y * 2.0;\n float sphere = 1.0 - bloom;\n float sphereAngle = -rawUv.x * PI * 2.0;\n float sphereY = outPer;\n vec3 spherePos = UP * rotate3d(sphereY * PI, FRONT) * rotate3d(sphereAngle, UP);\n pos = mix(pos, spherePos, sphere) + UP * 0.5 * sphere;\n #endif\n\n //常時ふわふわ\n// if (!isLowSpec) {\n vec3 n = normalize(pos);\n float huwaPower = mix(0.2, 0.09, bloom) * huwaScale;\n float huwaSize = mix(0.7, 0.45, bloom);\n if (isCenter) {\n huwaPower *= bloom;\n }\n pos += n * huwaPower * snoise(vec3(pos.xz * huwaSize, 33.0 + uTime * 0.3 - randoms.x*50.0));\n// }\n\n //動きに応じて揺らす\n if (isRoad) {\n float shakePower = 0.3 + abs(pos.y / heightForShake) * (pos.y < 0.0 ? 0.3 : 1.0) * 0.8;\n float shakeAmount = uAccel * mix(1.0, 0.7, randoms.x) * shakePower;\n pos *= rotate3d(shakeAmount * PI2 * 0.1, uRoadAxis);\n }\n\n //wrap\n mat4 wrapMatrix = isRoad ? uRoadWrapMatrix : (uBouquetWrapMatrix * uBouquetInnerMatrix);\n if (isCenter) wrapMatrix = uCenterMatrix;\n if (!isRoad) wrapMatrix *= uBouquetIntroMatrix;\n\n gl_Position = projectionMatrix * viewMatrix * modelMatrix * wrapMatrix * instanceMatrix * vec4(pos, 1.0);\n vFrontColor = frontColor;\n vBackColor = backColor;\n}\n"},2406:function(t,e){"use strict";e.Z="precision highp float;\n\n//\n// Description : Array and textureless GLSL 2D/3D/4D simplex\n// noise functions.\n// Author : Ian McEwan, Ashima Arts.\n// Maintainer : ijm\n// Lastmod : 20110822 (ijm)\n// License : Copyright (C) 2011 Ashima Arts. All rights reserved.\n// Distributed under the MIT License. See LICENSE file.\n// https://github.com/ashima/webgl-noise\n//\n\nprecision highp float;\n#define GLSLIFY 1\n\nvec3 mod289(vec3 x) {\n return x - floor(x * (1.0 / 289.0)) * 289.0;\n}\n\nvec4 mod289(vec4 x) {\n return x - floor(x * (1.0 / 289.0)) * 289.0;\n}\n\nvec4 permute(vec4 x) {\n return mod289(((x*34.0)+1.0)*x);\n}\n\nvec4 taylorInvSqrt(vec4 r)\n{\n return 1.79284291400159 - 0.85373472095314 * r;\n}\n\nfloat snoise(vec3 v)\n{\n const vec2 C = vec2(1.0/6.0, 1.0/3.0);\n const vec4 D = vec4(0.0, 0.5, 1.0, 2.0);\n\n // First corner\n vec3 i = floor(v + dot(v, C.yyy));\n vec3 x0 = v - i + dot(i, C.xxx);\n\n // Other corners\n vec3 g = step(x0.yzx, x0.xyz);\n vec3 l = 1.0 - g;\n vec3 i1 = min(g.xyz, l.zxy);\n vec3 i2 = max(g.xyz, l.zxy);\n\n // x0 = x0 - 0.0 + 0.0 * C.xxx;\n // x1 = x0 - i1 + 1.0 * C.xxx;\n // x2 = x0 - i2 + 2.0 * C.xxx;\n // x3 = x0 - 1.0 + 3.0 * C.xxx;\n vec3 x1 = x0 - i1 + C.xxx;\n vec3 x2 = x0 - i2 + C.yyy;// 2.0*C.x = 1/3 = C.y\n vec3 x3 = x0 - D.yyy;// -1.0+3.0*C.x = -0.5 = -D.y\n\n // Permutations\n i = mod289(i);\n vec4 p = permute(permute(permute(\n i.z + vec4(0.0, i1.z, i2.z, 1.0))\n + i.y + vec4(0.0, i1.y, i2.y, 1.0))\n + i.x + vec4(0.0, i1.x, i2.x, 1.0));\n\n // Gradients: 7x7 points over a square, mapped onto an octahedron.\n // The ring size 17*17 = 289 is close to a multiple of 49 (49*6 = 294)\n float n_ = 0.142857142857;// 1.0/7.0\n vec3 ns = n_ * D.wyz - D.xzx;\n\n vec4 j = p - 49.0 * floor(p * ns.z * ns.z);// mod(p,7*7)\n\n vec4 x_ = floor(j * ns.z);\n vec4 y_ = floor(j - 7.0 * x_);// mod(j,N)\n\n vec4 x = x_ *ns.x + ns.yyyy;\n vec4 y = y_ *ns.x + ns.yyyy;\n vec4 h = 1.0 - abs(x) - abs(y);\n\n vec4 b0 = vec4(x.xy, y.xy);\n vec4 b1 = vec4(x.zw, y.zw);\n\n //vec4 s0 = vec4(lessThan(b0,0.0))*2.0 - 1.0;\n //vec4 s1 = vec4(lessThan(b1,0.0))*2.0 - 1.0;\n vec4 s0 = floor(b0)*2.0 + 1.0;\n vec4 s1 = floor(b1)*2.0 + 1.0;\n vec4 sh = -step(h, vec4(0.0));\n\n vec4 a0 = b0.xzyw + s0.xzyw*sh.xxyy;\n vec4 a1 = b1.xzyw + s1.xzyw*sh.zzww;\n\n vec3 p0 = vec3(a0.xy, h.x);\n vec3 p1 = vec3(a0.zw, h.y);\n vec3 p2 = vec3(a1.xy, h.z);\n vec3 p3 = vec3(a1.zw, h.w);\n\n //Normalise gradients\n vec4 norm = taylorInvSqrt(vec4(dot(p0, p0), dot(p1, p1), dot(p2, p2), dot(p3, p3)));\n p0 *= norm.x;\n p1 *= norm.y;\n p2 *= norm.z;\n p3 *= norm.w;\n\n // Mix final noise value\n vec4 m = max(0.6 - vec4(dot(x0, x0), dot(x1, x1), dot(x2, x2), dot(x3, x3)), 0.0);\n m = m * m;\n return 42.0 * dot(m*m, vec4(dot(p0, x0), dot(p1, x1),\n dot(p2, x2), dot(p3, x3)));\n}\n\n \n\nuniform sampler2D uMap;\nuniform float uTime;\nuniform float uPicScale;\nuniform vec3 uBgColor;\nuniform float uFrameScale;\n\nvarying vec2 vUv;\nvarying vec3 vPos;\nvarying float vBreath;\n\nvoid main() {\n vec2 uv = vUv;\n float alpha = 1.0;\n\n uv = (uv * 2.0 - 1.0) / uPicScale * 0.5 + 0.5;\n\n float outerPer = length(vec2(vPos.x, vPos.y));\n float edge = uFrameScale - vBreath;\n alpha *= 1.0 - smoothstep(edge-0.005, edge, outerPer);\n\n float noiseAmount = 1.0 - smoothstep(0.8, 1.0, outerPer);\n if (noiseAmount > 0.0) {\n vec3 scale = vec3(vec2(0.5), 0.3);\n float offset = 0.01 * noiseAmount;\n float nx = snoise(vec3(vPos.x, vPos.y, uTime) * scale);\n float ny = snoise(vec3(vPos.x, vPos.y, -33.0 + uTime) * scale);\n uv.x += nx * offset;\n uv.y += ny * offset;\n }\n\n vec3 color = texture2D(uMap, uv).rgb;\n\n color = mix(uBgColor, color, alpha);\n if (alpha < 0.01) {\n discard;\n }\n\n gl_FragColor = vec4(color, 1.0);\n}\n"},2961:function(t,e){"use strict";e.Z="precision highp float;\n#define GLSLIFY 1\n\nconst float PI = 3.14159265358979;\nconst float PI2 = PI * 2.0;\n\nuniform float uFrameScale;\nuniform float uTime;\n\nvarying vec2 vUv;\nvarying vec3 vPos;\nvarying float vBreath;\n\nvoid main() {\n vec3 pos = position;\n\n pos.xy *= uFrameScale;\n\n float breath = (sin(uTime * 1.2) * 0.5 + 0.5) * 0.04;\n\n gl_Position = projectionMatrix * viewMatrix * modelMatrix * vec4(pos, 1.0);\n vUv = uv;\n vPos = pos;\n vBreath = breath;\n}\n"},3970:function(t,e){"use strict";e.Z="precision highp float;\n#define GLSLIFY 1\n\nuniform float uIsPetal;\n\nuniform vec4 uFocusY1;\nuniform vec4 uFocusY2;\nuniform vec3 uColor;\nuniform vec3 uBgColor;\nuniform sampler2D uMap;\nuniform vec2 uMapScale;\nuniform float uIsLast;\nuniform float uLastOpacity;\nuniform float uLastOpacity2;\nuniform float uPosOpacity;\nuniform float uIsFront;\nuniform float uHasLine;\nuniform float uLinkLineOpacity1;\nuniform float uLinkLineOpacity2;\nuniform vec4 uLinkLineRect1;\nuniform vec4 uLinkLineRect2;\n\nvarying vec2 vUv;\nvarying vec2 vRelPos;\nvarying float vOpacity;\nvarying float vOuterPer;\n\nvoid main() {\n bool isFront = uIsFront > 0.5;\n bool hasLine = uHasLine > 0.5;\n vec2 uv = vUv;\n\n float y1Top = mix(uFocusY1[0], uFocusY1[1], vRelPos.x);\n float y1Bottom = mix(uFocusY1[2], uFocusY1[3], vRelPos.x);\n float y2Top = mix(uFocusY2[0], uFocusY2[1], vRelPos.x);\n float y2Bottom = mix(uFocusY2[2], uFocusY2[3], vRelPos.x);\n float alpha = 0.15;\n bool hit1 = vRelPos.y >= y1Top && vRelPos.y <= y1Bottom;\n bool hit2 = vRelPos.y >= y2Top && vRelPos.y <= y2Bottom;\n\n bool anyHit = hit1 || hit2;\n if (\n (isFront && !anyHit)\n || (!isFront && anyHit)\n ) {\n discard;\n }\n\n vec4 color = texture2D(uMap, uv);\n float textPower = color.r;\n vec3 textColor = vec3(0.0);\n\n if (hit1 && hit2) {\n alpha = 1.0;\n } else if (hit1) {\n textColor = uColor;\n alpha = 1.0;\n }\n color.rgb = mix(uBgColor, textColor, textPower);\n alpha *= vOpacity;\n\n if (uIsLast > 0.5) {\n if (uv.y < 0.3) {\n //link\n alpha *= uLastOpacity2;\n } else if (uv.y < 0.7) {\n //logo\n alpha *= uLastOpacity;\n }\n }\n\n alpha *= uPosOpacity;\n\n if (hasLine) {\n if (uv.x >= uLinkLineRect1.r && uv.x <= uLinkLineRect1.g && uv.y >= uLinkLineRect1.b && uv.y <= uLinkLineRect1.a) {\n alpha *= uLinkLineOpacity1;\n } else if (uv.x >= uLinkLineRect2.r && uv.x <= uLinkLineRect2.g && uv.y >= uLinkLineRect2.b && uv.y <= uLinkLineRect2.a) {\n alpha *= uLinkLineOpacity2;\n }\n }\n\n// color = vec4(vec3(0.0), abs(vOuterPer));\n\n //for debug\n// if (hit1 && hit2) {\n// color.rg = vUv;\n// color.a = 0.9;\n// }\n\n color.a *= alpha;\n gl_FragColor = color;\n}\n"},9750:function(t,e){"use strict";e.Z="precision highp float;\n\n//\n// Description : Array and textureless GLSL 2D/3D/4D simplex\n// noise functions.\n// Author : Ian McEwan, Ashima Arts.\n// Maintainer : ijm\n// Lastmod : 20110822 (ijm)\n// License : Copyright (C) 2011 Ashima Arts. All rights reserved.\n// Distributed under the MIT License. See LICENSE file.\n// https://github.com/ashima/webgl-noise\n//\n\nprecision highp float;\n#define GLSLIFY 1\n\nvec3 mod289(vec3 x) {\n return x - floor(x * (1.0 / 289.0)) * 289.0;\n}\n\nvec4 mod289(vec4 x) {\n return x - floor(x * (1.0 / 289.0)) * 289.0;\n}\n\nvec4 permute(vec4 x) {\n return mod289(((x*34.0)+1.0)*x);\n}\n\nvec4 taylorInvSqrt(vec4 r)\n{\n return 1.79284291400159 - 0.85373472095314 * r;\n}\n\nfloat snoise(vec3 v)\n{\n const vec2 C = vec2(1.0/6.0, 1.0/3.0);\n const vec4 D = vec4(0.0, 0.5, 1.0, 2.0);\n\n // First corner\n vec3 i = floor(v + dot(v, C.yyy));\n vec3 x0 = v - i + dot(i, C.xxx);\n\n // Other corners\n vec3 g = step(x0.yzx, x0.xyz);\n vec3 l = 1.0 - g;\n vec3 i1 = min(g.xyz, l.zxy);\n vec3 i2 = max(g.xyz, l.zxy);\n\n // x0 = x0 - 0.0 + 0.0 * C.xxx;\n // x1 = x0 - i1 + 1.0 * C.xxx;\n // x2 = x0 - i2 + 2.0 * C.xxx;\n // x3 = x0 - 1.0 + 3.0 * C.xxx;\n vec3 x1 = x0 - i1 + C.xxx;\n vec3 x2 = x0 - i2 + C.yyy;// 2.0*C.x = 1/3 = C.y\n vec3 x3 = x0 - D.yyy;// -1.0+3.0*C.x = -0.5 = -D.y\n\n // Permutations\n i = mod289(i);\n vec4 p = permute(permute(permute(\n i.z + vec4(0.0, i1.z, i2.z, 1.0))\n + i.y + vec4(0.0, i1.y, i2.y, 1.0))\n + i.x + vec4(0.0, i1.x, i2.x, 1.0));\n\n // Gradients: 7x7 points over a square, mapped onto an octahedron.\n // The ring size 17*17 = 289 is close to a multiple of 49 (49*6 = 294)\n float n_ = 0.142857142857;// 1.0/7.0\n vec3 ns = n_ * D.wyz - D.xzx;\n\n vec4 j = p - 49.0 * floor(p * ns.z * ns.z);// mod(p,7*7)\n\n vec4 x_ = floor(j * ns.z);\n vec4 y_ = floor(j - 7.0 * x_);// mod(j,N)\n\n vec4 x = x_ *ns.x + ns.yyyy;\n vec4 y = y_ *ns.x + ns.yyyy;\n vec4 h = 1.0 - abs(x) - abs(y);\n\n vec4 b0 = vec4(x.xy, y.xy);\n vec4 b1 = vec4(x.zw, y.zw);\n\n //vec4 s0 = vec4(lessThan(b0,0.0))*2.0 - 1.0;\n //vec4 s1 = vec4(lessThan(b1,0.0))*2.0 - 1.0;\n vec4 s0 = floor(b0)*2.0 + 1.0;\n vec4 s1 = floor(b1)*2.0 + 1.0;\n vec4 sh = -step(h, vec4(0.0));\n\n vec4 a0 = b0.xzyw + s0.xzyw*sh.xxyy;\n vec4 a1 = b1.xzyw + s1.xzyw*sh.zzww;\n\n vec3 p0 = vec3(a0.xy, h.x);\n vec3 p1 = vec3(a0.zw, h.y);\n vec3 p2 = vec3(a1.xy, h.z);\n vec3 p3 = vec3(a1.zw, h.w);\n\n //Normalise gradients\n vec4 norm = taylorInvSqrt(vec4(dot(p0, p0), dot(p1, p1), dot(p2, p2), dot(p3, p3)));\n p0 *= norm.x;\n p1 *= norm.y;\n p2 *= norm.z;\n p3 *= norm.w;\n\n // Mix final noise value\n vec4 m = max(0.6 - vec4(dot(x0, x0), dot(x1, x1), dot(x2, x2), dot(x3, x3)), 0.0);\n m = m * m;\n return 42.0 * dot(m*m, vec4(dot(p0, x0), dot(p1, x1),\n dot(p2, x2), dot(p3, x3)));\n}\n\n \n\nconst float PI = 3.14159265358979;\nconst float PI2 = PI * 2.0;\n\nuniform vec4 uBounds;\nuniform float uAccel;\nuniform float uTime;\nuniform float uIsPc;\nuniform vec4 uVisibleRange;\n\nvarying vec2 vUv;\nvarying vec2 vRelPos;\nvarying float vOpacity;\nvarying float vWavePower;\nvarying float vOuterPer;\n\nvoid main() {\n bool isPc = uIsPc > 0.5;\n vec3 pos = position;\n\n vec2 uv = uv;\n\n float absAccel = abs(uAccel);\n\n vec2 relPos = vec2(\n uBounds.x + uv.x * uBounds.z,\n uBounds.y + (1.0 - uv.y) * uBounds.w\n );\n vec2 rawRelPos = relPos;\n float centerDist = relPos.x* 2.0 -1.0;\n relPos.y += pow(centerDist, 3.0) * 0.03 * absAccel;\n\n relPos.y += snoise(vec3(uv.x * 1.2, 0.0, uTime * 0.3)) * (isPc ? 0.03 : 0.02) * absAccel;\n\n float screenY = (rawRelPos.y-uVisibleRange.x) / (uVisibleRange.y-uVisibleRange.x);\n float outerPer = screenY * 2.0 - 1.0;\n float activeRange = uVisibleRange.z;\n outerPer = sign(outerPer) * smoothstep(activeRange, activeRange + 1.0, abs(outerPer));\n outerPer = smoothstep(0.0, (isPc ? 0.2 : 0.2), abs(outerPer));\n pos.z = (isPc ? 20.0 : 20.0) * -outerPer;\n pos.x += (isPc ? 0.0 : 0.0) * outerPer;\n float opacity = 1.0 - outerPer;\n\n gl_Position = projectionMatrix * viewMatrix * modelMatrix * vec4(pos, 1.0);\n vUv = uv;\n vRelPos = relPos;\n vOpacity = opacity;\n vOuterPer = outerPer;\n}\n"},1742:function(t,e){"use strict";e.Z="precision highp float;\n#define GLSLIFY 1\n\nuniform sampler2D uMap;\nuniform vec3 uBgColor;\nuniform float uOpacity;\n\nvarying vec2 vUv;\n\nvoid main() {\n vec3 color = texture2D(uMap, vUv).rgb;\n\n color = mix(uBgColor, color, uOpacity);\n\n gl_FragColor = vec4(color, 1.0);\n}\n"},3044:function(t,e){"use strict";e.Z="precision highp float;\n#define GLSLIFY 1\n\nvarying vec2 vUv;\n\nvoid main() {\n vec3 pos = position;\n\n gl_Position = projectionMatrix * viewMatrix * modelMatrix * vec4(pos, 1.0);\n vUv = uv;\n}\n"},3466:function(t){var e;t.exports=((e=function(){function t(t){return r.appendChild(t.dom),t}function n(t){for(var e=0;e<r.children.length;e++)r.children[e].style.display=e===t?"block":"none";i=t}var i=0,r=document.createElement("div");r.style.cssText="position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000",r.addEventListener("click",(function(t){t.preventDefault(),n(++i%r.children.length)}),!1);var o=(performance||Date).now(),s=o,a=0,l=t(new e.Panel("FPS","#0ff","#002")),c=t(new e.Panel("MS","#0f0","#020"));if(self.performance&&self.performance.memory)var h=t(new e.Panel("MB","#f08","#201"));return n(0),{REVISION:16,dom:r,addPanel:t,showPanel:n,begin:function(){o=(performance||Date).now()},end:function(){a++;var t=(performance||Date).now();if(c.update(t-o,200),t>s+1e3&&(l.update(1e3*a/(t-s),100),s=t,a=0,h)){var e=performance.memory;h.update(e.usedJSHeapSize/1048576,e.jsHeapSizeLimit/1048576)}return t},update:function(){o=this.end()},domElement:r,setMode:n}}).Panel=function(t,e,n){var i=1/0,r=0,o=Math.round,s=o(window.devicePixelRatio||1),a=80*s,l=48*s,c=3*s,h=2*s,u=3*s,d=15*s,p=74*s,f=30*s,m=document.createElement("canvas");m.width=a,m.height=l,m.style.cssText="width:80px;height:48px";var g=m.getContext("2d");return g.font="bold "+9*s+"px Helvetica,Arial,sans-serif",g.textBaseline="top",g.fillStyle=n,g.fillRect(0,0,a,l),g.fillStyle=e,g.fillText(t,c,h),g.fillRect(u,d,p,f),g.fillStyle=n,g.globalAlpha=.9,g.fillRect(u,d,p,f),{dom:m,update:function(l,_){i=Math.min(i,l),r=Math.max(r,l),g.fillStyle=n,g.globalAlpha=1,g.fillRect(0,0,a,d),g.fillStyle=e,g.fillText(o(l)+" "+t+" ("+o(i)+"-"+o(r)+")",c,h),g.drawImage(m,u+s,d,p-s,f,u,d,p-s,f),g.fillRect(u+p-s,d,s,f),g.fillStyle=n,g.globalAlpha=.9,g.fillRect(u+p-s,d,s,o((1-l/_)*f))}}},e)},1e3:function(t){"use strict";var e={linear:function(t,e,n,i){return(n-e)*t/i+e},easeInQuad:function(t,e,n,i){return(n-e)*(t/=i)*t+e},easeOutQuad:function(t,e,n,i){return-(n-e)*(t/=i)*(t-2)+e},easeInOutQuad:function(t,e,n,i){var r=n-e;return(t/=i/2)<1?r/2*t*t+e:-r/2*(--t*(t-2)-1)+e},easeInCubic:function(t,e,n,i){return(n-e)*(t/=i)*t*t+e},easeOutCubic:function(t,e,n,i){return(n-e)*((t=t/i-1)*t*t+1)+e},easeInOutCubic:function(t,e,n,i){var r=n-e;return(t/=i/2)<1?r/2*t*t*t+e:r/2*((t-=2)*t*t+2)+e},easeInQuart:function(t,e,n,i){return(n-e)*(t/=i)*t*t*t+e},easeOutQuart:function(t,e,n,i){return-(n-e)*((t=t/i-1)*t*t*t-1)+e},easeInOutQuart:function(t,e,n,i){var r=n-e;return(t/=i/2)<1?r/2*t*t*t*t+e:-r/2*((t-=2)*t*t*t-2)+e},easeInQuint:function(t,e,n,i){return(n-e)*(t/=i)*t*t*t*t+e},easeOutQuint:function(t,e,n,i){return(n-e)*((t=t/i-1)*t*t*t*t+1)+e},easeInOutQuint:function(t,e,n,i){var r=n-e;return(t/=i/2)<1?r/2*t*t*t*t*t+e:r/2*((t-=2)*t*t*t*t+2)+e},easeInSine:function(t,e,n,i){var r=n-e;return-r*Math.cos(t/i*(Math.PI/2))+r+e},easeOutSine:function(t,e,n,i){return(n-e)*Math.sin(t/i*(Math.PI/2))+e},easeInOutSine:function(t,e,n,i){return-(n-e)/2*(Math.cos(Math.PI*t/i)-1)+e},easeInExpo:function(t,e,n,i){return 0==t?e:(n-e)*Math.pow(2,10*(t/i-1))+e},easeOutExpo:function(t,e,n,i){var r=n-e;return t==i?e+r:r*(1-Math.pow(2,-10*t/i))+e},easeInOutExpo:function(t,e,n,i){var r=n-e;return 0===t?e:t===i?e+r:(t/=i/2)<1?r/2*Math.pow(2,10*(t-1))+e:r/2*(2-Math.pow(2,-10*--t))+e},easeInCirc:function(t,e,n,i){return-(n-e)*(Math.sqrt(1-(t/=i)*t)-1)+e},easeOutCirc:function(t,e,n,i){return(n-e)*Math.sqrt(1-(t=t/i-1)*t)+e},easeInOutCirc:function(t,e,n,i){var r=n-e;return(t/=i/2)<1?-r/2*(Math.sqrt(1-t*t)-1)+e:r/2*(Math.sqrt(1-(t-=2)*t)+1)+e},easeInElastic:function(t,e,n,i){var r,o,s,a=n-e;return s=1.70158,0===t?e:1==(t/=i)?e+a:((o=0)||(o=.3*i),(r=a)<Math.abs(a)?(r=a,s=o/4):s=o/(2*Math.PI)*Math.asin(a/r),-r*Math.pow(2,10*(t-=1))*Math.sin((t*i-s)*(2*Math.PI)/o)+e)},easeOutElastic:function(t,e,n,i){var r,o,s,a=n-e;return s=1.70158,0===t?e:1==(t/=i)?e+a:((o=0)||(o=.3*i),(r=a)<Math.abs(a)?(r=a,s=o/4):s=o/(2*Math.PI)*Math.asin(a/r),r*Math.pow(2,-10*t)*Math.sin((t*i-s)*(2*Math.PI)/o)+a+e)},easeInOutElastic:function(t,e,n,i){var r,o,s,a=n-e;return s=1.70158,0===t?e:2==(t/=i/2)?e+a:((o=0)||(o=i*(.3*1.5)),(r=a)<Math.abs(a)?(r=a,s=o/4):s=o/(2*Math.PI)*Math.asin(a/r),t<1?r*Math.pow(2,10*(t-=1))*Math.sin((t*i-s)*(2*Math.PI)/o)*-.5+e:r*Math.pow(2,-10*(t-=1))*Math.sin((t*i-s)*(2*Math.PI)/o)*.5+a+e)},easeInBack:function(t,e,n,i,r){return void 0===r&&(r=1.70158),(n-e)*(t/=i)*t*((r+1)*t-r)+e},easeOutBack:function(t,e,n,i,r){return void 0===r&&(r=1.70158),(n-e)*((t=t/i-1)*t*((r+1)*t+r)+1)+e},easeInOutBack:function(t,e,n,i,r){var o=n-e;return void 0===r&&(r=1.70158),(t/=i/2)<1?o/2*(t*t*((1+(r*=1.525))*t-r))+e:o/2*((t-=2)*t*((1+(r*=1.525))*t+r)+2)+e},easeInBounce:function(t,n,i,r){var o=i-n;return o-e.easeOutBounce(r-t,0,o,r)+n},easeOutBounce:function(t,e,n,i){var r=n-e;return(t/=i)<1/2.75?r*(7.5625*t*t)+e:t<2/2.75?r*(7.5625*(t-=1.5/2.75)*t+.75)+e:t<2.5/2.75?r*(7.5625*(t-=2.25/2.75)*t+.9375)+e:r*(7.5625*(t-=2.625/2.75)*t+.984375)+e},easeInOutBounce:function(t,n,i,r){var o=i-n;return t<r/2?.5*e.easeInBounce(2*t,0,o,r)+n:.5*e.easeOutBounce(2*t-r,0,o,r)+.5*o+n}};t.exports=e}},e={};function n(i){if(e[i])return e[i].exports;var r=e[i]={exports:{}};return t[i].call(r.exports,r,r.exports,n),r.exports}n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,{a:e}),e},n.d=function(t,e){for(var i in e)n.o(e,i)&&!n.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},function(){"use strict";var t=function(t){var e=this.constructor;return this.then((function(n){return e.resolve(t()).then((function(){return n}))}),(function(n){return e.resolve(t()).then((function(){return e.reject(n)}))}))},e=setTimeout;function i(){}function r(t){if(!(this instanceof r))throw new TypeError("Promises must be constructed via new");if("function"!=typeof t)throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=void 0,this._deferreds=[],h(t,this)}function o(t,e){for(;3===t._state;)t=t._value;0!==t._state?(t._handled=!0,r._immediateFn((function(){var n=1===t._state?e.onFulfilled:e.onRejected;if(null!==n){var i;try{i=n(t._value)}catch(t){return void a(e.promise,t)}s(e.promise,i)}else(1===t._state?s:a)(e.promise,t._value)}))):t._deferreds.push(e)}function s(t,e){try{if(e===t)throw new TypeError("A promise cannot be resolved with itself.");if(e&&("object"==typeof e||"function"==typeof e)){var n=e.then;if(e instanceof r)return t._state=3,t._value=e,void l(t);if("function"==typeof n)return void h((i=n,o=e,function(){i.apply(o,arguments)}),t)}t._state=1,t._value=e,l(t)}catch(e){a(t,e)}var i,o}function a(t,e){t._state=2,t._value=e,l(t)}function l(t){2===t._state&&0===t._deferreds.length&&r._immediateFn((function(){t._handled||r._unhandledRejectionFn(t._value)}));for(var e=0,n=t._deferreds.length;e<n;e++)o(t,t._deferreds[e]);t._deferreds=null}function c(t,e,n){this.onFulfilled="function"==typeof t?t:null,this.onRejected="function"==typeof e?e:null,this.promise=n}function h(t,e){var n=!1;try{t((function(t){n||(n=!0,s(e,t))}),(function(t){n||(n=!0,a(e,t))}))}catch(t){if(n)return;n=!0,a(e,t)}}r.prototype.catch=function(t){return this.then(null,t)},r.prototype.then=function(t,e){var n=new this.constructor(i);return o(this,new c(t,e,n)),n},r.prototype.finally=t,r.all=function(t){return new r((function(e,n){if(!t||void 0===t.length)throw new TypeError("Promise.all accepts an array");var i=Array.prototype.slice.call(t);if(0===i.length)return e([]);var r=i.length;function o(t,s){try{if(s&&("object"==typeof s||"function"==typeof s)){var a=s.then;if("function"==typeof a)return void a.call(s,(function(e){o(t,e)}),n)}i[t]=s,0==--r&&e(i)}catch(t){n(t)}}for(var s=0;s<i.length;s++)o(s,i[s])}))},r.resolve=function(t){return t&&"object"==typeof t&&t.constructor===r?t:new r((function(e){e(t)}))},r.reject=function(t){return new r((function(e,n){n(t)}))},r.race=function(t){return new r((function(e,n){for(var i=0,r=t.length;i<r;i++)t[i].then(e,n)}))},r._immediateFn="function"==typeof setImmediate&&function(t){setImmediate(t)}||function(t){e(t,0)},r._unhandledRejectionFn=function(t){"undefined"!=typeof console&&console&&console.warn("Possible Unhandled Promise Rejection:",t)};var u=r,d=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==n.g)return n.g;throw new Error("unable to locate global object")}();"Promise"in d?d.Promise.prototype.finally||(d.Promise.prototype.finally=t):d.Promise=u,n(9116),n(3462),n(9358),n(5354),n(4533);var p,f,m,g,_="object"==typeof global&&global&&global.Object===Object&&global,v="object"==typeof self&&self&&self.Object===Object&&self,y=_||v||Function("return this")(),x=y.Symbol,b=Object.prototype,w=b.hasOwnProperty,M=b.toString,S=x?x.toStringTag:void 0,T=Object.prototype.toString,E=x?x.toStringTag:void 0,A=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":E&&E in Object(t)?function(t){var e=w.call(t,S),n=t[S];try{t[S]=void 0;var i=!0}catch(t){}var r=M.call(t);return i&&(e?t[S]=n:delete t[S]),r}(t):function(t){return T.call(t)}(t)},C=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)},R=function(t){if(!C(t))return!1;var e=A(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e},L=y["__core-js_shared__"],P=(p=/[^.]+$/.exec(L&&L.keys&&L.keys.IE_PROTO||""))?"Symbol(src)_1."+p:"",I=Function.prototype.toString,D=function(t){if(null!=t){try{return I.call(t)}catch(t){}try{return t+""}catch(t){}}return""},O=/^\[object .+?Constructor\]$/,N=Function.prototype,z=Object.prototype,B=N.toString,F=z.hasOwnProperty,H=RegExp("^"+B.call(F).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),U=function(t){return!(!C(t)||(e=t,P&&P in e))&&(R(t)?H:O).test(D(t));var e},k=function(t,e){var n=function(t,e){return null==t?void 0:t[e]}(t,e);return U(n)?n:void 0},G=function(){try{var t=k(Object,"defineProperty");return t({},"",{}),t}catch(t){}}(),W=function(t,e,n){"__proto__"==e&&G?G(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n},V=function(t,e){return t===e||t!=t&&e!=e},j=Object.prototype.hasOwnProperty,q=function(t,e,n){var i=t[e];j.call(t,e)&&V(i,n)&&(void 0!==n||e in t)||W(t,e,n)},Y=function(t,e,n,i){var r=!n;n||(n={});for(var o=-1,s=e.length;++o<s;){var a=e[o],l=i?i(n[a],t[a],a,n,t):void 0;void 0===l&&(l=t[a]),r?W(n,a,l):q(n,a,l)}return n},X=function(t){return t},Z=function(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)},J=Math.max,$=function(t,e,n){return e=J(void 0===e?t.length-1:e,0),function(){for(var i=arguments,r=-1,o=J(i.length-e,0),s=Array(o);++r<o;)s[r]=i[e+r];r=-1;for(var a=Array(e+1);++r<e;)a[r]=i[r];return a[e]=n(s),Z(t,this,a)}},K=G?function(t,e){return G(t,"toString",{configurable:!0,enumerable:!1,value:(n=e,function(){return n}),writable:!0});var n}:X,Q=Date.now,tt=(f=K,m=0,g=0,function(){var t=Q(),e=16-(t-g);if(g=t,e>0){if(++m>=800)return arguments[0]}else m=0;return f.apply(void 0,arguments)}),et=function(t,e){return tt($(t,e,X),t+"")},nt=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991},it=function(t){return null!=t&&nt(t.length)&&!R(t)},rt=/^(?:0|[1-9]\d*)$/,ot=function(t,e){var n=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==n||"symbol"!=n&&rt.test(t))&&t>-1&&t%1==0&&t<e},st=function(t,e,n){if(!C(n))return!1;var i=typeof e;return!!("number"==i?it(n)&&ot(e,n.length):"string"==i&&e in n)&&V(n[e],t)},at=function(t){return null!=t&&"object"==typeof t},lt=function(t){return at(t)&&"[object Arguments]"==A(t)},ct=Object.prototype,ht=ct.hasOwnProperty,ut=ct.propertyIsEnumerable,dt=lt(function(){return arguments}())?lt:function(t){return at(t)&&ht.call(t,"callee")&&!ut.call(t,"callee")},pt=dt,ft=Array.isArray,mt="object"==typeof exports&&exports&&!exports.nodeType&&exports,gt=mt&&"object"==typeof module&&module&&!module.nodeType&&module,_t=gt&&gt.exports===mt?y.Buffer:void 0,vt=(_t?_t.isBuffer:void 0)||function(){return!1},yt={};yt["[object Float32Array]"]=yt["[object Float64Array]"]=yt["[object Int8Array]"]=yt["[object Int16Array]"]=yt["[object Int32Array]"]=yt["[object Uint8Array]"]=yt["[object Uint8ClampedArray]"]=yt["[object Uint16Array]"]=yt["[object Uint32Array]"]=!0,yt["[object Arguments]"]=yt["[object Array]"]=yt["[object ArrayBuffer]"]=yt["[object Boolean]"]=yt["[object DataView]"]=yt["[object Date]"]=yt["[object Error]"]=yt["[object Function]"]=yt["[object Map]"]=yt["[object Number]"]=yt["[object Object]"]=yt["[object RegExp]"]=yt["[object Set]"]=yt["[object String]"]=yt["[object WeakMap]"]=!1;var xt,bt=function(t){return function(e){return t(e)}},wt="object"==typeof exports&&exports&&!exports.nodeType&&exports,Mt=wt&&"object"==typeof module&&module&&!module.nodeType&&module,St=Mt&&Mt.exports===wt&&_.process,Tt=function(){try{return Mt&&Mt.require&&Mt.require("util").types||St&&St.binding&&St.binding("util")}catch(t){}}(),Et=Tt&&Tt.isTypedArray,At=Et?bt(Et):function(t){return at(t)&&nt(t.length)&&!!yt[A(t)]},Ct=Object.prototype.hasOwnProperty,Rt=function(t,e){var n=ft(t),i=!n&&pt(t),r=!n&&!i&&vt(t),o=!n&&!i&&!r&&At(t),s=n||i||r||o,a=s?function(t,e){for(var n=-1,i=Array(t);++n<t;)i[n]=e(n);return i}(t.length,String):[],l=a.length;for(var c in t)!e&&!Ct.call(t,c)||s&&("length"==c||r&&("offset"==c||"parent"==c)||o&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||ot(c,l))||a.push(c);return a},Lt=Object.prototype,Pt=function(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||Lt)},It=Object.prototype.hasOwnProperty,Dt=function(t){if(!C(t))return function(t){var e=[];if(null!=t)for(var n in Object(t))e.push(n);return e}(t);var e=Pt(t),n=[];for(var i in t)("constructor"!=i||!e&&It.call(t,i))&&n.push(i);return n},Ot=function(t){return it(t)?Rt(t,!0):Dt(t)},Nt=(xt=function(t,e){Y(e,Ot(e),t)},et((function(t,e){var n=-1,i=e.length,r=i>1?e[i-1]:void 0,o=i>2?e[2]:void 0;for(r=xt.length>3&&"function"==typeof r?(i--,r):void 0,o&&st(e[0],e[1],o)&&(r=i<3?void 0:r,i=1),t=Object(t);++n<i;){var s=e[n];s&&xt(t,s,n,r)}return t}))),zt=function(t,e){for(var n=t.length;n--;)if(V(t[n][0],e))return n;return-1},Bt=Array.prototype.splice;function Ft(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var i=t[e];this.set(i[0],i[1])}}Ft.prototype.clear=function(){this.__data__=[],this.size=0},Ft.prototype.delete=function(t){var e=this.__data__,n=zt(e,t);return!(n<0||(n==e.length-1?e.pop():Bt.call(e,n,1),--this.size,0))},Ft.prototype.get=function(t){var e=this.__data__,n=zt(e,t);return n<0?void 0:e[n][1]},Ft.prototype.has=function(t){return zt(this.__data__,t)>-1},Ft.prototype.set=function(t,e){var n=this.__data__,i=zt(n,t);return i<0?(++this.size,n.push([t,e])):n[i][1]=e,this};var Ht=Ft,Ut=k(y,"Map"),kt=k(Object,"create"),Gt=Object.prototype.hasOwnProperty,Wt=Object.prototype.hasOwnProperty;function Vt(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var i=t[e];this.set(i[0],i[1])}}Vt.prototype.clear=function(){this.__data__=kt?kt(null):{},this.size=0},Vt.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},Vt.prototype.get=function(t){var e=this.__data__;if(kt){var n=e[t];return"__lodash_hash_undefined__"===n?void 0:n}return Gt.call(e,t)?e[t]:void 0},Vt.prototype.has=function(t){var e=this.__data__;return kt?void 0!==e[t]:Wt.call(e,t)},Vt.prototype.set=function(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=kt&&void 0===e?"__lodash_hash_undefined__":e,this};var jt=Vt,qt=function(t,e){var n,i,r=t.__data__;return("string"==(i=typeof(n=e))||"number"==i||"symbol"==i||"boolean"==i?"__proto__"!==n:null===n)?r["string"==typeof e?"string":"hash"]:r.map};function Yt(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var i=t[e];this.set(i[0],i[1])}}Yt.prototype.clear=function(){this.size=0,this.__data__={hash:new jt,map:new(Ut||Ht),string:new jt}},Yt.prototype.delete=function(t){var e=qt(this,t).delete(t);return this.size-=e?1:0,e},Yt.prototype.get=function(t){return qt(this,t).get(t)},Yt.prototype.has=function(t){return qt(this,t).has(t)},Yt.prototype.set=function(t,e){var n=qt(this,t),i=n.size;return n.set(t,e),this.size+=n.size==i?0:1,this};var Xt=Yt;function Zt(t){var e=this.__data__=new Ht(t);this.size=e.size}Zt.prototype.clear=function(){this.__data__=new Ht,this.size=0},Zt.prototype.delete=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n},Zt.prototype.get=function(t){return this.__data__.get(t)},Zt.prototype.has=function(t){return this.__data__.has(t)},Zt.prototype.set=function(t,e){var n=this.__data__;if(n instanceof Ht){var i=n.__data__;if(!Ut||i.length<199)return i.push([t,e]),this.size=++n.size,this;n=this.__data__=new Xt(i)}return n.set(t,e),this.size=n.size,this};var Jt=Zt,$t=function(t,e){for(var n=-1,i=null==t?0:t.length;++n<i&&!1!==e(t[n],n,t););return t},Kt=function(t,e){return function(n){return t(e(n))}},Qt=Kt(Object.keys,Object),te=Object.prototype.hasOwnProperty,ee=function(t){return it(t)?Rt(t):function(t){if(!Pt(t))return Qt(t);var e=[];for(var n in Object(t))te.call(t,n)&&"constructor"!=n&&e.push(n);return e}(t)},ne="object"==typeof exports&&exports&&!exports.nodeType&&exports,ie=ne&&"object"==typeof module&&module&&!module.nodeType&&module,re=ie&&ie.exports===ne?y.Buffer:void 0,oe=re?re.allocUnsafe:void 0,se=function(t,e){var n=-1,i=t.length;for(e||(e=Array(i));++n<i;)e[n]=t[n];return e},ae=function(t,e){for(var n=-1,i=null==t?0:t.length,r=0,o=[];++n<i;){var s=t[n];e(s,n,t)&&(o[r++]=s)}return o},le=function(){return[]},ce=Object.prototype.propertyIsEnumerable,he=Object.getOwnPropertySymbols,ue=he?function(t){return null==t?[]:(t=Object(t),ae(he(t),(function(e){return ce.call(t,e)})))}:le,de=function(t,e){for(var n=-1,i=e.length,r=t.length;++n<i;)t[r+n]=e[n];return t},pe=Kt(Object.getPrototypeOf,Object),fe=Object.getOwnPropertySymbols?function(t){for(var e=[];t;)de(e,ue(t)),t=pe(t);return e}:le,me=function(t,e,n){var i=e(t);return ft(t)?i:de(i,n(t))},ge=function(t){return me(t,ee,ue)},_e=function(t){return me(t,Ot,fe)},ve=k(y,"DataView"),ye=k(y,"Promise"),xe=k(y,"Set"),be=k(y,"WeakMap"),we="[object Map]",Me="[object Promise]",Se="[object Set]",Te="[object WeakMap]",Ee="[object DataView]",Ae=D(ve),Ce=D(Ut),Re=D(ye),Le=D(xe),Pe=D(be),Ie=A;(ve&&Ie(new ve(new ArrayBuffer(1)))!=Ee||Ut&&Ie(new Ut)!=we||ye&&Ie(ye.resolve())!=Me||xe&&Ie(new xe)!=Se||be&&Ie(new be)!=Te)&&(Ie=function(t){var e=A(t),n="[object Object]"==e?t.constructor:void 0,i=n?D(n):"";if(i)switch(i){case Ae:return Ee;case Ce:return we;case Re:return Me;case Le:return Se;case Pe:return Te}return e});var De=Ie,Oe=Object.prototype.hasOwnProperty,Ne=y.Uint8Array,ze=function(t){var e=new t.constructor(t.byteLength);return new Ne(e).set(new Ne(t)),e},Be=/\w*$/,Fe=x?x.prototype:void 0,He=Fe?Fe.valueOf:void 0,Ue=function(t,e,n){var i,r,o,s=t.constructor;switch(e){case"[object ArrayBuffer]":return ze(t);case"[object Boolean]":case"[object Date]":return new s(+t);case"[object DataView]":return function(t,e){var n=e?ze(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.byteLength)}(t,n);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return function(t,e){var n=e?ze(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)}(t,n);case"[object Map]":case"[object Set]":return new s;case"[object Number]":case"[object String]":return new s(t);case"[object RegExp]":return(o=new(r=t).constructor(r.source,Be.exec(r))).lastIndex=r.lastIndex,o;case"[object Symbol]":return i=t,He?Object(He.call(i)):{}}},ke=Object.create,Ge=function(){function t(){}return function(e){if(!C(e))return{};if(ke)return ke(e);t.prototype=e;var n=new t;return t.prototype=void 0,n}}(),We=Tt&&Tt.isMap,Ve=We?bt(We):function(t){return at(t)&&"[object Map]"==De(t)},je=Tt&&Tt.isSet,qe=je?bt(je):function(t){return at(t)&&"[object Set]"==De(t)},Ye="[object Arguments]",Xe="[object Function]",Ze={};Ze[Ye]=Ze["[object Array]"]=Ze["[object ArrayBuffer]"]=Ze["[object DataView]"]=Ze["[object Boolean]"]=Ze["[object Date]"]=Ze["[object Float32Array]"]=Ze["[object Float64Array]"]=Ze["[object Int8Array]"]=Ze["[object Int16Array]"]=Ze["[object Int32Array]"]=Ze["[object Map]"]=Ze["[object Number]"]=Ze["[object Object]"]=Ze["[object RegExp]"]=Ze["[object Set]"]=Ze["[object String]"]=Ze["[object Symbol]"]=Ze["[object Uint8Array]"]=Ze["[object Uint8ClampedArray]"]=Ze["[object Uint16Array]"]=Ze["[object Uint32Array]"]=!0,Ze["[object Error]"]=Ze[Xe]=Ze["[object WeakMap]"]=!1;var Je,$e=function t(e,n,i,r,o,s){var a,l=1&n,c=2&n,h=4&n;if(i&&(a=o?i(e,r,o,s):i(e)),void 0!==a)return a;if(!C(e))return e;var u=ft(e);if(u){if(a=function(t){var e=t.length,n=new t.constructor(e);return e&&"string"==typeof t[0]&&Oe.call(t,"index")&&(n.index=t.index,n.input=t.input),n}(e),!l)return se(e,a)}else{var d=De(e),p=d==Xe||"[object GeneratorFunction]"==d;if(vt(e))return function(t,e){if(e)return t.slice();var n=t.length,i=oe?oe(n):new t.constructor(n);return t.copy(i),i}(e,l);if("[object Object]"==d||d==Ye||p&&!o){if(a=c||p?{}:function(t){return"function"!=typeof t.constructor||Pt(t)?{}:Ge(pe(t))}(e),!l)return c?function(t,e){return Y(t,fe(t),e)}(e,function(t,e){return t&&Y(e,Ot(e),t)}(a,e)):function(t,e){return Y(t,ue(t),e)}(e,function(t,e){return t&&Y(e,ee(e),t)}(a,e))}else{if(!Ze[d])return o?e:{};a=Ue(e,d,l)}}s||(s=new Jt);var f=s.get(e);if(f)return f;s.set(e,a),qe(e)?e.forEach((function(r){a.add(t(r,n,i,r,e,s))})):Ve(e)&&e.forEach((function(r,o){a.set(o,t(r,n,i,o,e,s))}));var m=u?void 0:(h?c?_e:ge:c?Ot:ee)(e);return $t(m||e,(function(r,o){m&&(r=e[o=r]),q(a,o,t(r,n,i,o,e,s))})),a},Ke=function(t,e,n){for(var i=-1,r=Object(t),o=n(t),s=o.length;s--;){var a=o[++i];if(!1===e(r[a],a,r))break}return t},Qe=function(t,e){return t&&Ke(t,e,ee)},tn=(Je=Qe,function(t,e){if(null==t)return t;if(!it(t))return Je(t,e);for(var n=t.length,i=-1,r=Object(t);++i<n&&!1!==e(r[i],i,r););return t}),en=function(t,e){for(var n=-1,i=null==t?0:t.length,r=Array(i);++n<i;)r[n]=e(t[n],n,t);return r};function nn(t){var e=-1,n=null==t?0:t.length;for(this.__data__=new Xt;++e<n;)this.add(t[e])}nn.prototype.add=nn.prototype.push=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},nn.prototype.has=function(t){return this.__data__.has(t)};var rn=nn,on=function(t,e){for(var n=-1,i=null==t?0:t.length;++n<i;)if(e(t[n],n,t))return!0;return!1},sn=function(t,e){return t.has(e)},an=function(t,e,n,i,r,o){var s=1&n,a=t.length,l=e.length;if(a!=l&&!(s&&l>a))return!1;var c=o.get(t),h=o.get(e);if(c&&h)return c==e&&h==t;var u=-1,d=!0,p=2&n?new rn:void 0;for(o.set(t,e),o.set(e,t);++u<a;){var f=t[u],m=e[u];if(i)var g=s?i(m,f,u,e,t,o):i(f,m,u,t,e,o);if(void 0!==g){if(g)continue;d=!1;break}if(p){if(!on(e,(function(t,e){if(!sn(p,e)&&(f===t||r(f,t,n,i,o)))return p.push(e)}))){d=!1;break}}else if(f!==m&&!r(f,m,n,i,o)){d=!1;break}}return o.delete(t),o.delete(e),d},ln=function(t){var e=-1,n=Array(t.size);return t.forEach((function(t,i){n[++e]=[i,t]})),n},cn=function(t){var e=-1,n=Array(t.size);return t.forEach((function(t){n[++e]=t})),n},hn=x?x.prototype:void 0,un=hn?hn.valueOf:void 0,dn=Object.prototype.hasOwnProperty,pn="[object Arguments]",fn="[object Array]",mn="[object Object]",gn=Object.prototype.hasOwnProperty,_n=function(t,e,n,i,r,o){var s=ft(t),a=ft(e),l=s?fn:De(t),c=a?fn:De(e),h=(l=l==pn?mn:l)==mn,u=(c=c==pn?mn:c)==mn,d=l==c;if(d&&vt(t)){if(!vt(e))return!1;s=!0,h=!1}if(d&&!h)return o||(o=new Jt),s||At(t)?an(t,e,n,i,r,o):function(t,e,n,i,r,o,s){switch(n){case"[object DataView]":if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case"[object ArrayBuffer]":return!(t.byteLength!=e.byteLength||!o(new Ne(t),new Ne(e)));case"[object Boolean]":case"[object Date]":case"[object Number]":return V(+t,+e);case"[object Error]":return t.name==e.name&&t.message==e.message;case"[object RegExp]":case"[object String]":return t==e+"";case"[object Map]":var a=ln;case"[object Set]":var l=1&i;if(a||(a=cn),t.size!=e.size&&!l)return!1;var c=s.get(t);if(c)return c==e;i|=2,s.set(t,e);var h=an(a(t),a(e),i,r,o,s);return s.delete(t),h;case"[object Symbol]":if(un)return un.call(t)==un.call(e)}return!1}(t,e,l,n,i,r,o);if(!(1&n)){var p=h&&gn.call(t,"__wrapped__"),f=u&&gn.call(e,"__wrapped__");if(p||f){var m=p?t.value():t,g=f?e.value():e;return o||(o=new Jt),r(m,g,n,i,o)}}return!!d&&(o||(o=new Jt),function(t,e,n,i,r,o){var s=1&n,a=ge(t),l=a.length;if(l!=ge(e).length&&!s)return!1;for(var c=l;c--;){var h=a[c];if(!(s?h in e:dn.call(e,h)))return!1}var u=o.get(t),d=o.get(e);if(u&&d)return u==e&&d==t;var p=!0;o.set(t,e),o.set(e,t);for(var f=s;++c<l;){var m=t[h=a[c]],g=e[h];if(i)var _=s?i(g,m,h,e,t,o):i(m,g,h,t,e,o);if(!(void 0===_?m===g||r(m,g,n,i,o):_)){p=!1;break}f||(f="constructor"==h)}if(p&&!f){var v=t.constructor,y=e.constructor;v==y||!("constructor"in t)||!("constructor"in e)||"function"==typeof v&&v instanceof v&&"function"==typeof y&&y instanceof y||(p=!1)}return o.delete(t),o.delete(e),p}(t,e,n,i,r,o))},vn=function t(e,n,i,r,o){return e===n||(null==e||null==n||!at(e)&&!at(n)?e!=e&&n!=n:_n(e,n,i,r,t,o))},yn=function(t){return t==t&&!C(t)},xn=function(t,e){return function(n){return null!=n&&n[t]===e&&(void 0!==e||t in Object(n))}},bn=function(t){var e=function(t){for(var e=ee(t),n=e.length;n--;){var i=e[n],r=t[i];e[n]=[i,r,yn(r)]}return e}(t);return 1==e.length&&e[0][2]?xn(e[0][0],e[0][1]):function(n){return n===t||function(t,e,n,i){var r=n.length,o=r,s=!i;if(null==t)return!o;for(t=Object(t);r--;){var a=n[r];if(s&&a[2]?a[1]!==t[a[0]]:!(a[0]in t))return!1}for(;++r<o;){var l=(a=n[r])[0],c=t[l],h=a[1];if(s&&a[2]){if(void 0===c&&!(l in t))return!1}else{var u=new Jt;if(i)var d=i(c,h,l,t,e,u);if(!(void 0===d?vn(h,c,3,i,u):d))return!1}}return!0}(n,t,e)}},wn=function(t){return"symbol"==typeof t||at(t)&&"[object Symbol]"==A(t)},Mn=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Sn=/^\w*$/,Tn=function(t,e){if(ft(t))return!1;var n=typeof t;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=t&&!wn(t))||Sn.test(t)||!Mn.test(t)||null!=e&&t in Object(e)};function En(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new TypeError("Expected a function");var n=function(){var i=arguments,r=e?e.apply(this,i):i[0],o=n.cache;if(o.has(r))return o.get(r);var s=t.apply(this,i);return n.cache=o.set(r,s)||o,s};return n.cache=new(En.Cache||Xt),n}En.Cache=Xt;var An,Cn,Rn,Ln=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Pn=/\\(\\)?/g,In=(An=En((function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(Ln,(function(t,n,i,r){e.push(i?r.replace(Pn,"$1"):n||t)})),e}),(function(t){return 500===Cn.size&&Cn.clear(),t})),Cn=An.cache,An),Dn=x?x.prototype:void 0,On=Dn?Dn.toString:void 0,Nn=function t(e){if("string"==typeof e)return e;if(ft(e))return en(e,t)+"";if(wn(e))return On?On.call(e):"";var n=e+"";return"0"==n&&1/e==-1/0?"-0":n},zn=function(t){return null==t?"":Nn(t)},Bn=function(t,e){return ft(t)?t:Tn(t,e)?[t]:In(zn(t))},Fn=function(t){if("string"==typeof t||wn(t))return t;var e=t+"";return"0"==e&&1/t==-1/0?"-0":e},Hn=function(t,e){for(var n=0,i=(e=Bn(e,t)).length;null!=t&&n<i;)t=t[Fn(e[n++])];return n&&n==i?t:void 0},Un=function(t,e){return null!=t&&e in Object(t)},kn=function(t,e){return null!=t&&function(t,e,n){for(var i=-1,r=(e=Bn(e,t)).length,o=!1;++i<r;){var s=Fn(e[i]);if(!(o=null!=t&&n(t,s)))break;t=t[s]}return o||++i!=r?o:!!(r=null==t?0:t.length)&&nt(r)&&ot(s,r)&&(ft(t)||pt(t))}(t,e,Un)},Gn=function(t,e){return Tn(t)&&yn(e)?xn(Fn(t),e):function(n){var i=function(t,e,n){var i=null==t?void 0:Hn(t,e);return void 0===i?n:i}(n,t);return void 0===i&&i===e?kn(n,t):vn(e,i,3)}},Wn=function(t){return Tn(t)?(e=Fn(t),function(t){return null==t?void 0:t[e]}):function(t){return function(e){return Hn(e,t)}}(t);var e},Vn=function(t){return"function"==typeof t?t:null==t?X:"object"==typeof t?ft(t)?Gn(t[0],t[1]):bn(t):Wn(t)},jn=function(t,e){var n=-1,i=it(t)?Array(t.length):[];return tn(t,(function(t,r,o){i[++n]=e(t,r,o)})),i},qn=function(t,e,n,i){var r=-1,o=null==t?0:t.length;for(i&&o&&(n=t[++r]);++r<o;)n=e(n,t[r],r,t);return n},Yn=function(t,e,n,i,r){return r(t,(function(t,r,o){n=i?(i=!1,t):e(n,t,r,o)})),n},Xn=x?x.isConcatSpreadable:void 0,Zn=function(t){return ft(t)||pt(t)||!!(Xn&&t&&t[Xn])},Jn=function t(e,n,i,r,o){var s=-1,a=e.length;for(i||(i=Zn),o||(o=[]);++s<a;){var l=e[s];n>0&&i(l)?n>1?t(l,n-1,i,r,o):de(o,l):r||(o[o.length]=l)}return o},$n=function(t){return null!=t&&t.length?Jn(t,1):[]},Kn=function(t){var e=null==t?0:t.length;return e?t[e-1]:void 0},Qn=function(t,e,n,i){for(var r=t.length,o=n+(i?1:-1);i?o--:++o<r;)if(e(t[o],o,t))return o;return-1},ti=/\s/,ei=/^\s+/,ni=function(t){return t?t.slice(0,function(t){for(var e=t.length;e--&&ti.test(t.charAt(e)););return e}(t)+1).replace(ei,""):t},ii=/^[-+]0x[0-9a-f]+$/i,ri=/^0b[01]+$/i,oi=/^0o[0-7]+$/i,si=parseInt,ai=function(t){return t?Infinity===(t=function(t){if("number"==typeof t)return t;if(wn(t))return NaN;if(C(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=C(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=ni(t);var n=ri.test(t);return n||oi.test(t)?si(t.slice(2),n?2:8):ii.test(t)?NaN:+t}(t))||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0},li=function(t){var e=ai(t),n=e%1;return e==e?n?e-n:e:0},ci=Math.max,hi=function(t,e,n){var i=null==t?0:t.length;if(!i)return-1;var r=null==n?0:li(n);return r<0&&(r=ci(i+r,0)),Qn(t,Vn(e),r)},ui=(Rn=hi,function(t,e,n){var i=Object(t);if(!it(t)){var r=Vn(e);t=ee(t),e=function(t){return r(i[t],t,i)}}var o=Rn(t,e,n);return o>-1?i[r?t[o]:o]:void 0}),di=Math.max,pi=Math.min,fi=function(t,e){var n=[];return tn(t,(function(t,i,r){e(t,i,r)&&n.push(t)})),n},mi=Math.floor,gi=Math.random,_i=function(t,e){return t+mi(gi()*(e-t+1))},vi=function(t,e){var n=-1,i=t.length,r=i-1;for(e=void 0===e?i:e;++n<e;){var o=_i(n,r),s=t[o];t[o]=t[n],t[n]=s}return t.length=e,t},yi=function(t){return vi(se(t))},xi=function(t){return null==t?[]:function(t,e){return en(e,(function(e){return t[e]}))}(t,ee(t))},bi=function(t){return vi(xi(t))},wi=function(t,e,n){var i=-1,r=t.length;e<0&&(e=-e>r?0:r+e),(n=n>r?r:n)<0&&(n+=r),r=e>n?0:n-e>>>0,e>>>=0;for(var o=Array(r);++i<r;)o[i]=t[i+e];return o},Mi=Math.ceil,Si=Math.max,Ti=function(t,e){return null==(t=function(t,e){return e.length<2?t:Hn(t,wi(e,0,-1))}(t,e=Bn(e,t)))||delete t[Fn(Kn(e))]},Ei=Array.prototype.splice,Ai=Math.ceil,Ci=Math.max,Ri=function(t,e,n){return n&&"number"!=typeof n&&st(t,e,n)&&(e=n=void 0),t=ai(t),void 0===e?(e=t,t=0):e=ai(e),function(t,e,n,i){for(var r=-1,o=Ci(Ai((e-t)/(n||1)),0),s=Array(o);o--;)s[i?o:++r]=t,t+=n;return s}(t,e,n=void 0===n?t<e?1:-1:ai(n),void 0)},Li=function(t){return t!=t},Pi=function(t,e,n){return e==e?function(t,e,n){for(var i=n-1,r=t.length;++i<r;)if(t[i]===e)return i;return-1}(t,e,n):Qn(t,Li,n)},Ii=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]"),Di="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",Oi="\\ud83c[\\udffb-\\udfff]",Ni="[^\\ud800-\\udfff]",zi="(?:\\ud83c[\\udde6-\\uddff]){2}",Bi="[\\ud800-\\udbff][\\udc00-\\udfff]",Fi="(?:"+Di+"|"+Oi+")?",Hi="[\\ufe0e\\ufe0f]?",Ui=Hi+Fi+"(?:\\u200d(?:"+[Ni,zi,Bi].join("|")+")"+Hi+Fi+")*",ki="(?:"+[Ni+Di+"?",Di,zi,Bi,"[\\ud800-\\udfff]"].join("|")+")",Gi=RegExp(Oi+"(?="+Oi+")|"+ki+Ui,"g"),Wi=function(t){return function(t){return Ii.test(t)}(t)?function(t){return t.match(Gi)||[]}(t):function(t){return t.split("")}(t)},Vi=function(t,e){if(t!==e){var n=void 0!==t,i=null===t,r=t==t,o=wn(t),s=void 0!==e,a=null===e,l=e==e,c=wn(e);if(!a&&!c&&!o&&t>e||o&&s&&l&&!a&&!c||i&&s&&l||!n&&l||!r)return 1;if(!i&&!o&&!c&&t<e||c&&n&&r&&!i&&!o||a&&n&&r||!s&&r||!l)return-1}return 0},ji=function(t,e,n){e=e.length?en(e,(function(t){return ft(t)?function(e){return Hn(e,1===t.length?t[0]:t)}:t})):[X];var i=-1;return e=en(e,bt(Vn)),function(t,e){var n=t.length;for(t.sort(e);n--;)t[n]=t[n].value;return t}(jn(t,(function(t,n,r){return{criteria:en(e,(function(e){return e(t)})),index:++i,value:t}})),(function(t,e){return function(t,e,n){for(var i=-1,r=t.criteria,o=e.criteria,s=r.length,a=n.length;++i<s;){var l=Vi(r[i],o[i]);if(l)return i>=a?l:l*("desc"==n[i]?-1:1)}return t.index-e.index}(t,e,n)}))},qi=et((function(t,e){if(null==t)return[];var n=e.length;return n>1&&st(t,e[0],e[1])?e=[]:n>2&&st(e[0],e[1],e[2])&&(e=[e[0]]),ji(t,Jn(e,1),[])})),Yi=function(t,e,n,i){if(!C(t))return t;for(var r=-1,o=(e=Bn(e,t)).length,s=o-1,a=t;null!=a&&++r<o;){var l=Fn(e[r]),c=n;if("__proto__"===l||"constructor"===l||"prototype"===l)return t;if(r!=s){var h=a[l];void 0===(c=i?i(h,l,a):void 0)&&(c=C(h)?h:ot(e[r+1])?[]:{})}q(a,l,c),a=a[l]}return t},Xi=function(t,e){return function(t,e,n){for(var i=-1,r=e.length,o={};++i<r;){var s=e[i],a=Hn(t,s);n(a,s)&&Yi(o,Bn(s,t),a)}return o}(t,e,(function(e,n){return kn(t,n)}))},Zi=function(t){return tt($(t,void 0,$n),t+"")}((function(t,e){return null==t?{}:Xi(t,e)})),Ji=function(t,e){return!(null==t||!t.length)&&Pi(t,e,0)>-1},$i=function(t,e,n){for(var i=-1,r=null==t?0:t.length;++i<r;)if(n(e,t[i]))return!0;return!1},Ki=xe&&1/cn(new xe([,-0]))[1]==1/0?function(t){return new xe(t)}:function(){},Qi=function(t){var e=t.length;return e?t[_i(0,e-1)]:void 0},tr=function(t){return Qi(xi(t))},er=function(t,e,n,i){for(var r=n-1,o=t.length;++r<o;)if(i(t[r],e))return r;return-1},nr=Array.prototype.splice;function ir(t){return"[object Array]"===Object.prototype.toString.call(t)}var rr,or,sr,ar={assignIn:Nt,cloneDeep:function(t){return $e(t,5)},forEach:function(t,e){return(ft(t)?$t:tn)(t,"function"==typeof(n=e)?n:X);var n},map:function(t,e){return(ft(t)?en:jn)(t,Vn(e))},reduce:function(t,e,n){var i=ft(t)?qn:Yn,r=arguments.length<3;return i(t,Vn(e),n,r,tn)},compact:function(t){for(var e=-1,n=null==t?0:t.length,i=0,r=[];++e<n;){var o=t[e];o&&(r[i++]=o)}return r},flatten:$n,head:function(t){return t&&t.length?t[0]:void 0},last:Kn,find:ui,findIndex:hi,findLastIndex:function(t,e,n){var i=null==t?0:t.length;if(!i)return-1;var r=i-1;return void 0!==n&&(r=li(n),r=n<0?di(i+r,0):pi(r,i-1)),Qn(t,Vn(e),r,!0)},findKey:function(t,e){return function(t,e,n){var i;return n(t,(function(t,n,r){if(e(t,n,r))return i=n,!1})),i}(t,Vn(e),Qe)},filter:function(t,e){return(ft(t)?ae:fi)(t,Vn(e))},shuffle:function(t){return(ft(t)?yi:bi)(t)},chunk:function(t,e,n){e=(n?st(t,e,n):void 0===e)?1:Si(li(e),0);var i=null==t?0:t.length;if(!i||e<1)return[];for(var r=0,o=0,s=Array(Mi(i/e));r<i;)s[o++]=wi(t,r,r+=e);return s},remove:function(t,e){var n=[];if(!t||!t.length)return n;var i=-1,r=[],o=t.length;for(e=Vn(e);++i<o;){var s=t[i];e(s,i,t)&&(n.push(s),r.push(i))}return function(t,e){for(var n=t?e.length:0,i=n-1;n--;){var r=e[n];if(n==i||r!==o){var o=r;ot(r)?Ei.call(t,r,1):Ti(t,r)}}}(t,r),n},range:Ri,trim:function(t,e,n){if((t=zn(t))&&(n||void 0===e))return ni(t);if(!t||!(e=Nn(e)))return t;var i=Wi(t),r=Wi(e),o=function(t,e){for(var n=-1,i=t.length;++n<i&&Pi(e,t[n],0)>-1;);return n}(i,r),s=function(t,e){for(var n=t.length;n--&&Pi(e,t[n],0)>-1;);return n}(i,r)+1;return function(t,e,n){var i=t.length;return n=void 0===n?i:n,!e&&n>=i?t:wi(t,e,n)}(i,o,s).join("")},sortBy:qi,pick:Zi,sum:function(t){return t&&t.length?function(t,e){for(var n,i=-1,r=t.length;++i<r;){var o=e(t[i]);void 0!==o&&(n=void 0===n?o:n+o)}return n}(t,X):0},uniq:function(t){return t&&t.length?function(t,e,n){var i=-1,r=Ji,o=t.length,s=!0,a=[],l=a;if(n)s=!1,r=$i;else if(o>=200){var c=e?null:Ki(t);if(c)return cn(c);s=!1,r=sn,l=new rn}else l=e?[]:a;t:for(;++i<o;){var h=t[i],u=e?e(h):h;if(h=n||0!==h?h:0,s&&u==u){for(var d=l.length;d--;)if(l[d]===u)continue t;e&&l.push(u),a.push(h)}else r(l,u,n)||(l!==a&&l.push(u),a.push(h))}return a}(t):[]},sample:function(t){return(ft(t)?Qi:tr)(t)},pullAll:function(t,e){return t&&t.length&&e&&e.length?function(t,e,n,i){var r=i?er:Pi,o=-1,s=e.length,a=t;for(t===e&&(e=se(e)),n&&(a=en(t,bt(n)));++o<s;)for(var l=0,c=e[o],h=n?n(c):c;(l=r(a,h,l,i))>-1;)a!==t&&nr.call(a,l,1),nr.call(t,l,1);return t}(t,e):t},isElement:function(t){return t&&!!t.querySelector},isString:function(t){return t&&!!t.substr||""===t},isArray:ir,isObject:function(t){return"object"==typeof t&&null!==t&&!ir(t)}},lr=function(){function t(){this._listeners={}}return t.prototype.on=function(t,e){return this._listeners[t]=this._listeners[t]||[],this._listeners[t].push(e),this},t.prototype.off=function(t,e){var n=this;return ar.forEach(this._listeners,(function(i,r){t&&r!==t||(ar.forEach(i,(function(t,n){e&&t!==e||(i[n]=null)})),i=ar.compact(i),n._listeners[r]=i,0===i.length&&delete n._listeners[r])})),this},t.prototype.emit=function(t,e){return ar.forEach(this._listeners[t],(function(t,n){t&&t(e)})),this},t}(),cr=(rr=location.href,or=rr.split("#")[0].split("?")[1],sr={},(or?or.split("&"):[]).forEach((function(t){var e=t.split("="),n=e[0],i=e[1];isNaN(Number(i))||String(Number(i)).length!==String(i).length||(i=Number(i)),""!==i&&(sr[n]=i)})),{query:sr}).query,hr=Object.keys(cr)||[],ur=hr.slice();try{var dr=(window.sessionStorage.getItem("query-stored-keys")||"").split(",");ur=ur.concat(dr),ur=ar.compact(ar.uniq(ur)),window.sessionStorage.setItem("query-stored-keys",ur.join(","))}catch(t){console.error(t)}var pr,fr=(pr=function(t,e){return pr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},pr(t,e)},function(t,e){function n(){this.constructor=t}pr(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),mr=new(function(t){function e(){var e=t.call(this)||this;return e.e={update:"update"},e._state={startTime:Date.now(),currentTime:Date.now(),tickedTime:0,fps:60,fpsAverage:60,frameStretch:1},e._timeouts=[],e}return fr(e,t),e.prototype.getStatsDom=function(){return null},e.prototype.setup=function(){this._bindedUpdateHdl=this._updateHdl.bind(this),this._updateHdl()},Object.defineProperty(e.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),e.prototype._updateHdl=function(){var t=this,e=Date.now();this._state.tickedTime=e-this._state.currentTime,this._state.currentTime=e,this._state.elapsedTime=e-this._state.startTime,this._state.fps=1e3/this._state.tickedTime,this._state.frameStretch=Math.max(0,this._state.tickedTime/16.666666666666668),this._timeouts.forEach((function(n,i){n&&e>=n.endTime&&(n.fn(),t._timeouts[i]=null)})),this.emit(this.e.update),window.requestAnimationFrame(this._bindedUpdateHdl)},e.prototype.setTimeout=function(t,e){return this._timeouts.push({fn:t,endTime:this._state.currentTime+e}),this._timeouts.length-1},e.prototype.clearTimeout=function(t){this._timeouts[t]=null},e.prototype.correctDumping=function(t){return 1-Math.pow(1-t,this._state.frameStretch)},e.prototype.correctDecrease=function(t){return Math.pow(t,this._state.frameStretch)},e}(lr)),gr=n(1e3),_r=n.n(gr),vr=function(){function t(t){void 0===t&&(t=1),this._progressPer=0,this._onProcess=!1,this._currentValue=t,this._bindedUpdateHdl=this._updateHdl.bind(this)}return Object.defineProperty(t.prototype,"progressPer",{get:function(){return this._progressPer},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onProcess",{get:function(){return this._onProcess},enumerable:!1,configurable:!0}),t.prototype.it=function(t){return this._p=Object.assign({start:this._currentValue,end:0,duration:0,delay:0,easing:"easeInOutQuad",onProgress:null,onStart:null,onComplete:null},t),this._easingFunc=_r()[this._p.easing]||_r().linear,this.stop(),0===this._p.delay?this._start():this._delayId=setTimeout(this._start.bind(this),this._p.delay),this},t.prototype.tick=function(){this._updateHdl()},t.prototype.pause=function(){this._paused=!0,this.stop(),this._elapsedTime=(new Date).getTime()-this._startTime},t.prototype.resume=function(){this._paused&&(this._paused=!1,this._start(this._elapsedTime))},t.prototype.stop=function(){this._onProcess=!1,clearTimeout(this._delayId),mr.off(mr.e.update,this._bindedUpdateHdl)},t.prototype.skip=function(){this._onProcess&&(this.stop(),this._currentValue=this._p.end,this._progressPer=1,this._p.onProgress&&this._p.onProgress(this._currentValue,this._progressPer),this._p.onComplete&&this._p.onComplete())},t.prototype._start=function(t){void 0===t&&(t=0),this._onProcess=!0,this._startTime=mr.state.currentTime,t&&(this._startTime-=t),mr.on(mr.e.update,this._bindedUpdateHdl),this._updateHdl(),this._p.onStart&&this._p.onStart()},t.prototype._updateHdl=function(){var t=Math.min(mr.state.currentTime-this._startTime,this._p.duration);this._currentValue=0===this._p.duration?this._p.end:this._easingFunc(t,this._p.start,this._p.end,this._p.duration),this._progressPer=0===this._p.duration?0:t/this._p.duration,this._p.onProgress&&this._p.onProgress(this._currentValue,this._progressPer),(t>=this._p.duration||0===this._p.duration)&&(this.stop(),this._p.onComplete&&this._p.onComplete())},t}();function yr(t,e,n){return void 0===t&&(t=void 0),void 0===e&&(e=void 0),void 0===n&&(n=.5),n>1?e:n<0?t:t*(1-n)+e*n}var xr=document.createElement("div"),br={},wr=[],Mr=function(t){var e;return ar.isElement(t)||t===window?e=t:ar.isString(t)?e=Mr.find(ar.trim(t))[0]:console.error("[DomU] selector must be HTMLElement | string"),new Er(e)};Mr.uniqueId=function(t){var e=wr.indexOf(t);return e>=0?e+1:(wr.push(t),wr.length)},Mr.data=function(t,e,n){var i=String(Mr.uniqueId(t));if(br[i]=br[i]||{},void 0===n)return br[i][e];br[i][e]=n},Mr.find=function(t,e){return"#"===t.substr(0,1)&&t.indexOf(" ")<0?ar.compact([document.getElementById(t.substr(1))]):"<"===t.substr(0,1)?(xr.innerHTML=t,[xr.children[0]]):e?ar.map(e.querySelectorAll(t)):ar.map(document.querySelectorAll(t))},Mr.find$=function(t,e){return Mr.find(t,e).map((function(t){return Mr(t)}))};var Sr,Tr,Er=function(){function t(t){this._eventListeners={},this._el=t}return Object.defineProperty(t.prototype,"el",{get:function(){return this._el},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isVideoMetaLoaded",{get:function(){return this._isVideoMetaLoaded},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"videoWidth",{get:function(){return this._videoWidth},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"videoHeight",{get:function(){return this._videoHeight},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"moduleInstance",{get:function(){return this.data("module-instance")},enumerable:!1,configurable:!0}),t.prototype.dispose=function(){var t=wr.indexOf(this._el);wr[t]=null},t.prototype.data=function(t,e){return void 0===e?Mr.data(this._el,t):(Mr.data(this._el,t,e),this)},t.prototype.find=function(t){return Mr.find(t,this._el)},t.prototype.find$=function(t){return Mr.find$(t,this._el)},t.prototype.on=function(t,e,n){var i=this;return void 0===n&&(n=!1),t.split(" ").forEach((function(t){i._eventListeners[t]||(i._eventListeners[t]=[]),i._eventListeners[t].push(e),i._el.addEventListener(t,e,n)})),this},t.prototype.off=function(t,e){var n=this;return ar.forEach(this._eventListeners,(function(i,r){t&&t.indexOf(r)<0||(i.forEach((function(t,o){e&&e!==t||(n._el.removeEventListener(r,t),i[o]=null)})),n._eventListeners[r]=ar.compact(i),0===n._eventListeners[r].length&&delete n._eventListeners[r])})),this},t.prototype.onClick=function(t){this.on("click",(function(e){e.preventDefault(),e.stopPropagation(),t(e)}))},t.prototype.trigger=function(t,e){if(void 0===e&&(e={}),window.CustomEvent)this._el.dispatchEvent(new CustomEvent(t,e));else{var n=document.createEvent("CustomEvent");n.initCustomEvent(t,!0,!0,e),this._el.dispatchEvent(n)}return this},t.prototype.onImgLoad=function(t,e){var n=this._el;return n.complete||"complete"==n.readyState||4==n.readyState?(setTimeout(t,0),this):(this.on("load",t).on("error",(function(t){console.error("image load error ["+n.src+"]",t,n),e&&e()})),this)},t.prototype.onVideoMetaLoad=function(t,e){var n=this,i=this._el;return this._isVideoMetaLoaded||i.readyState>=2?(this._isVideoMetaLoaded=!0,setTimeout(t,0),this):i.videoWidth>0?(this._isVideoMetaLoaded=!0,this._videoWidth=i.videoWidth,this._videoHeight=i.videoHeight,t(),this):(this.on("loadedmetadata",(function(){n._isVideoMetaLoaded=!0,n._videoWidth=i.videoWidth,n._videoHeight=i.videoHeight,t()})).on("error",(function(n){console.error("video load error ["+i.src+"]",n,i),e?e():t()})),this)},t.prototype.remove=function(){return this._el.parentNode&&this._el.parentNode.removeChild(this._el),this},t.prototype.width=function(){return this._el.offsetWidth},t.prototype.height=function(){return this._el.offsetHeight},t.prototype.innerWidth=function(){return this._el.offsetWidth-parseInt(this.css("padding-left")||"0")-parseInt(this.css("padding-right")||"0")},t.prototype.scrollWidth=function(){return this._el.scrollWidth},t.prototype.scrollHeight=function(){return this._el.scrollHeight},t.prototype.naturalWidth=function(){return this._el.width},t.prototype.naturalHeight=function(){return this._el.height},t.prototype.append=function(e){return e instanceof t&&(e=e.el),this._el.appendChild(e),this},t.prototype.appendTo=function(e){return e instanceof t&&(e=e.el),e.appendChild(this._el),this},t.prototype.prepend=function(e){return e instanceof t&&(e=e.el),this._el.insertBefore(e,this._el.firstChild),this},t.prototype.parent=function(){return this._el.parentNode},t.prototype.addClass=function(t){var e=this;return t.split(" ").forEach((function(t){e._el.classList.add(t)})),this},t.prototype.hasClass=function(t){return this._el.classList.contains(t)},t.prototype.removeClass=function(t){var e=this;return t.split(" ").forEach((function(t){e._el.classList.remove(t)})),this},t.prototype.toggleClass=function(t,e){return e?this.addClass(t):this.removeClass(t)},t.prototype.css=function(t,e){var n=this;if(ar.isString(t)){if(void 0===e)return getComputedStyle(this._el)[t];this._applyCSS(t,e)}else ar.forEach(t,(function(t,e){n._applyCSS(e,t)}));return this},t.prototype.transform=function(t){var e=[];if(t){if(void 0!==t.perspective&&e.push("perspective("+(ar.isString(t.perspective)?t.perspective:t.perspective+"px")+")"),void 0!==t.x||void 0!==t.y||void 0!==t.z){var n=t.x&&ar.isString(t.x)?t.x:(t.x||0)+"px",i=t.y&&ar.isString(t.y)?t.y:(t.y||0)+"px",r=t.z&&ar.isString(t.z)?t.z:(t.z||0)+"px";t.is2D?e.push("translate("+n+", "+i+")"):e.push("translate3d("+n+", "+i+", "+r+")")}void 0===t.scale&&void 0===t.scaleX&&void 0===t.scaleY||e.push("scale("+(t.scale||t.scaleX||0)+", "+(t.scale||t.scaleY||0)+")"),void 0!==t.rotate&&e.push("rotate("+(t.rotate||0)+"deg)"),void 0!==t.rotateX&&e.push("rotateX("+(t.rotateX||0)+"deg)"),void 0!==t.rotateY&&e.push("rotateY("+(t.rotateY||0)+"deg)"),void 0!==t.rotateZ&&e.push("rotateZ("+(t.rotateZ||0)+"deg)"),void 0!==t.skewX&&e.push("skewX("+(t.skewX||0)+"deg)")}return this._el.style.transform=this._el.style["-webkit-transform"]=e.length>0?e.join(" "):"",t.origin&&(this._el.style["transform-origin"]=this._el.style["-webkit-transform-origin"]=t.origin),this},t.prototype.transformMatrix=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this._el.style.transform="matrix(1, 0, 0, 1, "+t+", "+e+")",this},t.prototype.transformMatrix3d=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this._el.style.transform="matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, "+t+", "+e+", 0, 1)",this},t.prototype.tween=function(t,e,n){var i=this;this._tw=this._tw||new vr,this._tw.it({start:0,end:1,duration:n.duration,delay:n.delay,easing:n.easing,onProgress:function(r){void 0!==t.opacity&&i.css("opacity",yr(t.opacity,e.opacity,r));var o=void 0!==t.x?yr(t.x,e.x,r):0,s=void 0!==t.y?yr(t.y,e.y,r):0,a=void 0!==t.scale?yr(t.scale,e.scale,r):1,l=a;void 0!==t.scaleX&&(a=yr(t.scaleX,e.scaleX,r)),void 0!==t.scaleY&&(l=yr(t.scaleY,e.scaleY,r));var c=void 0!==t.rotate?yr(t.rotate,e.rotate,r):0,h=t.origin||"";0===o&&0===s&&1===a&&1===l||i.transform({x:o,y:s,scaleX:a,scaleY:l,origin:h,rotate:c,is2D:t.is2D});var u={};void 0!==t.left&&(u.left=yr(t.left,e.left,r)),void 0!==t.top&&(u.top=yr(t.top,e.top,r)),void 0!==t.width&&(u.width=yr(t.width,e.width,r)),void 0!==t.height&&(u.height=yr(t.height,e.height,r)),Object.keys(u).length>0&&i.css(u),n.onProgress&&n.onProgress(r)},onStart:function(){n.onStart&&n.onStart()},onComplete:function(){n.onComplete&&n.onComplete()}})},t.prototype.tweenStop=function(){return this._tw?(this._tw.stop(),this):this},t.prototype._applyCSS=function(t,e){t.indexOf("-")>=0&&(t=ar.map(t.split("-"),(function(t,e){return 0===e?t:t.substr(0,1).toUpperCase()+t.substr(1)})).join("")),this._el.style[t]=ar.isString(e)||"opacity"===t||"zIndex"===t||"strokeDashoffset"===t?""+e:e+"px"},t.prototype.scrollTop=function(t){return void 0===t?this._el.scrollTop:(this._el.scrollTop=t,this)},t.prototype.scrollLeft=function(t){return void 0===t?this._el.scrollLeft:(this._el.scrollLeft=t,this)},t.prototype.attr=function(t,e){return void 0===e?this._el.getAttribute(t):(this._el.setAttribute(t,e),this)},t.prototype.attrBool=function(t){return 1===parseInt(this.attr(t))},t.prototype.val=function(t){return void 0===t?this._el.value:(this._el.value=t,this)},t.prototype.html=function(t){return void 0===t?this._el.innerHTML:(this._el.innerHTML=t,this)},t.prototype.removeAttr=function(t){return this._el.removeAttribute(t),this},t.prototype.clientRect=function(){return this._el.getBoundingClientRect()},t.prototype.position=function(t){var e=this.clientRect();return{x:e.left+t.scrollLeft,y:e.top+t.scrollTop}},t.prototype.rawPosition=function(){var t=this.clientRect();return{x:t.left,y:t.top}},t.prototype.delay=function(t,e){return void 0===e&&(e=null),this.cancelDelay(),e&&(0===t?e():this._delayId=setTimeout(e,t)),this},t.prototype.cancelDelay=function(){return clearTimeout(this._delayId),this},t.prototype.show=function(t){var e=this;return void 0===t&&(t=0),mr.setTimeout((function(){e.addClass("is_visible")}),t)},t.prototype.fade=function(t,e){var n=this;void 0===e&&(e={});var i=void 0!==e.delay?e.delay:0,r=void 0!==e.complete?e.complete:null,o=void 0!==e.hideDulation?e.hideDulation:500;return this.delay(i,(function(){t?(n.addClass("is_visible"),n.delay(33,(function(){n.addClass("is_show"),r&&r()}))):(n.removeClass("is_show"),n.delay(o,(function(){n.removeClass("is_visible"),r&&r()})))})),this},t.prototype.findParentNode=function(t,e){void 0===e&&(e=5);var n=0,i=function(r){if(!r)return null;var o=r.nodeName.toLowerCase();return t.includes(o)?r:++n>e?null:i(r.parentNode)};return i(this._el)},t}(),Ar=document.createElement("canvas");try{var Cr=(Sr=Ar.getContext("experimental-webgl")).getExtension("WEBGL_debug_renderer_info");Tr=Cr?Sr.getParameter(Cr.UNMASKED_RENDERER_WEBGL):""}catch(t){Sr=null,Tr=""}var Rr,Lr={gl:Sr,renderer:Tr},Pr=navigator.userAgent.toLowerCase(),Ir=navigator.platform.toLowerCase(),Dr=Pr.match(/windows/),Or=Pr.match(/macintosh/),Nr=Pr.match(/googlebot/),zr=Pr.indexOf("y!j")>=0,Br=Pr.match(/bing/),Fr=Nr||zr||Br,Hr="ontouchstart"in window&&!Dr,Ur=!Hr,kr=Pr.match(/windows/)&&Pr.match(/edge/),Gr=Pr.match(/chrome/)&&Pr.match(/edg\//),Wr=Pr.match(/msie/)||Pr.match(/trident/)||hr.includes("ie"),Vr=Pr.match(/msie 8/),jr=Pr.match(/msie 9/),qr=Pr.match(/msie 10/),Yr=Pr.match(/chrome/),Xr=Pr.match(/safari/)&&!Pr.match(/chrome/),Zr=Pr.match(/firefox/),Jr=Pr.match(/opera/),$r=Pr.match(/iphone/),Kr=Pr.match(/ipod/),Qr=Pr.indexOf("ipad")>-1||Pr.indexOf("macintosh")>-1&&Hr,to=$r||Kr||Qr,eo=Pr.match(/android/),no=eo&&Pr.match(/mobile/),io=eo&&!Pr.match(/mobile/),ro=Pr.match(/android 2|android 4.0|android 4.1|android 4.2|android 4.3/),oo=null,so=null;try{if(to){oo=(Pr.split(" os ")[1]||"").split(" ")[0];var ao=parseInt(oo.split("_")[0]),lo=parseInt(oo.split("_")[1]||0);oo=parseInt(((ao<10?"0":"")+ao+lo).substr(0,3))/10,(Rr=(Pr.split("version/")[1]||"").split(" ")[0])&&(Rr=parseFloat(Rr))}eo&&(so=(Pr.split("android ")[1]||"").substr(0,3).split(".").join(""),so=parseInt(so))}catch(t){console.error(t)}var co=Math.min(window.screen.width,window.screen.height)>=375&&/iphone/.test(Pr),ho="macintel"===Ir,uo=no||$r||Kr,po=io||Qr;try{window.sessionStorage.getItem("webgl_lose_context")}catch(t){}var fo=Ur&&(Lr.renderer.toLowerCase().match(/intel/)||Xr),mo=window.devicePixelRatio>=2,go=window.devicePixelRatio,_o=!Hr,vo={googlebot:Nr,yahoobot:zr,bingbot:Br,crawlerbot:Fr,win:Dr,mac:Or,ie:Wr,ie8:Vr,ie9:jr,ie10:qr,edge:kr,newEdge:Gr,chrome:Yr,safari:Xr,firefox:Zr,opera:Jr,ios:to,iphone:$r,iphoneX:co,ipad:Qr,android:eo,androidLegacy:ro,androidMobile:no,androidTablet:io,ios_ver:oo,ios_safari_ver:Rr,android_ver:so,mobile:uo,tablet:po,touch:Hr,desktop:Ur,retina:mo,pixelratio:Math.min(2,go),canVideoPlaysInline:!!(Ur||to&&Rr>=100),macPC:ho,clickEvent:Hr?"touchend":"click",jsScroll:_o,noJSScroll:!_o,isPC:window.innerWidth>=1080,isFullSpec:!(!Ur&&!co),LOCAL:"localhost"===location.hostname||"192.168"===location.hostname.substr(0,7),noBitmap:hr.indexOf("noBitmap")>=0,weakGPU:fo,noCanvas:!!(po||Wr||kr),local:location.hostname.includes("192.168.")||location.hostname.includes("localhost")};function yo(t,e){return e=ar.assignIn({pagePosition:!1,screenPosition:!1},e),t.touches&&t.touches[0]?e.pagePosition?{x:t.touches[0].pageX,y:t.touches[0].pageY}:e.screenPosition?{x:t.touches[0].screenX,y:t.touches[0].screenY}:{x:t.touches[0].clientX,y:t.touches[0].clientY}:{x:t.clientX,y:t.clientY}}var xo=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),bo=new(function(t){function e(){var e=t.call(this)||this;return e.e={load:"load",resize:"resize",resizeFirst:"resizeFirst",resizeAny:"resizeAny",directionChange:"directionChange",break:"break",scroll:"scroll",update:"update",mouseMove:"mouseMove",mouseDown:"mouseDown",mouseUp:"mouseUp",touchStart:"touchStart",touchEnd:"touchEnd",dragStart:"dragStart",dragMove:"dragMove",dragEnd:"dragEnd",focus:"focus",key:"key",keyUp:"keyUp"},e.direction={portrait:"portrait",landscape:"landscape"},e._isScrolling=!1,e._isLandscape=void 0,e._state={dragDiff:{dx:0,dy:0,ax:0,ay:0},modalOpened:!1,modalAnimating:!1,focusing:!0,mouse:{x:0,y:0},keyPressing:{}},e._viewScale=1,e._scrollTarget=document.scrollingElement||document.documentElement,e.$window=Mr(window),e.$html=Mr("html"),e.$body=Mr(document.body),e.$orientation=Mr('<div class="js_winu_orientation"></div>').appendTo(e.$body),e.$edge=Mr('<div class="js_winu_edge"></div>').appendTo(e.$body),e.$landscape=Mr('<div class="js_winu_landscape"></div>').appendTo(e.$body),e._$mq={pc:Mr('<div class="js_winu_mq -pc"></div>').appendTo(e.$body),tab:Mr('<div class="js_winu_mq -tab"></div>').appendTo(e.$body),sp:Mr('<div class="js_winu_mq -sp"></div>').appendTo(e.$body)},e._$fixed=Mr.find$(".js_winu_fixed"),e._$fixedInner=Mr.find$(".js_winu_fixedInner"),e._$fixedCenter=Mr.find$(".js_winu_fixedCenter"),e.$outer=Mr('<div class="js_winu_outer"></div>').appendTo(e.$body),e.$inner=Mr('<div class="js_winu_inner"></div>').appendTo(e.$body),e.$scrollChecker=Mr('<div class="js_winu_scrollChecker"></div>').appendTo(e.$body),e.$scrollCheckerInner=Mr('<div class="js_winu_scrollCheckerInner">bar</div>').appendTo(e.$scrollChecker),e._resizeHdl(!1),e}return xo(e,t),Object.defineProperty(e.prototype,"isPc",{get:function(){return"pc"===this._state.mq},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isLandscape",{get:function(){return this._isLandscape},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"viewScale",{get:function(){return this._viewScale},enumerable:!1,configurable:!0}),e.prototype.setup=function(){this._boundScrollEnd=this._scrollEnd.bind(this),setTimeout(this._loadHdl.bind(this),5e3),this.$window.on("load",this._loadHdl.bind(this),{passive:!0}).on("scroll",this._scrollHdl.bind(this),{passive:!0}).on("resize",this._resizeHdl.bind(this,!1),{passive:!0}).on("focus",this._focusHdl.bind(this,!1),{passive:!0}).on("blur",this._blurHdl.bind(this,!1),{passive:!0}),vo.desktop?this.$window.on("mousedown",this._mouseDownHdl.bind(this),{passive:!1}).on("mousemove",this._mouseMoveHdl.bind(this),{passive:!1}).on("mouseup",this._mouseUpHdl.bind(this),{passive:!1}).on("keydown",this._keyDownHdl.bind(this),{passive:!1}).on("keyup",this._keyUpHdl.bind(this),{passive:!1}):this.$window.on("touchstart",this._touchStartHdl.bind(this),{passive:!1}).on("touchmove",this._touchMoveHdl.bind(this),{passive:!1}).on("touchend",this._touchEndHdl.bind(this),{passive:!1}),this._calcScrollBarWidth(),this._offsetScrollbar(),this._scrollHdl(),this._resizeHdl(!1),mr.on(mr.e.update,this._updateHdl.bind(this)),this._updateHdl()},Object.defineProperty(e.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"bodyHeight",{get:function(){return this._bodyHeight},enumerable:!1,configurable:!0}),e.prototype.bind=function(t,e,n){return t?this.on(e,n):this.off(e,n)},e.prototype.on=function(e,n){return e===this.e.load&&this._state.loaded?(n(),this):t.prototype.on.call(this,e,n)},e.prototype.scrollTo=function(t,e){var n=this;void 0===e&&(e=0),this._tw&&this._tw.stop(),0!==e?(this._tw=this._tw||new vr,this._tw.it({start:this._state.scrollTop,end:t,duration:e,easing:"easeInOutQuart",onProgress:function(t){n._scrollTarget.scrollTop=n._state.scrollTop=t}})):this._scrollTarget.scrollTop=this._state.scrollTop=t},e.prototype.scrollToAutoDuration=function(t){var e=Math.abs(this._state.scrollTop-t),n=300+1500*Math.min(1,e/5e3);this.scrollTo(t,n)},e.prototype.switchModal=function(t,e,n){if(void 0===e&&(e=0),void 0===n&&(n=!1),clearTimeout(this._modalDelayId),0===e)return this._doSwitchModal(t,n);this._modalDelayId=setTimeout(this._doSwitchModal.bind(this,t,n),e)},e.prototype.triggerResize=function(){this._resizeHdl(!0)},e.prototype.isKeyPressing=function(t){return!!this._state.keyPressing[t]},e.prototype._calcScrollBarWidth=function(){this._state.scrollBarWidth=vo.touch?0:this.$scrollChecker.width()-this.$scrollCheckerInner.width(),document.documentElement.style.setProperty("--scroll-bar-width",this._state.scrollBarWidth+"px"),this.$scrollChecker.remove()},e.prototype._offsetScrollbar=function(){var t=this;this._state.scrollBarWidth&&(Mr.find$(".js_winu_rightOffset").forEach((function(e){e.css("margin-right",t._state.scrollBarWidth)})),Mr.find$(".js_winu_rightOffsetMinus").forEach((function(e){e.css("margin-right",-t._state.scrollBarWidth)})))},e.prototype._doSwitchModal=function(t,e){var n=this;void 0===e&&(e=!1),this._state.modalAnimating=!0,this._modalDelayId=setTimeout((function(){n._state.modalAnimating=!1,t&&vo.safari&&(n.$html.css("overflow","hidden").css("height","100%"),n.$body.css("overflow","hidden").css("height","100%"))}),200),this._state.modalOpened!==t&&(this._state.modalOpened=t,t?(this._state.scrollBarWidth&&this.$body.css("margin-right",this._state.scrollBarWidth),vo.touch?(this.$html.css("overflow","hidden").css("height","100%"),this.$body.css("overflow","hidden").css("height","100%")):this.$html.css("overflow-y","hidden"),this._memoriedScrollTop=this._state.scrollTop,this.$body.scrollTop(this._memoriedScrollTop),this._offsetFixedElements()):(this._state.scrollBarWidth&&this.$body.css("margin-right",""),this.$html.css("overflow","").css("overflow-y","").css("height",""),this.$body.css("overflow","").css("overflow-y","").css("height",""),this.$body.scrollTop(0),e||this.scrollTo(this._memoriedScrollTop),this._offsetFixedElements()))},e.prototype._offsetFixedElements=function(){var t=this;this._state.scrollBarWidth&&(this._$fixed.forEach((function(e){e.css("margin-right",t._state.modalOpened?t._state.scrollBarWidth:"")})),this._state.modalOpened?this._$fixedInner.forEach((function(e){e.css("margin-right",t._state.scrollBarWidth)})):setTimeout((function(){t._$fixedInner.forEach((function(t){t.css("margin-right","")}))}),500))},e.prototype._loadHdl=function(){this._state.loaded||(this._state.loaded=!0,this.emit(this.e.load),this._resizeHdl(!1),this._bindedCalcBodyHeight=this._calcBodyHeight.bind(this),setTimeout(this._bindedCalcBodyHeight,100))},e.prototype._scrollHdl=function(){var t=this;if(this._isScrolling||(this._isScrolling=!0,this.$html.addClass("html_scrolling")),clearTimeout(this._scrollEndId),this._scrollEndId=setTimeout(this._boundScrollEnd,200),!this._state.modalAnimating&&!this._state.modalOpened){var e=this._scrollTarget.scrollTop,n=this._scrollTarget.scrollLeft,i=(this._state.scrollTop,this._state.scrollLeft!==n);this._state.scrollTop=e,this._state.scrollLeft=n,i&&this._$fixed.forEach((function(e){e.transform({x:-t._state.scrollLeft})})),this.emit(this.e.scroll)}},e.prototype._scrollEnd=function(){this._isScrolling=!1,this.$html.removeClass("html_scrolling")},e.prototype._resizeHdl=function(t){this._viewScale=window.VIEW_SCALE;var e=this._state.width,n=this._state.height;this._state.width=this.$outer.width(),this._state.height=this.$outer.height();var i="block"===this.$landscape.css("display").toLowerCase()?this.direction.landscape:this.direction.portrait,r=i!==this._state.direction;(r||this._state.scrollTop<=0)&&(this._state.direction=i,vo.touch&&(this._state.innerWidth=void 0,this._state.innerHeight=void 0));var o=this.$inner.width(),s=Math.min(this.$inner.height(),window.innerHeight);if(vo.touch?(this._state.innerWidth=void 0===this._state.innerWidth?o:Math.min(this._state.innerWidth,o),this._state.innerHeight=void 0===this._state.innerHeight?s:Math.min(this._state.innerHeight,s)):(this._state.innerWidth=this.$inner.width(),this._state.innerHeight=this.$inner.height()),this._state.fullWidth=vo.touch?this._state.width:this._state.innerWidth,this._state.fullHeight=this._state.height,vo.touch){var a=s>this._state.innerHeight;this.$html.toggleClass("html_spFull",a)}var l=ar.findKey(this._$mq,(function(t){return"block"===t.css("display").toLowerCase()}));this._state.mq!==l&&(this._state.mq=l,this.emit(this.e.break));var c="block"===this.$orientation.css("display").toLowerCase();if(void 0!==this._isLandscape&&this._isLandscape!==c)if(function(){if(window.IS_FORCED_FULLSCREEN)return!0;var t=document;return void 0!==t.fullscreenElement&&null!==t.fullscreenElement||void 0!==t.mozFullScreenElement&&null!==t.mozFullScreenElement||void 0!==t.webkitFullscreenElement&&null!==t.webkitFullscreenElement||void 0!==t.webkitCurrentFullScreenElement&&null!==t.webkitCurrentFullScreenElement||void 0!==t.msFullscreenElement&&null!==t.msFullscreenElement}())c=this._isLandscape;else{try{window.sessionStorage.setItem("reload-by-orientationchange","yes")}catch(t){console.error(t)}location.href=location.href}this._isLandscape=c,this._state.scrollTop=this._scrollTarget.scrollTop,this._state.scrollLeft=this._scrollTarget.scrollLeft,this.emit(this.e.resizeAny),(t||e!==this._state.width||n!==this._state.height)&&(this.emit(this.e.resizeFirst),this.emit(this.e.resize),r&&this.emit(this.e.directionChange))},e.prototype._calcBodyHeight=function(){var t=document.body.scrollHeight;if(this._bodyHeight!==t&&!this._state.modalOpened){var e=this._bodyHeight;this._bodyHeight=t,void 0!==e&&this._resizeHdl(!0)}if(vo.touch){var n=Math.min(this.$inner.height(),window.innerHeight);this._state.innerHeight!==n&&this._resizeHdl(!0)}setTimeout(this._bindedCalcBodyHeight,1e3)},e.prototype._updateHdl=function(){this._state.dragDiff.ax*=.5,this._state.dragDiff.ay*=.5,this.emit(this.e.update)},e.prototype._mouseDownHdl=function(t){this._state.pressing||(this._state.pressing=!0,this._dragStart(t),this.emit(this.e.mouseDown))},e.prototype._mouseMoveHdl=function(t){this._state.cursorPoint=yo(t),this.emit(this.e.mouseMove,t),this._state.mouse.x+=.05*(this._state.cursorPoint.x/this._state.width*2-1-this._state.mouse.x),this._state.mouse.y+=.05*(-1*(this._state.cursorPoint.y/this._state.height*2-1)-this._state.mouse.y),this._state.pressing&&(this._dragMove(t),this.emit(this.e.mouseUp))},e.prototype._mouseUpHdl=function(t){this._state.pressing&&(this._state.pressing=!1,this._dragEnd(t))},e.prototype._touchStartHdl=function(t){this._state.touching||(this._state.touching=!0,this._state.touchPoint=yo(t),this.emit(this.e.touchStart,t),this._dragStart(t))},e.prototype._touchMoveHdl=function(t){this._state.touchPoint=yo(t),this._dragMove(t)},e.prototype._touchEndHdl=function(t){this._state.touching&&(this._state.touching=!1,this.emit(this.e.touchEnd,t),this._dragEnd(t))},e.prototype._dragStart=function(t){this._state.dragStartPoint=yo(t),this._state.dragDiff={dx:0,dy:0,ax:0,ay:0,dirX:0,dirY:0,startTime:mr.state.currentTime},this._state.dragging||(this._state.dragging=!0,this.emit(this.e.dragStart,t))},e.prototype._dragMove=function(t){var e,n,i=(e=yo(t),n=this._state.dragStartPoint,{x:e.x-n.x,y:e.y-n.y,z:void 0===e.z?void 0:e.z-n.z});this._state.dragDiff.ax+=i.x-this._state.dragDiff.dx,this._state.dragDiff.ay+=i.y-this._state.dragDiff.dy,this._state.dragDiff.dx=i.x,this._state.dragDiff.dy=i.y,this.emit(this.e.dragMove,t)},e.prototype._dragEnd=function(t){this._state.dragging&&(this._state.dragDiff.elapsedTime=mr.state.currentTime-this._state.dragDiff.startTime,Math.abs(this._state.dragDiff.dx)>30&&(this._state.dragDiff.dx<0&&this._state.dragDiff.ax<0?this._state.dragDiff.dirX=-1:this._state.dragDiff.dx>0&&this._state.dragDiff.ax>0&&(this._state.dragDiff.dirX=1)),Math.abs(this._state.dragDiff.dy)>30&&(this._state.dragDiff.dy<0&&this._state.dragDiff.ay<0?this._state.dragDiff.dirY=-1:this._state.dragDiff.dy>0&&this._state.dragDiff.ay>0&&(this._state.dragDiff.dirY=1)),this._state.dragging=!1,this.emit(this.e.dragEnd,t))},e.prototype._focusHdl=function(){this._state.focusing=!0,this.emit(this.e.focus)},e.prototype._blurHdl=function(){this._state.focusing=!1,this._state.keyPressing={},this.emit(this.e.focus)},e.prototype._keyDownHdl=function(t){this._state.keyPressing[t.keyCode]=!0,this.emit(this.e.key)},e.prototype._keyUpHdl=function(t){delete this._state.keyPressing[t.keyCode],this.emit(this.e.key),this.emit(this.e.keyUp,t)},e}(lr)),wo=function(){return"loading"!=document.readyState?Promise.resolve():new Promise((function(t,e){document.addEventListener("DOMContentLoaded",t)}))};const Mo=100,So=301,To=302,Eo=306,Ao=1e3,Co=1001,Ro=1002,Lo=1003,Po=1006,Io=1008,Do=1009,Oo=1012,No=1014,zo=1015,Bo=1016,Fo=1020,Ho=1023,Uo=1026,ko=1027,Go=33776,Wo=33777,Vo=33778,jo=33779,qo=2300,Yo=2301,Xo=2302,Zo=2400,Jo=2401,$o=2402,Ko=3e3,Qo=3001,ts=7680,es=35044,ns=35048,is="300 es",rs=1035;class os{addEventListener(t,e){void 0===this._listeners&&(this._listeners={});const n=this._listeners;void 0===n[t]&&(n[t]=[]),-1===n[t].indexOf(e)&&n[t].push(e)}hasEventListener(t,e){if(void 0===this._listeners)return!1;const n=this._listeners;return void 0!==n[t]&&-1!==n[t].indexOf(e)}removeEventListener(t,e){if(void 0===this._listeners)return;const n=this._listeners[t];if(void 0!==n){const t=n.indexOf(e);-1!==t&&n.splice(t,1)}}dispatchEvent(t){if(void 0===this._listeners)return;const e=this._listeners[t.type];if(void 0!==e){t.target=this;const n=e.slice(0);for(let e=0,i=n.length;e<i;e++)n[e].call(this,t);t.target=null}}}const ss=[];for(let t=0;t<256;t++)ss[t]=(t<16?"0":"")+t.toString(16);const as=Math.PI/180,ls=180/Math.PI;function cs(){const t=4294967295*Math.random()|0,e=4294967295*Math.random()|0,n=4294967295*Math.random()|0,i=4294967295*Math.random()|0;return(ss[255&t]+ss[t>>8&255]+ss[t>>16&255]+ss[t>>24&255]+"-"+ss[255&e]+ss[e>>8&255]+"-"+ss[e>>16&15|64]+ss[e>>24&255]+"-"+ss[63&n|128]+ss[n>>8&255]+"-"+ss[n>>16&255]+ss[n>>24&255]+ss[255&i]+ss[i>>8&255]+ss[i>>16&255]+ss[i>>24&255]).toUpperCase()}function hs(t,e,n){return Math.max(e,Math.min(n,t))}function us(t,e,n){return(1-n)*t+n*e}function ds(t){return 0==(t&t-1)&&0!==t}function ps(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}class fs{constructor(t=0,e=0){this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t,e){return void 0!==e?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this)}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t,e){return void 0!==e?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this)}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){const e=this.x,n=this.y,i=t.elements;return this.x=i[0]*e+i[3]*n+i[6],this.y=i[1]*e+i[4]*n+i[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,n=this.y-t.y;return e*e+n*n}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e,n){return void 0!==n&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){const n=Math.cos(e),i=Math.sin(e),r=this.x-t.x,o=this.y-t.y;return this.x=r*n-o*i+t.x,this.y=r*i+o*n+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}fs.prototype.isVector2=!0;class ms{constructor(){this.elements=[1,0,0,0,1,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}set(t,e,n,i,r,o,s,a,l){const c=this.elements;return c[0]=t,c[1]=i,c[2]=s,c[3]=e,c[4]=r,c[5]=a,c[6]=n,c[7]=o,c[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],this}extractBasis(t,e,n){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(t){const e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const n=t.elements,i=e.elements,r=this.elements,o=n[0],s=n[3],a=n[6],l=n[1],c=n[4],h=n[7],u=n[2],d=n[5],p=n[8],f=i[0],m=i[3],g=i[6],_=i[1],v=i[4],y=i[7],x=i[2],b=i[5],w=i[8];return r[0]=o*f+s*_+a*x,r[3]=o*m+s*v+a*b,r[6]=o*g+s*y+a*w,r[1]=l*f+c*_+h*x,r[4]=l*m+c*v+h*b,r[7]=l*g+c*y+h*w,r[2]=u*f+d*_+p*x,r[5]=u*m+d*v+p*b,r[8]=u*g+d*y+p*w,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){const t=this.elements,e=t[0],n=t[1],i=t[2],r=t[3],o=t[4],s=t[5],a=t[6],l=t[7],c=t[8];return e*o*c-e*s*l-n*r*c+n*s*a+i*r*l-i*o*a}invert(){const t=this.elements,e=t[0],n=t[1],i=t[2],r=t[3],o=t[4],s=t[5],a=t[6],l=t[7],c=t[8],h=c*o-s*l,u=s*a-c*r,d=l*r-o*a,p=e*h+n*u+i*d;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);const f=1/p;return t[0]=h*f,t[1]=(i*l-c*n)*f,t[2]=(s*n-i*o)*f,t[3]=u*f,t[4]=(c*e-i*a)*f,t[5]=(i*r-s*e)*f,t[6]=d*f,t[7]=(n*a-l*e)*f,t[8]=(o*e-n*r)*f,this}transpose(){let t;const e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){const e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}setUvTransform(t,e,n,i,r,o,s){const a=Math.cos(r),l=Math.sin(r);return this.set(n*a,n*l,-n*(a*o+l*s)+o+t,-i*l,i*a,-i*(-l*o+a*s)+s+e,0,0,1),this}scale(t,e){const n=this.elements;return n[0]*=t,n[3]*=t,n[6]*=t,n[1]*=e,n[4]*=e,n[7]*=e,this}rotate(t){const e=Math.cos(t),n=Math.sin(t),i=this.elements,r=i[0],o=i[3],s=i[6],a=i[1],l=i[4],c=i[7];return i[0]=e*r+n*a,i[3]=e*o+n*l,i[6]=e*s+n*c,i[1]=-n*r+e*a,i[4]=-n*o+e*l,i[7]=-n*s+e*c,this}translate(t,e){const n=this.elements;return n[0]+=t*n[2],n[3]+=t*n[5],n[6]+=t*n[8],n[1]+=e*n[2],n[4]+=e*n[5],n[7]+=e*n[8],this}equals(t){const e=this.elements,n=t.elements;for(let t=0;t<9;t++)if(e[t]!==n[t])return!1;return!0}fromArray(t,e=0){for(let n=0;n<9;n++)this.elements[n]=t[n+e];return this}toArray(t=[],e=0){const n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t}clone(){return(new this.constructor).fromArray(this.elements)}}function gs(t){for(let e=t.length-1;e>=0;--e)if(t[e]>65535)return!0;return!1}function _s(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}ms.prototype.isMatrix3=!0,Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array;const vs={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},ys={h:0,s:0,l:0},xs={h:0,s:0,l:0};function bs(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+6*(e-t)*(2/3-n):t}function ws(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function Ms(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}class Ss{constructor(t,e,n){return void 0===e&&void 0===n?this.set(t):this.setRGB(t,e,n)}set(t){return t&&t.isColor?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t),this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,this}setRGB(t,e,n){return this.r=t,this.g=e,this.b=n,this}setHSL(t,e,n){if(t=(t%(i=1)+i)%i,e=hs(e,0,1),n=hs(n,0,1),0===e)this.r=this.g=this.b=n;else{const i=n<=.5?n*(1+e):n+e-n*e,r=2*n-i;this.r=bs(r,i,t+1/3),this.g=bs(r,i,t),this.b=bs(r,i,t-1/3)}var i;return this}setStyle(t){function e(e){void 0!==e&&parseFloat(e)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}let n;if(n=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(t)){let t;const i=n[1],r=n[2];switch(i){case"rgb":case"rgba":if(t=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(r))return this.r=Math.min(255,parseInt(t[1],10))/255,this.g=Math.min(255,parseInt(t[2],10))/255,this.b=Math.min(255,parseInt(t[3],10))/255,e(t[4]),this;if(t=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(r))return this.r=Math.min(100,parseInt(t[1],10))/100,this.g=Math.min(100,parseInt(t[2],10))/100,this.b=Math.min(100,parseInt(t[3],10))/100,e(t[4]),this;break;case"hsl":case"hsla":if(t=/^\s*(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(r)){const n=parseFloat(t[1])/360,i=parseInt(t[2],10)/100,r=parseInt(t[3],10)/100;return e(t[4]),this.setHSL(n,i,r)}}}else if(n=/^\#([A-Fa-f\d]+)$/.exec(t)){const t=n[1],e=t.length;if(3===e)return this.r=parseInt(t.charAt(0)+t.charAt(0),16)/255,this.g=parseInt(t.charAt(1)+t.charAt(1),16)/255,this.b=parseInt(t.charAt(2)+t.charAt(2),16)/255,this;if(6===e)return this.r=parseInt(t.charAt(0)+t.charAt(1),16)/255,this.g=parseInt(t.charAt(2)+t.charAt(3),16)/255,this.b=parseInt(t.charAt(4)+t.charAt(5),16)/255,this}return t&&t.length>0?this.setColorName(t):this}setColorName(t){const e=vs[t.toLowerCase()];return void 0!==e?this.setHex(e):console.warn("THREE.Color: Unknown color "+t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}copySRGBToLinear(t){return this.r=ws(t.r),this.g=ws(t.g),this.b=ws(t.b),this}copyLinearToSRGB(t){return this.r=Ms(t.r),this.g=Ms(t.g),this.b=Ms(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0}getHexString(){return("000000"+this.getHex().toString(16)).slice(-6)}getHSL(t){const e=this.r,n=this.g,i=this.b,r=Math.max(e,n,i),o=Math.min(e,n,i);let s,a;const l=(o+r)/2;if(o===r)s=0,a=0;else{const t=r-o;switch(a=l<=.5?t/(r+o):t/(2-r-o),r){case e:s=(n-i)/t+(n<i?6:0);break;case n:s=(i-e)/t+2;break;case i:s=(e-n)/t+4}s/=6}return t.h=s,t.s=a,t.l=l,t}getStyle(){return"rgb("+(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"}offsetHSL(t,e,n){return this.getHSL(ys),ys.h+=t,ys.s+=e,ys.l+=n,this.setHSL(ys.h,ys.s,ys.l),this}add(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this}addColors(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this}addScalar(t){return this.r+=t,this.g+=t,this.b+=t,this}sub(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this}multiply(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this}multiplyScalar(t){return this.r*=t,this.g*=t,this.b*=t,this}lerp(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this}lerpColors(t,e,n){return this.r=t.r+(e.r-t.r)*n,this.g=t.g+(e.g-t.g)*n,this.b=t.b+(e.b-t.b)*n,this}lerpHSL(t,e){this.getHSL(ys),t.getHSL(xs);const n=us(ys.h,xs.h,e),i=us(ys.s,xs.s,e),r=us(ys.l,xs.l,e);return this.setHSL(n,i,r),this}equals(t){return t.r===this.r&&t.g===this.g&&t.b===this.b}fromArray(t,e=0){return this.r=t[e],this.g=t[e+1],this.b=t[e+2],this}toArray(t=[],e=0){return t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t}fromBufferAttribute(t,e){return this.r=t.getX(e),this.g=t.getY(e),this.b=t.getZ(e),!0===t.normalized&&(this.r/=255,this.g/=255,this.b/=255),this}toJSON(){return this.getHex()}}let Ts;Ss.NAMES=vs,Ss.prototype.isColor=!0,Ss.prototype.r=1,Ss.prototype.g=1,Ss.prototype.b=1;class Es{static getDataURL(t){if(/^data:/i.test(t.src))return t.src;if("undefined"==typeof HTMLCanvasElement)return t.src;let e;if(t instanceof HTMLCanvasElement)e=t;else{void 0===Ts&&(Ts=_s("canvas")),Ts.width=t.width,Ts.height=t.height;const n=Ts.getContext("2d");t instanceof ImageData?n.putImageData(t,0,0):n.drawImage(t,0,0,t.width,t.height),e=Ts}return e.width>2048||e.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",t),e.toDataURL("image/jpeg",.6)):e.toDataURL("image/png")}static sRGBToLinear(t){if("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap){const e=_s("canvas");e.width=t.width,e.height=t.height;const n=e.getContext("2d");n.drawImage(t,0,0,t.width,t.height);const i=n.getImageData(0,0,t.width,t.height),r=i.data;for(let t=0;t<r.length;t++)r[t]=255*ws(r[t]/255);return n.putImageData(i,0,0),e}if(t.data){const e=t.data.slice(0);for(let t=0;t<e.length;t++)e instanceof Uint8Array||e instanceof Uint8ClampedArray?e[t]=Math.floor(255*ws(e[t]/255)):e[t]=ws(e[t]);return{data:e,width:t.width,height:t.height}}return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),t}}class As{constructor(t=null){this.uuid=cs(),this.data=t,this.version=0}set needsUpdate(t){!0===t&&this.version++}toJSON(t){const e=void 0===t||"string"==typeof t;if(!e&&void 0!==t.images[this.uuid])return t.images[this.uuid];const n={uuid:this.uuid,url:""},i=this.data;if(null!==i){let t;if(Array.isArray(i)){t=[];for(let e=0,n=i.length;e<n;e++)i[e].isDataTexture?t.push(Cs(i[e].image)):t.push(Cs(i[e]))}else t=Cs(i);n.url=t}return e||(t.images[this.uuid]=n),n}}function Cs(t){return"undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap?Es.getDataURL(t):t.data?{data:Array.prototype.slice.call(t.data),width:t.width,height:t.height,type:t.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}As.prototype.isSource=!0;let Rs=0;class Ls extends os{constructor(t=Ls.DEFAULT_IMAGE,e=Ls.DEFAULT_MAPPING,n=1001,i=1001,r=1006,o=1008,s=1023,a=1009,l=1,c=3e3){super(),Object.defineProperty(this,"id",{value:Rs++}),this.uuid=cs(),this.name="",this.source=new As(t),this.mipmaps=[],this.mapping=e,this.wrapS=n,this.wrapT=i,this.magFilter=r,this.minFilter=o,this.anisotropy=l,this.format=s,this.internalFormat=null,this.type=a,this.offset=new fs(0,0),this.repeat=new fs(1,1),this.center=new fs(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new ms,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=c,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.needsPMREMUpdate=!1}get image(){return this.source.data}set image(t){this.source.data=t}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return(new this.constructor).copy(this)}copy(t){return this.name=t.name,this.source=t.source,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.encoding=t.encoding,this.userData=JSON.parse(JSON.stringify(t.userData)),this.needsUpdate=!0,this}toJSON(t){const e=void 0===t||"string"==typeof t;if(!e&&void 0!==t.textures[this.uuid])return t.textures[this.uuid];const n={metadata:{version:4.5,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(t).uuid,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};return"{}"!==JSON.stringify(this.userData)&&(n.userData=this.userData),e||(t.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(300!==this.mapping)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case Ao:t.x=t.x-Math.floor(t.x);break;case Co:t.x=t.x<0?0:1;break;case Ro:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x)}if(t.y<0||t.y>1)switch(this.wrapT){case Ao:t.y=t.y-Math.floor(t.y);break;case Co:t.y=t.y<0?0:1;break;case Ro:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y)}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){!0===t&&(this.version++,this.source.needsUpdate=!0)}}Ls.DEFAULT_IMAGE=null,Ls.DEFAULT_MAPPING=300,Ls.prototype.isTexture=!0;class Ps{constructor(t=0,e=0,n=0,i=1){this.x=t,this.y=e,this.z=n,this.w=i}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,e,n,i){return this.x=t,this.y=e,this.z=n,this.w=i,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this}add(t,e){return void 0!==e?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this)}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this}sub(t,e){return void 0!==e?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this)}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){const e=this.x,n=this.y,i=this.z,r=this.w,o=t.elements;return this.x=o[0]*e+o[4]*n+o[8]*i+o[12]*r,this.y=o[1]*e+o[5]*n+o[9]*i+o[13]*r,this.z=o[2]*e+o[6]*n+o[10]*i+o[14]*r,this.w=o[3]*e+o[7]*n+o[11]*i+o[15]*r,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);const e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this}setAxisAngleFromRotationMatrix(t){let e,n,i,r;const o=.01,s=.1,a=t.elements,l=a[0],c=a[4],h=a[8],u=a[1],d=a[5],p=a[9],f=a[2],m=a[6],g=a[10];if(Math.abs(c-u)<o&&Math.abs(h-f)<o&&Math.abs(p-m)<o){if(Math.abs(c+u)<s&&Math.abs(h+f)<s&&Math.abs(p+m)<s&&Math.abs(l+d+g-3)<s)return this.set(1,0,0,0),this;e=Math.PI;const t=(l+1)/2,a=(d+1)/2,_=(g+1)/2,v=(c+u)/4,y=(h+f)/4,x=(p+m)/4;return t>a&&t>_?t<o?(n=0,i=.707106781,r=.707106781):(n=Math.sqrt(t),i=v/n,r=y/n):a>_?a<o?(n=.707106781,i=0,r=.707106781):(i=Math.sqrt(a),n=v/i,r=x/i):_<o?(n=.707106781,i=.707106781,r=0):(r=Math.sqrt(_),n=y/r,i=x/r),this.set(n,i,r,e),this}let _=Math.sqrt((m-p)*(m-p)+(h-f)*(h-f)+(u-c)*(u-c));return Math.abs(_)<.001&&(_=1),this.x=(m-p)/_,this.y=(h-f)/_,this.z=(u-c)/_,this.w=Math.acos((l+d+g-1)/2),this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this.w=Math.max(t.w,Math.min(e.w,this.w)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this.w=Math.max(t,Math.min(e,this.w)),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this.w=t.w+(e.w-t.w)*n,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t}fromBufferAttribute(t,e,n){return void 0!==n&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}Ps.prototype.isVector4=!0;class Is extends os{constructor(t,e,n={}){super(),this.width=t,this.height=e,this.depth=1,this.scissor=new Ps(0,0,t,e),this.scissorTest=!1,this.viewport=new Ps(0,0,t,e);const i={width:t,height:e,depth:1};this.texture=new Ls(i,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.encoding),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=void 0!==n.generateMipmaps&&n.generateMipmaps,this.texture.internalFormat=void 0!==n.internalFormat?n.internalFormat:null,this.texture.minFilter=void 0!==n.minFilter?n.minFilter:Po,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,this.samples=void 0!==n.samples?n.samples:0}setSize(t,e,n=1){this.width===t&&this.height===e&&this.depth===n||(this.width=t,this.height=e,this.depth=n,this.texture.image.width=t,this.texture.image.height=e,this.texture.image.depth=n,this.dispose()),this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)}clone(){return(new this.constructor).copy(this)}copy(t){return this.width=t.width,this.height=t.height,this.depth=t.depth,this.viewport.copy(t.viewport),this.texture=t.texture.clone(),this.texture.image=Object.assign({},t.texture.image),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,null!==t.depthTexture&&(this.depthTexture=t.depthTexture.clone()),this.samples=t.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}Is.prototype.isWebGLRenderTarget=!0;class Ds extends Ls{constructor(t=null,e=1,n=1,i=1){super(null),this.image={data:t,width:e,height:n,depth:i},this.magFilter=Lo,this.minFilter=Lo,this.wrapR=Co,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}Ds.prototype.isDataArrayTexture=!0,class extends Is{constructor(t,e,n){super(t,e),this.depth=n,this.texture=new Ds(null,t,e,n),this.texture.isRenderTargetTexture=!0}}.prototype.isWebGLArrayRenderTarget=!0;class Os extends Ls{constructor(t=null,e=1,n=1,i=1){super(null),this.image={data:t,width:e,height:n,depth:i},this.magFilter=Lo,this.minFilter=Lo,this.wrapR=Co,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}Os.prototype.isData3DTexture=!0,class extends Is{constructor(t,e,n){super(t,e),this.depth=n,this.texture=new Os(null,t,e,n),this.texture.isRenderTargetTexture=!0}}.prototype.isWebGL3DRenderTarget=!0,class extends Is{constructor(t,e,n,i={}){super(t,e,i);const r=this.texture;this.texture=[];for(let t=0;t<n;t++)this.texture[t]=r.clone(),this.texture[t].isRenderTargetTexture=!0}setSize(t,e,n=1){if(this.width!==t||this.height!==e||this.depth!==n){this.width=t,this.height=e,this.depth=n;for(let i=0,r=this.texture.length;i<r;i++)this.texture[i].image.width=t,this.texture[i].image.height=e,this.texture[i].image.depth=n;this.dispose()}return this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e),this}copy(t){this.dispose(),this.width=t.width,this.height=t.height,this.depth=t.depth,this.viewport.set(0,0,this.width,this.height),this.scissor.set(0,0,this.width,this.height),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.depthTexture=t.depthTexture,this.texture.length=0;for(let e=0,n=t.texture.length;e<n;e++)this.texture[e]=t.texture[e].clone();return this}}.prototype.isWebGLMultipleRenderTargets=!0;class Ns{constructor(t=0,e=0,n=0,i=1){this._x=t,this._y=e,this._z=n,this._w=i}static slerp(t,e,n,i){return console.warn("THREE.Quaternion: Static .slerp() has been deprecated. Use qm.slerpQuaternions( qa, qb, t ) instead."),n.slerpQuaternions(t,e,i)}static slerpFlat(t,e,n,i,r,o,s){let a=n[i+0],l=n[i+1],c=n[i+2],h=n[i+3];const u=r[o+0],d=r[o+1],p=r[o+2],f=r[o+3];if(0===s)return t[e+0]=a,t[e+1]=l,t[e+2]=c,void(t[e+3]=h);if(1===s)return t[e+0]=u,t[e+1]=d,t[e+2]=p,void(t[e+3]=f);if(h!==f||a!==u||l!==d||c!==p){let t=1-s;const e=a*u+l*d+c*p+h*f,n=e>=0?1:-1,i=1-e*e;if(i>Number.EPSILON){const r=Math.sqrt(i),o=Math.atan2(r,e*n);t=Math.sin(t*o)/r,s=Math.sin(s*o)/r}const r=s*n;if(a=a*t+u*r,l=l*t+d*r,c=c*t+p*r,h=h*t+f*r,t===1-s){const t=1/Math.sqrt(a*a+l*l+c*c+h*h);a*=t,l*=t,c*=t,h*=t}}t[e]=a,t[e+1]=l,t[e+2]=c,t[e+3]=h}static multiplyQuaternionsFlat(t,e,n,i,r,o){const s=n[i],a=n[i+1],l=n[i+2],c=n[i+3],h=r[o],u=r[o+1],d=r[o+2],p=r[o+3];return t[e]=s*p+c*h+a*d-l*u,t[e+1]=a*p+c*u+l*h-s*d,t[e+2]=l*p+c*d+s*u-a*h,t[e+3]=c*p-s*h-a*u-l*d,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,n,i){return this._x=t,this._y=e,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e){if(!t||!t.isEuler)throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");const n=t._x,i=t._y,r=t._z,o=t._order,s=Math.cos,a=Math.sin,l=s(n/2),c=s(i/2),h=s(r/2),u=a(n/2),d=a(i/2),p=a(r/2);switch(o){case"XYZ":this._x=u*c*h+l*d*p,this._y=l*d*h-u*c*p,this._z=l*c*p+u*d*h,this._w=l*c*h-u*d*p;break;case"YXZ":this._x=u*c*h+l*d*p,this._y=l*d*h-u*c*p,this._z=l*c*p-u*d*h,this._w=l*c*h+u*d*p;break;case"ZXY":this._x=u*c*h-l*d*p,this._y=l*d*h+u*c*p,this._z=l*c*p+u*d*h,this._w=l*c*h-u*d*p;break;case"ZYX":this._x=u*c*h-l*d*p,this._y=l*d*h+u*c*p,this._z=l*c*p-u*d*h,this._w=l*c*h+u*d*p;break;case"YZX":this._x=u*c*h+l*d*p,this._y=l*d*h+u*c*p,this._z=l*c*p-u*d*h,this._w=l*c*h-u*d*p;break;case"XZY":this._x=u*c*h-l*d*p,this._y=l*d*h-u*c*p,this._z=l*c*p+u*d*h,this._w=l*c*h+u*d*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return!1!==e&&this._onChangeCallback(),this}setFromAxisAngle(t,e){const n=e/2,i=Math.sin(n);return this._x=t.x*i,this._y=t.y*i,this._z=t.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(t){const e=t.elements,n=e[0],i=e[4],r=e[8],o=e[1],s=e[5],a=e[9],l=e[2],c=e[6],h=e[10],u=n+s+h;if(u>0){const t=.5/Math.sqrt(u+1);this._w=.25/t,this._x=(c-a)*t,this._y=(r-l)*t,this._z=(o-i)*t}else if(n>s&&n>h){const t=2*Math.sqrt(1+n-s-h);this._w=(c-a)/t,this._x=.25*t,this._y=(i+o)/t,this._z=(r+l)/t}else if(s>h){const t=2*Math.sqrt(1+s-n-h);this._w=(r-l)/t,this._x=(i+o)/t,this._y=.25*t,this._z=(a+c)/t}else{const t=2*Math.sqrt(1+h-n-s);this._w=(o-i)/t,this._x=(r+l)/t,this._y=(a+c)/t,this._z=.25*t}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let n=t.dot(e)+1;return n<Number.EPSILON?(n=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=n):(this._x=0,this._y=-t.z,this._z=t.y,this._w=n)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=n),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(hs(this.dot(t),-1,1)))}rotateTowards(t,e){const n=this.angleTo(t);if(0===n)return this;const i=Math.min(1,e/n);return this.slerp(t,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t,e){return void 0!==e?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(t,e)):this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){const n=t._x,i=t._y,r=t._z,o=t._w,s=e._x,a=e._y,l=e._z,c=e._w;return this._x=n*c+o*s+i*l-r*a,this._y=i*c+o*a+r*s-n*l,this._z=r*c+o*l+n*a-i*s,this._w=o*c-n*s-i*a-r*l,this._onChangeCallback(),this}slerp(t,e){if(0===e)return this;if(1===e)return this.copy(t);const n=this._x,i=this._y,r=this._z,o=this._w;let s=o*t._w+n*t._x+i*t._y+r*t._z;if(s<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,s=-s):this.copy(t),s>=1)return this._w=o,this._x=n,this._y=i,this._z=r,this;const a=1-s*s;if(a<=Number.EPSILON){const t=1-e;return this._w=t*o+e*this._w,this._x=t*n+e*this._x,this._y=t*i+e*this._y,this._z=t*r+e*this._z,this.normalize(),this._onChangeCallback(),this}const l=Math.sqrt(a),c=Math.atan2(l,s),h=Math.sin((1-e)*c)/l,u=Math.sin(e*c)/l;return this._w=o*h+this._w*u,this._x=n*h+this._x*u,this._y=i*h+this._y*u,this._z=r*h+this._z*u,this._onChangeCallback(),this}slerpQuaternions(t,e,n){return this.copy(t).slerp(e,n)}random(){const t=Math.random(),e=Math.sqrt(1-t),n=Math.sqrt(t),i=2*Math.PI*Math.random(),r=2*Math.PI*Math.random();return this.set(e*Math.cos(i),n*Math.sin(r),n*Math.cos(r),e*Math.sin(i))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}}Ns.prototype.isQuaternion=!0;class zs{constructor(t=0,e=0,n=0){this.x=t,this.y=e,this.z=n}set(t,e,n){return void 0===n&&(n=this.z),this.x=t,this.y=e,this.z=n,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t,e){return void 0!==e?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this)}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t,e){return void 0!==e?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this)}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t,e){return void 0!==e?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(t,e)):(this.x*=t.x,this.y*=t.y,this.z*=t.z,this)}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return t&&t.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(Fs.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(Fs.setFromAxisAngle(t,e))}applyMatrix3(t){const e=this.x,n=this.y,i=this.z,r=t.elements;return this.x=r[0]*e+r[3]*n+r[6]*i,this.y=r[1]*e+r[4]*n+r[7]*i,this.z=r[2]*e+r[5]*n+r[8]*i,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){const e=this.x,n=this.y,i=this.z,r=t.elements,o=1/(r[3]*e+r[7]*n+r[11]*i+r[15]);return this.x=(r[0]*e+r[4]*n+r[8]*i+r[12])*o,this.y=(r[1]*e+r[5]*n+r[9]*i+r[13])*o,this.z=(r[2]*e+r[6]*n+r[10]*i+r[14])*o,this}applyQuaternion(t){const e=this.x,n=this.y,i=this.z,r=t.x,o=t.y,s=t.z,a=t.w,l=a*e+o*i-s*n,c=a*n+s*e-r*i,h=a*i+r*n-o*e,u=-r*e-o*n-s*i;return this.x=l*a+u*-r+c*-s-h*-o,this.y=c*a+u*-o+h*-r-l*-s,this.z=h*a+u*-s+l*-o-c*-r,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){const e=this.x,n=this.y,i=this.z,r=t.elements;return this.x=r[0]*e+r[4]*n+r[8]*i,this.y=r[1]*e+r[5]*n+r[9]*i,this.z=r[2]*e+r[6]*n+r[10]*i,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this}cross(t,e){return void 0!==e?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(t,e)):this.crossVectors(this,t)}crossVectors(t,e){const n=t.x,i=t.y,r=t.z,o=e.x,s=e.y,a=e.z;return this.x=i*a-r*s,this.y=r*o-n*a,this.z=n*s-i*o,this}projectOnVector(t){const e=t.lengthSq();if(0===e)return this.set(0,0,0);const n=t.dot(this)/e;return this.copy(t).multiplyScalar(n)}projectOnPlane(t){return Bs.copy(this).projectOnVector(t),this.sub(Bs)}reflect(t){return this.sub(Bs.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===e)return Math.PI/2;const n=this.dot(t)/e;return Math.acos(hs(n,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,n=this.y-t.y,i=this.z-t.z;return e*e+n*n+i*i}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,n){const i=Math.sin(e)*t;return this.x=i*Math.sin(n),this.y=Math.cos(e)*t,this.z=i*Math.cos(n),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,n){return this.x=t*Math.sin(e),this.y=n,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){const e=this.setFromMatrixColumn(t,0).length(),n=this.setFromMatrixColumn(t,1).length(),i=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=n,this.z=i,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,4*e)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,3*e)}setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e,n){return void 0!==n&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const t=2*(Math.random()-.5),e=Math.random()*Math.PI*2,n=Math.sqrt(1-t**2);return this.x=n*Math.cos(e),this.y=n*Math.sin(e),this.z=t,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}zs.prototype.isVector3=!0;const Bs=new zs,Fs=new Ns;class Hs{constructor(t=new zs(1/0,1/0,1/0),e=new zs(-1/0,-1/0,-1/0)){this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){let e=1/0,n=1/0,i=1/0,r=-1/0,o=-1/0,s=-1/0;for(let a=0,l=t.length;a<l;a+=3){const l=t[a],c=t[a+1],h=t[a+2];l<e&&(e=l),c<n&&(n=c),h<i&&(i=h),l>r&&(r=l),c>o&&(o=c),h>s&&(s=h)}return this.min.set(e,n,i),this.max.set(r,o,s),this}setFromBufferAttribute(t){let e=1/0,n=1/0,i=1/0,r=-1/0,o=-1/0,s=-1/0;for(let a=0,l=t.count;a<l;a++){const l=t.getX(a),c=t.getY(a),h=t.getZ(a);l<e&&(e=l),c<n&&(n=c),h<i&&(i=h),l>r&&(r=l),c>o&&(o=c),h>s&&(s=h)}return this.min.set(e,n,i),this.max.set(r,o,s),this}setFromPoints(t){this.makeEmpty();for(let e=0,n=t.length;e<n;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){const n=ks.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(n),this.max.copy(t).add(n),this}setFromObject(t,e=!1){return this.makeEmpty(),this.expandByObject(t,e)}clone(){return(new this.constructor).copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(t){return this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}expandByObject(t,e=!1){t.updateWorldMatrix(!1,!1);const n=t.geometry;if(void 0!==n)if(e&&null!=n.attributes&&void 0!==n.attributes.position){const e=n.attributes.position;for(let n=0,i=e.count;n<i;n++)ks.fromBufferAttribute(e,n).applyMatrix4(t.matrixWorld),this.expandByPoint(ks)}else null===n.boundingBox&&n.computeBoundingBox(),Gs.copy(n.boundingBox),Gs.applyMatrix4(t.matrixWorld),this.union(Gs);const i=t.children;for(let t=0,n=i.length;t<n;t++)this.expandByObject(i[t],e);return this}containsPoint(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y||t.z<this.min.z||t.z>this.max.z)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y||t.max.z<this.min.z||t.min.z>this.max.z)}intersectsSphere(t){return this.clampPoint(t.center,ks),ks.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let e,n;return t.normal.x>0?(e=t.normal.x*this.min.x,n=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,n=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,n+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,n+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,n+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,n+=t.normal.z*this.min.z),e<=-t.constant&&n>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(Zs),Js.subVectors(this.max,Zs),Ws.subVectors(t.a,Zs),Vs.subVectors(t.b,Zs),js.subVectors(t.c,Zs),qs.subVectors(Vs,Ws),Ys.subVectors(js,Vs),Xs.subVectors(Ws,js);let e=[0,-qs.z,qs.y,0,-Ys.z,Ys.y,0,-Xs.z,Xs.y,qs.z,0,-qs.x,Ys.z,0,-Ys.x,Xs.z,0,-Xs.x,-qs.y,qs.x,0,-Ys.y,Ys.x,0,-Xs.y,Xs.x,0];return!!Qs(e,Ws,Vs,js,Js)&&(e=[1,0,0,0,1,0,0,0,1],!!Qs(e,Ws,Vs,js,Js)&&($s.crossVectors(qs,Ys),e=[$s.x,$s.y,$s.z],Qs(e,Ws,Vs,js,Js)))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return ks.copy(t).clamp(this.min,this.max).sub(t).length()}getBoundingSphere(t){return this.getCenter(t.center),t.radius=.5*this.getSize(ks).length(),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()||(Us[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),Us[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),Us[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),Us[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),Us[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),Us[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),Us[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),Us[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(Us)),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}Hs.prototype.isBox3=!0;const Us=[new zs,new zs,new zs,new zs,new zs,new zs,new zs,new zs],ks=new zs,Gs=new Hs,Ws=new zs,Vs=new zs,js=new zs,qs=new zs,Ys=new zs,Xs=new zs,Zs=new zs,Js=new zs,$s=new zs,Ks=new zs;function Qs(t,e,n,i,r){for(let o=0,s=t.length-3;o<=s;o+=3){Ks.fromArray(t,o);const s=r.x*Math.abs(Ks.x)+r.y*Math.abs(Ks.y)+r.z*Math.abs(Ks.z),a=e.dot(Ks),l=n.dot(Ks),c=i.dot(Ks);if(Math.max(-Math.max(a,l,c),Math.min(a,l,c))>s)return!1}return!0}const ta=new Hs,ea=new zs,na=new zs,ia=new zs;class ra{constructor(t=new zs,e=-1){this.center=t,this.radius=e}set(t,e){return this.center.copy(t),this.radius=e,this}setFromPoints(t,e){const n=this.center;void 0!==e?n.copy(e):ta.setFromPoints(t).getCenter(n);let i=0;for(let e=0,r=t.length;e<r;e++)i=Math.max(i,n.distanceToSquared(t[e]));return this.radius=Math.sqrt(i),this}copy(t){return this.center.copy(t.center),this.radius=t.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(t){return t.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(t){return t.distanceTo(this.center)-this.radius}intersectsSphere(t){const e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e}intersectsBox(t){return t.intersectsSphere(this)}intersectsPlane(t){return Math.abs(t.distanceToPoint(this.center))<=this.radius}clampPoint(t,e){const n=this.center.distanceToSquared(t);return e.copy(t),n>this.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(t){return this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)}applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}translate(t){return this.center.add(t),this}expandByPoint(t){ia.subVectors(t,this.center);const e=ia.lengthSq();if(e>this.radius*this.radius){const t=Math.sqrt(e),n=.5*(t-this.radius);this.center.add(ia.multiplyScalar(n/t)),this.radius+=n}return this}union(t){return!0===this.center.equals(t.center)?na.set(0,0,1).multiplyScalar(t.radius):na.subVectors(t.center,this.center).normalize().multiplyScalar(t.radius),this.expandByPoint(ea.copy(t.center).add(na)),this.expandByPoint(ea.copy(t.center).sub(na)),this}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return(new this.constructor).copy(this)}}const oa=new zs,sa=new zs,aa=new zs,la=new zs,ca=new zs,ha=new zs,ua=new zs;class da{constructor(t=new zs,e=new zs(0,0,-1)){this.origin=t,this.direction=e}set(t,e){return this.origin.copy(t),this.direction.copy(e),this}copy(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this}at(t,e){return e.copy(this.direction).multiplyScalar(t).add(this.origin)}lookAt(t){return this.direction.copy(t).sub(this.origin).normalize(),this}recast(t){return this.origin.copy(this.at(t,oa)),this}closestPointToPoint(t,e){e.subVectors(t,this.origin);const n=e.dot(this.direction);return n<0?e.copy(this.origin):e.copy(this.direction).multiplyScalar(n).add(this.origin)}distanceToPoint(t){return Math.sqrt(this.distanceSqToPoint(t))}distanceSqToPoint(t){const e=oa.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(oa.copy(this.direction).multiplyScalar(e).add(this.origin),oa.distanceToSquared(t))}distanceSqToSegment(t,e,n,i){sa.copy(t).add(e).multiplyScalar(.5),aa.copy(e).sub(t).normalize(),la.copy(this.origin).sub(sa);const r=.5*t.distanceTo(e),o=-this.direction.dot(aa),s=la.dot(this.direction),a=-la.dot(aa),l=la.lengthSq(),c=Math.abs(1-o*o);let h,u,d,p;if(c>0)if(h=o*a-s,u=o*s-a,p=r*c,h>=0)if(u>=-p)if(u<=p){const t=1/c;h*=t,u*=t,d=h*(h+o*u+2*s)+u*(o*h+u+2*a)+l}else u=r,h=Math.max(0,-(o*u+s)),d=-h*h+u*(u+2*a)+l;else u=-r,h=Math.max(0,-(o*u+s)),d=-h*h+u*(u+2*a)+l;else u<=-p?(h=Math.max(0,-(-o*r+s)),u=h>0?-r:Math.min(Math.max(-r,-a),r),d=-h*h+u*(u+2*a)+l):u<=p?(h=0,u=Math.min(Math.max(-r,-a),r),d=u*(u+2*a)+l):(h=Math.max(0,-(o*r+s)),u=h>0?r:Math.min(Math.max(-r,-a),r),d=-h*h+u*(u+2*a)+l);else u=o>0?-r:r,h=Math.max(0,-(o*u+s)),d=-h*h+u*(u+2*a)+l;return n&&n.copy(this.direction).multiplyScalar(h).add(this.origin),i&&i.copy(aa).multiplyScalar(u).add(sa),d}intersectSphere(t,e){oa.subVectors(t.center,this.origin);const n=oa.dot(this.direction),i=oa.dot(oa)-n*n,r=t.radius*t.radius;if(i>r)return null;const o=Math.sqrt(r-i),s=n-o,a=n+o;return s<0&&a<0?null:s<0?this.at(a,e):this.at(s,e)}intersectsSphere(t){return this.distanceSqToPoint(t.center)<=t.radius*t.radius}distanceToPlane(t){const e=t.normal.dot(this.direction);if(0===e)return 0===t.distanceToPoint(this.origin)?0:null;const n=-(this.origin.dot(t.normal)+t.constant)/e;return n>=0?n:null}intersectPlane(t,e){const n=this.distanceToPlane(t);return null===n?null:this.at(n,e)}intersectsPlane(t){const e=t.distanceToPoint(this.origin);return 0===e||t.normal.dot(this.direction)*e<0}intersectBox(t,e){let n,i,r,o,s,a;const l=1/this.direction.x,c=1/this.direction.y,h=1/this.direction.z,u=this.origin;return l>=0?(n=(t.min.x-u.x)*l,i=(t.max.x-u.x)*l):(n=(t.max.x-u.x)*l,i=(t.min.x-u.x)*l),c>=0?(r=(t.min.y-u.y)*c,o=(t.max.y-u.y)*c):(r=(t.max.y-u.y)*c,o=(t.min.y-u.y)*c),n>o||r>i?null:((r>n||n!=n)&&(n=r),(o<i||i!=i)&&(i=o),h>=0?(s=(t.min.z-u.z)*h,a=(t.max.z-u.z)*h):(s=(t.max.z-u.z)*h,a=(t.min.z-u.z)*h),n>a||s>i?null:((s>n||n!=n)&&(n=s),(a<i||i!=i)&&(i=a),i<0?null:this.at(n>=0?n:i,e)))}intersectsBox(t){return null!==this.intersectBox(t,oa)}intersectTriangle(t,e,n,i,r){ca.subVectors(e,t),ha.subVectors(n,t),ua.crossVectors(ca,ha);let o,s=this.direction.dot(ua);if(s>0){if(i)return null;o=1}else{if(!(s<0))return null;o=-1,s=-s}la.subVectors(this.origin,t);const a=o*this.direction.dot(ha.crossVectors(la,ha));if(a<0)return null;const l=o*this.direction.dot(ca.cross(la));if(l<0)return null;if(a+l>s)return null;const c=-o*la.dot(ua);return c<0?null:this.at(c/s,r)}applyMatrix4(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this}equals(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}clone(){return(new this.constructor).copy(this)}}class pa{constructor(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}set(t,e,n,i,r,o,s,a,l,c,h,u,d,p,f,m){const g=this.elements;return g[0]=t,g[4]=e,g[8]=n,g[12]=i,g[1]=r,g[5]=o,g[9]=s,g[13]=a,g[2]=l,g[6]=c,g[10]=h,g[14]=u,g[3]=d,g[7]=p,g[11]=f,g[15]=m,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return(new pa).fromArray(this.elements)}copy(t){const e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],e[9]=n[9],e[10]=n[10],e[11]=n[11],e[12]=n[12],e[13]=n[13],e[14]=n[14],e[15]=n[15],this}copyPosition(t){const e=this.elements,n=t.elements;return e[12]=n[12],e[13]=n[13],e[14]=n[14],this}setFromMatrix3(t){const e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}extractBasis(t,e,n){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(t,e,n){return this.set(t.x,e.x,n.x,0,t.y,e.y,n.y,0,t.z,e.z,n.z,0,0,0,0,1),this}extractRotation(t){const e=this.elements,n=t.elements,i=1/fa.setFromMatrixColumn(t,0).length(),r=1/fa.setFromMatrixColumn(t,1).length(),o=1/fa.setFromMatrixColumn(t,2).length();return e[0]=n[0]*i,e[1]=n[1]*i,e[2]=n[2]*i,e[3]=0,e[4]=n[4]*r,e[5]=n[5]*r,e[6]=n[6]*r,e[7]=0,e[8]=n[8]*o,e[9]=n[9]*o,e[10]=n[10]*o,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){t&&t.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");const e=this.elements,n=t.x,i=t.y,r=t.z,o=Math.cos(n),s=Math.sin(n),a=Math.cos(i),l=Math.sin(i),c=Math.cos(r),h=Math.sin(r);if("XYZ"===t.order){const t=o*c,n=o*h,i=s*c,r=s*h;e[0]=a*c,e[4]=-a*h,e[8]=l,e[1]=n+i*l,e[5]=t-r*l,e[9]=-s*a,e[2]=r-t*l,e[6]=i+n*l,e[10]=o*a}else if("YXZ"===t.order){const t=a*c,n=a*h,i=l*c,r=l*h;e[0]=t+r*s,e[4]=i*s-n,e[8]=o*l,e[1]=o*h,e[5]=o*c,e[9]=-s,e[2]=n*s-i,e[6]=r+t*s,e[10]=o*a}else if("ZXY"===t.order){const t=a*c,n=a*h,i=l*c,r=l*h;e[0]=t-r*s,e[4]=-o*h,e[8]=i+n*s,e[1]=n+i*s,e[5]=o*c,e[9]=r-t*s,e[2]=-o*l,e[6]=s,e[10]=o*a}else if("ZYX"===t.order){const t=o*c,n=o*h,i=s*c,r=s*h;e[0]=a*c,e[4]=i*l-n,e[8]=t*l+r,e[1]=a*h,e[5]=r*l+t,e[9]=n*l-i,e[2]=-l,e[6]=s*a,e[10]=o*a}else if("YZX"===t.order){const t=o*a,n=o*l,i=s*a,r=s*l;e[0]=a*c,e[4]=r-t*h,e[8]=i*h+n,e[1]=h,e[5]=o*c,e[9]=-s*c,e[2]=-l*c,e[6]=n*h+i,e[10]=t-r*h}else if("XZY"===t.order){const t=o*a,n=o*l,i=s*a,r=s*l;e[0]=a*c,e[4]=-h,e[8]=l*c,e[1]=t*h+r,e[5]=o*c,e[9]=n*h-i,e[2]=i*h-n,e[6]=s*c,e[10]=r*h+t}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose(ga,t,_a)}lookAt(t,e,n){const i=this.elements;return xa.subVectors(t,e),0===xa.lengthSq()&&(xa.z=1),xa.normalize(),va.crossVectors(n,xa),0===va.lengthSq()&&(1===Math.abs(n.z)?xa.x+=1e-4:xa.z+=1e-4,xa.normalize(),va.crossVectors(n,xa)),va.normalize(),ya.crossVectors(xa,va),i[0]=va.x,i[4]=ya.x,i[8]=xa.x,i[1]=va.y,i[5]=ya.y,i[9]=xa.y,i[2]=va.z,i[6]=ya.z,i[10]=xa.z,this}multiply(t,e){return void 0!==e?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(t,e)):this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const n=t.elements,i=e.elements,r=this.elements,o=n[0],s=n[4],a=n[8],l=n[12],c=n[1],h=n[5],u=n[9],d=n[13],p=n[2],f=n[6],m=n[10],g=n[14],_=n[3],v=n[7],y=n[11],x=n[15],b=i[0],w=i[4],M=i[8],S=i[12],T=i[1],E=i[5],A=i[9],C=i[13],R=i[2],L=i[6],P=i[10],I=i[14],D=i[3],O=i[7],N=i[11],z=i[15];return r[0]=o*b+s*T+a*R+l*D,r[4]=o*w+s*E+a*L+l*O,r[8]=o*M+s*A+a*P+l*N,r[12]=o*S+s*C+a*I+l*z,r[1]=c*b+h*T+u*R+d*D,r[5]=c*w+h*E+u*L+d*O,r[9]=c*M+h*A+u*P+d*N,r[13]=c*S+h*C+u*I+d*z,r[2]=p*b+f*T+m*R+g*D,r[6]=p*w+f*E+m*L+g*O,r[10]=p*M+f*A+m*P+g*N,r[14]=p*S+f*C+m*I+g*z,r[3]=_*b+v*T+y*R+x*D,r[7]=_*w+v*E+y*L+x*O,r[11]=_*M+v*A+y*P+x*N,r[15]=_*S+v*C+y*I+x*z,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}determinant(){const t=this.elements,e=t[0],n=t[4],i=t[8],r=t[12],o=t[1],s=t[5],a=t[9],l=t[13],c=t[2],h=t[6],u=t[10],d=t[14];return t[3]*(+r*a*h-i*l*h-r*s*u+n*l*u+i*s*d-n*a*d)+t[7]*(+e*a*d-e*l*u+r*o*u-i*o*d+i*l*c-r*a*c)+t[11]*(+e*l*h-e*s*d-r*o*h+n*o*d+r*s*c-n*l*c)+t[15]*(-i*s*c-e*a*h+e*s*u+i*o*h-n*o*u+n*a*c)}transpose(){const t=this.elements;let e;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(t,e,n){const i=this.elements;return t.isVector3?(i[12]=t.x,i[13]=t.y,i[14]=t.z):(i[12]=t,i[13]=e,i[14]=n),this}invert(){const t=this.elements,e=t[0],n=t[1],i=t[2],r=t[3],o=t[4],s=t[5],a=t[6],l=t[7],c=t[8],h=t[9],u=t[10],d=t[11],p=t[12],f=t[13],m=t[14],g=t[15],_=h*m*l-f*u*l+f*a*d-s*m*d-h*a*g+s*u*g,v=p*u*l-c*m*l-p*a*d+o*m*d+c*a*g-o*u*g,y=c*f*l-p*h*l+p*s*d-o*f*d-c*s*g+o*h*g,x=p*h*a-c*f*a-p*s*u+o*f*u+c*s*m-o*h*m,b=e*_+n*v+i*y+r*x;if(0===b)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const w=1/b;return t[0]=_*w,t[1]=(f*u*r-h*m*r-f*i*d+n*m*d+h*i*g-n*u*g)*w,t[2]=(s*m*r-f*a*r+f*i*l-n*m*l-s*i*g+n*a*g)*w,t[3]=(h*a*r-s*u*r-h*i*l+n*u*l+s*i*d-n*a*d)*w,t[4]=v*w,t[5]=(c*m*r-p*u*r+p*i*d-e*m*d-c*i*g+e*u*g)*w,t[6]=(p*a*r-o*m*r-p*i*l+e*m*l+o*i*g-e*a*g)*w,t[7]=(o*u*r-c*a*r+c*i*l-e*u*l-o*i*d+e*a*d)*w,t[8]=y*w,t[9]=(p*h*r-c*f*r-p*n*d+e*f*d+c*n*g-e*h*g)*w,t[10]=(o*f*r-p*s*r+p*n*l-e*f*l-o*n*g+e*s*g)*w,t[11]=(c*s*r-o*h*r-c*n*l+e*h*l+o*n*d-e*s*d)*w,t[12]=x*w,t[13]=(c*f*i-p*h*i+p*n*u-e*f*u-c*n*m+e*h*m)*w,t[14]=(p*s*i-o*f*i-p*n*a+e*f*a+o*n*m-e*s*m)*w,t[15]=(o*h*i-c*s*i+c*n*a-e*h*a-o*n*u+e*s*u)*w,this}scale(t){const e=this.elements,n=t.x,i=t.y,r=t.z;return e[0]*=n,e[4]*=i,e[8]*=r,e[1]*=n,e[5]*=i,e[9]*=r,e[2]*=n,e[6]*=i,e[10]*=r,e[3]*=n,e[7]*=i,e[11]*=r,this}getMaxScaleOnAxis(){const t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],n=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],i=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,n,i))}makeTranslation(t,e,n){return this.set(1,0,0,t,0,1,0,e,0,0,1,n,0,0,0,1),this}makeRotationX(t){const e=Math.cos(t),n=Math.sin(t);return this.set(1,0,0,0,0,e,-n,0,0,n,e,0,0,0,0,1),this}makeRotationY(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,0,n,0,0,1,0,0,-n,0,e,0,0,0,0,1),this}makeRotationZ(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,0,n,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){const n=Math.cos(e),i=Math.sin(e),r=1-n,o=t.x,s=t.y,a=t.z,l=r*o,c=r*s;return this.set(l*o+n,l*s-i*a,l*a+i*s,0,l*s+i*a,c*s+n,c*a-i*o,0,l*a-i*s,c*a+i*o,r*a*a+n,0,0,0,0,1),this}makeScale(t,e,n){return this.set(t,0,0,0,0,e,0,0,0,0,n,0,0,0,0,1),this}makeShear(t,e,n,i,r,o){return this.set(1,n,r,0,t,1,o,0,e,i,1,0,0,0,0,1),this}compose(t,e,n){const i=this.elements,r=e._x,o=e._y,s=e._z,a=e._w,l=r+r,c=o+o,h=s+s,u=r*l,d=r*c,p=r*h,f=o*c,m=o*h,g=s*h,_=a*l,v=a*c,y=a*h,x=n.x,b=n.y,w=n.z;return i[0]=(1-(f+g))*x,i[1]=(d+y)*x,i[2]=(p-v)*x,i[3]=0,i[4]=(d-y)*b,i[5]=(1-(u+g))*b,i[6]=(m+_)*b,i[7]=0,i[8]=(p+v)*w,i[9]=(m-_)*w,i[10]=(1-(u+f))*w,i[11]=0,i[12]=t.x,i[13]=t.y,i[14]=t.z,i[15]=1,this}decompose(t,e,n){const i=this.elements;let r=fa.set(i[0],i[1],i[2]).length();const o=fa.set(i[4],i[5],i[6]).length(),s=fa.set(i[8],i[9],i[10]).length();this.determinant()<0&&(r=-r),t.x=i[12],t.y=i[13],t.z=i[14],ma.copy(this);const a=1/r,l=1/o,c=1/s;return ma.elements[0]*=a,ma.elements[1]*=a,ma.elements[2]*=a,ma.elements[4]*=l,ma.elements[5]*=l,ma.elements[6]*=l,ma.elements[8]*=c,ma.elements[9]*=c,ma.elements[10]*=c,e.setFromRotationMatrix(ma),n.x=r,n.y=o,n.z=s,this}makePerspective(t,e,n,i,r,o){void 0===o&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");const s=this.elements,a=2*r/(e-t),l=2*r/(n-i),c=(e+t)/(e-t),h=(n+i)/(n-i),u=-(o+r)/(o-r),d=-2*o*r/(o-r);return s[0]=a,s[4]=0,s[8]=c,s[12]=0,s[1]=0,s[5]=l,s[9]=h,s[13]=0,s[2]=0,s[6]=0,s[10]=u,s[14]=d,s[3]=0,s[7]=0,s[11]=-1,s[15]=0,this}makeOrthographic(t,e,n,i,r,o){const s=this.elements,a=1/(e-t),l=1/(n-i),c=1/(o-r),h=(e+t)*a,u=(n+i)*l,d=(o+r)*c;return s[0]=2*a,s[4]=0,s[8]=0,s[12]=-h,s[1]=0,s[5]=2*l,s[9]=0,s[13]=-u,s[2]=0,s[6]=0,s[10]=-2*c,s[14]=-d,s[3]=0,s[7]=0,s[11]=0,s[15]=1,this}equals(t){const e=this.elements,n=t.elements;for(let t=0;t<16;t++)if(e[t]!==n[t])return!1;return!0}fromArray(t,e=0){for(let n=0;n<16;n++)this.elements[n]=t[n+e];return this}toArray(t=[],e=0){const n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t[e+9]=n[9],t[e+10]=n[10],t[e+11]=n[11],t[e+12]=n[12],t[e+13]=n[13],t[e+14]=n[14],t[e+15]=n[15],t}}pa.prototype.isMatrix4=!0;const fa=new zs,ma=new pa,ga=new zs(0,0,0),_a=new zs(1,1,1),va=new zs,ya=new zs,xa=new zs,ba=new pa,wa=new Ns;class Ma{constructor(t=0,e=0,n=0,i=Ma.DefaultOrder){this._x=t,this._y=e,this._z=n,this._order=i}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,e,n,i=this._order){return this._x=t,this._y=e,this._z=n,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,e=this._order,n=!0){const i=t.elements,r=i[0],o=i[4],s=i[8],a=i[1],l=i[5],c=i[9],h=i[2],u=i[6],d=i[10];switch(e){case"XYZ":this._y=Math.asin(hs(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(-c,d),this._z=Math.atan2(-o,r)):(this._x=Math.atan2(u,l),this._z=0);break;case"YXZ":this._x=Math.asin(-hs(c,-1,1)),Math.abs(c)<.9999999?(this._y=Math.atan2(s,d),this._z=Math.atan2(a,l)):(this._y=Math.atan2(-h,r),this._z=0);break;case"ZXY":this._x=Math.asin(hs(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(-h,d),this._z=Math.atan2(-o,l)):(this._y=0,this._z=Math.atan2(a,r));break;case"ZYX":this._y=Math.asin(-hs(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(u,d),this._z=Math.atan2(a,r)):(this._x=0,this._z=Math.atan2(-o,l));break;case"YZX":this._z=Math.asin(hs(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-c,l),this._y=Math.atan2(-h,r)):(this._x=0,this._y=Math.atan2(s,d));break;case"XZY":this._z=Math.asin(-hs(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(u,l),this._y=Math.atan2(s,r)):(this._x=Math.atan2(-c,d),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,!0===n&&this._onChangeCallback(),this}setFromQuaternion(t,e,n){return ba.makeRotationFromQuaternion(t),this.setFromRotationMatrix(ba,e,n)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return wa.setFromEuler(this),this.setFromQuaternion(wa,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],void 0!==t[3]&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}}Ma.prototype.isEuler=!0,Ma.DefaultOrder="XYZ",Ma.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];class Sa{constructor(){this.mask=1}set(t){this.mask=(1<<t|0)>>>0}enable(t){this.mask|=1<<t|0}enableAll(){this.mask=-1}toggle(t){this.mask^=1<<t|0}disable(t){this.mask&=~(1<<t|0)}disableAll(){this.mask=0}test(t){return 0!=(this.mask&t.mask)}isEnabled(t){return 0!=(this.mask&(1<<t|0))}}let Ta=0;const Ea=new zs,Aa=new Ns,Ca=new pa,Ra=new zs,La=new zs,Pa=new zs,Ia=new Ns,Da=new zs(1,0,0),Oa=new zs(0,1,0),Na=new zs(0,0,1),za={type:"added"},Ba={type:"removed"};class Fa extends os{constructor(){super(),Object.defineProperty(this,"id",{value:Ta++}),this.uuid=cs(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Fa.DefaultUp.clone();const t=new zs,e=new Ma,n=new Ns,i=new zs(1,1,1);e._onChange((function(){n.setFromEuler(e,!1)})),n._onChange((function(){e.setFromQuaternion(n,void 0,!1)})),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:e},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new pa},normalMatrix:{value:new ms}}),this.matrix=new pa,this.matrixWorld=new pa,this.matrixAutoUpdate=Fa.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new Sa,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeRender(){}onAfterRender(){}applyMatrix4(t){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(t),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(t){return this.quaternion.premultiply(t),this}setRotationFromAxisAngle(t,e){this.quaternion.setFromAxisAngle(t,e)}setRotationFromEuler(t){this.quaternion.setFromEuler(t,!0)}setRotationFromMatrix(t){this.quaternion.setFromRotationMatrix(t)}setRotationFromQuaternion(t){this.quaternion.copy(t)}rotateOnAxis(t,e){return Aa.setFromAxisAngle(t,e),this.quaternion.multiply(Aa),this}rotateOnWorldAxis(t,e){return Aa.setFromAxisAngle(t,e),this.quaternion.premultiply(Aa),this}rotateX(t){return this.rotateOnAxis(Da,t)}rotateY(t){return this.rotateOnAxis(Oa,t)}rotateZ(t){return this.rotateOnAxis(Na,t)}translateOnAxis(t,e){return Ea.copy(t).applyQuaternion(this.quaternion),this.position.add(Ea.multiplyScalar(e)),this}translateX(t){return this.translateOnAxis(Da,t)}translateY(t){return this.translateOnAxis(Oa,t)}translateZ(t){return this.translateOnAxis(Na,t)}localToWorld(t){return t.applyMatrix4(this.matrixWorld)}worldToLocal(t){return t.applyMatrix4(Ca.copy(this.matrixWorld).invert())}lookAt(t,e,n){t.isVector3?Ra.copy(t):Ra.set(t,e,n);const i=this.parent;this.updateWorldMatrix(!0,!1),La.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Ca.lookAt(La,Ra,this.up):Ca.lookAt(Ra,La,this.up),this.quaternion.setFromRotationMatrix(Ca),i&&(Ca.extractRotation(i.matrixWorld),Aa.setFromRotationMatrix(Ca),this.quaternion.premultiply(Aa.invert()))}add(t){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return t===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",t),this):(t&&t.isObject3D?(null!==t.parent&&t.parent.remove(t),t.parent=this,this.children.push(t),t.dispatchEvent(za)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",t),this)}remove(t){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.remove(arguments[t]);return this}const e=this.children.indexOf(t);return-1!==e&&(t.parent=null,this.children.splice(e,1),t.dispatchEvent(Ba)),this}removeFromParent(){const t=this.parent;return null!==t&&t.remove(this),this}clear(){for(let t=0;t<this.children.length;t++){const e=this.children[t];e.parent=null,e.dispatchEvent(Ba)}return this.children.length=0,this}attach(t){return this.updateWorldMatrix(!0,!1),Ca.copy(this.matrixWorld).invert(),null!==t.parent&&(t.parent.updateWorldMatrix(!0,!1),Ca.multiply(t.parent.matrixWorld)),t.applyMatrix4(Ca),this.add(t),t.updateWorldMatrix(!1,!0),this}getObjectById(t){return this.getObjectByProperty("id",t)}getObjectByName(t){return this.getObjectByProperty("name",t)}getObjectByProperty(t,e){if(this[t]===e)return this;for(let n=0,i=this.children.length;n<i;n++){const i=this.children[n].getObjectByProperty(t,e);if(void 0!==i)return i}}getWorldPosition(t){return this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(La,t,Pa),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(La,Ia,t),t}getWorldDirection(t){this.updateWorldMatrix(!0,!1);const e=this.matrixWorld.elements;return t.set(e[8],e[9],e[10]).normalize()}raycast(){}traverse(t){t(this);const e=this.children;for(let n=0,i=e.length;n<i;n++)e[n].traverse(t)}traverseVisible(t){if(!1===this.visible)return;t(this);const e=this.children;for(let n=0,i=e.length;n<i;n++)e[n].traverseVisible(t)}traverseAncestors(t){const e=this.parent;null!==e&&(t(e),e.traverseAncestors(t))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,t=!0);const e=this.children;for(let n=0,i=e.length;n<i;n++)e[n].updateMatrixWorld(t)}updateWorldMatrix(t,e){const n=this.parent;if(!0===t&&null!==n&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),!0===e){const t=this.children;for(let e=0,n=t.length;e<n;e++)t[e].updateWorldMatrix(!1,!0)}}toJSON(t){const e=void 0===t||"string"==typeof t,n={};e&&(t={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});const i={};function r(e,n){return void 0===e[n.uuid]&&(e[n.uuid]=n.toJSON(t)),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(),null!==this.instanceColor&&(i.instanceColor=this.instanceColor.toJSON())),this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&(i.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=r(t.geometries,this.geometry);const e=this.geometry.parameters;if(void 0!==e&&void 0!==e.shapes){const n=e.shapes;if(Array.isArray(n))for(let e=0,i=n.length;e<i;e++){const i=n[e];r(t.shapes,i)}else r(t.shapes,n)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton&&(r(t.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),void 0!==this.material)if(Array.isArray(this.material)){const e=[];for(let n=0,i=this.material.length;n<i;n++)e.push(r(t.materials,this.material[n]));i.material=e}else i.material=r(t.materials,this.material);if(this.children.length>0){i.children=[];for(let e=0;e<this.children.length;e++)i.children.push(this.children[e].toJSON(t).object)}if(this.animations.length>0){i.animations=[];for(let e=0;e<this.animations.length;e++){const n=this.animations[e];i.animations.push(r(t.animations,n))}}if(e){const e=o(t.geometries),i=o(t.materials),r=o(t.textures),s=o(t.images),a=o(t.shapes),l=o(t.skeletons),c=o(t.animations),h=o(t.nodes);e.length>0&&(n.geometries=e),i.length>0&&(n.materials=i),r.length>0&&(n.textures=r),s.length>0&&(n.images=s),a.length>0&&(n.shapes=a),l.length>0&&(n.skeletons=l),c.length>0&&(n.animations=c),h.length>0&&(n.nodes=h)}return n.object=i,n;function o(t){const e=[];for(const n in t){const i=t[n];delete i.metadata,e.push(i)}return e}}clone(t){return(new this.constructor).copy(this,t)}copy(t,e=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.userData=JSON.parse(JSON.stringify(t.userData)),!0===e)for(let e=0;e<t.children.length;e++){const n=t.children[e];this.add(n.clone())}return this}}Fa.DefaultUp=new zs(0,1,0),Fa.DefaultMatrixAutoUpdate=!0,Fa.prototype.isObject3D=!0;const Ha=new zs,Ua=new zs,ka=new zs,Ga=new zs,Wa=new zs,Va=new zs,ja=new zs,qa=new zs,Ya=new zs,Xa=new zs;class Za{constructor(t=new zs,e=new zs,n=new zs){this.a=t,this.b=e,this.c=n}static getNormal(t,e,n,i){i.subVectors(n,e),Ha.subVectors(t,e),i.cross(Ha);const r=i.lengthSq();return r>0?i.multiplyScalar(1/Math.sqrt(r)):i.set(0,0,0)}static getBarycoord(t,e,n,i,r){Ha.subVectors(i,e),Ua.subVectors(n,e),ka.subVectors(t,e);const o=Ha.dot(Ha),s=Ha.dot(Ua),a=Ha.dot(ka),l=Ua.dot(Ua),c=Ua.dot(ka),h=o*l-s*s;if(0===h)return r.set(-2,-1,-1);const u=1/h,d=(l*a-s*c)*u,p=(o*c-s*a)*u;return r.set(1-d-p,p,d)}static containsPoint(t,e,n,i){return this.getBarycoord(t,e,n,i,Ga),Ga.x>=0&&Ga.y>=0&&Ga.x+Ga.y<=1}static getUV(t,e,n,i,r,o,s,a){return this.getBarycoord(t,e,n,i,Ga),a.set(0,0),a.addScaledVector(r,Ga.x),a.addScaledVector(o,Ga.y),a.addScaledVector(s,Ga.z),a}static isFrontFacing(t,e,n,i){return Ha.subVectors(n,e),Ua.subVectors(t,e),Ha.cross(Ua).dot(i)<0}set(t,e,n){return this.a.copy(t),this.b.copy(e),this.c.copy(n),this}setFromPointsAndIndices(t,e,n,i){return this.a.copy(t[e]),this.b.copy(t[n]),this.c.copy(t[i]),this}setFromAttributeAndIndices(t,e,n,i){return this.a.fromBufferAttribute(t,e),this.b.fromBufferAttribute(t,n),this.c.fromBufferAttribute(t,i),this}clone(){return(new this.constructor).copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return Ha.subVectors(this.c,this.b),Ua.subVectors(this.a,this.b),.5*Ha.cross(Ua).length()}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return Za.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return Za.getBarycoord(t,this.a,this.b,this.c,e)}getUV(t,e,n,i,r){return Za.getUV(t,this.a,this.b,this.c,e,n,i,r)}containsPoint(t){return Za.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return Za.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){const n=this.a,i=this.b,r=this.c;let o,s;Wa.subVectors(i,n),Va.subVectors(r,n),qa.subVectors(t,n);const a=Wa.dot(qa),l=Va.dot(qa);if(a<=0&&l<=0)return e.copy(n);Ya.subVectors(t,i);const c=Wa.dot(Ya),h=Va.dot(Ya);if(c>=0&&h<=c)return e.copy(i);const u=a*h-c*l;if(u<=0&&a>=0&&c<=0)return o=a/(a-c),e.copy(n).addScaledVector(Wa,o);Xa.subVectors(t,r);const d=Wa.dot(Xa),p=Va.dot(Xa);if(p>=0&&d<=p)return e.copy(r);const f=d*l-a*p;if(f<=0&&l>=0&&p<=0)return s=l/(l-p),e.copy(n).addScaledVector(Va,s);const m=c*p-d*h;if(m<=0&&h-c>=0&&d-p>=0)return ja.subVectors(r,i),s=(h-c)/(h-c+(d-p)),e.copy(i).addScaledVector(ja,s);const g=1/(m+f+u);return o=f*g,s=u*g,e.copy(n).addScaledVector(Wa,o).addScaledVector(Va,s)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}let Ja=0;class $a extends os{constructor(){super(),Object.defineProperty(this,"id",{value:Ja++}),this.uuid=cs(),this.name="",this.type="Material",this.fog=!0,this.blending=1,this.side=0,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=204,this.blendDst=205,this.blendEquation=Mo,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=3,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=519,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=ts,this.stencilZFail=ts,this.stencilZPass=ts,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.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(t){this._alphaTest>0!=t>0&&this.version++,this._alphaTest=t}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(t){if(void 0!==t)for(const e in t){const n=t[e];if(void 0===n){console.warn("THREE.Material: '"+e+"' parameter is undefined.");continue}if("shading"===e){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===n;continue}const i=this[e];void 0!==i?i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[e]=n:console.warn("THREE."+this.type+": '"+e+"' is not a property of this material.")}}toJSON(t){const e=void 0===t||"string"==typeof t;e&&(t={textures:{},images:{}});const n={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};function i(t){const e=[];for(const n in t){const i=t[n];delete i.metadata,e.push(i)}return e}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),void 0!==this.roughness&&(n.roughness=this.roughness),void 0!==this.metalness&&(n.metalness=this.metalness),void 0!==this.sheen&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(n.sheenRoughness=this.sheenRoughness),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.specularIntensity&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(n.shininess=this.shininess),void 0!==this.clearcoat&&(n.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(t).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(t).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(t).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(t).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(t).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(t).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(t).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(t).uuid,void 0!==this.combine&&(n.combine=this.combine)),void 0!==this.envMapIntensity&&(n.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(n.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(t).uuid),void 0!==this.transmission&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(t).uuid),void 0!==this.thickness&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(t).uuid),void 0!==this.attenuationDistance&&(n.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(n.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(n.size=this.size),null!==this.shadowSide&&(n.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(n.blending=this.blending),0!==this.side&&(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.colorWrite=this.colorWrite,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,void 0!==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),void 0!==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.alphaToCoverage&&(n.alphaToCoverage=this.alphaToCoverage),!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.flatShading&&(n.flatShading=this.flatShading),!1===this.visible&&(n.visible=!1),!1===this.toneMapped&&(n.toneMapped=!1),"{}"!==JSON.stringify(this.userData)&&(n.userData=this.userData),e){const e=i(t.textures),r=i(t.images);e.length>0&&(n.textures=e),r.length>0&&(n.images=r)}return n}clone(){return(new this.constructor).copy(this)}copy(t){this.name=t.name,this.fog=t.fog,this.blending=t.blending,this.side=t.side,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;const e=t.clippingPlanes;let n=null;if(null!==e){const t=e.length;n=new Array(t);for(let i=0;i!==t;++i)n[i]=e[i].clone()}return this.clippingPlanes=n,this.clipIntersection=t.clipIntersection,this.clipShadows=t.clipShadows,this.shadowSide=t.shadowSide,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.alphaToCoverage=t.alphaToCoverage,this.premultipliedAlpha=t.premultipliedAlpha,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(t){!0===t&&this.version++}}$a.prototype.isMaterial=!0,$a.fromType=function(){return null};class Ka extends $a{constructor(t){super(),this.type="MeshBasicMaterial",this.color=new Ss(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=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this}}Ka.prototype.isMeshBasicMaterial=!0;const Qa=new zs,tl=new fs;class el{constructor(t,e,n){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.name="",this.array=t,this.itemSize=e,this.count=void 0!==t?t.length/e:0,this.normalized=!0===n,this.usage=es,this.updateRange={offset:0,count:-1},this.version=0}onUploadCallback(){}set needsUpdate(t){!0===t&&this.version++}setUsage(t){return this.usage=t,this}copy(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this}copyAt(t,e,n){t*=this.itemSize,n*=e.itemSize;for(let i=0,r=this.itemSize;i<r;i++)this.array[t+i]=e.array[n+i];return this}copyArray(t){return this.array.set(t),this}copyColorsArray(t){const e=this.array;let n=0;for(let i=0,r=t.length;i<r;i++){let r=t[i];void 0===r&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",i),r=new Ss),e[n++]=r.r,e[n++]=r.g,e[n++]=r.b}return this}copyVector2sArray(t){const e=this.array;let n=0;for(let i=0,r=t.length;i<r;i++){let r=t[i];void 0===r&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",i),r=new fs),e[n++]=r.x,e[n++]=r.y}return this}copyVector3sArray(t){const e=this.array;let n=0;for(let i=0,r=t.length;i<r;i++){let r=t[i];void 0===r&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",i),r=new zs),e[n++]=r.x,e[n++]=r.y,e[n++]=r.z}return this}copyVector4sArray(t){const e=this.array;let n=0;for(let i=0,r=t.length;i<r;i++){let r=t[i];void 0===r&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",i),r=new Ps),e[n++]=r.x,e[n++]=r.y,e[n++]=r.z,e[n++]=r.w}return this}applyMatrix3(t){if(2===this.itemSize)for(let e=0,n=this.count;e<n;e++)tl.fromBufferAttribute(this,e),tl.applyMatrix3(t),this.setXY(e,tl.x,tl.y);else if(3===this.itemSize)for(let e=0,n=this.count;e<n;e++)Qa.fromBufferAttribute(this,e),Qa.applyMatrix3(t),this.setXYZ(e,Qa.x,Qa.y,Qa.z);return this}applyMatrix4(t){for(let e=0,n=this.count;e<n;e++)Qa.x=this.getX(e),Qa.y=this.getY(e),Qa.z=this.getZ(e),Qa.applyMatrix4(t),this.setXYZ(e,Qa.x,Qa.y,Qa.z);return this}applyNormalMatrix(t){for(let e=0,n=this.count;e<n;e++)Qa.x=this.getX(e),Qa.y=this.getY(e),Qa.z=this.getZ(e),Qa.applyNormalMatrix(t),this.setXYZ(e,Qa.x,Qa.y,Qa.z);return this}transformDirection(t){for(let e=0,n=this.count;e<n;e++)Qa.x=this.getX(e),Qa.y=this.getY(e),Qa.z=this.getZ(e),Qa.transformDirection(t),this.setXYZ(e,Qa.x,Qa.y,Qa.z);return this}set(t,e=0){return this.array.set(t,e),this}getX(t){return this.array[t*this.itemSize]}setX(t,e){return this.array[t*this.itemSize]=e,this}getY(t){return this.array[t*this.itemSize+1]}setY(t,e){return this.array[t*this.itemSize+1]=e,this}getZ(t){return this.array[t*this.itemSize+2]}setZ(t,e){return this.array[t*this.itemSize+2]=e,this}getW(t){return this.array[t*this.itemSize+3]}setW(t,e){return this.array[t*this.itemSize+3]=e,this}setXY(t,e,n){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=n,this}setXYZ(t,e,n,i){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=n,this.array[t+2]=i,this}setXYZW(t,e,n,i,r){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=n,this.array[t+2]=i,this.array[t+3]=r,this}onUpload(t){return this.onUploadCallback=t,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const t={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.prototype.slice.call(this.array),normalized:this.normalized};return""!==this.name&&(t.name=this.name),this.usage!==es&&(t.usage=this.usage),0===this.updateRange.offset&&-1===this.updateRange.count||(t.updateRange=this.updateRange),t}}el.prototype.isBufferAttribute=!0;class nl extends el{constructor(t,e,n){super(new Uint16Array(t),e,n)}}class il extends el{constructor(t,e,n){super(new Uint32Array(t),e,n)}}(class extends el{constructor(t,e,n){super(new Uint16Array(t),e,n)}}).prototype.isFloat16BufferAttribute=!0;class rl extends el{constructor(t,e,n){super(new Float32Array(t),e,n)}}let ol=0;const sl=new pa,al=new Fa,ll=new zs,cl=new Hs,hl=new Hs,ul=new zs;class dl extends os{constructor(){super(),Object.defineProperty(this,"id",{value:ol++}),this.uuid=cs(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(t){return Array.isArray(t)?this.index=new(gs(t)?il:nl)(t,1):this.index=t,this}getAttribute(t){return this.attributes[t]}setAttribute(t,e){return this.attributes[t]=e,this}deleteAttribute(t){return delete this.attributes[t],this}hasAttribute(t){return void 0!==this.attributes[t]}addGroup(t,e,n=0){this.groups.push({start:t,count:e,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(t,e){this.drawRange.start=t,this.drawRange.count=e}applyMatrix4(t){const e=this.attributes.position;void 0!==e&&(e.applyMatrix4(t),e.needsUpdate=!0);const n=this.attributes.normal;if(void 0!==n){const e=(new ms).getNormalMatrix(t);n.applyNormalMatrix(e),n.needsUpdate=!0}const i=this.attributes.tangent;return void 0!==i&&(i.transformDirection(t),i.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}applyQuaternion(t){return sl.makeRotationFromQuaternion(t),this.applyMatrix4(sl),this}rotateX(t){return sl.makeRotationX(t),this.applyMatrix4(sl),this}rotateY(t){return sl.makeRotationY(t),this.applyMatrix4(sl),this}rotateZ(t){return sl.makeRotationZ(t),this.applyMatrix4(sl),this}translate(t,e,n){return sl.makeTranslation(t,e,n),this.applyMatrix4(sl),this}scale(t,e,n){return sl.makeScale(t,e,n),this.applyMatrix4(sl),this}lookAt(t){return al.lookAt(t),al.updateMatrix(),this.applyMatrix4(al.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(ll).negate(),this.translate(ll.x,ll.y,ll.z),this}setFromPoints(t){const e=[];for(let n=0,i=t.length;n<i;n++){const i=t[n];e.push(i.x,i.y,i.z||0)}return this.setAttribute("position",new rl(e,3)),this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new Hs);const t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute)return console.error('THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set "mesh.frustumCulled" to "false".',this),void this.boundingBox.set(new zs(-1/0,-1/0,-1/0),new zs(1/0,1/0,1/0));if(void 0!==t){if(this.boundingBox.setFromBufferAttribute(t),e)for(let t=0,n=e.length;t<n;t++){const n=e[t];cl.setFromBufferAttribute(n),this.morphTargetsRelative?(ul.addVectors(this.boundingBox.min,cl.min),this.boundingBox.expandByPoint(ul),ul.addVectors(this.boundingBox.max,cl.max),this.boundingBox.expandByPoint(ul)):(this.boundingBox.expandByPoint(cl.min),this.boundingBox.expandByPoint(cl.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(){null===this.boundingSphere&&(this.boundingSphere=new ra);const t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute)return console.error('THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set "mesh.frustumCulled" to "false".',this),void this.boundingSphere.set(new zs,1/0);if(t){const n=this.boundingSphere.center;if(cl.setFromBufferAttribute(t),e)for(let t=0,n=e.length;t<n;t++){const n=e[t];hl.setFromBufferAttribute(n),this.morphTargetsRelative?(ul.addVectors(cl.min,hl.min),cl.expandByPoint(ul),ul.addVectors(cl.max,hl.max),cl.expandByPoint(ul)):(cl.expandByPoint(hl.min),cl.expandByPoint(hl.max))}cl.getCenter(n);let i=0;for(let e=0,r=t.count;e<r;e++)ul.fromBufferAttribute(t,e),i=Math.max(i,n.distanceToSquared(ul));if(e)for(let r=0,o=e.length;r<o;r++){const o=e[r],s=this.morphTargetsRelative;for(let e=0,r=o.count;e<r;e++)ul.fromBufferAttribute(o,e),s&&(ll.fromBufferAttribute(t,e),ul.add(ll)),i=Math.max(i,n.distanceToSquared(ul))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const t=this.index,e=this.attributes;if(null===t||void 0===e.position||void 0===e.normal||void 0===e.uv)return void console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");const n=t.array,i=e.position.array,r=e.normal.array,o=e.uv.array,s=i.length/3;!1===this.hasAttribute("tangent")&&this.setAttribute("tangent",new el(new Float32Array(4*s),4));const a=this.getAttribute("tangent").array,l=[],c=[];for(let t=0;t<s;t++)l[t]=new zs,c[t]=new zs;const h=new zs,u=new zs,d=new zs,p=new fs,f=new fs,m=new fs,g=new zs,_=new zs;function v(t,e,n){h.fromArray(i,3*t),u.fromArray(i,3*e),d.fromArray(i,3*n),p.fromArray(o,2*t),f.fromArray(o,2*e),m.fromArray(o,2*n),u.sub(h),d.sub(h),f.sub(p),m.sub(p);const r=1/(f.x*m.y-m.x*f.y);isFinite(r)&&(g.copy(u).multiplyScalar(m.y).addScaledVector(d,-f.y).multiplyScalar(r),_.copy(d).multiplyScalar(f.x).addScaledVector(u,-m.x).multiplyScalar(r),l[t].add(g),l[e].add(g),l[n].add(g),c[t].add(_),c[e].add(_),c[n].add(_))}let y=this.groups;0===y.length&&(y=[{start:0,count:n.length}]);for(let t=0,e=y.length;t<e;++t){const e=y[t],i=e.start;for(let t=i,r=i+e.count;t<r;t+=3)v(n[t+0],n[t+1],n[t+2])}const x=new zs,b=new zs,w=new zs,M=new zs;function S(t){w.fromArray(r,3*t),M.copy(w);const e=l[t];x.copy(e),x.sub(w.multiplyScalar(w.dot(e))).normalize(),b.crossVectors(M,e);const n=b.dot(c[t])<0?-1:1;a[4*t]=x.x,a[4*t+1]=x.y,a[4*t+2]=x.z,a[4*t+3]=n}for(let t=0,e=y.length;t<e;++t){const e=y[t],i=e.start;for(let t=i,r=i+e.count;t<r;t+=3)S(n[t+0]),S(n[t+1]),S(n[t+2])}}computeVertexNormals(){const t=this.index,e=this.getAttribute("position");if(void 0!==e){let n=this.getAttribute("normal");if(void 0===n)n=new el(new Float32Array(3*e.count),3),this.setAttribute("normal",n);else for(let t=0,e=n.count;t<e;t++)n.setXYZ(t,0,0,0);const i=new zs,r=new zs,o=new zs,s=new zs,a=new zs,l=new zs,c=new zs,h=new zs;if(t)for(let u=0,d=t.count;u<d;u+=3){const d=t.getX(u+0),p=t.getX(u+1),f=t.getX(u+2);i.fromBufferAttribute(e,d),r.fromBufferAttribute(e,p),o.fromBufferAttribute(e,f),c.subVectors(o,r),h.subVectors(i,r),c.cross(h),s.fromBufferAttribute(n,d),a.fromBufferAttribute(n,p),l.fromBufferAttribute(n,f),s.add(c),a.add(c),l.add(c),n.setXYZ(d,s.x,s.y,s.z),n.setXYZ(p,a.x,a.y,a.z),n.setXYZ(f,l.x,l.y,l.z)}else for(let t=0,s=e.count;t<s;t+=3)i.fromBufferAttribute(e,t+0),r.fromBufferAttribute(e,t+1),o.fromBufferAttribute(e,t+2),c.subVectors(o,r),h.subVectors(i,r),c.cross(h),n.setXYZ(t+0,c.x,c.y,c.z),n.setXYZ(t+1,c.x,c.y,c.z),n.setXYZ(t+2,c.x,c.y,c.z);this.normalizeNormals(),n.needsUpdate=!0}}merge(t,e){if(!t||!t.isBufferGeometry)return void console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",t);void 0===e&&(e=0,console.warn("THREE.BufferGeometry.merge(): Overwriting original geometry, starting at offset=0. Use BufferGeometryUtils.mergeBufferGeometries() for lossless merge."));const n=this.attributes;for(const i in n){if(void 0===t.attributes[i])continue;const r=n[i].array,o=t.attributes[i],s=o.array,a=o.itemSize*e,l=Math.min(s.length,r.length-a);for(let t=0,e=a;t<l;t++,e++)r[e]=s[t]}return this}normalizeNormals(){const t=this.attributes.normal;for(let e=0,n=t.count;e<n;e++)ul.fromBufferAttribute(t,e),ul.normalize(),t.setXYZ(e,ul.x,ul.y,ul.z)}toNonIndexed(){function t(t,e){const n=t.array,i=t.itemSize,r=t.normalized,o=new n.constructor(e.length*i);let s=0,a=0;for(let r=0,l=e.length;r<l;r++){s=t.isInterleavedBufferAttribute?e[r]*t.data.stride+t.offset:e[r]*i;for(let t=0;t<i;t++)o[a++]=n[s++]}return new el(o,i,r)}if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const e=new dl,n=this.index.array,i=this.attributes;for(const r in i){const o=t(i[r],n);e.setAttribute(r,o)}const r=this.morphAttributes;for(const i in r){const o=[],s=r[i];for(let e=0,i=s.length;e<i;e++){const i=t(s[e],n);o.push(i)}e.morphAttributes[i]=o}e.morphTargetsRelative=this.morphTargetsRelative;const o=this.groups;for(let t=0,n=o.length;t<n;t++){const n=o[t];e.addGroup(n.start,n.count,n.materialIndex)}return e}toJSON(){const t={metadata:{version:4.5,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,""!==this.name&&(t.name=this.name),Object.keys(this.userData).length>0&&(t.userData=this.userData),void 0!==this.parameters){const e=this.parameters;for(const n in e)void 0!==e[n]&&(t[n]=e[n]);return t}t.data={attributes:{}};const e=this.index;null!==e&&(t.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});const n=this.attributes;for(const e in n){const i=n[e];t.data.attributes[e]=i.toJSON(t.data)}const i={};let r=!1;for(const e in this.morphAttributes){const n=this.morphAttributes[e],o=[];for(let e=0,i=n.length;e<i;e++){const i=n[e];o.push(i.toJSON(t.data))}o.length>0&&(i[e]=o,r=!0)}r&&(t.data.morphAttributes=i,t.data.morphTargetsRelative=this.morphTargetsRelative);const o=this.groups;o.length>0&&(t.data.groups=JSON.parse(JSON.stringify(o)));const s=this.boundingSphere;return null!==s&&(t.data.boundingSphere={center:s.center.toArray(),radius:s.radius}),t}clone(){return(new this.constructor).copy(this)}copy(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const e={};this.name=t.name;const n=t.index;null!==n&&this.setIndex(n.clone(e));const i=t.attributes;for(const t in i){const n=i[t];this.setAttribute(t,n.clone(e))}const r=t.morphAttributes;for(const t in r){const n=[],i=r[t];for(let t=0,r=i.length;t<r;t++)n.push(i[t].clone(e));this.morphAttributes[t]=n}this.morphTargetsRelative=t.morphTargetsRelative;const o=t.groups;for(let t=0,e=o.length;t<e;t++){const e=o[t];this.addGroup(e.start,e.count,e.materialIndex)}const s=t.boundingBox;null!==s&&(this.boundingBox=s.clone());const a=t.boundingSphere;return null!==a&&(this.boundingSphere=a.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this.userData=t.userData,void 0!==t.parameters&&(this.parameters=Object.assign({},t.parameters)),this}dispose(){this.dispatchEvent({type:"dispose"})}}dl.prototype.isBufferGeometry=!0;const pl=new pa,fl=new da,ml=new ra,gl=new zs,_l=new zs,vl=new zs,yl=new zs,xl=new zs,bl=new zs,wl=new zs,Ml=new zs,Sl=new zs,Tl=new fs,El=new fs,Al=new fs,Cl=new zs,Rl=new zs;class Ll extends Fa{constructor(t=new dl,e=new Ka){super(),this.type="Mesh",this.geometry=t,this.material=e,this.updateMorphTargets()}copy(t){return super.copy(t),void 0!==t.morphTargetInfluences&&(this.morphTargetInfluences=t.morphTargetInfluences.slice()),void 0!==t.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},t.morphTargetDictionary)),this.material=t.material,this.geometry=t.geometry,this}updateMorphTargets(){const t=this.geometry;if(t.isBufferGeometry){const e=t.morphAttributes,n=Object.keys(e);if(n.length>0){const t=e[n[0]];if(void 0!==t){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,n=t.length;e<n;e++){const n=t[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[n]=e}}}}else{const e=t.morphTargets;void 0!==e&&e.length>0&&console.error("THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}}raycast(t,e){const n=this.geometry,i=this.material,r=this.matrixWorld;if(void 0===i)return;if(null===n.boundingSphere&&n.computeBoundingSphere(),ml.copy(n.boundingSphere),ml.applyMatrix4(r),!1===t.ray.intersectsSphere(ml))return;if(pl.copy(r).invert(),fl.copy(t.ray).applyMatrix4(pl),null!==n.boundingBox&&!1===fl.intersectsBox(n.boundingBox))return;let o;if(n.isBufferGeometry){const r=n.index,s=n.attributes.position,a=n.morphAttributes.position,l=n.morphTargetsRelative,c=n.attributes.uv,h=n.attributes.uv2,u=n.groups,d=n.drawRange;if(null!==r)if(Array.isArray(i))for(let n=0,p=u.length;n<p;n++){const p=u[n],f=i[p.materialIndex];for(let n=Math.max(p.start,d.start),i=Math.min(r.count,Math.min(p.start+p.count,d.start+d.count));n<i;n+=3){const i=r.getX(n),u=r.getX(n+1),d=r.getX(n+2);o=Pl(this,f,t,fl,s,a,l,c,h,i,u,d),o&&(o.faceIndex=Math.floor(n/3),o.face.materialIndex=p.materialIndex,e.push(o))}}else for(let n=Math.max(0,d.start),u=Math.min(r.count,d.start+d.count);n<u;n+=3){const u=r.getX(n),d=r.getX(n+1),p=r.getX(n+2);o=Pl(this,i,t,fl,s,a,l,c,h,u,d,p),o&&(o.faceIndex=Math.floor(n/3),e.push(o))}else if(void 0!==s)if(Array.isArray(i))for(let n=0,r=u.length;n<r;n++){const r=u[n],p=i[r.materialIndex];for(let n=Math.max(r.start,d.start),i=Math.min(s.count,Math.min(r.start+r.count,d.start+d.count));n<i;n+=3)o=Pl(this,p,t,fl,s,a,l,c,h,n,n+1,n+2),o&&(o.faceIndex=Math.floor(n/3),o.face.materialIndex=r.materialIndex,e.push(o))}else for(let n=Math.max(0,d.start),r=Math.min(s.count,d.start+d.count);n<r;n+=3)o=Pl(this,i,t,fl,s,a,l,c,h,n,n+1,n+2),o&&(o.faceIndex=Math.floor(n/3),e.push(o))}else n.isGeometry&&console.error("THREE.Mesh.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}}function Pl(t,e,n,i,r,o,s,a,l,c,h,u){gl.fromBufferAttribute(r,c),_l.fromBufferAttribute(r,h),vl.fromBufferAttribute(r,u);const d=t.morphTargetInfluences;if(o&&d){wl.set(0,0,0),Ml.set(0,0,0),Sl.set(0,0,0);for(let t=0,e=o.length;t<e;t++){const e=d[t],n=o[t];0!==e&&(yl.fromBufferAttribute(n,c),xl.fromBufferAttribute(n,h),bl.fromBufferAttribute(n,u),s?(wl.addScaledVector(yl,e),Ml.addScaledVector(xl,e),Sl.addScaledVector(bl,e)):(wl.addScaledVector(yl.sub(gl),e),Ml.addScaledVector(xl.sub(_l),e),Sl.addScaledVector(bl.sub(vl),e)))}gl.add(wl),_l.add(Ml),vl.add(Sl)}t.isSkinnedMesh&&(t.boneTransform(c,gl),t.boneTransform(h,_l),t.boneTransform(u,vl));const p=function(t,e,n,i,r,o,s,a){let l;if(l=1===e.side?i.intersectTriangle(s,o,r,!0,a):i.intersectTriangle(r,o,s,2!==e.side,a),null===l)return null;Rl.copy(a),Rl.applyMatrix4(t.matrixWorld);const c=n.ray.origin.distanceTo(Rl);return c<n.near||c>n.far?null:{distance:c,point:Rl.clone(),object:t}}(t,e,n,i,gl,_l,vl,Cl);if(p){a&&(Tl.fromBufferAttribute(a,c),El.fromBufferAttribute(a,h),Al.fromBufferAttribute(a,u),p.uv=Za.getUV(Cl,gl,_l,vl,Tl,El,Al,new fs)),l&&(Tl.fromBufferAttribute(l,c),El.fromBufferAttribute(l,h),Al.fromBufferAttribute(l,u),p.uv2=Za.getUV(Cl,gl,_l,vl,Tl,El,Al,new fs));const t={a:c,b:h,c:u,normal:new zs,materialIndex:0};Za.getNormal(gl,_l,vl,t.normal),p.face=t}return p}Ll.prototype.isMesh=!0;class Il extends dl{constructor(t=1,e=1,n=1,i=1,r=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:n,widthSegments:i,heightSegments:r,depthSegments:o};const s=this;i=Math.floor(i),r=Math.floor(r),o=Math.floor(o);const a=[],l=[],c=[],h=[];let u=0,d=0;function p(t,e,n,i,r,o,p,f,m,g,_){const v=o/m,y=p/g,x=o/2,b=p/2,w=f/2,M=m+1,S=g+1;let T=0,E=0;const A=new zs;for(let o=0;o<S;o++){const s=o*y-b;for(let a=0;a<M;a++){const u=a*v-x;A[t]=u*i,A[e]=s*r,A[n]=w,l.push(A.x,A.y,A.z),A[t]=0,A[e]=0,A[n]=f>0?1:-1,c.push(A.x,A.y,A.z),h.push(a/m),h.push(1-o/g),T+=1}}for(let t=0;t<g;t++)for(let e=0;e<m;e++){const n=u+e+M*t,i=u+e+M*(t+1),r=u+(e+1)+M*(t+1),o=u+(e+1)+M*t;a.push(n,i,o),a.push(i,r,o),E+=6}s.addGroup(d,E,_),d+=E,u+=T}p("z","y","x",-1,-1,n,e,t,o,r,0),p("z","y","x",1,-1,n,e,-t,o,r,1),p("x","z","y",1,1,t,n,e,i,o,2),p("x","z","y",1,-1,t,n,-e,i,o,3),p("x","y","z",1,-1,t,e,n,i,r,4),p("x","y","z",-1,-1,t,e,-n,i,r,5),this.setIndex(a),this.setAttribute("position",new rl(l,3)),this.setAttribute("normal",new rl(c,3)),this.setAttribute("uv",new rl(h,2))}static fromJSON(t){return new Il(t.width,t.height,t.depth,t.widthSegments,t.heightSegments,t.depthSegments)}}function Dl(t){const e={};for(const n in t){e[n]={};for(const i in t[n]){const r=t[n][i];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture||r.isQuaternion)?e[n][i]=r.clone():Array.isArray(r)?e[n][i]=r.slice():e[n][i]=r}}return e}function Ol(t){const e={};for(let n=0;n<t.length;n++){const i=Dl(t[n]);for(const t in i)e[t]=i[t]}return e}const Nl={clone:Dl,merge:Ol};class zl extends $a{constructor(t){super(),this.type="ShaderMaterial",this.defines={},this.uniforms={},this.vertexShader="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,void 0!==t&&(void 0!==t.attributes&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),this.setValues(t))}copy(t){return super.copy(t),this.fragmentShader=t.fragmentShader,this.vertexShader=t.vertexShader,this.uniforms=Dl(t.uniforms),this.defines=Object.assign({},t.defines),this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.lights=t.lights,this.clipping=t.clipping,this.extensions=Object.assign({},t.extensions),this.glslVersion=t.glslVersion,this}toJSON(t){const e=super.toJSON(t);e.glslVersion=this.glslVersion,e.uniforms={};for(const n in this.uniforms){const i=this.uniforms[n].value;i&&i.isTexture?e.uniforms[n]={type:"t",value:i.toJSON(t).uuid}:i&&i.isColor?e.uniforms[n]={type:"c",value:i.getHex()}:i&&i.isVector2?e.uniforms[n]={type:"v2",value:i.toArray()}:i&&i.isVector3?e.uniforms[n]={type:"v3",value:i.toArray()}:i&&i.isVector4?e.uniforms[n]={type:"v4",value:i.toArray()}:i&&i.isMatrix3?e.uniforms[n]={type:"m3",value:i.toArray()}:i&&i.isMatrix4?e.uniforms[n]={type:"m4",value:i.toArray()}:e.uniforms[n]={value:i}}Object.keys(this.defines).length>0&&(e.defines=this.defines),e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader;const n={};for(const t in this.extensions)!0===this.extensions[t]&&(n[t]=!0);return Object.keys(n).length>0&&(e.extensions=n),e}}zl.prototype.isShaderMaterial=!0;class Bl extends Fa{constructor(){super(),this.type="Camera",this.matrixWorldInverse=new pa,this.projectionMatrix=new pa,this.projectionMatrixInverse=new pa}copy(t,e){return super.copy(t,e),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this.projectionMatrixInverse.copy(t.projectionMatrixInverse),this}getWorldDirection(t){this.updateWorldMatrix(!0,!1);const e=this.matrixWorld.elements;return t.set(-e[8],-e[9],-e[10]).normalize()}updateMatrixWorld(t){super.updateMatrixWorld(t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(t,e){super.updateWorldMatrix(t,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return(new this.constructor).copy(this)}}Bl.prototype.isCamera=!0;class Fl extends Bl{constructor(t=50,e=1,n=.1,i=2e3){super(),this.type="PerspectiveCamera",this.fov=t,this.zoom=1,this.near=n,this.far=i,this.focus=10,this.aspect=e,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.fov=t.fov,this.zoom=t.zoom,this.near=t.near,this.far=t.far,this.focus=t.focus,this.aspect=t.aspect,this.view=null===t.view?null:Object.assign({},t.view),this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this}setFocalLength(t){const e=.5*this.getFilmHeight()/t;this.fov=2*ls*Math.atan(e),this.updateProjectionMatrix()}getFocalLength(){const t=Math.tan(.5*as*this.fov);return.5*this.getFilmHeight()/t}getEffectiveFOV(){return 2*ls*Math.atan(Math.tan(.5*as*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(t,e,n,i,r,o){this.aspect=t/e,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=this.near;let e=t*Math.tan(.5*as*this.fov)/this.zoom,n=2*e,i=this.aspect*n,r=-.5*i;const o=this.view;if(null!==this.view&&this.view.enabled){const t=o.fullWidth,s=o.fullHeight;r+=o.offsetX*i/t,e-=o.offsetY*n/s,i*=o.width/t,n*=o.height/s}const s=this.filmOffset;0!==s&&(r+=t*s/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+i,e,e-n,t,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const e=super.toJSON(t);return e.object.fov=this.fov,e.object.zoom=this.zoom,e.object.near=this.near,e.object.far=this.far,e.object.focus=this.focus,e.object.aspect=this.aspect,null!==this.view&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e}}Fl.prototype.isPerspectiveCamera=!0;const Hl=90;class Ul extends Fa{constructor(t,e,n){if(super(),this.type="CubeCamera",!0!==n.isWebGLCubeRenderTarget)return void console.error("THREE.CubeCamera: The constructor now expects an instance of WebGLCubeRenderTarget as third parameter.");this.renderTarget=n;const i=new Fl(Hl,1,t,e);i.layers=this.layers,i.up.set(0,-1,0),i.lookAt(new zs(1,0,0)),this.add(i);const r=new Fl(Hl,1,t,e);r.layers=this.layers,r.up.set(0,-1,0),r.lookAt(new zs(-1,0,0)),this.add(r);const o=new Fl(Hl,1,t,e);o.layers=this.layers,o.up.set(0,0,1),o.lookAt(new zs(0,1,0)),this.add(o);const s=new Fl(Hl,1,t,e);s.layers=this.layers,s.up.set(0,0,-1),s.lookAt(new zs(0,-1,0)),this.add(s);const a=new Fl(Hl,1,t,e);a.layers=this.layers,a.up.set(0,-1,0),a.lookAt(new zs(0,0,1)),this.add(a);const l=new Fl(Hl,1,t,e);l.layers=this.layers,l.up.set(0,-1,0),l.lookAt(new zs(0,0,-1)),this.add(l)}update(t,e){null===this.parent&&this.updateMatrixWorld();const n=this.renderTarget,[i,r,o,s,a,l]=this.children,c=t.xr.enabled,h=t.getRenderTarget();t.xr.enabled=!1;const u=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,t.setRenderTarget(n,0),t.render(e,i),t.setRenderTarget(n,1),t.render(e,r),t.setRenderTarget(n,2),t.render(e,o),t.setRenderTarget(n,3),t.render(e,s),t.setRenderTarget(n,4),t.render(e,a),n.texture.generateMipmaps=u,t.setRenderTarget(n,5),t.render(e,l),t.setRenderTarget(h),t.xr.enabled=c,n.texture.needsPMREMUpdate=!0}}class kl extends Ls{constructor(t,e,n,i,r,o,s,a,l,c){super(t=void 0!==t?t:[],e=void 0!==e?e:So,n,i,r,o,s,a,l,c),this.flipY=!1}get images(){return this.image}set images(t){this.image=t}}kl.prototype.isCubeTexture=!0;class Gl extends Is{constructor(t,e={}){super(t,t,e);const n={width:t,height:t,depth:1},i=[n,n,n,n,n,n];this.texture=new kl(i,e.mapping,e.wrapS,e.wrapT,e.magFilter,e.minFilter,e.format,e.type,e.anisotropy,e.encoding),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=void 0!==e.generateMipmaps&&e.generateMipmaps,this.texture.minFilter=void 0!==e.minFilter?e.minFilter:Po}fromEquirectangularTexture(t,e){this.texture.type=e.type,this.texture.format=Ho,this.texture.encoding=e.encoding,this.texture.generateMipmaps=e.generateMipmaps,this.texture.minFilter=e.minFilter,this.texture.magFilter=e.magFilter;const n={tEquirect:{value:null}},i="\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t\t#include <begin_vertex>\n\t\t\t\t\t#include <project_vertex>\n\n\t\t\t\t}\n\t\t\t",r="\n\n\t\t\t\tuniform sampler2D tEquirect;\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\t#include <common>\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t",o=new Il(5,5,5),s=new zl({name:"CubemapFromEquirect",uniforms:Dl(n),vertexShader:i,fragmentShader:r,side:1,blending:0});s.uniforms.tEquirect.value=e;const a=new Ll(o,s),l=e.minFilter;return e.minFilter===Io&&(e.minFilter=Po),new Ul(1,10,this).update(t,a),e.minFilter=l,a.geometry.dispose(),a.material.dispose(),this}clear(t,e,n,i){const r=t.getRenderTarget();for(let r=0;r<6;r++)t.setRenderTarget(this,r),t.clear(e,n,i);t.setRenderTarget(r)}}Gl.prototype.isWebGLCubeRenderTarget=!0;const Wl=new zs,Vl=new zs,jl=new ms;class ql{constructor(t=new zs(1,0,0),e=0){this.normal=t,this.constant=e}set(t,e){return this.normal.copy(t),this.constant=e,this}setComponents(t,e,n,i){return this.normal.set(t,e,n),this.constant=i,this}setFromNormalAndCoplanarPoint(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this}setFromCoplanarPoints(t,e,n){const i=Wl.subVectors(n,e).cross(Vl.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(i,t),this}copy(t){return this.normal.copy(t.normal),this.constant=t.constant,this}normalize(){const t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(t){return this.normal.dot(t)+this.constant}distanceToSphere(t){return this.distanceToPoint(t.center)-t.radius}projectPoint(t,e){return e.copy(this.normal).multiplyScalar(-this.distanceToPoint(t)).add(t)}intersectLine(t,e){const n=t.delta(Wl),i=this.normal.dot(n);if(0===i)return 0===this.distanceToPoint(t.start)?e.copy(t.start):null;const r=-(t.start.dot(this.normal)+this.constant)/i;return r<0||r>1?null:e.copy(n).multiplyScalar(r).add(t.start)}intersectsLine(t){const e=this.distanceToPoint(t.start),n=this.distanceToPoint(t.end);return e<0&&n>0||n<0&&e>0}intersectsBox(t){return t.intersectsPlane(this)}intersectsSphere(t){return t.intersectsPlane(this)}coplanarPoint(t){return t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){const n=e||jl.getNormalMatrix(t),i=this.coplanarPoint(Wl).applyMatrix4(t),r=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(r),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}clone(){return(new this.constructor).copy(this)}}ql.prototype.isPlane=!0;const Yl=new ra,Xl=new zs;class Zl{constructor(t=new ql,e=new ql,n=new ql,i=new ql,r=new ql,o=new ql){this.planes=[t,e,n,i,r,o]}set(t,e,n,i,r,o){const s=this.planes;return s[0].copy(t),s[1].copy(e),s[2].copy(n),s[3].copy(i),s[4].copy(r),s[5].copy(o),this}copy(t){const e=this.planes;for(let n=0;n<6;n++)e[n].copy(t.planes[n]);return this}setFromProjectionMatrix(t){const e=this.planes,n=t.elements,i=n[0],r=n[1],o=n[2],s=n[3],a=n[4],l=n[5],c=n[6],h=n[7],u=n[8],d=n[9],p=n[10],f=n[11],m=n[12],g=n[13],_=n[14],v=n[15];return e[0].setComponents(s-i,h-a,f-u,v-m).normalize(),e[1].setComponents(s+i,h+a,f+u,v+m).normalize(),e[2].setComponents(s+r,h+l,f+d,v+g).normalize(),e[3].setComponents(s-r,h-l,f-d,v-g).normalize(),e[4].setComponents(s-o,h-c,f-p,v-_).normalize(),e[5].setComponents(s+o,h+c,f+p,v+_).normalize(),this}intersectsObject(t){const e=t.geometry;return null===e.boundingSphere&&e.computeBoundingSphere(),Yl.copy(e.boundingSphere).applyMatrix4(t.matrixWorld),this.intersectsSphere(Yl)}intersectsSprite(t){return Yl.center.set(0,0,0),Yl.radius=.7071067811865476,Yl.applyMatrix4(t.matrixWorld),this.intersectsSphere(Yl)}intersectsSphere(t){const e=this.planes,n=t.center,i=-t.radius;for(let t=0;t<6;t++)if(e[t].distanceToPoint(n)<i)return!1;return!0}intersectsBox(t){const e=this.planes;for(let n=0;n<6;n++){const i=e[n];if(Xl.x=i.normal.x>0?t.max.x:t.min.x,Xl.y=i.normal.y>0?t.max.y:t.min.y,Xl.z=i.normal.z>0?t.max.z:t.min.z,i.distanceToPoint(Xl)<0)return!1}return!0}containsPoint(t){const e=this.planes;for(let n=0;n<6;n++)if(e[n].distanceToPoint(t)<0)return!1;return!0}clone(){return(new this.constructor).copy(this)}}function Jl(){let t=null,e=!1,n=null,i=null;function r(e,o){n(e,o),i=t.requestAnimationFrame(r)}return{start:function(){!0!==e&&null!==n&&(i=t.requestAnimationFrame(r),e=!0)},stop:function(){t.cancelAnimationFrame(i),e=!1},setAnimationLoop:function(t){n=t},setContext:function(e){t=e}}}function $l(t,e){const n=e.isWebGL2,i=new WeakMap;return{get:function(t){return t.isInterleavedBufferAttribute&&(t=t.data),i.get(t)},remove:function(e){e.isInterleavedBufferAttribute&&(e=e.data);const n=i.get(e);n&&(t.deleteBuffer(n.buffer),i.delete(e))},update:function(e,r){if(e.isGLBufferAttribute){const t=i.get(e);return void((!t||t.version<e.version)&&i.set(e,{buffer:e.buffer,type:e.type,bytesPerElement:e.elementSize,version:e.version}))}e.isInterleavedBufferAttribute&&(e=e.data);const o=i.get(e);void 0===o?i.set(e,function(e,i){const r=e.array,o=e.usage,s=t.createBuffer();let a;if(t.bindBuffer(i,s),t.bufferData(i,r,o),e.onUploadCallback(),r instanceof Float32Array)a=5126;else if(r instanceof Uint16Array)if(e.isFloat16BufferAttribute){if(!n)throw new Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.");a=5131}else a=5123;else if(r instanceof Int16Array)a=5122;else if(r instanceof Uint32Array)a=5125;else if(r instanceof Int32Array)a=5124;else if(r instanceof Int8Array)a=5120;else if(r instanceof Uint8Array)a=5121;else{if(!(r instanceof Uint8ClampedArray))throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+r);a=5121}return{buffer:s,type:a,bytesPerElement:r.BYTES_PER_ELEMENT,version:e.version}}(e,r)):o.version<e.version&&(function(e,i,r){const o=i.array,s=i.updateRange;t.bindBuffer(r,e),-1===s.count?t.bufferSubData(r,0,o):(n?t.bufferSubData(r,s.offset*o.BYTES_PER_ELEMENT,o,s.offset,s.count):t.bufferSubData(r,s.offset*o.BYTES_PER_ELEMENT,o.subarray(s.offset,s.offset+s.count)),s.count=-1)}(o.buffer,e,r),o.version=e.version)}}}class Kl extends dl{constructor(t=1,e=1,n=1,i=1){super(),this.type="PlaneGeometry",this.parameters={width:t,height:e,widthSegments:n,heightSegments:i};const r=t/2,o=e/2,s=Math.floor(n),a=Math.floor(i),l=s+1,c=a+1,h=t/s,u=e/a,d=[],p=[],f=[],m=[];for(let t=0;t<c;t++){const e=t*u-o;for(let n=0;n<l;n++){const i=n*h-r;p.push(i,-e,0),f.push(0,0,1),m.push(n/s),m.push(1-t/a)}}for(let t=0;t<a;t++)for(let e=0;e<s;e++){const n=e+l*t,i=e+l*(t+1),r=e+1+l*(t+1),o=e+1+l*t;d.push(n,i,o),d.push(i,r,o)}this.setIndex(d),this.setAttribute("position",new rl(p,3)),this.setAttribute("normal",new rl(f,3)),this.setAttribute("uv",new rl(m,2))}static fromJSON(t){return new Kl(t.width,t.height,t.widthSegments,t.heightSegments)}}const Ql={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 USE_ALPHATEST\n\tif ( diffuseColor.a < alphaTest ) discard;\n#endif",alphatest_pars_fragment:"#ifdef USE_ALPHATEST\n\tuniform float alphaTest;\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.roughness );\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:"vec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat V_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_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 f0, const in float f90, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( f0, f90, dotVH );\n\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( V * 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}\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_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, 1.0, dotVH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n\tfloat alpha = pow2( roughness );\n\tfloat invAlpha = 1.0 / alpha;\n\tfloat cos2h = dotNH * dotNH;\n\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 );\n\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n\treturn saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat D = D_Charlie( sheenRoughness, dotNH );\n\tfloat V = V_Neubelt( dotNV, dotNL );\n\treturn sheenColor * ( D * V );\n}\n#endif",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n\t\tvec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\n\t\tvec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 ) * faceDirection;\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#pragma unroll_loop_end\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\tif ( clipped ) discard;\n\t#endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#if defined( USE_COLOR_ALPHA )\n\tdiffuseColor *= vColor;\n#elif defined( USE_COLOR )\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR )\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvarying vec3 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n\tvColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n\tvColor.xyz *= instanceColor.xyz;\n#endif",common:"#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\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 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 USE_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}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat linearToRelativeLuminance( const in vec3 color ) {\n\tvec3 weights = vec3( 0.2126, 0.7152, 0.0722 );\n\treturn dot( weights, color.rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\tvec2 uv = getUV( direction, face ) * ( faceSize - 1.0 ) + 0.5;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tuv.x += filterInt * 3.0 * cubeUV_minTileSize;\n\t\tuv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n\t\tuv.x *= CUBEUV_TEXEL_WIDTH;\n\t\tuv.y *= CUBEUV_TEXEL_HEIGHT;\n\t\t#ifdef texture2DGradEXT\n\t\t\treturn texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n\t\t#else\n\t\t\treturn texture2D( envMap, uv ).rgb;\n\t\t#endif\n\t}\n\t#define r0 1.0\n\t#define v0 0.339\n\t#define m0 - 2.0\n\t#define r1 0.8\n\t#define v1 0.276\n\t#define m1 - 1.0\n\t#define r4 0.4\n\t#define v4 0.046\n\t#define m4 2.0\n\t#define r5 0.305\n\t#define v5 0.016\n\t#define m5 3.0\n\t#define r6 0.21\n\t#define v6 0.0038\n\t#define m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= r1 ) {\n\t\t\tmip = ( r0 - roughness ) * ( m1 - m0 ) / ( r0 - r1 ) + m0;\n\t\t} else if ( roughness >= r4 ) {\n\t\t\tmip = ( r1 - roughness ) * ( m4 - m1 ) / ( r1 - r4 ) + m1;\n\t\t} else if ( roughness >= r5 ) {\n\t\t\tmip = ( r4 - roughness ) * ( m5 - m4 ) / ( r4 - r5 ) + m4;\n\t\t} else if ( roughness >= r6 ) {\n\t\t\tmip = ( r5 - roughness ) * ( m6 - m5 ) / ( r5 - r6 ) + m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), m0, CUBEUV_MAX_MIP );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_INSTANCING\n\tmat3 m = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );\n\ttransformedNormal = m * transformedNormal;\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\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:"vec4 LinearToLinear( in vec4 value ) {\n\treturn value;\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}",envmap_fragment:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 envColor = textureCubeUV( envMap, reflectVec, 0.0 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#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\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 getIBLIrradiance( const in vec3 normal ) {\n\t\t#if defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );\n\t\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\tvec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n\t\t#if defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 reflectVec;\n\t\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\t\treflectVec = reflect( - viewDir, normal );\n\t\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t\t#else\n\t\t\t\treflectVec = refract( - viewDir, normal, refractionRatio );\n\t\t\t#endif\n\t\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\n\t\t\treturn envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\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\tvFogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float vFogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\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 vFogDepth;\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 vec3( texture2D( gradientMap, coord ).r );\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\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tlightMapIrradiance *= PI;\n\t#endif\n\treflectedLight.indirectDiffuse += lightMapIrradiance;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_vertex:"vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\nvIndirectFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n\tvIndirectBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\nvIndirectFront += getAmbientLightIrradiance( ambientLightColor );\nvIndirectFront += getLightProbeIrradiance( lightProbe, geometry.normal );\n#ifdef DOUBLE_SIDED\n\tvIndirectBack += getAmbientLightIrradiance( ambientLightColor );\n\tvIndirectBack += getLightProbeIrradiance( lightProbe, backGeometry.normal );\n#endif\n#if NUM_POINT_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointLightInfo( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = 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\tgetSpotLightInfo( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = 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\tgetDirectionalLightInfo( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = 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.normal );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry.normal );\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 vec3 normal ) {\n\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\treturn irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\t#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\t\tif ( cutoffDistance > 0.0 ) {\n\t\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t\t}\n\t\treturn distanceFalloff;\n\t#else\n\t\tif ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\t\treturn pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t\t}\n\t\treturn 1.0;\n\t#endif\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tlight.color = directionalLight.color;\n\t\tlight.direction = directionalLight.direction;\n\t\tlight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointLightInfo( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tlight.color = pointLight.color;\n\t\tlight.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotLightInfo( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat angleCos = dot( light.direction, spotLight.direction );\n\t\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\tif ( spotAttenuation > 0.0 ) {\n\t\t\tfloat lightDistance = length( lVector );\n\t\t\tlight.color = spotLight.color * spotAttenuation;\n\t\t\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t\t} else {\n\t\t\tlight.color = vec3( 0.0 );\n\t\t\tlight.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 vec3 normal ) {\n\t\tfloat dotNL = dot( normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\treturn irradiance;\n\t}\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\nstruct ToonMaterial {\n\tvec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_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;\nstruct BlinnPhongMaterial {\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometry.viewDir, geometry.normal, 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_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.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n\t#ifdef SPECULAR\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularColorFactor = specularColor;\n\t\t#ifdef USE_SPECULARINTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vUv ).a;\n\t\t#endif\n\t\t#ifdef USE_SPECULARCOLORMAP\n\t\t\tspecularColorFactor *= texture2D( specularColorMap, vUv ).rgb;\n\t\t#endif\n\t\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n\t#else\n\t\tfloat specularIntensityFactor = 1.0;\n\t\tvec3 specularColorFactor = vec3( 1.0 );\n\t\tmaterial.specularF90 = 1.0;\n\t#endif\n\tmaterial.specularColor = mix( min( pow2( ( ior - 1.0 ) / ( ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\tmaterial.clearcoatF0 = vec3( 0.04 );\n\tmaterial.clearcoatF90 = 1.0;\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 = sheenColor;\n\t#ifdef USE_SHEENCOLORMAP\n\t\tmaterial.sheenColor *= texture2D( sheenColorMap, vUv ).rgb;\n\t#endif\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n\t#ifdef USE_SHEENROUGHNESSMAP\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vUv ).a;\n\t#endif\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat roughness;\n\tvec3 specularColor;\n\tfloat specularF90;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat clearcoat;\n\t\tfloat clearcoatRoughness;\n\t\tvec3 clearcoatF0;\n\t\tfloat clearcoatF90;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n};\nvec3 clearcoatSpecular = vec3( 0.0 );\nvec3 sheenSpecular = vec3( 0.0 );\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat r2 = roughness * roughness;\n\tfloat a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n\tfloat b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n\tfloat DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n\treturn saturate( DG * RECIPROCAL_PI );\n}\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n\treturn fab;\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\treturn specularColor * fab.x + specularF90 * fab.y;\n}\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\tvec3 FssEss = specularColor * fab.x + specularF90 * fab.y;\n\tfloat Ess = fab.x + fab.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}\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.roughness;\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#ifdef USE_CLEARCOAT\n\t\tfloat dotNLcc = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\t\tclearcoatSpecular += ccIrradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.clearcoatNormal, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecular += irradiance * BRDF_Sheen( directLight.direction, geometry.viewDir, geometry.normal, material.sheenColor, material.sheenRoughness );\n\t#endif\n\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.roughness );\n\treflectedLight.directDiffuse += irradiance * BRDF_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_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 USE_CLEARCOAT\n\t\tclearcoatSpecular += clearcoatRadiance * EnvironmentBRDF( geometry.clearcoatNormal, geometry.viewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecular += irradiance * material.sheenColor * IBLSheenBRDF( geometry.normal, geometry.viewDir, material.sheenRoughness );\n\t#endif\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\tcomputeMultiscattering( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) );\n\treflectedLight.indirectSpecular += 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 USE_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\tgetPointLightInfo( 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\tgetSpotLightInfo( 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\tgetDirectionalLightInfo( 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.normal );\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.normal );\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 = 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 += getIBLIrradiance( geometry.normal );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tradiance += getIBLRadiance( geometry.viewDir, geometry.normal, material.roughness );\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatRadiance += getIBLRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness );\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 sampledDiffuseColor = texture2D( map, vUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\tsampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w );\n\t#endif\n\tdiffuseColor *= sampledDiffuseColor;\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\tdiffuseColor *= texture2D( map, uv );\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",morphcolor_vertex:"#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE )\n\tvColor *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t#if defined( USE_COLOR_ALPHA )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\n\t\t#elif defined( USE_COLOR )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ]\n\t\t#endif\n\t}\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\n\t\t}\n\t#else\n\t\tobjectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\n\t\tobjectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\n\t\tobjectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\n\t\tobjectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\n\t#endif\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\tuniform float morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\t\tuniform sampler2DArray morphTargetsTexture;\n\t\tuniform vec2 morphTargetsTextureSize;\n\t\tvec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n\t\t\tfloat texelIndex = float( vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset );\n\t\t\tfloat y = floor( texelIndex / morphTargetsTextureSize.x );\n\t\t\tfloat x = texelIndex - y * morphTargetsTextureSize.x;\n\t\t\tvec3 morphUV = vec3( ( x + 0.5 ) / morphTargetsTextureSize.x, y / morphTargetsTextureSize.y, morphTargetIndex );\n\t\t\treturn texture( morphTargetsTexture, morphUV );\n\t\t}\n\t#else\n\t\t#ifndef USE_MORPHNORMALS\n\t\t\tuniform float morphTargetInfluences[ 8 ];\n\t\t#else\n\t\t\tuniform float morphTargetInfluences[ 4 ];\n\t\t#endif\n\t#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n\t\t}\n\t#else\n\t\ttransformed += morphTarget0 * morphTargetInfluences[ 0 ];\n\t\ttransformed += morphTarget1 * morphTargetInfluences[ 1 ];\n\t\ttransformed += morphTarget2 * morphTargetInfluences[ 2 ];\n\t\ttransformed += morphTarget3 * morphTargetInfluences[ 3 ];\n\t\t#ifndef USE_MORPHNORMALS\n\t\t\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\n\t\t\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\n\t\t\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\n\t\t\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\n\t\t#endif\n\t#endif\n#endif",normal_fragment_begin:"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n\tvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\t#ifdef USE_TANGENT\n\t\tvec3 tangent = normalize( vTangent );\n\t\tvec3 bitangent = normalize( vBitangent );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\ttangent = tangent * faceDirection;\n\t\t\tbitangent = bitangent * faceDirection;\n\t\t#endif\n\t\t#if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tmat3 vTBN = mat3( tangent, bitangent, normal );\n\t\t#endif\n\t#endif\n#endif\nvec3 geometryNormal = normal;",normal_fragment_maps:"#ifdef OBJECTSPACE_NORMALMAP\n\tnormal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( TANGENTSPACE_NORMALMAP )\n\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\t#ifdef USE_TANGENT\n\t\tnormal = normalize( vTBN * mapN );\n\t#else\n\t\tnormal = perturbNormal2Arb( - vViewPosition, normal, mapN, faceDirection );\n\t#endif\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",normal_pars_fragment:"#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",normal_pars_vertex:"#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",normal_vertex:"#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",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN, float faceDirection ) {\n\t\tvec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\n\t\tvec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\t\tvec3 N = surf_norm;\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : faceDirection * inversesqrt( det );\n\t\treturn normalize( T * ( mapN.x * scale ) + B * ( mapN.y * scale ) + N * mapN.z );\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal = geometryNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\t#ifdef USE_TANGENT\n\t\tclearcoatNormal = normalize( vTBN * clearcoatMapN );\n\t#else\n\t\tclearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN, faceDirection );\n\t#endif\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif",output_fragment:"#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= transmissionAlpha + 0.1;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nvec4 pack2HalfToRGBA( vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\nvec2 unpackRGBATo2Half( vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n\treturn linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), \n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), \n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\tdp += shadowBias;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif",shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif",shadowmap_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0 || NUM_SPOT_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0\n\t\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\tvec4 shadowWorldPosition;\n\t#endif\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\t#ifdef BONE_TEXTURE\n\t\tuniform highp sampler2D boneTexture;\n\t\tuniform int boneTextureSize;\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\t\ty = dy * ( y + 0.5 );\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\treturn bone;\n\t\t}\n\t#else\n\t\tuniform mat4 boneMatrices[ MAX_BONES ];\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tmat4 bone = boneMatrices[ int(i) ];\n\t\t\treturn bone;\n\t\t}\n\t#endif\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3( 1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmission_fragment:"#ifdef USE_TRANSMISSION\n\tfloat transmissionAlpha = 1.0;\n\tfloat transmissionFactor = transmission;\n\tfloat thicknessFactor = thickness;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\ttransmissionFactor *= texture2D( transmissionMap, vUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tthicknessFactor *= texture2D( thicknessMap, vUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\n\tvec4 transmission = getIBLVolumeRefraction(\n\t\tn, v, roughnessFactor, material.diffuseColor, material.specularColor, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, ior, thicknessFactor,\n\t\tattenuationColor, attenuationDistance );\n\ttotalDiffuse = mix( totalDiffuse, transmission.rgb, transmissionFactor );\n\ttransmissionAlpha = mix( transmissionAlpha, transmission.a, transmissionFactor );\n#endif",transmission_pars_fragment:"#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tuniform sampler2D transmissionMap;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tuniform sampler2D thicknessMap;\n\t#endif\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\tvarying vec3 vWorldPosition;\n\tvec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n\t\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n\t\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n\t\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n\t\treturn normalize( refractionVector ) * thickness * modelScale;\n\t}\n\tfloat applyIorToRoughness( const in float roughness, const in float ior ) {\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\t}\n\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n\t\tfloat framebufferLod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\t#ifdef texture2DLodEXT\n\t\t\treturn texture2DLodEXT( transmissionSamplerMap, fragCoord.xy, framebufferLod );\n\t\t#else\n\t\t\treturn texture2D( transmissionSamplerMap, fragCoord.xy, framebufferLod );\n\t\t#endif\n\t}\n\tvec3 applyVolumeAttenuation( const in vec3 radiance, const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tif ( attenuationDistance == 0.0 ) {\n\t\t\treturn radiance;\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\t\t\treturn transmittance * radiance;\n\t\t}\n\t}\n\tvec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n\t\tconst in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n\t\tconst in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness,\n\t\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\trefractionCoords += 1.0;\n\t\trefractionCoords /= 2.0;\n\t\tvec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n\t\tvec3 attenuatedColor = applyVolumeAttenuation( transmittedLight.rgb, length( transmissionRay ), attenuationColor, attenuationDistance );\n\t\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n\t\treturn vec4( ( 1.0 - F ) * attenuatedColor * diffuseColor, transmittedLight.a );\n\t}\n#endif",uv_pars_fragment:"#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )\n\tvarying vec2 vUv;\n#endif",uv_pars_vertex:"#ifdef USE_UV\n\t#ifdef UVS_VERTEX_ONLY\n\t\tvec2 vUv;\n\t#else\n\t\tvarying vec2 vUv;\n\t#endif\n\tuniform mat3 uvTransform;\n#endif",uv_vertex:"#ifdef USE_UV\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n#endif",uv2_pars_fragment:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",uv2_pars_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n\tuniform mat3 uv2Transform;\n#endif",uv2_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION )\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_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}",background_frag:"uniform sampler2D t2D;\nvarying vec2 vUv;\nvoid main() {\n\tgl_FragColor = texture2D( t2D, vUv );\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}",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}",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}",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 <alphatest_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}",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}",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 <alphatest_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}",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}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",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\t#include <output_fragment>\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 <morphcolor_vertex>\n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinbase_vertex>\n\t\t#include <skinnormal_vertex>\n\t\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 <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_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\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\t\treflectedLight.indirectDiffuse += 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\t#include <output_fragment>\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 <morphcolor_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}",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 <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <fog_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <emissivemap_fragment>\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack;\n\t#else\n\t\treflectedLight.indirectDiffuse += vIndirectFront;\n\t#endif\n\t#include <lightmap_fragment>\n\treflectedLight.indirectDiffuse *= BRDF_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_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_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 <morphcolor_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 <normal_vertex>\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}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <fog_pars_fragment>\n#include <normal_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#else\n\t\tvec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\t#include <output_fragment>\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}",meshnormal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <normal_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\t#include <normal_vertex>\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}",meshnormal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <normal_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\t#ifdef OPAQUE\n\t\tgl_FragColor.a = 1.0;\n\t#endif\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\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 <normal_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 <morphcolor_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 <normal_vertex>\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}",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 <alphatest_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 <normal_pars_fragment>\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\t#include <output_fragment>\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#ifdef USE_TRANSMISSION\n\tvarying vec3 vWorldPosition;\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 <normal_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 <morphcolor_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 <normal_vertex>\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#ifdef USE_TRANSMISSION\n\tvWorldPosition = worldPosition.xyz;\n#endif\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n\t#define IOR\n\t#define SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n\tuniform float ior;\n#endif\n#ifdef SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\t#ifdef USE_SPECULARINTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n\t#ifdef USE_SPECULARCOLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\t#ifdef USE_SHEENCOLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\t#ifdef USE_SHEENROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\n#endif\nvarying vec3 vViewPosition;\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 <alphatest_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 <normal_pars_fragment>\n#include <lights_physical_pars_fragment>\n#include <transmission_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 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include <transmission_fragment>\n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\t#ifdef USE_SHEEN\n\t\tfloat sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n\t\toutgoingLight = outgoingLight * sheenEnergyComp + sheenSpecular;\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNVcc = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + clearcoatSpecular * material.clearcoat;\n\t#endif\n\t#include <output_fragment>\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#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 <normal_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 <morphcolor_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 <normal_vertex>\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}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_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 <normal_pars_fragment>\n#include <lights_toon_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_toon_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <output_fragment>\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}",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 <morphcolor_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}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <alphatest_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\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",shadow_vert:"#include <common>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\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 <worldpos_vertex>\n\t#include <shadowmap_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}",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}",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 <alphatest_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\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}"},tc={common:{diffuse:{value:new Ss(16777215)},opacity:{value:1},map:{value:null},uvTransform:{value:new ms},uv2Transform:{value:new ms},alphaMap:{value:null},alphaTest:{value:0}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},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 fs(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 Ss(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new Ss(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new ms}},sprite:{diffuse:{value:new Ss(16777215)},opacity:{value:1},center:{value:new fs(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new ms}}},ec={basic:{uniforms:Ol([tc.common,tc.specularmap,tc.envmap,tc.aomap,tc.lightmap,tc.fog]),vertexShader:Ql.meshbasic_vert,fragmentShader:Ql.meshbasic_frag},lambert:{uniforms:Ol([tc.common,tc.specularmap,tc.envmap,tc.aomap,tc.lightmap,tc.emissivemap,tc.fog,tc.lights,{emissive:{value:new Ss(0)}}]),vertexShader:Ql.meshlambert_vert,fragmentShader:Ql.meshlambert_frag},phong:{uniforms:Ol([tc.common,tc.specularmap,tc.envmap,tc.aomap,tc.lightmap,tc.emissivemap,tc.bumpmap,tc.normalmap,tc.displacementmap,tc.fog,tc.lights,{emissive:{value:new Ss(0)},specular:{value:new Ss(1118481)},shininess:{value:30}}]),vertexShader:Ql.meshphong_vert,fragmentShader:Ql.meshphong_frag},standard:{uniforms:Ol([tc.common,tc.envmap,tc.aomap,tc.lightmap,tc.emissivemap,tc.bumpmap,tc.normalmap,tc.displacementmap,tc.roughnessmap,tc.metalnessmap,tc.fog,tc.lights,{emissive:{value:new Ss(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Ql.meshphysical_vert,fragmentShader:Ql.meshphysical_frag},toon:{uniforms:Ol([tc.common,tc.aomap,tc.lightmap,tc.emissivemap,tc.bumpmap,tc.normalmap,tc.displacementmap,tc.gradientmap,tc.fog,tc.lights,{emissive:{value:new Ss(0)}}]),vertexShader:Ql.meshtoon_vert,fragmentShader:Ql.meshtoon_frag},matcap:{uniforms:Ol([tc.common,tc.bumpmap,tc.normalmap,tc.displacementmap,tc.fog,{matcap:{value:null}}]),vertexShader:Ql.meshmatcap_vert,fragmentShader:Ql.meshmatcap_frag},points:{uniforms:Ol([tc.points,tc.fog]),vertexShader:Ql.points_vert,fragmentShader:Ql.points_frag},dashed:{uniforms:Ol([tc.common,tc.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Ql.linedashed_vert,fragmentShader:Ql.linedashed_frag},depth:{uniforms:Ol([tc.common,tc.displacementmap]),vertexShader:Ql.depth_vert,fragmentShader:Ql.depth_frag},normal:{uniforms:Ol([tc.common,tc.bumpmap,tc.normalmap,tc.displacementmap,{opacity:{value:1}}]),vertexShader:Ql.meshnormal_vert,fragmentShader:Ql.meshnormal_frag},sprite:{uniforms:Ol([tc.sprite,tc.fog]),vertexShader:Ql.sprite_vert,fragmentShader:Ql.sprite_frag},background:{uniforms:{uvTransform:{value:new ms},t2D:{value:null}},vertexShader:Ql.background_vert,fragmentShader:Ql.background_frag},cube:{uniforms:Ol([tc.envmap,{opacity:{value:1}}]),vertexShader:Ql.cube_vert,fragmentShader:Ql.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Ql.equirect_vert,fragmentShader:Ql.equirect_frag},distanceRGBA:{uniforms:Ol([tc.common,tc.displacementmap,{referencePosition:{value:new zs},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Ql.distanceRGBA_vert,fragmentShader:Ql.distanceRGBA_frag},shadow:{uniforms:Ol([tc.lights,tc.fog,{color:{value:new Ss(0)},opacity:{value:1}}]),vertexShader:Ql.shadow_vert,fragmentShader:Ql.shadow_frag}};function nc(t,e,n,i,r,o){const s=new Ss(0);let a,l,c=!0===r?0:1,h=null,u=0,d=null;function p(t,e){n.buffers.color.setClear(t.r,t.g,t.b,e,o)}return{getClearColor:function(){return s},setClearColor:function(t,e=1){s.set(t),c=e,p(s,c)},getClearAlpha:function(){return c},setClearAlpha:function(t){c=t,p(s,c)},render:function(n,r){let o=!1,f=!0===r.isScene?r.background:null;f&&f.isTexture&&(f=e.get(f));const m=t.xr,g=m.getSession&&m.getSession();g&&"additive"===g.environmentBlendMode&&(f=null),null===f?p(s,c):f&&f.isColor&&(p(f,1),o=!0),(t.autoClear||o)&&t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil),f&&(f.isCubeTexture||f.mapping===Eo)?(void 0===l&&(l=new Ll(new Il(1,1,1),new zl({name:"BackgroundCubeMaterial",uniforms:Dl(ec.cube.uniforms),vertexShader:ec.cube.vertexShader,fragmentShader:ec.cube.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1})),l.geometry.deleteAttribute("normal"),l.geometry.deleteAttribute("uv"),l.onBeforeRender=function(t,e,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(l.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(l)),l.material.uniforms.envMap.value=f,l.material.uniforms.flipEnvMap.value=f.isCubeTexture&&!1===f.isRenderTargetTexture?-1:1,h===f&&u===f.version&&d===t.toneMapping||(l.material.needsUpdate=!0,h=f,u=f.version,d=t.toneMapping),n.unshift(l,l.geometry,l.material,0,0,null)):f&&f.isTexture&&(void 0===a&&(a=new Ll(new Kl(2,2),new zl({name:"BackgroundMaterial",uniforms:Dl(ec.background.uniforms),vertexShader:ec.background.vertexShader,fragmentShader:ec.background.fragmentShader,side:0,depthTest:!1,depthWrite:!1,fog:!1})),a.geometry.deleteAttribute("normal"),Object.defineProperty(a.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(a)),a.material.uniforms.t2D.value=f,!0===f.matrixAutoUpdate&&f.updateMatrix(),a.material.uniforms.uvTransform.value.copy(f.matrix),h===f&&u===f.version&&d===t.toneMapping||(a.material.needsUpdate=!0,h=f,u=f.version,d=t.toneMapping),n.unshift(a,a.geometry,a.material,0,0,null))}}}function ic(t,e,n,i){const r=t.getParameter(34921),o=i.isWebGL2?null:e.get("OES_vertex_array_object"),s=i.isWebGL2||null!==o,a={},l=d(null);let c=l;function h(e){return i.isWebGL2?t.bindVertexArray(e):o.bindVertexArrayOES(e)}function u(e){return i.isWebGL2?t.deleteVertexArray(e):o.deleteVertexArrayOES(e)}function d(t){const e=[],n=[],i=[];for(let t=0;t<r;t++)e[t]=0,n[t]=0,i[t]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:e,enabledAttributes:n,attributeDivisors:i,object:t,attributes:{},index:null}}function p(){const t=c.newAttributes;for(let e=0,n=t.length;e<n;e++)t[e]=0}function f(t){m(t,0)}function m(n,r){const o=c.newAttributes,s=c.enabledAttributes,a=c.attributeDivisors;o[n]=1,0===s[n]&&(t.enableVertexAttribArray(n),s[n]=1),a[n]!==r&&((i.isWebGL2?t:e.get("ANGLE_instanced_arrays"))[i.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](n,r),a[n]=r)}function g(){const e=c.newAttributes,n=c.enabledAttributes;for(let i=0,r=n.length;i<r;i++)n[i]!==e[i]&&(t.disableVertexAttribArray(i),n[i]=0)}function _(e,n,r,o,s,a){!0!==i.isWebGL2||5124!==r&&5125!==r?t.vertexAttribPointer(e,n,r,o,s,a):t.vertexAttribIPointer(e,n,r,s,a)}function v(){y(),c!==l&&(c=l,h(c.object))}function y(){l.geometry=null,l.program=null,l.wireframe=!1}return{setup:function(r,l,u,v,y){let x=!1;if(s){const e=function(e,n,r){const s=!0===r.wireframe;let l=a[e.id];void 0===l&&(l={},a[e.id]=l);let c=l[n.id];void 0===c&&(c={},l[n.id]=c);let h=c[s];return void 0===h&&(h=d(i.isWebGL2?t.createVertexArray():o.createVertexArrayOES()),c[s]=h),h}(v,u,l);c!==e&&(c=e,h(c.object)),x=function(t,e){const n=c.attributes,i=t.attributes;let r=0;for(const t in i){const e=n[t],o=i[t];if(void 0===e)return!0;if(e.attribute!==o)return!0;if(e.data!==o.data)return!0;r++}return c.attributesNum!==r||c.index!==e}(v,y),x&&function(t,e){const n={},i=t.attributes;let r=0;for(const t in i){const e=i[t],o={};o.attribute=e,e.data&&(o.data=e.data),n[t]=o,r++}c.attributes=n,c.attributesNum=r,c.index=e}(v,y)}else{const t=!0===l.wireframe;c.geometry===v.id&&c.program===u.id&&c.wireframe===t||(c.geometry=v.id,c.program=u.id,c.wireframe=t,x=!0)}!0===r.isInstancedMesh&&(x=!0),null!==y&&n.update(y,34963),x&&(function(r,o,s,a){if(!1===i.isWebGL2&&(r.isInstancedMesh||a.isInstancedBufferGeometry)&&null===e.get("ANGLE_instanced_arrays"))return;p();const l=a.attributes,c=s.getAttributes(),h=o.defaultAttributeValues;for(const e in c){const i=c[e];if(i.location>=0){let o=l[e];if(void 0===o&&("instanceMatrix"===e&&r.instanceMatrix&&(o=r.instanceMatrix),"instanceColor"===e&&r.instanceColor&&(o=r.instanceColor)),void 0!==o){const e=o.normalized,s=o.itemSize,l=n.get(o);if(void 0===l)continue;const c=l.buffer,h=l.type,u=l.bytesPerElement;if(o.isInterleavedBufferAttribute){const n=o.data,l=n.stride,d=o.offset;if(n.isInstancedInterleavedBuffer){for(let t=0;t<i.locationSize;t++)m(i.location+t,n.meshPerAttribute);!0!==r.isInstancedMesh&&void 0===a._maxInstanceCount&&(a._maxInstanceCount=n.meshPerAttribute*n.count)}else for(let t=0;t<i.locationSize;t++)f(i.location+t);t.bindBuffer(34962,c);for(let t=0;t<i.locationSize;t++)_(i.location+t,s/i.locationSize,h,e,l*u,(d+s/i.locationSize*t)*u)}else{if(o.isInstancedBufferAttribute){for(let t=0;t<i.locationSize;t++)m(i.location+t,o.meshPerAttribute);!0!==r.isInstancedMesh&&void 0===a._maxInstanceCount&&(a._maxInstanceCount=o.meshPerAttribute*o.count)}else for(let t=0;t<i.locationSize;t++)f(i.location+t);t.bindBuffer(34962,c);for(let t=0;t<i.locationSize;t++)_(i.location+t,s/i.locationSize,h,e,s*u,s/i.locationSize*t*u)}}else if(void 0!==h){const n=h[e];if(void 0!==n)switch(n.length){case 2:t.vertexAttrib2fv(i.location,n);break;case 3:t.vertexAttrib3fv(i.location,n);break;case 4:t.vertexAttrib4fv(i.location,n);break;default:t.vertexAttrib1fv(i.location,n)}}}}g()}(r,l,u,v),null!==y&&t.bindBuffer(34963,n.get(y).buffer))},reset:v,resetDefaultState:y,dispose:function(){v();for(const t in a){const e=a[t];for(const t in e){const n=e[t];for(const t in n)u(n[t].object),delete n[t];delete e[t]}delete a[t]}},releaseStatesOfGeometry:function(t){if(void 0===a[t.id])return;const e=a[t.id];for(const t in e){const n=e[t];for(const t in n)u(n[t].object),delete n[t];delete e[t]}delete a[t.id]},releaseStatesOfProgram:function(t){for(const e in a){const n=a[e];if(void 0===n[t.id])continue;const i=n[t.id];for(const t in i)u(i[t].object),delete i[t];delete n[t.id]}},initAttributes:p,enableAttribute:f,disableUnusedAttributes:g}}function rc(t,e,n,i){const r=i.isWebGL2;let o;this.setMode=function(t){o=t},this.render=function(e,i){t.drawArrays(o,e,i),n.update(i,o,1)},this.renderInstances=function(i,s,a){if(0===a)return;let l,c;if(r)l=t,c="drawArraysInstanced";else if(l=e.get("ANGLE_instanced_arrays"),c="drawArraysInstancedANGLE",null===l)return void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");l[c](o,i,s,a),n.update(s,o,a)}}function oc(t,e,n){let i;function r(e){if("highp"===e){if(t.getShaderPrecisionFormat(35633,36338).precision>0&&t.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";e="mediump"}return"mediump"===e&&t.getShaderPrecisionFormat(35633,36337).precision>0&&t.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}const o="undefined"!=typeof WebGL2RenderingContext&&t instanceof WebGL2RenderingContext||"undefined"!=typeof WebGL2ComputeRenderingContext&&t instanceof WebGL2ComputeRenderingContext;let s=void 0!==n.precision?n.precision:"highp";const a=r(s);a!==s&&(console.warn("THREE.WebGLRenderer:",s,"not supported, using",a,"instead."),s=a);const l=o||e.has("WEBGL_draw_buffers"),c=!0===n.logarithmicDepthBuffer,h=t.getParameter(34930),u=t.getParameter(35660),d=t.getParameter(3379),p=t.getParameter(34076),f=t.getParameter(34921),m=t.getParameter(36347),g=t.getParameter(36348),_=t.getParameter(36349),v=u>0,y=o||e.has("OES_texture_float");return{isWebGL2:o,drawBuffers:l,getMaxAnisotropy:function(){if(void 0!==i)return i;if(!0===e.has("EXT_texture_filter_anisotropic")){const n=e.get("EXT_texture_filter_anisotropic");i=t.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i},getMaxPrecision:r,precision:s,logarithmicDepthBuffer:c,maxTextures:h,maxVertexTextures:u,maxTextureSize:d,maxCubemapSize:p,maxAttributes:f,maxVertexUniforms:m,maxVaryings:g,maxFragmentUniforms:_,vertexTextures:v,floatFragmentTextures:y,floatVertexTextures:v&&y,maxSamples:o?t.getParameter(36183):0}}function sc(t){const e=this;let n=null,i=0,r=!1,o=!1;const s=new ql,a=new ms,l={value:null,needsUpdate:!1};function c(){l.value!==n&&(l.value=n,l.needsUpdate=i>0),e.numPlanes=i,e.numIntersection=0}function h(t,n,i,r){const o=null!==t?t.length:0;let c=null;if(0!==o){if(c=l.value,!0!==r||null===c){const e=i+4*o,r=n.matrixWorldInverse;a.getNormalMatrix(r),(null===c||c.length<e)&&(c=new Float32Array(e));for(let e=0,n=i;e!==o;++e,n+=4)s.copy(t[e]).applyMatrix4(r,a),s.normal.toArray(c,n),c[n+3]=s.constant}l.value=c,l.needsUpdate=!0}return e.numPlanes=o,e.numIntersection=0,c}this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(t,e,o){const s=0!==t.length||e||0!==i||r;return r=e,n=h(t,o,0),i=t.length,s},this.beginShadows=function(){o=!0,h(null)},this.endShadows=function(){o=!1,c()},this.setState=function(e,s,a){const u=e.clippingPlanes,d=e.clipIntersection,p=e.clipShadows,f=t.get(e);if(!r||null===u||0===u.length||o&&!p)o?h(null):c();else{const t=o?0:i,e=4*t;let r=f.clippingState||null;l.value=r,r=h(u,s,e,a);for(let t=0;t!==e;++t)r[t]=n[t];f.clippingState=r,this.numIntersection=d?this.numPlanes:0,this.numPlanes+=t}}}function ac(t){let e=new WeakMap;function n(t,e){return 303===e?t.mapping=So:304===e&&(t.mapping=To),t}function i(t){const n=t.target;n.removeEventListener("dispose",i);const r=e.get(n);void 0!==r&&(e.delete(n),r.dispose())}return{get:function(r){if(r&&r.isTexture&&!1===r.isRenderTargetTexture){const o=r.mapping;if(303===o||304===o){if(e.has(r))return n(e.get(r).texture,r.mapping);{const o=r.image;if(o&&o.height>0){const s=new Gl(o.height/2);return s.fromEquirectangularTexture(t,r),e.set(r,s),r.addEventListener("dispose",i),n(s.texture,r.mapping)}return null}}}return r},dispose:function(){e=new WeakMap}}}ec.physical={uniforms:Ol([ec.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new fs(1,1)},clearcoatNormalMap:{value:null},sheen:{value:0},sheenColor:{value:new Ss(0)},sheenColorMap:{value:null},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},transmission:{value:0},transmissionMap:{value:null},transmissionSamplerSize:{value:new fs},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},attenuationDistance:{value:0},attenuationColor:{value:new Ss(0)},specularIntensity:{value:1},specularIntensityMap:{value:null},specularColor:{value:new Ss(1,1,1)},specularColorMap:{value:null}}]),vertexShader:Ql.meshphysical_vert,fragmentShader:Ql.meshphysical_frag};class lc extends Bl{constructor(t=-1,e=1,n=1,i=-1,r=.1,o=2e3){super(),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=t,this.right=e,this.top=n,this.bottom=i,this.near=r,this.far=o,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.near=t.near,this.far=t.far,this.zoom=t.zoom,this.view=null===t.view?null:Object.assign({},t.view),this}setViewOffset(t,e,n,i,r,o){null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let r=n-t,o=n+t,s=i+e,a=i-e;if(null!==this.view&&this.view.enabled){const t=(this.right-this.left)/this.view.fullWidth/this.zoom,e=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=t*this.view.offsetX,o=r+t*this.view.width,s-=e*this.view.offsetY,a=s-e*this.view.height}this.projectionMatrix.makeOrthographic(r,o,s,a,this.near,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const e=super.toJSON(t);return e.object.zoom=this.zoom,e.object.left=this.left,e.object.right=this.right,e.object.top=this.top,e.object.bottom=this.bottom,e.object.near=this.near,e.object.far=this.far,null!==this.view&&(e.object.view=Object.assign({},this.view)),e}}lc.prototype.isOrthographicCamera=!0;const cc=[.125,.215,.35,.446,.526,.582],hc=new lc,uc=new Ss;let dc=null;const pc=(1+Math.sqrt(5))/2,fc=1/pc,mc=[new zs(1,1,1),new zs(-1,1,1),new zs(1,1,-1),new zs(-1,1,-1),new zs(0,pc,fc),new zs(0,pc,-fc),new zs(fc,0,pc),new zs(-fc,0,pc),new zs(pc,fc,0),new zs(-pc,fc,0)];class gc{constructor(t){this._renderer=t,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(t,e=0,n=.1,i=100){dc=this._renderer.getRenderTarget(),this._setSize(256);const r=this._allocateTargets();return r.depthBuffer=!0,this._sceneToCubeUV(t,n,i,r),e>0&&this._blur(r,0,0,e),this._applyPMREM(r),this._cleanup(r),r}fromEquirectangular(t,e=null){return this._fromTexture(t,e)}fromCubemap(t,e=null){return this._fromTexture(t,e)}compileCubemapShader(){null===this._cubemapMaterial&&(this._cubemapMaterial=xc(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){null===this._equirectMaterial&&(this._equirectMaterial=yc(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),null!==this._cubemapMaterial&&this._cubemapMaterial.dispose(),null!==this._equirectMaterial&&this._equirectMaterial.dispose()}_setSize(t){this._lodMax=Math.floor(Math.log2(t)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(let t=0;t<this._lodPlanes.length;t++)this._lodPlanes[t].dispose()}_cleanup(t){this._renderer.setRenderTarget(dc),t.scissorTest=!1,vc(t,0,0,t.width,t.height)}_fromTexture(t,e){t.mapping===So||t.mapping===To?this._setSize(0===t.image.length?16:t.image[0].width||t.image[0].image.width):this._setSize(t.image.width/4),dc=this._renderer.getRenderTarget();const n=e||this._allocateTargets();return this._textureToCubeUV(t,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTargets(){const t=3*Math.max(this._cubeSize,112),e=4*this._cubeSize-32,n={magFilter:Po,minFilter:Po,generateMipmaps:!1,type:Bo,format:Ho,encoding:Ko,depthBuffer:!1},i=_c(t,e,n);if(null===this._pingPongRenderTarget||this._pingPongRenderTarget.width!==t){null!==this._pingPongRenderTarget&&this._dispose(),this._pingPongRenderTarget=_c(t,e,n);const{_lodMax:i}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=function(t){const e=[],n=[],i=[];let r=t;const o=t-4+1+cc.length;for(let s=0;s<o;s++){const o=Math.pow(2,r);n.push(o);let a=1/o;s>t-4?a=cc[s-t+4-1]:0===s&&(a=0),i.push(a);const l=1/(o-1),c=-l/2,h=1+l/2,u=[c,c,h,c,h,h,c,c,h,h,c,h],d=6,p=6,f=3,m=2,g=1,_=new Float32Array(f*p*d),v=new Float32Array(m*p*d),y=new Float32Array(g*p*d);for(let t=0;t<d;t++){const e=t%3*2/3-1,n=t>2?0:-1,i=[e,n,0,e+2/3,n,0,e+2/3,n+1,0,e,n,0,e+2/3,n+1,0,e,n+1,0];_.set(i,f*p*t),v.set(u,m*p*t);const r=[t,t,t,t,t,t];y.set(r,g*p*t)}const x=new dl;x.setAttribute("position",new el(_,f)),x.setAttribute("uv",new el(v,m)),x.setAttribute("faceIndex",new el(y,g)),e.push(x),r>4&&r--}return{lodPlanes:e,sizeLods:n,sigmas:i}}(i)),this._blurMaterial=function(t,e,n){const i=new Float32Array(20),r=new zs(0,1,0);return new zl({name:"SphericalGaussianBlur",defines:{n:20,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${t}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform int samples;\n\t\t\tuniform float weights[ n ];\n\t\t\tuniform bool latitudinal;\n\t\t\tuniform float dTheta;\n\t\t\tuniform float mipInt;\n\t\t\tuniform vec3 poleAxis;\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include <cube_uv_reflection_fragment>\n\n\t\t\tvec3 getSample( float theta, vec3 axis ) {\n\n\t\t\t\tfloat cosTheta = cos( theta );\n\t\t\t\t// Rodrigues' axis-angle rotation\n\t\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t\t\t\t+ cross( axis, vOutputDirection ) * sin( theta )\n\t\t\t\t\t+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n\t\t\t\treturn bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n\t\t\t\tif ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n\t\t\t\t\taxis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n\t\t\t\t}\n\n\t\t\t\taxis = normalize( axis );\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n\t\t\t\tfor ( int i = 1; i < n; i++ ) {\n\n\t\t\t\t\tif ( i >= samples ) {\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfloat theta = dTheta * float( i );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n\t\t\t\t}\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}(i,t,e)}return i}_compileMaterial(t){const e=new Ll(this._lodPlanes[0],t);this._renderer.compile(e,hc)}_sceneToCubeUV(t,e,n,i){const r=new Fl(90,1,e,n),o=[1,-1,1,1,1,1],s=[1,1,1,-1,-1,-1],a=this._renderer,l=a.autoClear,c=a.toneMapping;a.getClearColor(uc),a.toneMapping=0,a.autoClear=!1;const h=new Ka({name:"PMREM.Background",side:1,depthWrite:!1,depthTest:!1}),u=new Ll(new Il,h);let d=!1;const p=t.background;p?p.isColor&&(h.color.copy(p),t.background=null,d=!0):(h.color.copy(uc),d=!0);for(let e=0;e<6;e++){const n=e%3;0===n?(r.up.set(0,o[e],0),r.lookAt(s[e],0,0)):1===n?(r.up.set(0,0,o[e]),r.lookAt(0,s[e],0)):(r.up.set(0,o[e],0),r.lookAt(0,0,s[e]));const l=this._cubeSize;vc(i,n*l,e>2?l:0,l,l),a.setRenderTarget(i),d&&a.render(u,r),a.render(t,r)}u.geometry.dispose(),u.material.dispose(),a.toneMapping=c,a.autoClear=l,t.background=p}_textureToCubeUV(t,e){const n=this._renderer,i=t.mapping===So||t.mapping===To;i?(null===this._cubemapMaterial&&(this._cubemapMaterial=xc()),this._cubemapMaterial.uniforms.flipEnvMap.value=!1===t.isRenderTargetTexture?-1:1):null===this._equirectMaterial&&(this._equirectMaterial=yc());const r=i?this._cubemapMaterial:this._equirectMaterial,o=new Ll(this._lodPlanes[0],r);r.uniforms.envMap.value=t;const s=this._cubeSize;vc(e,0,0,3*s,2*s),n.setRenderTarget(e),n.render(o,hc)}_applyPMREM(t){const e=this._renderer,n=e.autoClear;e.autoClear=!1;for(let e=1;e<this._lodPlanes.length;e++){const n=Math.sqrt(this._sigmas[e]*this._sigmas[e]-this._sigmas[e-1]*this._sigmas[e-1]),i=mc[(e-1)%mc.length];this._blur(t,e-1,e,n,i)}e.autoClear=n}_blur(t,e,n,i,r){const o=this._pingPongRenderTarget;this._halfBlur(t,o,e,n,i,"latitudinal",r),this._halfBlur(o,t,n,n,i,"longitudinal",r)}_halfBlur(t,e,n,i,r,o,s){const a=this._renderer,l=this._blurMaterial;"latitudinal"!==o&&"longitudinal"!==o&&console.error("blur direction must be either latitudinal or longitudinal!");const c=new Ll(this._lodPlanes[i],l),h=l.uniforms,u=this._sizeLods[n]-1,d=isFinite(r)?Math.PI/(2*u):2*Math.PI/39,p=r/d,f=isFinite(r)?1+Math.floor(3*p):20;f>20&&console.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${f} samples when the maximum is set to 20`);const m=[];let g=0;for(let t=0;t<20;++t){const e=t/p,n=Math.exp(-e*e/2);m.push(n),0===t?g+=n:t<f&&(g+=2*n)}for(let t=0;t<m.length;t++)m[t]=m[t]/g;h.envMap.value=t.texture,h.samples.value=f,h.weights.value=m,h.latitudinal.value="latitudinal"===o,s&&(h.poleAxis.value=s);const{_lodMax:_}=this;h.dTheta.value=d,h.mipInt.value=_-n;const v=this._sizeLods[i];vc(e,3*v*(i>_-4?i-_+4:0),4*(this._cubeSize-v),3*v,2*v),a.setRenderTarget(e),a.render(c,hc)}}function _c(t,e,n){const i=new Is(t,e,n);return i.texture.mapping=Eo,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function vc(t,e,n,i,r){t.viewport.set(e,n,i,r),t.scissor.set(e,n,i,r)}function yc(){return new zl({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\n\t\t\t#include <common>\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tgl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}function xc(){return new zl({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tuniform float flipEnvMap;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform samplerCube envMap;\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}function bc(t){let e=new WeakMap,n=null;function i(t){const n=t.target;n.removeEventListener("dispose",i);const r=e.get(n);void 0!==r&&(e.delete(n),r.dispose())}return{get:function(r){if(r&&r.isTexture){const o=r.mapping,s=303===o||304===o,a=o===So||o===To;if(s||a){if(r.isRenderTargetTexture&&!0===r.needsPMREMUpdate){r.needsPMREMUpdate=!1;let i=e.get(r);return null===n&&(n=new gc(t)),i=s?n.fromEquirectangular(r,i):n.fromCubemap(r,i),e.set(r,i),i.texture}if(e.has(r))return e.get(r).texture;{const o=r.image;if(s&&o&&o.height>0||a&&o&&function(t){let e=0;for(let n=0;n<6;n++)void 0!==t[n]&&e++;return 6===e}(o)){null===n&&(n=new gc(t));const o=s?n.fromEquirectangular(r):n.fromCubemap(r);return e.set(r,o),r.addEventListener("dispose",i),o.texture}return null}}}return r},dispose:function(){e=new WeakMap,null!==n&&(n.dispose(),n=null)}}}function wc(t){const e={};function n(n){if(void 0!==e[n])return e[n];let i;switch(n){case"WEBGL_depth_texture":i=t.getExtension("WEBGL_depth_texture")||t.getExtension("MOZ_WEBGL_depth_texture")||t.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":i=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=t.getExtension("WEBGL_compressed_texture_s3tc")||t.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:i=t.getExtension(n)}return e[n]=i,i}return{has:function(t){return null!==n(t)},init:function(t){t.isWebGL2?n("EXT_color_buffer_float"):(n("WEBGL_depth_texture"),n("OES_texture_float"),n("OES_texture_half_float"),n("OES_texture_half_float_linear"),n("OES_standard_derivatives"),n("OES_element_index_uint"),n("OES_vertex_array_object"),n("ANGLE_instanced_arrays")),n("OES_texture_float_linear"),n("EXT_color_buffer_half_float"),n("WEBGL_multisampled_render_to_texture")},get:function(t){const e=n(t);return null===e&&console.warn("THREE.WebGLRenderer: "+t+" extension not supported."),e}}}function Mc(t,e,n,i){const r={},o=new WeakMap;function s(t){const a=t.target;null!==a.index&&e.remove(a.index);for(const t in a.attributes)e.remove(a.attributes[t]);a.removeEventListener("dispose",s),delete r[a.id];const l=o.get(a);l&&(e.remove(l),o.delete(a)),i.releaseStatesOfGeometry(a),!0===a.isInstancedBufferGeometry&&delete a._maxInstanceCount,n.memory.geometries--}function a(t){const n=[],i=t.index,r=t.attributes.position;let s=0;if(null!==i){const t=i.array;s=i.version;for(let e=0,i=t.length;e<i;e+=3){const i=t[e+0],r=t[e+1],o=t[e+2];n.push(i,r,r,o,o,i)}}else{const t=r.array;s=r.version;for(let e=0,i=t.length/3-1;e<i;e+=3){const t=e+0,i=e+1,r=e+2;n.push(t,i,i,r,r,t)}}const a=new(gs(n)?il:nl)(n,1);a.version=s;const l=o.get(t);l&&e.remove(l),o.set(t,a)}return{get:function(t,e){return!0===r[e.id]||(e.addEventListener("dispose",s),r[e.id]=!0,n.memory.geometries++),e},update:function(t){const n=t.attributes;for(const t in n)e.update(n[t],34962);const i=t.morphAttributes;for(const t in i){const n=i[t];for(let t=0,i=n.length;t<i;t++)e.update(n[t],34962)}},getWireframeAttribute:function(t){const e=o.get(t);if(e){const n=t.index;null!==n&&e.version<n.version&&a(t)}else a(t);return o.get(t)}}}function Sc(t,e,n,i){const r=i.isWebGL2;let o,s,a;this.setMode=function(t){o=t},this.setIndex=function(t){s=t.type,a=t.bytesPerElement},this.render=function(e,i){t.drawElements(o,i,s,e*a),n.update(i,o,1)},this.renderInstances=function(i,l,c){if(0===c)return;let h,u;if(r)h=t,u="drawElementsInstanced";else if(h=e.get("ANGLE_instanced_arrays"),u="drawElementsInstancedANGLE",null===h)return void console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");h[u](o,l,s,i*a,c),n.update(l,o,c)}}function Tc(t){const e={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:{geometries:0,textures:0},render:e,programs:null,autoReset:!0,reset:function(){e.frame++,e.calls=0,e.triangles=0,e.points=0,e.lines=0},update:function(t,n,i){switch(e.calls++,n){case 4:e.triangles+=i*(t/3);break;case 1:e.lines+=i*(t/2);break;case 3:e.lines+=i*(t-1);break;case 2:e.lines+=i*t;break;case 0:e.points+=i*t;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",n)}}}}function Ec(t,e){return t[0]-e[0]}function Ac(t,e){return Math.abs(e[1])-Math.abs(t[1])}function Cc(t,e){let n=1;const i=e.isInterleavedBufferAttribute?e.data.array:e.array;i instanceof Int8Array?n=127:i instanceof Int16Array?n=32767:i instanceof Int32Array?n=2147483647:console.error("THREE.WebGLMorphtargets: Unsupported morph attribute data type: ",i),t.divideScalar(n)}function Rc(t,e,n){const i={},r=new Float32Array(8),o=new WeakMap,s=new Ps,a=[];for(let t=0;t<8;t++)a[t]=[t,0];return{update:function(l,c,h,u){const d=l.morphTargetInfluences;if(!0===e.isWebGL2){const p=c.morphAttributes.position||c.morphAttributes.normal||c.morphAttributes.color,f=void 0!==p?p.length:0;let m=o.get(c);if(void 0===m||m.count!==f){void 0!==m&&m.texture.dispose();const v=void 0!==c.morphAttributes.position,y=void 0!==c.morphAttributes.normal,x=void 0!==c.morphAttributes.color,b=c.morphAttributes.position||[],w=c.morphAttributes.normal||[],M=c.morphAttributes.color||[];let S=0;!0===v&&(S=1),!0===y&&(S=2),!0===x&&(S=3);let T=c.attributes.position.count*S,E=1;T>e.maxTextureSize&&(E=Math.ceil(T/e.maxTextureSize),T=e.maxTextureSize);const A=new Float32Array(T*E*4*f),C=new Ds(A,T,E,f);C.format=Ho,C.type=zo,C.needsUpdate=!0;const R=4*S;for(let P=0;P<f;P++){const I=b[P],D=w[P],O=M[P],N=T*E*4*P;for(let z=0;z<I.count;z++){const B=z*R;!0===v&&(s.fromBufferAttribute(I,z),!0===I.normalized&&Cc(s,I),A[N+B+0]=s.x,A[N+B+1]=s.y,A[N+B+2]=s.z,A[N+B+3]=0),!0===y&&(s.fromBufferAttribute(D,z),!0===D.normalized&&Cc(s,D),A[N+B+4]=s.x,A[N+B+5]=s.y,A[N+B+6]=s.z,A[N+B+7]=0),!0===x&&(s.fromBufferAttribute(O,z),!0===O.normalized&&Cc(s,D),A[N+B+8]=s.x,A[N+B+9]=s.y,A[N+B+10]=s.z,A[N+B+11]=4===O.itemSize?s.w:1)}}function L(){C.dispose(),o.delete(c),c.removeEventListener("dispose",L)}m={count:f,texture:C,size:new fs(T,E)},o.set(c,m),c.addEventListener("dispose",L)}let g=0;for(let F=0;F<d.length;F++)g+=d[F];const _=c.morphTargetsRelative?1:1-g;u.getUniforms().setValue(t,"morphTargetBaseInfluence",_),u.getUniforms().setValue(t,"morphTargetInfluences",d),u.getUniforms().setValue(t,"morphTargetsTexture",m.texture,n),u.getUniforms().setValue(t,"morphTargetsTextureSize",m.size)}else{const H=void 0===d?0:d.length;let U=i[c.id];if(void 0===U||U.length!==H){U=[];for(let j=0;j<H;j++)U[j]=[j,0];i[c.id]=U}for(let q=0;q<H;q++){const Y=U[q];Y[0]=q,Y[1]=d[q]}U.sort(Ac);for(let X=0;X<8;X++)X<H&&U[X][1]?(a[X][0]=U[X][0],a[X][1]=U[X][1]):(a[X][0]=Number.MAX_SAFE_INTEGER,a[X][1]=0);a.sort(Ec);const k=c.morphAttributes.position,G=c.morphAttributes.normal;let W=0;for(let Z=0;Z<8;Z++){const J=a[Z],$=J[0],K=J[1];$!==Number.MAX_SAFE_INTEGER&&K?(k&&c.getAttribute("morphTarget"+Z)!==k[$]&&c.setAttribute("morphTarget"+Z,k[$]),G&&c.getAttribute("morphNormal"+Z)!==G[$]&&c.setAttribute("morphNormal"+Z,G[$]),r[Z]=K,W+=K):(k&&!0===c.hasAttribute("morphTarget"+Z)&&c.deleteAttribute("morphTarget"+Z),G&&!0===c.hasAttribute("morphNormal"+Z)&&c.deleteAttribute("morphNormal"+Z),r[Z]=0)}const V=c.morphTargetsRelative?1:1-W;u.getUniforms().setValue(t,"morphTargetBaseInfluence",V),u.getUniforms().setValue(t,"morphTargetInfluences",r)}}}}function Lc(t,e,n,i){let r=new WeakMap;function o(t){const e=t.target;e.removeEventListener("dispose",o),n.remove(e.instanceMatrix),null!==e.instanceColor&&n.remove(e.instanceColor)}return{update:function(t){const s=i.render.frame,a=t.geometry,l=e.get(t,a);return r.get(l)!==s&&(e.update(l),r.set(l,s)),t.isInstancedMesh&&(!1===t.hasEventListener("dispose",o)&&t.addEventListener("dispose",o),n.update(t.instanceMatrix,34962),null!==t.instanceColor&&n.update(t.instanceColor,34962)),l},dispose:function(){r=new WeakMap}}}const Pc=new Ls,Ic=new Ds,Dc=new Os,Oc=new kl,Nc=[],zc=[],Bc=new Float32Array(16),Fc=new Float32Array(9),Hc=new Float32Array(4);function Uc(t,e,n){const i=t[0];if(i<=0||i>0)return t;const r=e*n;let o=Nc[r];if(void 0===o&&(o=new Float32Array(r),Nc[r]=o),0!==e){i.toArray(o,0);for(let i=1,r=0;i!==e;++i)r+=n,t[i].toArray(o,r)}return o}function kc(t,e){if(t.length!==e.length)return!1;for(let n=0,i=t.length;n<i;n++)if(t[n]!==e[n])return!1;return!0}function Gc(t,e){for(let n=0,i=e.length;n<i;n++)t[n]=e[n]}function Wc(t,e){let n=zc[e];void 0===n&&(n=new Int32Array(e),zc[e]=n);for(let i=0;i!==e;++i)n[i]=t.allocateTextureUnit();return n}function Vc(t,e){const n=this.cache;n[0]!==e&&(t.uniform1f(this.addr,e),n[0]=e)}function jc(t,e){const n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y||(t.uniform2f(this.addr,e.x,e.y),n[0]=e.x,n[1]=e.y);else{if(kc(n,e))return;t.uniform2fv(this.addr,e),Gc(n,e)}}function qc(t,e){const n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y&&n[2]===e.z||(t.uniform3f(this.addr,e.x,e.y,e.z),n[0]=e.x,n[1]=e.y,n[2]=e.z);else if(void 0!==e.r)n[0]===e.r&&n[1]===e.g&&n[2]===e.b||(t.uniform3f(this.addr,e.r,e.g,e.b),n[0]=e.r,n[1]=e.g,n[2]=e.b);else{if(kc(n,e))return;t.uniform3fv(this.addr,e),Gc(n,e)}}function Yc(t,e){const n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y&&n[2]===e.z&&n[3]===e.w||(t.uniform4f(this.addr,e.x,e.y,e.z,e.w),n[0]=e.x,n[1]=e.y,n[2]=e.z,n[3]=e.w);else{if(kc(n,e))return;t.uniform4fv(this.addr,e),Gc(n,e)}}function Xc(t,e){const n=this.cache,i=e.elements;if(void 0===i){if(kc(n,e))return;t.uniformMatrix2fv(this.addr,!1,e),Gc(n,e)}else{if(kc(n,i))return;Hc.set(i),t.uniformMatrix2fv(this.addr,!1,Hc),Gc(n,i)}}function Zc(t,e){const n=this.cache,i=e.elements;if(void 0===i){if(kc(n,e))return;t.uniformMatrix3fv(this.addr,!1,e),Gc(n,e)}else{if(kc(n,i))return;Fc.set(i),t.uniformMatrix3fv(this.addr,!1,Fc),Gc(n,i)}}function Jc(t,e){const n=this.cache,i=e.elements;if(void 0===i){if(kc(n,e))return;t.uniformMatrix4fv(this.addr,!1,e),Gc(n,e)}else{if(kc(n,i))return;Bc.set(i),t.uniformMatrix4fv(this.addr,!1,Bc),Gc(n,i)}}function $c(t,e){const n=this.cache;n[0]!==e&&(t.uniform1i(this.addr,e),n[0]=e)}function Kc(t,e){const n=this.cache;kc(n,e)||(t.uniform2iv(this.addr,e),Gc(n,e))}function Qc(t,e){const n=this.cache;kc(n,e)||(t.uniform3iv(this.addr,e),Gc(n,e))}function th(t,e){const n=this.cache;kc(n,e)||(t.uniform4iv(this.addr,e),Gc(n,e))}function eh(t,e){const n=this.cache;n[0]!==e&&(t.uniform1ui(this.addr,e),n[0]=e)}function nh(t,e){const n=this.cache;kc(n,e)||(t.uniform2uiv(this.addr,e),Gc(n,e))}function ih(t,e){const n=this.cache;kc(n,e)||(t.uniform3uiv(this.addr,e),Gc(n,e))}function rh(t,e){const n=this.cache;kc(n,e)||(t.uniform4uiv(this.addr,e),Gc(n,e))}function oh(t,e,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(t.uniform1i(this.addr,r),i[0]=r),n.setTexture2D(e||Pc,r)}function sh(t,e,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(t.uniform1i(this.addr,r),i[0]=r),n.setTexture3D(e||Dc,r)}function ah(t,e,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(t.uniform1i(this.addr,r),i[0]=r),n.setTextureCube(e||Oc,r)}function lh(t,e,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(t.uniform1i(this.addr,r),i[0]=r),n.setTexture2DArray(e||Ic,r)}function ch(t,e){t.uniform1fv(this.addr,e)}function hh(t,e){const n=Uc(e,this.size,2);t.uniform2fv(this.addr,n)}function uh(t,e){const n=Uc(e,this.size,3);t.uniform3fv(this.addr,n)}function dh(t,e){const n=Uc(e,this.size,4);t.uniform4fv(this.addr,n)}function ph(t,e){const n=Uc(e,this.size,4);t.uniformMatrix2fv(this.addr,!1,n)}function fh(t,e){const n=Uc(e,this.size,9);t.uniformMatrix3fv(this.addr,!1,n)}function mh(t,e){const n=Uc(e,this.size,16);t.uniformMatrix4fv(this.addr,!1,n)}function gh(t,e){t.uniform1iv(this.addr,e)}function _h(t,e){t.uniform2iv(this.addr,e)}function vh(t,e){t.uniform3iv(this.addr,e)}function yh(t,e){t.uniform4iv(this.addr,e)}function xh(t,e){t.uniform1uiv(this.addr,e)}function bh(t,e){t.uniform2uiv(this.addr,e)}function wh(t,e){t.uniform3uiv(this.addr,e)}function Mh(t,e){t.uniform4uiv(this.addr,e)}function Sh(t,e,n){const i=e.length,r=Wc(n,i);t.uniform1iv(this.addr,r);for(let t=0;t!==i;++t)n.setTexture2D(e[t]||Pc,r[t])}function Th(t,e,n){const i=e.length,r=Wc(n,i);t.uniform1iv(this.addr,r);for(let t=0;t!==i;++t)n.setTexture3D(e[t]||Dc,r[t])}function Eh(t,e,n){const i=e.length,r=Wc(n,i);t.uniform1iv(this.addr,r);for(let t=0;t!==i;++t)n.setTextureCube(e[t]||Oc,r[t])}function Ah(t,e,n){const i=e.length,r=Wc(n,i);t.uniform1iv(this.addr,r);for(let t=0;t!==i;++t)n.setTexture2DArray(e[t]||Ic,r[t])}function Ch(t,e,n){this.id=t,this.addr=n,this.cache=[],this.setValue=function(t){switch(t){case 5126:return Vc;case 35664:return jc;case 35665:return qc;case 35666:return Yc;case 35674:return Xc;case 35675:return Zc;case 35676:return Jc;case 5124:case 35670:return $c;case 35667:case 35671:return Kc;case 35668:case 35672:return Qc;case 35669:case 35673:return th;case 5125:return eh;case 36294:return nh;case 36295:return ih;case 36296:return rh;case 35678:case 36198:case 36298:case 36306:case 35682:return oh;case 35679:case 36299:case 36307:return sh;case 35680:case 36300:case 36308:case 36293:return ah;case 36289:case 36303:case 36311:case 36292:return lh}}(e.type)}function Rh(t,e,n){this.id=t,this.addr=n,this.cache=[],this.size=e.size,this.setValue=function(t){switch(t){case 5126:return ch;case 35664:return hh;case 35665:return uh;case 35666:return dh;case 35674:return ph;case 35675:return fh;case 35676:return mh;case 5124:case 35670:return gh;case 35667:case 35671:return _h;case 35668:case 35672:return vh;case 35669:case 35673:return yh;case 5125:return xh;case 36294:return bh;case 36295:return wh;case 36296:return Mh;case 35678:case 36198:case 36298:case 36306:case 35682:return Sh;case 35679:case 36299:case 36307:return Th;case 35680:case 36300:case 36308:case 36293:return Eh;case 36289:case 36303:case 36311:case 36292:return Ah}}(e.type)}function Lh(t){this.id=t,this.seq=[],this.map={}}Rh.prototype.updateCache=function(t){const e=this.cache;t instanceof Float32Array&&e.length!==t.length&&(this.cache=new Float32Array(t.length)),Gc(e,t)},Lh.prototype.setValue=function(t,e,n){const i=this.seq;for(let r=0,o=i.length;r!==o;++r){const o=i[r];o.setValue(t,e[o.id],n)}};const Ph=/(\w+)(\])?(\[|\.)?/g;function Ih(t,e){t.seq.push(e),t.map[e.id]=e}function Dh(t,e,n){const i=t.name,r=i.length;for(Ph.lastIndex=0;;){const o=Ph.exec(i),s=Ph.lastIndex;let a=o[1];const l="]"===o[2],c=o[3];if(l&&(a|=0),void 0===c||"["===c&&s+2===r){Ih(n,void 0===c?new Ch(a,t,e):new Rh(a,t,e));break}{let t=n.map[a];void 0===t&&(t=new Lh(a),Ih(n,t)),n=t}}}function Oh(t,e){this.seq=[],this.map={};const n=t.getProgramParameter(e,35718);for(let i=0;i<n;++i){const n=t.getActiveUniform(e,i);Dh(n,t.getUniformLocation(e,n.name),this)}}function Nh(t,e,n){const i=t.createShader(e);return t.shaderSource(i,n),t.compileShader(i),i}Oh.prototype.setValue=function(t,e,n,i){const r=this.map[e];void 0!==r&&r.setValue(t,n,i)},Oh.prototype.setOptional=function(t,e,n){const i=e[n];void 0!==i&&this.setValue(t,n,i)},Oh.upload=function(t,e,n,i){for(let r=0,o=e.length;r!==o;++r){const o=e[r],s=n[o.id];!1!==s.needsUpdate&&o.setValue(t,s.value,i)}},Oh.seqWithValue=function(t,e){const n=[];for(let i=0,r=t.length;i!==r;++i){const r=t[i];r.id in e&&n.push(r)}return n};let zh=0;function Bh(t,e,n){const i=t.getShaderParameter(e,35713),r=t.getShaderInfoLog(e).trim();return i&&""===r?"":n.toUpperCase()+"\n\n"+r+"\n\n"+function(t){const e=t.split("\n");for(let t=0;t<e.length;t++)e[t]=t+1+": "+e[t];return e.join("\n")}(t.getShaderSource(e))}function Fh(t,e){const n=function(t){switch(t){case Ko:return["Linear","( value )"];case Qo:return["sRGB","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported encoding:",t),["Linear","( value )"]}}(e);return"vec4 "+t+"( vec4 value ) { return LinearTo"+n[0]+n[1]+"; }"}function Hh(t,e){let n;switch(e){case 1:n="Linear";break;case 2:n="Reinhard";break;case 3:n="OptimizedCineon";break;case 4:n="ACESFilmic";break;case 5:n="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),n="Linear"}return"vec3 "+t+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}function Uh(t){return""!==t}function kh(t,e){return t.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function Gh(t,e){return t.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const Wh=/^[ \t]*#include +<([\w\d./]+)>/gm;function Vh(t){return t.replace(Wh,jh)}function jh(t,e){const n=Ql[e];if(void 0===n)throw new Error("Can not resolve #include <"+e+">");return Vh(n)}const qh=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,Yh=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function Xh(t){return t.replace(Yh,Jh).replace(qh,Zh)}function Zh(t,e,n,i){return console.warn("WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead."),Jh(0,e,n,i)}function Jh(t,e,n,i){let r="";for(let t=parseInt(e);t<parseInt(n);t++)r+=i.replace(/\[\s*i\s*\]/g,"[ "+t+" ]").replace(/UNROLLED_LOOP_INDEX/g,t);return r}function $h(t){let e="precision "+t.precision+" float;\nprecision "+t.precision+" int;";return"highp"===t.precision?e+="\n#define HIGH_PRECISION":"mediump"===t.precision?e+="\n#define MEDIUM_PRECISION":"lowp"===t.precision&&(e+="\n#define LOW_PRECISION"),e}function Kh(t,e,n,i){const r=t.getContext(),o=n.defines;let s=n.vertexShader,a=n.fragmentShader;const l=function(t){let e="SHADOWMAP_TYPE_BASIC";return 1===t.shadowMapType?e="SHADOWMAP_TYPE_PCF":2===t.shadowMapType?e="SHADOWMAP_TYPE_PCF_SOFT":3===t.shadowMapType&&(e="SHADOWMAP_TYPE_VSM"),e}(n),c=function(t){let e="ENVMAP_TYPE_CUBE";if(t.envMap)switch(t.envMapMode){case So:case To:e="ENVMAP_TYPE_CUBE";break;case Eo:case 307:e="ENVMAP_TYPE_CUBE_UV"}return e}(n),h=function(t){let e="ENVMAP_MODE_REFLECTION";if(t.envMap)switch(t.envMapMode){case To:case 307:e="ENVMAP_MODE_REFRACTION"}return e}(n),u=function(t){let e="ENVMAP_BLENDING_NONE";if(t.envMap)switch(t.combine){case 0:e="ENVMAP_BLENDING_MULTIPLY";break;case 1:e="ENVMAP_BLENDING_MIX";break;case 2:e="ENVMAP_BLENDING_ADD"}return e}(n),d=function(t){const e=t.envMapCubeUVHeight;if(null===e)return null;const n=Math.log2(e/32+1)+3,i=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,n),112)),texelHeight:i,maxMip:n}}(n),p=n.isWebGL2?"":function(t){return[t.extensionDerivatives||t.envMapCubeUVHeight||t.bumpMap||t.tangentSpaceNormalMap||t.clearcoatNormalMap||t.flatShading||"physical"===t.shaderID?"#extension GL_OES_standard_derivatives : enable":"",(t.extensionFragDepth||t.logarithmicDepthBuffer)&&t.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",t.extensionDrawBuffers&&t.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(t.extensionShaderTextureLOD||t.envMap||t.transmission)&&t.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(Uh).join("\n")}(n),f=function(t){const e=[];for(const n in t){const i=t[n];!1!==i&&e.push("#define "+n+" "+i)}return e.join("\n")}(o),m=r.createProgram();let g,_,v=n.glslVersion?"#version "+n.glslVersion+"\n":"";n.isRawShaderMaterial?(g=[f].filter(Uh).join("\n"),g.length>0&&(g+="\n"),_=[p,f].filter(Uh).join("\n"),_.length>0&&(_+="\n")):(g=[$h(n),"#define SHADER_NAME "+n.shaderName,f,n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#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 "+h:"",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.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",n.specularColorMap?"#define USE_SPECULARCOLORMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.sheenColorMap?"#define USE_SHEENCOLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",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.morphColors&&n.isWebGL2?"#define USE_MORPHCOLORS":"",n.morphTargetsCount>0&&n.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",n.morphTargetsCount>0&&n.isWebGL2?"#define MORPHTARGETS_TEXTURE_STRIDE "+n.morphTextureStride:"",n.morphTargetsCount>0&&n.isWebGL2?"#define MORPHTARGETS_COUNT "+n.morphTargetsCount:"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","\tattribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","\tattribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","\tattribute vec4 color;","#elif defined( USE_COLOR )","\tattribute vec3 color;","#endif","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )","\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(Uh).join("\n"),_=[p,$h(n),"#define SHADER_NAME "+n.shaderName,f,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+c:"",n.envMap?"#define "+h:"",n.envMap?"#define "+u:"",d?"#define CUBEUV_TEXEL_WIDTH "+d.texelWidth:"",d?"#define CUBEUV_TEXEL_HEIGHT "+d.texelHeight:"",d?"#define CUBEUV_MAX_MIP "+d.maxMip+".0":"",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.clearcoat?"#define USE_CLEARCOAT":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",n.specularColorMap?"#define USE_SPECULARCOLORMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaTest?"#define USE_ALPHATEST":"",n.sheen?"#define USE_SHEEN":"",n.sheenColorMap?"#define USE_SHEENCOLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUvs?"#define USE_UV":"",n.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",0!==n.toneMapping?"#define TONE_MAPPING":"",0!==n.toneMapping?Ql.tonemapping_pars_fragment:"",0!==n.toneMapping?Hh("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",Ql.encodings_pars_fragment,Fh("linearToOutputTexel",n.outputEncoding),n.depthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(Uh).join("\n")),s=Vh(s),s=kh(s,n),s=Gh(s,n),a=Vh(a),a=kh(a,n),a=Gh(a,n),s=Xh(s),a=Xh(a),n.isWebGL2&&!0!==n.isRawShaderMaterial&&(v="#version 300 es\n",g=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+g,_=["#define varying in",n.glslVersion===is?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===is?"":"#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"+_);const y=v+_+a,x=Nh(r,35633,v+g+s),b=Nh(r,35632,y);if(r.attachShader(m,x),r.attachShader(m,b),void 0!==n.index0AttributeName?r.bindAttribLocation(m,0,n.index0AttributeName):!0===n.morphTargets&&r.bindAttribLocation(m,0,"position"),r.linkProgram(m),t.debug.checkShaderErrors){const t=r.getProgramInfoLog(m).trim(),e=r.getShaderInfoLog(x).trim(),n=r.getShaderInfoLog(b).trim();let i=!0,o=!0;if(!1===r.getProgramParameter(m,35714)){i=!1;const e=Bh(r,x,"vertex"),n=Bh(r,b,"fragment");console.error("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(m,35715)+"\n\nProgram Info Log: "+t+"\n"+e+"\n"+n)}else""!==t?console.warn("THREE.WebGLProgram: Program Info Log:",t):""!==e&&""!==n||(o=!1);o&&(this.diagnostics={runnable:i,programLog:t,vertexShader:{log:e,prefix:g},fragmentShader:{log:n,prefix:_}})}let w,M;return r.deleteShader(x),r.deleteShader(b),this.getUniforms=function(){return void 0===w&&(w=new Oh(r,m)),w},this.getAttributes=function(){return void 0===M&&(M=function(t,e){const n={},i=t.getProgramParameter(e,35721);for(let r=0;r<i;r++){const i=t.getActiveAttrib(e,r),o=i.name;let s=1;35674===i.type&&(s=2),35675===i.type&&(s=3),35676===i.type&&(s=4),n[o]={type:i.type,location:t.getAttribLocation(e,o),locationSize:s}}return n}(r,m)),M},this.destroy=function(){i.releaseStatesOfProgram(this),r.deleteProgram(m),this.program=void 0},this.name=n.shaderName,this.id=zh++,this.cacheKey=e,this.usedTimes=1,this.program=m,this.vertexShader=x,this.fragmentShader=b,this}let Qh=0;class tu{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(t){const e=t.vertexShader,n=t.fragmentShader,i=this._getShaderStage(e),r=this._getShaderStage(n),o=this._getShaderCacheForMaterial(t);return!1===o.has(i)&&(o.add(i),i.usedTimes++),!1===o.has(r)&&(o.add(r),r.usedTimes++),this}remove(t){const e=this.materialCache.get(t);for(const t of e)t.usedTimes--,0===t.usedTimes&&this.shaderCache.delete(t);return this.materialCache.delete(t),this}getVertexShaderID(t){return this._getShaderStage(t.vertexShader).id}getFragmentShaderID(t){return this._getShaderStage(t.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(t){const e=this.materialCache;return!1===e.has(t)&&e.set(t,new Set),e.get(t)}_getShaderStage(t){const e=this.shaderCache;if(!1===e.has(t)){const n=new eu;e.set(t,n)}return e.get(t)}}class eu{constructor(){this.id=Qh++,this.usedTimes=0}}function nu(t,e,n,i,r,o,s){const a=new Sa,l=new tu,c=[],h=r.isWebGL2,u=r.logarithmicDepthBuffer,d=r.floatVertexTextures,p=r.maxVertexUniforms,f=r.vertexTextures;let m=r.precision;const g={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"};return{getParameters:function(o,a,c,_,v){const y=_.fog,x=v.geometry,b=o.isMeshStandardMaterial?_.environment:null,w=(o.isMeshStandardMaterial?n:e).get(o.envMap||b),M=!w||w.mapping!==Eo&&307!==w.mapping?null:w.image.height,S=g[o.type],T=v.isSkinnedMesh?function(t){const e=t.skeleton.bones;if(d)return 1024;{const t=p,n=Math.floor((t-20)/4),i=Math.min(n,e.length);return i<e.length?(console.warn("THREE.WebGLRenderer: Skeleton has "+e.length+" bones. This GPU supports "+i+"."),0):i}}(v):0;null!==o.precision&&(m=r.getMaxPrecision(o.precision),m!==o.precision&&console.warn("THREE.WebGLProgram.getParameters:",o.precision,"not supported, using",m,"instead."));const E=x.morphAttributes.position||x.morphAttributes.normal||x.morphAttributes.color,A=void 0!==E?E.length:0;let C,R,L,P,I=0;if(void 0!==x.morphAttributes.position&&(I=1),void 0!==x.morphAttributes.normal&&(I=2),void 0!==x.morphAttributes.color&&(I=3),S){const t=ec[S];C=t.vertexShader,R=t.fragmentShader}else C=o.vertexShader,R=o.fragmentShader,l.update(o),L=l.getVertexShaderID(o),P=l.getFragmentShaderID(o);const D=t.getRenderTarget(),O=o.alphaTest>0,N=o.clearcoat>0;return{isWebGL2:h,shaderID:S,shaderName:o.type,vertexShader:C,fragmentShader:R,defines:o.defines,customVertexShaderID:L,customFragmentShaderID:P,isRawShaderMaterial:!0===o.isRawShaderMaterial,glslVersion:o.glslVersion,precision:m,instancing:!0===v.isInstancedMesh,instancingColor:!0===v.isInstancedMesh&&null!==v.instanceColor,supportsVertexTextures:f,outputEncoding:null===D?t.outputEncoding:!0===D.isXRRenderTarget?D.texture.encoding:Ko,map:!!o.map,matcap:!!o.matcap,envMap:!!w,envMapMode:w&&w.mapping,envMapCubeUVHeight:M,lightMap:!!o.lightMap,aoMap:!!o.aoMap,emissiveMap:!!o.emissiveMap,bumpMap:!!o.bumpMap,normalMap:!!o.normalMap,objectSpaceNormalMap:1===o.normalMapType,tangentSpaceNormalMap:0===o.normalMapType,decodeVideoTexture:!!o.map&&!0===o.map.isVideoTexture&&o.map.encoding===Qo,clearcoat:N,clearcoatMap:N&&!!o.clearcoatMap,clearcoatRoughnessMap:N&&!!o.clearcoatRoughnessMap,clearcoatNormalMap:N&&!!o.clearcoatNormalMap,displacementMap:!!o.displacementMap,roughnessMap:!!o.roughnessMap,metalnessMap:!!o.metalnessMap,specularMap:!!o.specularMap,specularIntensityMap:!!o.specularIntensityMap,specularColorMap:!!o.specularColorMap,opaque:!1===o.transparent&&1===o.blending,alphaMap:!!o.alphaMap,alphaTest:O,gradientMap:!!o.gradientMap,sheen:o.sheen>0,sheenColorMap:!!o.sheenColorMap,sheenRoughnessMap:!!o.sheenRoughnessMap,transmission:o.transmission>0,transmissionMap:!!o.transmissionMap,thicknessMap:!!o.thicknessMap,combine:o.combine,vertexTangents:!!o.normalMap&&!!x.attributes.tangent,vertexColors:o.vertexColors,vertexAlphas:!0===o.vertexColors&&!!x.attributes.color&&4===x.attributes.color.itemSize,vertexUvs:!!(o.map||o.bumpMap||o.normalMap||o.specularMap||o.alphaMap||o.emissiveMap||o.roughnessMap||o.metalnessMap||o.clearcoatMap||o.clearcoatRoughnessMap||o.clearcoatNormalMap||o.displacementMap||o.transmissionMap||o.thicknessMap||o.specularIntensityMap||o.specularColorMap||o.sheenColorMap||o.sheenRoughnessMap),uvsVertexOnly:!(o.map||o.bumpMap||o.normalMap||o.specularMap||o.alphaMap||o.emissiveMap||o.roughnessMap||o.metalnessMap||o.clearcoatNormalMap||o.transmission>0||o.transmissionMap||o.thicknessMap||o.specularIntensityMap||o.specularColorMap||o.sheen>0||o.sheenColorMap||o.sheenRoughnessMap||!o.displacementMap),fog:!!y,useFog:o.fog,fogExp2:y&&y.isFogExp2,flatShading:!!o.flatShading,sizeAttenuation:o.sizeAttenuation,logarithmicDepthBuffer:u,skinning:!0===v.isSkinnedMesh&&T>0,maxBones:T,useVertexTexture:d,morphTargets:void 0!==x.morphAttributes.position,morphNormals:void 0!==x.morphAttributes.normal,morphColors:void 0!==x.morphAttributes.color,morphTargetsCount:A,morphTextureStride:I,numDirLights:a.directional.length,numPointLights:a.point.length,numSpotLights:a.spot.length,numRectAreaLights:a.rectArea.length,numHemiLights:a.hemi.length,numDirLightShadows:a.directionalShadowMap.length,numPointLightShadows:a.pointShadowMap.length,numSpotLightShadows:a.spotShadowMap.length,numClippingPlanes:s.numPlanes,numClipIntersection:s.numIntersection,dithering:o.dithering,shadowMapEnabled:t.shadowMap.enabled&&c.length>0,shadowMapType:t.shadowMap.type,toneMapping:o.toneMapped?t.toneMapping:0,physicallyCorrectLights:t.physicallyCorrectLights,premultipliedAlpha:o.premultipliedAlpha,doubleSided:2===o.side,flipSided:1===o.side,depthPacking:void 0!==o.depthPacking&&o.depthPacking,index0AttributeName:o.index0AttributeName,extensionDerivatives:o.extensions&&o.extensions.derivatives,extensionFragDepth:o.extensions&&o.extensions.fragDepth,extensionDrawBuffers:o.extensions&&o.extensions.drawBuffers,extensionShaderTextureLOD:o.extensions&&o.extensions.shaderTextureLOD,rendererExtensionFragDepth:h||i.has("EXT_frag_depth"),rendererExtensionDrawBuffers:h||i.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:h||i.has("EXT_shader_texture_lod"),customProgramCacheKey:o.customProgramCacheKey()}},getProgramCacheKey:function(e){const n=[];if(e.shaderID?n.push(e.shaderID):(n.push(e.customVertexShaderID),n.push(e.customFragmentShaderID)),void 0!==e.defines)for(const t in e.defines)n.push(t),n.push(e.defines[t]);return!1===e.isRawShaderMaterial&&(function(t,e){t.push(e.precision),t.push(e.outputEncoding),t.push(e.envMapMode),t.push(e.envMapCubeUVHeight),t.push(e.combine),t.push(e.vertexUvs),t.push(e.fogExp2),t.push(e.sizeAttenuation),t.push(e.maxBones),t.push(e.morphTargetsCount),t.push(e.morphAttributeCount),t.push(e.numDirLights),t.push(e.numPointLights),t.push(e.numSpotLights),t.push(e.numHemiLights),t.push(e.numRectAreaLights),t.push(e.numDirLightShadows),t.push(e.numPointLightShadows),t.push(e.numSpotLightShadows),t.push(e.shadowMapType),t.push(e.toneMapping),t.push(e.numClippingPlanes),t.push(e.numClipIntersection)}(n,e),function(t,e){a.disableAll(),e.isWebGL2&&a.enable(0),e.supportsVertexTextures&&a.enable(1),e.instancing&&a.enable(2),e.instancingColor&&a.enable(3),e.map&&a.enable(4),e.matcap&&a.enable(5),e.envMap&&a.enable(6),e.lightMap&&a.enable(7),e.aoMap&&a.enable(8),e.emissiveMap&&a.enable(9),e.bumpMap&&a.enable(10),e.normalMap&&a.enable(11),e.objectSpaceNormalMap&&a.enable(12),e.tangentSpaceNormalMap&&a.enable(13),e.clearcoat&&a.enable(14),e.clearcoatMap&&a.enable(15),e.clearcoatRoughnessMap&&a.enable(16),e.clearcoatNormalMap&&a.enable(17),e.displacementMap&&a.enable(18),e.specularMap&&a.enable(19),e.roughnessMap&&a.enable(20),e.metalnessMap&&a.enable(21),e.gradientMap&&a.enable(22),e.alphaMap&&a.enable(23),e.alphaTest&&a.enable(24),e.vertexColors&&a.enable(25),e.vertexAlphas&&a.enable(26),e.vertexUvs&&a.enable(27),e.vertexTangents&&a.enable(28),e.uvsVertexOnly&&a.enable(29),e.fog&&a.enable(30),t.push(a.mask),a.disableAll(),e.useFog&&a.enable(0),e.flatShading&&a.enable(1),e.logarithmicDepthBuffer&&a.enable(2),e.skinning&&a.enable(3),e.useVertexTexture&&a.enable(4),e.morphTargets&&a.enable(5),e.morphNormals&&a.enable(6),e.morphColors&&a.enable(7),e.premultipliedAlpha&&a.enable(8),e.shadowMapEnabled&&a.enable(9),e.physicallyCorrectLights&&a.enable(10),e.doubleSided&&a.enable(11),e.flipSided&&a.enable(12),e.depthPacking&&a.enable(13),e.dithering&&a.enable(14),e.specularIntensityMap&&a.enable(15),e.specularColorMap&&a.enable(16),e.transmission&&a.enable(17),e.transmissionMap&&a.enable(18),e.thicknessMap&&a.enable(19),e.sheen&&a.enable(20),e.sheenColorMap&&a.enable(21),e.sheenRoughnessMap&&a.enable(22),e.decodeVideoTexture&&a.enable(23),e.opaque&&a.enable(24),t.push(a.mask)}(n,e),n.push(t.outputEncoding)),n.push(e.customProgramCacheKey),n.join()},getUniforms:function(t){const e=g[t.type];let n;if(e){const t=ec[e];n=Nl.clone(t.uniforms)}else n=t.uniforms;return n},acquireProgram:function(e,n){let i;for(let t=0,e=c.length;t<e;t++){const e=c[t];if(e.cacheKey===n){i=e,++i.usedTimes;break}}return void 0===i&&(i=new Kh(t,n,e,o),c.push(i)),i},releaseProgram:function(t){if(0==--t.usedTimes){const e=c.indexOf(t);c[e]=c[c.length-1],c.pop(),t.destroy()}},releaseShaderCache:function(t){l.remove(t)},programs:c,dispose:function(){l.dispose()}}}function iu(){let t=new WeakMap;return{get:function(e){let n=t.get(e);return void 0===n&&(n={},t.set(e,n)),n},remove:function(e){t.delete(e)},update:function(e,n,i){t.get(e)[n]=i},dispose:function(){t=new WeakMap}}}function ru(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.material.id!==e.material.id?t.material.id-e.material.id:t.z!==e.z?t.z-e.z:t.id-e.id}function ou(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z!==e.z?e.z-t.z:t.id-e.id}function su(){const t=[];let e=0;const n=[],i=[],r=[];function o(n,i,r,o,s,a){let l=t[e];return void 0===l?(l={id:n.id,object:n,geometry:i,material:r,groupOrder:o,renderOrder:n.renderOrder,z:s,group:a},t[e]=l):(l.id=n.id,l.object=n,l.geometry=i,l.material=r,l.groupOrder=o,l.renderOrder=n.renderOrder,l.z=s,l.group=a),e++,l}return{opaque:n,transmissive:i,transparent:r,init:function(){e=0,n.length=0,i.length=0,r.length=0},push:function(t,e,s,a,l,c){const h=o(t,e,s,a,l,c);s.transmission>0?i.push(h):!0===s.transparent?r.push(h):n.push(h)},unshift:function(t,e,s,a,l,c){const h=o(t,e,s,a,l,c);s.transmission>0?i.unshift(h):!0===s.transparent?r.unshift(h):n.unshift(h)},finish:function(){for(let n=e,i=t.length;n<i;n++){const e=t[n];if(null===e.id)break;e.id=null,e.object=null,e.geometry=null,e.material=null,e.group=null}},sort:function(t,e){n.length>1&&n.sort(t||ru),i.length>1&&i.sort(e||ou),r.length>1&&r.sort(e||ou)}}}function au(){let t=new WeakMap;return{get:function(e,n){let i;return!1===t.has(e)?(i=new su,t.set(e,[i])):n>=t.get(e).length?(i=new su,t.get(e).push(i)):i=t.get(e)[n],i},dispose:function(){t=new WeakMap}}}function lu(){const t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];let n;switch(e.type){case"DirectionalLight":n={direction:new zs,color:new Ss};break;case"SpotLight":n={position:new zs,direction:new zs,color:new Ss,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new zs,color:new Ss,distance:0,decay:0};break;case"HemisphereLight":n={direction:new zs,skyColor:new Ss,groundColor:new Ss};break;case"RectAreaLight":n={color:new Ss,position:new zs,halfWidth:new zs,halfHeight:new zs}}return t[e.id]=n,n}}}let cu=0;function hu(t,e){return(e.castShadow?1:0)-(t.castShadow?1:0)}function uu(t,e){const n=new lu,i=function(){const t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];let n;switch(e.type){case"DirectionalLight":case"SpotLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new fs};break;case"PointLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new fs,shadowCameraNear:1,shadowCameraFar:1e3}}return t[e.id]=n,n}}}(),r={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadow:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[]};for(let t=0;t<9;t++)r.probe.push(new zs);const o=new zs,s=new pa,a=new pa;return{setup:function(o,s){let a=0,l=0,c=0;for(let t=0;t<9;t++)r.probe[t].set(0,0,0);let h=0,u=0,d=0,p=0,f=0,m=0,g=0,_=0;o.sort(hu);const v=!0!==s?Math.PI:1;for(let t=0,e=o.length;t<e;t++){const e=o[t],s=e.color,y=e.intensity,x=e.distance,b=e.shadow&&e.shadow.map?e.shadow.map.texture:null;if(e.isAmbientLight)a+=s.r*y*v,l+=s.g*y*v,c+=s.b*y*v;else if(e.isLightProbe)for(let t=0;t<9;t++)r.probe[t].addScaledVector(e.sh.coefficients[t],y);else if(e.isDirectionalLight){const t=n.get(e);if(t.color.copy(e.color).multiplyScalar(e.intensity*v),e.castShadow){const t=e.shadow,n=i.get(e);n.shadowBias=t.bias,n.shadowNormalBias=t.normalBias,n.shadowRadius=t.radius,n.shadowMapSize=t.mapSize,r.directionalShadow[h]=n,r.directionalShadowMap[h]=b,r.directionalShadowMatrix[h]=e.shadow.matrix,m++}r.directional[h]=t,h++}else if(e.isSpotLight){const t=n.get(e);if(t.position.setFromMatrixPosition(e.matrixWorld),t.color.copy(s).multiplyScalar(y*v),t.distance=x,t.coneCos=Math.cos(e.angle),t.penumbraCos=Math.cos(e.angle*(1-e.penumbra)),t.decay=e.decay,e.castShadow){const t=e.shadow,n=i.get(e);n.shadowBias=t.bias,n.shadowNormalBias=t.normalBias,n.shadowRadius=t.radius,n.shadowMapSize=t.mapSize,r.spotShadow[d]=n,r.spotShadowMap[d]=b,r.spotShadowMatrix[d]=e.shadow.matrix,_++}r.spot[d]=t,d++}else if(e.isRectAreaLight){const t=n.get(e);t.color.copy(s).multiplyScalar(y),t.halfWidth.set(.5*e.width,0,0),t.halfHeight.set(0,.5*e.height,0),r.rectArea[p]=t,p++}else if(e.isPointLight){const t=n.get(e);if(t.color.copy(e.color).multiplyScalar(e.intensity*v),t.distance=e.distance,t.decay=e.decay,e.castShadow){const t=e.shadow,n=i.get(e);n.shadowBias=t.bias,n.shadowNormalBias=t.normalBias,n.shadowRadius=t.radius,n.shadowMapSize=t.mapSize,n.shadowCameraNear=t.camera.near,n.shadowCameraFar=t.camera.far,r.pointShadow[u]=n,r.pointShadowMap[u]=b,r.pointShadowMatrix[u]=e.shadow.matrix,g++}r.point[u]=t,u++}else if(e.isHemisphereLight){const t=n.get(e);t.skyColor.copy(e.color).multiplyScalar(y*v),t.groundColor.copy(e.groundColor).multiplyScalar(y*v),r.hemi[f]=t,f++}}p>0&&(e.isWebGL2||!0===t.has("OES_texture_float_linear")?(r.rectAreaLTC1=tc.LTC_FLOAT_1,r.rectAreaLTC2=tc.LTC_FLOAT_2):!0===t.has("OES_texture_half_float_linear")?(r.rectAreaLTC1=tc.LTC_HALF_1,r.rectAreaLTC2=tc.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),r.ambient[0]=a,r.ambient[1]=l,r.ambient[2]=c;const y=r.hash;y.directionalLength===h&&y.pointLength===u&&y.spotLength===d&&y.rectAreaLength===p&&y.hemiLength===f&&y.numDirectionalShadows===m&&y.numPointShadows===g&&y.numSpotShadows===_||(r.directional.length=h,r.spot.length=d,r.rectArea.length=p,r.point.length=u,r.hemi.length=f,r.directionalShadow.length=m,r.directionalShadowMap.length=m,r.pointShadow.length=g,r.pointShadowMap.length=g,r.spotShadow.length=_,r.spotShadowMap.length=_,r.directionalShadowMatrix.length=m,r.pointShadowMatrix.length=g,r.spotShadowMatrix.length=_,y.directionalLength=h,y.pointLength=u,y.spotLength=d,y.rectAreaLength=p,y.hemiLength=f,y.numDirectionalShadows=m,y.numPointShadows=g,y.numSpotShadows=_,r.version=cu++)},setupView:function(t,e){let n=0,i=0,l=0,c=0,h=0;const u=e.matrixWorldInverse;for(let e=0,d=t.length;e<d;e++){const d=t[e];if(d.isDirectionalLight){const t=r.directional[n];t.direction.setFromMatrixPosition(d.matrixWorld),o.setFromMatrixPosition(d.target.matrixWorld),t.direction.sub(o),t.direction.transformDirection(u),n++}else if(d.isSpotLight){const t=r.spot[l];t.position.setFromMatrixPosition(d.matrixWorld),t.position.applyMatrix4(u),t.direction.setFromMatrixPosition(d.matrixWorld),o.setFromMatrixPosition(d.target.matrixWorld),t.direction.sub(o),t.direction.transformDirection(u),l++}else if(d.isRectAreaLight){const t=r.rectArea[c];t.position.setFromMatrixPosition(d.matrixWorld),t.position.applyMatrix4(u),a.identity(),s.copy(d.matrixWorld),s.premultiply(u),a.extractRotation(s),t.halfWidth.set(.5*d.width,0,0),t.halfHeight.set(0,.5*d.height,0),t.halfWidth.applyMatrix4(a),t.halfHeight.applyMatrix4(a),c++}else if(d.isPointLight){const t=r.point[i];t.position.setFromMatrixPosition(d.matrixWorld),t.position.applyMatrix4(u),i++}else if(d.isHemisphereLight){const t=r.hemi[h];t.direction.setFromMatrixPosition(d.matrixWorld),t.direction.transformDirection(u),t.direction.normalize(),h++}}},state:r}}function du(t,e){const n=new uu(t,e),i=[],r=[];return{init:function(){i.length=0,r.length=0},state:{lightsArray:i,shadowsArray:r,lights:n},setupLights:function(t){n.setup(i,t)},setupLightsView:function(t){n.setupView(i,t)},pushLight:function(t){i.push(t)},pushShadow:function(t){r.push(t)}}}function pu(t,e){let n=new WeakMap;return{get:function(i,r=0){let o;return!1===n.has(i)?(o=new du(t,e),n.set(i,[o])):r>=n.get(i).length?(o=new du(t,e),n.get(i).push(o)):o=n.get(i)[r],o},dispose:function(){n=new WeakMap}}}class fu extends $a{constructor(t){super(),this.type="MeshDepthMaterial",this.depthPacking=3200,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.setValues(t)}copy(t){return super.copy(t),this.depthPacking=t.depthPacking,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this}}fu.prototype.isMeshDepthMaterial=!0;class mu extends $a{constructor(t){super(),this.type="MeshDistanceMaterial",this.referencePosition=new zs,this.nearDistance=1,this.farDistance=1e3,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.fog=!1,this.setValues(t)}copy(t){return super.copy(t),this.referencePosition.copy(t.referencePosition),this.nearDistance=t.nearDistance,this.farDistance=t.farDistance,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this}}function gu(t,e,n){let i=new Zl;const r=new fs,o=new fs,s=new Ps,a=new fu({depthPacking:3201}),l=new mu,c={},h=n.maxTextureSize,u={0:1,1:0,2:2},d=new zl({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new fs},radius:{value:4}},vertexShader:"void main() {\n\tgl_Position = vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include <packing>\nvoid main() {\n\tconst float samples = float( VSM_SAMPLES );\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n\tfloat uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n\tfor ( float i = 0.0; i < samples; i ++ ) {\n\t\tfloat uvOffset = uvStart + i * uvStride;\n\t\t#ifdef HORIZONTAL_PASS\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\t\t#else\n\t\t\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean / samples;\n\tsquared_mean = squared_mean / samples;\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}"}),p=d.clone();p.defines.HORIZONTAL_PASS=1;const f=new dl;f.setAttribute("position",new el(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const m=new Ll(f,d),g=this;function _(n,i){const r=e.update(m);d.defines.VSM_SAMPLES!==n.blurSamples&&(d.defines.VSM_SAMPLES=n.blurSamples,p.defines.VSM_SAMPLES=n.blurSamples,d.needsUpdate=!0,p.needsUpdate=!0),d.uniforms.shadow_pass.value=n.map.texture,d.uniforms.resolution.value=n.mapSize,d.uniforms.radius.value=n.radius,t.setRenderTarget(n.mapPass),t.clear(),t.renderBufferDirect(i,null,r,d,m,null),p.uniforms.shadow_pass.value=n.mapPass.texture,p.uniforms.resolution.value=n.mapSize,p.uniforms.radius.value=n.radius,t.setRenderTarget(n.map),t.clear(),t.renderBufferDirect(i,null,r,p,m,null)}function v(e,n,i,r,o,s){let h=null;const d=!0===i.isPointLight?e.customDistanceMaterial:e.customDepthMaterial;if(h=void 0!==d?d:!0===i.isPointLight?l:a,t.localClippingEnabled&&!0===n.clipShadows&&0!==n.clippingPlanes.length||n.displacementMap&&0!==n.displacementScale||n.alphaMap&&n.alphaTest>0){const t=h.uuid,e=n.uuid;let i=c[t];void 0===i&&(i={},c[t]=i);let r=i[e];void 0===r&&(r=h.clone(),i[e]=r),h=r}return h.visible=n.visible,h.wireframe=n.wireframe,h.side=3===s?null!==n.shadowSide?n.shadowSide:n.side:null!==n.shadowSide?n.shadowSide:u[n.side],h.alphaMap=n.alphaMap,h.alphaTest=n.alphaTest,h.clipShadows=n.clipShadows,h.clippingPlanes=n.clippingPlanes,h.clipIntersection=n.clipIntersection,h.displacementMap=n.displacementMap,h.displacementScale=n.displacementScale,h.displacementBias=n.displacementBias,h.wireframeLinewidth=n.wireframeLinewidth,h.linewidth=n.linewidth,!0===i.isPointLight&&!0===h.isMeshDistanceMaterial&&(h.referencePosition.setFromMatrixPosition(i.matrixWorld),h.nearDistance=r,h.farDistance=o),h}function y(n,r,o,s,a){if(!1===n.visible)return;if(n.layers.test(r.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&3===a)&&(!n.frustumCulled||i.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(o.matrixWorldInverse,n.matrixWorld);const i=e.update(n),r=n.material;if(Array.isArray(r)){const e=i.groups;for(let l=0,c=e.length;l<c;l++){const c=e[l],h=r[c.materialIndex];if(h&&h.visible){const e=v(n,h,s,o.near,o.far,a);t.renderBufferDirect(o,null,i,e,n,c)}}}else if(r.visible){const e=v(n,r,s,o.near,o.far,a);t.renderBufferDirect(o,null,i,e,n,null)}}const l=n.children;for(let t=0,e=l.length;t<e;t++)y(l[t],r,o,s,a)}this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=1,this.render=function(e,n,a){if(!1===g.enabled)return;if(!1===g.autoUpdate&&!1===g.needsUpdate)return;if(0===e.length)return;const l=t.getRenderTarget(),c=t.getActiveCubeFace(),u=t.getActiveMipmapLevel(),d=t.state;d.setBlending(0),d.buffers.color.setClear(1,1,1,1),d.buffers.depth.setTest(!0),d.setScissorTest(!1);for(let l=0,c=e.length;l<c;l++){const c=e[l],u=c.shadow;if(void 0===u){console.warn("THREE.WebGLShadowMap:",c,"has no shadow.");continue}if(!1===u.autoUpdate&&!1===u.needsUpdate)continue;r.copy(u.mapSize);const p=u.getFrameExtents();if(r.multiply(p),o.copy(u.mapSize),(r.x>h||r.y>h)&&(r.x>h&&(o.x=Math.floor(h/p.x),r.x=o.x*p.x,u.mapSize.x=o.x),r.y>h&&(o.y=Math.floor(h/p.y),r.y=o.y*p.y,u.mapSize.y=o.y)),null===u.map&&!u.isPointLightShadow&&3===this.type){const t={minFilter:Po,magFilter:Po,format:Ho};u.map=new Is(r.x,r.y,t),u.map.texture.name=c.name+".shadowMap",u.mapPass=new Is(r.x,r.y,t),u.camera.updateProjectionMatrix()}if(null===u.map){const t={minFilter:Lo,magFilter:Lo,format:Ho};u.map=new Is(r.x,r.y,t),u.map.texture.name=c.name+".shadowMap",u.camera.updateProjectionMatrix()}t.setRenderTarget(u.map),t.clear();const f=u.getViewportCount();for(let t=0;t<f;t++){const e=u.getViewport(t);s.set(o.x*e.x,o.y*e.y,o.x*e.z,o.y*e.w),d.viewport(s),u.updateMatrices(c,t),i=u.getFrustum(),y(n,a,u.camera,c,this.type)}u.isPointLightShadow||3!==this.type||_(u,a),u.needsUpdate=!1}g.needsUpdate=!1,t.setRenderTarget(l,c,u)}}function _u(t,e,n){const i=n.isWebGL2,r=new function(){let e=!1;const n=new Ps;let i=null;const r=new Ps(0,0,0,0);return{setMask:function(n){i===n||e||(t.colorMask(n,n,n,n),i=n)},setLocked:function(t){e=t},setClear:function(e,i,o,s,a){!0===a&&(e*=s,i*=s,o*=s),n.set(e,i,o,s),!1===r.equals(n)&&(t.clearColor(e,i,o,s),r.copy(n))},reset:function(){e=!1,i=null,r.set(-1,0,0,0)}}},o=new function(){let e=!1,n=null,i=null,r=null;return{setTest:function(t){t?F(2929):H(2929)},setMask:function(i){n===i||e||(t.depthMask(i),n=i)},setFunc:function(e){if(i!==e){if(e)switch(e){case 0:t.depthFunc(512);break;case 1:t.depthFunc(519);break;case 2:t.depthFunc(513);break;case 3:default:t.depthFunc(515);break;case 4:t.depthFunc(514);break;case 5:t.depthFunc(518);break;case 6:t.depthFunc(516);break;case 7:t.depthFunc(517)}else t.depthFunc(515);i=e}},setLocked:function(t){e=t},setClear:function(e){r!==e&&(t.clearDepth(e),r=e)},reset:function(){e=!1,n=null,i=null,r=null}}},s=new function(){let e=!1,n=null,i=null,r=null,o=null,s=null,a=null,l=null,c=null;return{setTest:function(t){e||(t?F(2960):H(2960))},setMask:function(i){n===i||e||(t.stencilMask(i),n=i)},setFunc:function(e,n,s){i===e&&r===n&&o===s||(t.stencilFunc(e,n,s),i=e,r=n,o=s)},setOp:function(e,n,i){s===e&&a===n&&l===i||(t.stencilOp(e,n,i),s=e,a=n,l=i)},setLocked:function(t){e=t},setClear:function(e){c!==e&&(t.clearStencil(e),c=e)},reset:function(){e=!1,n=null,i=null,r=null,o=null,s=null,a=null,l=null,c=null}}};let a={},l={},c=new WeakMap,h=[],u=null,d=!1,p=null,f=null,m=null,g=null,_=null,v=null,y=null,x=!1,b=null,w=null,M=null,S=null,T=null;const E=t.getParameter(35661);let A=!1,C=0;const R=t.getParameter(7938);-1!==R.indexOf("WebGL")?(C=parseFloat(/^WebGL (\d)/.exec(R)[1]),A=C>=1):-1!==R.indexOf("OpenGL ES")&&(C=parseFloat(/^OpenGL ES (\d)/.exec(R)[1]),A=C>=2);let L=null,P={};const I=t.getParameter(3088),D=t.getParameter(2978),O=(new Ps).fromArray(I),N=(new Ps).fromArray(D);function z(e,n,i){const r=new Uint8Array(4),o=t.createTexture();t.bindTexture(e,o),t.texParameteri(e,10241,9728),t.texParameteri(e,10240,9728);for(let e=0;e<i;e++)t.texImage2D(n+e,0,6408,1,1,0,6408,5121,r);return o}const B={};function F(e){!0!==a[e]&&(t.enable(e),a[e]=!0)}function H(e){!1!==a[e]&&(t.disable(e),a[e]=!1)}B[3553]=z(3553,3553,1),B[34067]=z(34067,34069,6),r.setClear(0,0,0,1),o.setClear(1),s.setClear(0),F(2929),o.setFunc(3),W(!1),V(1),F(2884),G(0);const U={[Mo]:32774,101:32778,102:32779};if(i)U[103]=32775,U[104]=32776;else{const t=e.get("EXT_blend_minmax");null!==t&&(U[103]=t.MIN_EXT,U[104]=t.MAX_EXT)}const k={200:0,201:1,202:768,204:770,210:776,208:774,206:772,203:769,205:771,209:775,207:773};function G(e,n,i,r,o,s,a,l){if(0!==e){if(!1===d&&(F(3042),d=!0),5===e)o=o||n,s=s||i,a=a||r,n===f&&o===_||(t.blendEquationSeparate(U[n],U[o]),f=n,_=o),i===m&&r===g&&s===v&&a===y||(t.blendFuncSeparate(k[i],k[r],k[s],k[a]),m=i,g=r,v=s,y=a),p=e,x=null;else if(e!==p||l!==x){if(f===Mo&&_===Mo||(t.blendEquation(32774),f=Mo,_=Mo),l)switch(e){case 1:t.blendFuncSeparate(1,771,1,771);break;case 2:t.blendFunc(1,1);break;case 3:t.blendFuncSeparate(0,769,0,1);break;case 4:t.blendFuncSeparate(0,768,0,770);break;default:console.error("THREE.WebGLState: Invalid blending: ",e)}else switch(e){case 1:t.blendFuncSeparate(770,771,1,771);break;case 2:t.blendFunc(770,1);break;case 3:t.blendFuncSeparate(0,769,0,1);break;case 4:t.blendFunc(0,768);break;default:console.error("THREE.WebGLState: Invalid blending: ",e)}m=null,g=null,v=null,y=null,p=e,x=l}}else!0===d&&(H(3042),d=!1)}function W(e){b!==e&&(e?t.frontFace(2304):t.frontFace(2305),b=e)}function V(e){0!==e?(F(2884),e!==w&&(1===e?t.cullFace(1029):2===e?t.cullFace(1028):t.cullFace(1032))):H(2884),w=e}function j(e,n,i){e?(F(32823),S===n&&T===i||(t.polygonOffset(n,i),S=n,T=i)):H(32823)}function q(e){void 0===e&&(e=33984+E-1),L!==e&&(t.activeTexture(e),L=e)}return{buffers:{color:r,depth:o,stencil:s},enable:F,disable:H,bindFramebuffer:function(e,n){return l[e]!==n&&(t.bindFramebuffer(e,n),l[e]=n,i&&(36009===e&&(l[36160]=n),36160===e&&(l[36009]=n)),!0)},drawBuffers:function(i,r){let o=h,s=!1;if(i)if(o=c.get(r),void 0===o&&(o=[],c.set(r,o)),i.isWebGLMultipleRenderTargets){const t=i.texture;if(o.length!==t.length||36064!==o[0]){for(let e=0,n=t.length;e<n;e++)o[e]=36064+e;o.length=t.length,s=!0}}else 36064!==o[0]&&(o[0]=36064,s=!0);else 1029!==o[0]&&(o[0]=1029,s=!0);s&&(n.isWebGL2?t.drawBuffers(o):e.get("WEBGL_draw_buffers").drawBuffersWEBGL(o))},useProgram:function(e){return u!==e&&(t.useProgram(e),u=e,!0)},setBlending:G,setMaterial:function(t,e){2===t.side?H(2884):F(2884);let n=1===t.side;e&&(n=!n),W(n),1===t.blending&&!1===t.transparent?G(0):G(t.blending,t.blendEquation,t.blendSrc,t.blendDst,t.blendEquationAlpha,t.blendSrcAlpha,t.blendDstAlpha,t.premultipliedAlpha),o.setFunc(t.depthFunc),o.setTest(t.depthTest),o.setMask(t.depthWrite),r.setMask(t.colorWrite);const i=t.stencilWrite;s.setTest(i),i&&(s.setMask(t.stencilWriteMask),s.setFunc(t.stencilFunc,t.stencilRef,t.stencilFuncMask),s.setOp(t.stencilFail,t.stencilZFail,t.stencilZPass)),j(t.polygonOffset,t.polygonOffsetFactor,t.polygonOffsetUnits),!0===t.alphaToCoverage?F(32926):H(32926)},setFlipSided:W,setCullFace:V,setLineWidth:function(e){e!==M&&(A&&t.lineWidth(e),M=e)},setPolygonOffset:j,setScissorTest:function(t){t?F(3089):H(3089)},activeTexture:q,bindTexture:function(e,n){null===L&&q();let i=P[L];void 0===i&&(i={type:void 0,texture:void 0},P[L]=i),i.type===e&&i.texture===n||(t.bindTexture(e,n||B[e]),i.type=e,i.texture=n)},unbindTexture:function(){const e=P[L];void 0!==e&&void 0!==e.type&&(t.bindTexture(e.type,null),e.type=void 0,e.texture=void 0)},compressedTexImage2D:function(){try{t.compressedTexImage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texImage2D:function(){try{t.texImage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texImage3D:function(){try{t.texImage3D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texStorage2D:function(){try{t.texStorage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texStorage3D:function(){try{t.texStorage3D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texSubImage2D:function(){try{t.texSubImage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texSubImage3D:function(){try{t.texSubImage3D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},compressedTexSubImage2D:function(){try{t.compressedTexSubImage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},scissor:function(e){!1===O.equals(e)&&(t.scissor(e.x,e.y,e.z,e.w),O.copy(e))},viewport:function(e){!1===N.equals(e)&&(t.viewport(e.x,e.y,e.z,e.w),N.copy(e))},reset:function(){t.disable(3042),t.disable(2884),t.disable(2929),t.disable(32823),t.disable(3089),t.disable(2960),t.disable(32926),t.blendEquation(32774),t.blendFunc(1,0),t.blendFuncSeparate(1,0,1,0),t.colorMask(!0,!0,!0,!0),t.clearColor(0,0,0,0),t.depthMask(!0),t.depthFunc(513),t.clearDepth(1),t.stencilMask(4294967295),t.stencilFunc(519,0,4294967295),t.stencilOp(7680,7680,7680),t.clearStencil(0),t.cullFace(1029),t.frontFace(2305),t.polygonOffset(0,0),t.activeTexture(33984),t.bindFramebuffer(36160,null),!0===i&&(t.bindFramebuffer(36009,null),t.bindFramebuffer(36008,null)),t.useProgram(null),t.lineWidth(1),t.scissor(0,0,t.canvas.width,t.canvas.height),t.viewport(0,0,t.canvas.width,t.canvas.height),a={},L=null,P={},l={},c=new WeakMap,h=[],u=null,d=!1,p=null,f=null,m=null,g=null,_=null,v=null,y=null,x=!1,b=null,w=null,M=null,S=null,T=null,O.set(0,0,t.canvas.width,t.canvas.height),N.set(0,0,t.canvas.width,t.canvas.height),r.reset(),o.reset(),s.reset()}}}function vu(t,e,n,i,r,o,s){const a=r.isWebGL2,l=r.maxTextures,c=r.maxCubemapSize,h=r.maxTextureSize,u=r.maxSamples,d=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,p=new WeakMap;let f;const m=new WeakMap;let g=!1;try{g="undefined"!=typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(t){}function _(t,e){return g?new OffscreenCanvas(t,e):_s("canvas")}function v(t,e,n,i){let r=1;if((t.width>i||t.height>i)&&(r=i/Math.max(t.width,t.height)),r<1||!0===e){if("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap){const i=e?ps:Math.floor,o=i(r*t.width),s=i(r*t.height);void 0===f&&(f=_(o,s));const a=n?_(o,s):f;return a.width=o,a.height=s,a.getContext("2d").drawImage(t,0,0,o,s),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+t.width+"x"+t.height+") to ("+o+"x"+s+")."),a}return"data"in t&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+t.width+"x"+t.height+")."),t}return t}function y(t){return ds(t.width)&&ds(t.height)}function x(t,e){return t.generateMipmaps&&e&&t.minFilter!==Lo&&t.minFilter!==Po}function b(e){t.generateMipmap(e)}function w(n,i,r,o,s=!1){if(!1===a)return i;if(null!==n){if(void 0!==t[n])return t[n];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+n+"'")}let l=i;return 6403===i&&(5126===r&&(l=33326),5131===r&&(l=33325),5121===r&&(l=33321)),33319===i&&(5126===r&&(l=33328),5131===r&&(l=33327),5121===r&&(l=33323)),6408===i&&(5126===r&&(l=34836),5131===r&&(l=34842),5121===r&&(l=o===Qo&&!1===s?35907:32856),32819===r&&(l=32854),32820===r&&(l=32855)),33325!==l&&33326!==l&&33327!==l&&33328!==l&&34842!==l&&34836!==l||e.get("EXT_color_buffer_float"),l}function M(t,e,n){return!0===x(t,n)||t.isFramebufferTexture&&t.minFilter!==Lo&&t.minFilter!==Po?Math.log2(Math.max(e.width,e.height))+1:void 0!==t.mipmaps&&t.mipmaps.length>0?t.mipmaps.length:t.isCompressedTexture&&Array.isArray(t.image)?e.mipmaps.length:1}function S(t){return t===Lo||1004===t||1005===t?9728:9729}function T(t){const e=t.target;e.removeEventListener("dispose",T),function(t){const e=i.get(t);if(void 0===e.__webglInit)return;const n=t.source,r=m.get(n);if(r){const i=r[e.__cacheKey];i.usedTimes--,0===i.usedTimes&&A(t),0===Object.keys(r).length&&m.delete(n)}i.remove(t)}(e),e.isVideoTexture&&p.delete(e)}function E(e){const n=e.target;n.removeEventListener("dispose",E),function(e){const n=e.texture,r=i.get(e),o=i.get(n);if(void 0!==o.__webglTexture&&(t.deleteTexture(o.__webglTexture),s.memory.textures--),e.depthTexture&&e.depthTexture.dispose(),e.isWebGLCubeRenderTarget)for(let e=0;e<6;e++)t.deleteFramebuffer(r.__webglFramebuffer[e]),r.__webglDepthbuffer&&t.deleteRenderbuffer(r.__webglDepthbuffer[e]);else t.deleteFramebuffer(r.__webglFramebuffer),r.__webglDepthbuffer&&t.deleteRenderbuffer(r.__webglDepthbuffer),r.__webglMultisampledFramebuffer&&t.deleteFramebuffer(r.__webglMultisampledFramebuffer),r.__webglColorRenderbuffer&&t.deleteRenderbuffer(r.__webglColorRenderbuffer),r.__webglDepthRenderbuffer&&t.deleteRenderbuffer(r.__webglDepthRenderbuffer);if(e.isWebGLMultipleRenderTargets)for(let e=0,r=n.length;e<r;e++){const r=i.get(n[e]);r.__webglTexture&&(t.deleteTexture(r.__webglTexture),s.memory.textures--),i.remove(n[e])}i.remove(n),i.remove(e)}(n)}function A(e){const n=i.get(e);t.deleteTexture(n.__webglTexture);const r=e.source;delete m.get(r)[n.__cacheKey],s.memory.textures--}let C=0;function R(t,e){const r=i.get(t);if(t.isVideoTexture&&function(t){const e=s.render.frame;p.get(t)!==e&&(p.set(t,e),t.update())}(t),!1===t.isRenderTargetTexture&&t.version>0&&r.__version!==t.version){const n=t.image;if(null===n)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else{if(!1!==n.complete)return void O(r,t,e);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}n.activeTexture(33984+e),n.bindTexture(3553,r.__webglTexture)}const L={[Ao]:10497,[Co]:33071,[Ro]:33648},P={[Lo]:9728,1004:9984,1005:9986,[Po]:9729,1007:9985,[Io]:9987};function I(n,o,s){if(s?(t.texParameteri(n,10242,L[o.wrapS]),t.texParameteri(n,10243,L[o.wrapT]),32879!==n&&35866!==n||t.texParameteri(n,32882,L[o.wrapR]),t.texParameteri(n,10240,P[o.magFilter]),t.texParameteri(n,10241,P[o.minFilter])):(t.texParameteri(n,10242,33071),t.texParameteri(n,10243,33071),32879!==n&&35866!==n||t.texParameteri(n,32882,33071),o.wrapS===Co&&o.wrapT===Co||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),t.texParameteri(n,10240,S(o.magFilter)),t.texParameteri(n,10241,S(o.minFilter)),o.minFilter!==Lo&&o.minFilter!==Po&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),!0===e.has("EXT_texture_filter_anisotropic")){const s=e.get("EXT_texture_filter_anisotropic");if(o.type===zo&&!1===e.has("OES_texture_float_linear"))return;if(!1===a&&o.type===Bo&&!1===e.has("OES_texture_half_float_linear"))return;(o.anisotropy>1||i.get(o).__currentAnisotropy)&&(t.texParameterf(n,s.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(o.anisotropy,r.getMaxAnisotropy())),i.get(o).__currentAnisotropy=o.anisotropy)}}function D(e,n){let i=!1;void 0===e.__webglInit&&(e.__webglInit=!0,n.addEventListener("dispose",T));const r=n.source;let o=m.get(r);void 0===o&&(o={},m.set(r,o));const a=function(t){const e=[];return e.push(t.wrapS),e.push(t.wrapT),e.push(t.magFilter),e.push(t.minFilter),e.push(t.anisotropy),e.push(t.internalFormat),e.push(t.format),e.push(t.type),e.push(t.generateMipmaps),e.push(t.premultiplyAlpha),e.push(t.flipY),e.push(t.unpackAlignment),e.push(t.encoding),e.join()}(n);if(a!==e.__cacheKey){void 0===o[a]&&(o[a]={texture:t.createTexture(),usedTimes:0},s.memory.textures++,i=!0),o[a].usedTimes++;const r=o[e.__cacheKey];void 0!==r&&(o[e.__cacheKey].usedTimes--,0===r.usedTimes&&A(n)),e.__cacheKey=a,e.__webglTexture=o[a].texture}return i}function O(e,i,r){let s=3553;i.isDataArrayTexture&&(s=35866),i.isData3DTexture&&(s=32879);const l=D(e,i),c=i.source;if(n.activeTexture(33984+r),n.bindTexture(s,e.__webglTexture),c.version!==c.__currentVersion||!0===l){t.pixelStorei(37440,i.flipY),t.pixelStorei(37441,i.premultiplyAlpha),t.pixelStorei(3317,i.unpackAlignment),t.pixelStorei(37443,0);const r=function(t){return!a&&(t.wrapS!==Co||t.wrapT!==Co||t.minFilter!==Lo&&t.minFilter!==Po)}(i)&&!1===y(i.image);let l=v(i.image,r,!1,h);l=U(i,l);const u=y(l)||a,d=o.convert(i.format,i.encoding);let p,f=o.convert(i.type),m=w(i.internalFormat,d,f,i.encoding,i.isVideoTexture);I(s,i,u);const g=i.mipmaps,_=a&&!0!==i.isVideoTexture,S=void 0===e.__version,T=M(i,l,u);if(i.isDepthTexture)m=6402,a?m=i.type===zo?36012:i.type===No?33190:i.type===Fo?35056:33189:i.type===zo&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),i.format===Uo&&6402===m&&i.type!==Oo&&i.type!==No&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),i.type=Oo,f=o.convert(i.type)),i.format===ko&&6402===m&&(m=34041,i.type!==Fo&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),i.type=Fo,f=o.convert(i.type))),_&&S?n.texStorage2D(3553,1,m,l.width,l.height):n.texImage2D(3553,0,m,l.width,l.height,0,d,f,null);else if(i.isDataTexture)if(g.length>0&&u){_&&S&&n.texStorage2D(3553,T,m,g[0].width,g[0].height);for(let t=0,e=g.length;t<e;t++)p=g[t],_?n.texSubImage2D(3553,t,0,0,p.width,p.height,d,f,p.data):n.texImage2D(3553,t,m,p.width,p.height,0,d,f,p.data);i.generateMipmaps=!1}else _?(S&&n.texStorage2D(3553,T,m,l.width,l.height),n.texSubImage2D(3553,0,0,0,l.width,l.height,d,f,l.data)):n.texImage2D(3553,0,m,l.width,l.height,0,d,f,l.data);else if(i.isCompressedTexture){_&&S&&n.texStorage2D(3553,T,m,g[0].width,g[0].height);for(let t=0,e=g.length;t<e;t++)p=g[t],i.format!==Ho?null!==d?_?n.compressedTexSubImage2D(3553,t,0,0,p.width,p.height,d,p.data):n.compressedTexImage2D(3553,t,m,p.width,p.height,0,p.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):_?n.texSubImage2D(3553,t,0,0,p.width,p.height,d,f,p.data):n.texImage2D(3553,t,m,p.width,p.height,0,d,f,p.data)}else if(i.isDataArrayTexture)_?(S&&n.texStorage3D(35866,T,m,l.width,l.height,l.depth),n.texSubImage3D(35866,0,0,0,0,l.width,l.height,l.depth,d,f,l.data)):n.texImage3D(35866,0,m,l.width,l.height,l.depth,0,d,f,l.data);else if(i.isData3DTexture)_?(S&&n.texStorage3D(32879,T,m,l.width,l.height,l.depth),n.texSubImage3D(32879,0,0,0,0,l.width,l.height,l.depth,d,f,l.data)):n.texImage3D(32879,0,m,l.width,l.height,l.depth,0,d,f,l.data);else if(i.isFramebufferTexture)_&&S?n.texStorage2D(3553,T,m,l.width,l.height):n.texImage2D(3553,0,m,l.width,l.height,0,d,f,null);else if(g.length>0&&u){_&&S&&n.texStorage2D(3553,T,m,g[0].width,g[0].height);for(let t=0,e=g.length;t<e;t++)p=g[t],_?n.texSubImage2D(3553,t,0,0,d,f,p):n.texImage2D(3553,t,m,d,f,p);i.generateMipmaps=!1}else _?(S&&n.texStorage2D(3553,T,m,l.width,l.height),n.texSubImage2D(3553,0,0,0,d,f,l)):n.texImage2D(3553,0,m,d,f,l);x(i,u)&&b(s),c.__currentVersion=c.version,i.onUpdate&&i.onUpdate(i)}e.__version=i.version}function N(e,r,s,a,l){const c=o.convert(s.format,s.encoding),h=o.convert(s.type),u=w(s.internalFormat,c,h,s.encoding);i.get(r).__hasExternalTextures||(32879===l||35866===l?n.texImage3D(l,0,u,r.width,r.height,r.depth,0,c,h,null):n.texImage2D(l,0,u,r.width,r.height,0,c,h,null)),n.bindFramebuffer(36160,e),H(r)?d.framebufferTexture2DMultisampleEXT(36160,a,l,i.get(s).__webglTexture,0,F(r)):t.framebufferTexture2D(36160,a,l,i.get(s).__webglTexture,0),n.bindFramebuffer(36160,null)}function z(e,n,i){if(t.bindRenderbuffer(36161,e),n.depthBuffer&&!n.stencilBuffer){let r=33189;if(i||H(n)){const e=n.depthTexture;e&&e.isDepthTexture&&(e.type===zo?r=36012:e.type===No&&(r=33190));const i=F(n);H(n)?d.renderbufferStorageMultisampleEXT(36161,i,r,n.width,n.height):t.renderbufferStorageMultisample(36161,i,r,n.width,n.height)}else t.renderbufferStorage(36161,r,n.width,n.height);t.framebufferRenderbuffer(36160,36096,36161,e)}else if(n.depthBuffer&&n.stencilBuffer){const r=F(n);i&&!1===H(n)?t.renderbufferStorageMultisample(36161,r,35056,n.width,n.height):H(n)?d.renderbufferStorageMultisampleEXT(36161,r,35056,n.width,n.height):t.renderbufferStorage(36161,34041,n.width,n.height),t.framebufferRenderbuffer(36160,33306,36161,e)}else{const e=!0===n.isWebGLMultipleRenderTargets?n.texture[0]:n.texture,r=o.convert(e.format,e.encoding),s=o.convert(e.type),a=w(e.internalFormat,r,s,e.encoding),l=F(n);i&&!1===H(n)?t.renderbufferStorageMultisample(36161,l,a,n.width,n.height):H(n)?d.renderbufferStorageMultisampleEXT(36161,l,a,n.width,n.height):t.renderbufferStorage(36161,a,n.width,n.height)}t.bindRenderbuffer(36161,null)}function B(e){const r=i.get(e),o=!0===e.isWebGLCubeRenderTarget;if(e.depthTexture&&!r.__autoAllocateDepthBuffer){if(o)throw new Error("target.depthTexture not supported in Cube render targets");!function(e,r){if(r&&r.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(n.bindFramebuffer(36160,e),!r.depthTexture||!r.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");i.get(r.depthTexture).__webglTexture&&r.depthTexture.image.width===r.width&&r.depthTexture.image.height===r.height||(r.depthTexture.image.width=r.width,r.depthTexture.image.height=r.height,r.depthTexture.needsUpdate=!0),R(r.depthTexture,0);const o=i.get(r.depthTexture).__webglTexture,s=F(r);if(r.depthTexture.format===Uo)H(r)?d.framebufferTexture2DMultisampleEXT(36160,36096,3553,o,0,s):t.framebufferTexture2D(36160,36096,3553,o,0);else{if(r.depthTexture.format!==ko)throw new Error("Unknown depthTexture format");H(r)?d.framebufferTexture2DMultisampleEXT(36160,33306,3553,o,0,s):t.framebufferTexture2D(36160,33306,3553,o,0)}}(r.__webglFramebuffer,e)}else if(o){r.__webglDepthbuffer=[];for(let i=0;i<6;i++)n.bindFramebuffer(36160,r.__webglFramebuffer[i]),r.__webglDepthbuffer[i]=t.createRenderbuffer(),z(r.__webglDepthbuffer[i],e,!1)}else n.bindFramebuffer(36160,r.__webglFramebuffer),r.__webglDepthbuffer=t.createRenderbuffer(),z(r.__webglDepthbuffer,e,!1);n.bindFramebuffer(36160,null)}function F(t){return Math.min(u,t.samples)}function H(t){const n=i.get(t);return a&&t.samples>0&&!0===e.has("WEBGL_multisampled_render_to_texture")&&!1!==n.__useRenderToTexture}function U(t,n){const i=t.encoding,r=t.format,o=t.type;return!0===t.isCompressedTexture||!0===t.isVideoTexture||t.format===rs||i!==Ko&&(i===Qo?!1===a?!0===e.has("EXT_sRGB")&&r===Ho?(t.format=rs,t.minFilter=Po,t.generateMipmaps=!1):n=Es.sRGBToLinear(n):r===Ho&&o===Do||console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture encoding:",i)),n}this.allocateTextureUnit=function(){const t=C;return t>=l&&console.warn("THREE.WebGLTextures: Trying to use "+t+" texture units while this GPU supports only "+l),C+=1,t},this.resetTextureUnits=function(){C=0},this.setTexture2D=R,this.setTexture2DArray=function(t,e){const r=i.get(t);t.version>0&&r.__version!==t.version?O(r,t,e):(n.activeTexture(33984+e),n.bindTexture(35866,r.__webglTexture))},this.setTexture3D=function(t,e){const r=i.get(t);t.version>0&&r.__version!==t.version?O(r,t,e):(n.activeTexture(33984+e),n.bindTexture(32879,r.__webglTexture))},this.setTextureCube=function(e,r){const s=i.get(e);e.version>0&&s.__version!==e.version?function(e,i,r){if(6!==i.image.length)return;const s=D(e,i),l=i.source;if(n.activeTexture(33984+r),n.bindTexture(34067,e.__webglTexture),l.version!==l.__currentVersion||!0===s){t.pixelStorei(37440,i.flipY),t.pixelStorei(37441,i.premultiplyAlpha),t.pixelStorei(3317,i.unpackAlignment),t.pixelStorei(37443,0);const r=i.isCompressedTexture||i.image[0].isCompressedTexture,s=i.image[0]&&i.image[0].isDataTexture,h=[];for(let t=0;t<6;t++)h[t]=r||s?s?i.image[t].image:i.image[t]:v(i.image[t],!1,!0,c),h[t]=U(i,h[t]);const u=h[0],d=y(u)||a,p=o.convert(i.format,i.encoding),f=o.convert(i.type),m=w(i.internalFormat,p,f,i.encoding),g=a&&!0!==i.isVideoTexture,_=void 0===e.__version;let S,T=M(i,u,d);if(I(34067,i,d),r){g&&_&&n.texStorage2D(34067,T,m,u.width,u.height);for(let t=0;t<6;t++){S=h[t].mipmaps;for(let e=0;e<S.length;e++){const r=S[e];i.format!==Ho?null!==p?g?n.compressedTexSubImage2D(34069+t,e,0,0,r.width,r.height,p,r.data):n.compressedTexImage2D(34069+t,e,m,r.width,r.height,0,r.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):g?n.texSubImage2D(34069+t,e,0,0,r.width,r.height,p,f,r.data):n.texImage2D(34069+t,e,m,r.width,r.height,0,p,f,r.data)}}}else{S=i.mipmaps,g&&_&&(S.length>0&&T++,n.texStorage2D(34067,T,m,h[0].width,h[0].height));for(let t=0;t<6;t++)if(s){g?n.texSubImage2D(34069+t,0,0,0,h[t].width,h[t].height,p,f,h[t].data):n.texImage2D(34069+t,0,m,h[t].width,h[t].height,0,p,f,h[t].data);for(let e=0;e<S.length;e++){const i=S[e].image[t].image;g?n.texSubImage2D(34069+t,e+1,0,0,i.width,i.height,p,f,i.data):n.texImage2D(34069+t,e+1,m,i.width,i.height,0,p,f,i.data)}}else{g?n.texSubImage2D(34069+t,0,0,0,p,f,h[t]):n.texImage2D(34069+t,0,m,p,f,h[t]);for(let e=0;e<S.length;e++){const i=S[e];g?n.texSubImage2D(34069+t,e+1,0,0,p,f,i.image[t]):n.texImage2D(34069+t,e+1,m,p,f,i.image[t])}}}x(i,d)&&b(34067),l.__currentVersion=l.version,i.onUpdate&&i.onUpdate(i)}e.__version=i.version}(s,e,r):(n.activeTexture(33984+r),n.bindTexture(34067,s.__webglTexture))},this.rebindTextures=function(t,e,n){const r=i.get(t);void 0!==e&&N(r.__webglFramebuffer,t,t.texture,36064,3553),void 0!==n&&B(t)},this.setupRenderTarget=function(e){const l=e.texture,c=i.get(e),h=i.get(l);e.addEventListener("dispose",E),!0!==e.isWebGLMultipleRenderTargets&&(void 0===h.__webglTexture&&(h.__webglTexture=t.createTexture()),h.__version=l.version,s.memory.textures++);const u=!0===e.isWebGLCubeRenderTarget,d=!0===e.isWebGLMultipleRenderTargets,p=y(e)||a;if(u){c.__webglFramebuffer=[];for(let e=0;e<6;e++)c.__webglFramebuffer[e]=t.createFramebuffer()}else if(c.__webglFramebuffer=t.createFramebuffer(),d)if(r.drawBuffers){const n=e.texture;for(let e=0,r=n.length;e<r;e++){const r=i.get(n[e]);void 0===r.__webglTexture&&(r.__webglTexture=t.createTexture(),s.memory.textures++)}}else console.warn("THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.");else if(a&&e.samples>0&&!1===H(e)){c.__webglMultisampledFramebuffer=t.createFramebuffer(),c.__webglColorRenderbuffer=t.createRenderbuffer(),t.bindRenderbuffer(36161,c.__webglColorRenderbuffer);const i=o.convert(l.format,l.encoding),r=o.convert(l.type),s=w(l.internalFormat,i,r,l.encoding),a=F(e);t.renderbufferStorageMultisample(36161,a,s,e.width,e.height),n.bindFramebuffer(36160,c.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(36160,36064,36161,c.__webglColorRenderbuffer),t.bindRenderbuffer(36161,null),e.depthBuffer&&(c.__webglDepthRenderbuffer=t.createRenderbuffer(),z(c.__webglDepthRenderbuffer,e,!0)),n.bindFramebuffer(36160,null)}if(u){n.bindTexture(34067,h.__webglTexture),I(34067,l,p);for(let t=0;t<6;t++)N(c.__webglFramebuffer[t],e,l,36064,34069+t);x(l,p)&&b(34067),n.unbindTexture()}else if(d){const t=e.texture;for(let r=0,o=t.length;r<o;r++){const o=t[r],s=i.get(o);n.bindTexture(3553,s.__webglTexture),I(3553,o,p),N(c.__webglFramebuffer,e,o,36064+r,3553),x(o,p)&&b(3553)}n.unbindTexture()}else{let t=3553;(e.isWebGL3DRenderTarget||e.isWebGLArrayRenderTarget)&&(a?t=e.isWebGL3DRenderTarget?32879:35866:console.error("THREE.WebGLTextures: THREE.Data3DTexture and THREE.DataArrayTexture only supported with WebGL2.")),n.bindTexture(t,h.__webglTexture),I(t,l,p),N(c.__webglFramebuffer,e,l,36064,t),x(l,p)&&b(t),n.unbindTexture()}e.depthBuffer&&B(e)},this.updateRenderTargetMipmap=function(t){const e=y(t)||a,r=!0===t.isWebGLMultipleRenderTargets?t.texture:[t.texture];for(let o=0,s=r.length;o<s;o++){const s=r[o];if(x(s,e)){const e=t.isWebGLCubeRenderTarget?34067:3553,r=i.get(s).__webglTexture;n.bindTexture(e,r),b(e),n.unbindTexture()}}},this.updateMultisampleRenderTarget=function(e){if(a&&e.samples>0&&!1===H(e)){const r=e.width,o=e.height;let s=16384;const a=[36064],l=e.stencilBuffer?33306:36096;e.depthBuffer&&a.push(l);const c=i.get(e),h=void 0!==c.__ignoreDepthValues&&c.__ignoreDepthValues;!1===h&&(e.depthBuffer&&(s|=256),e.stencilBuffer&&(s|=1024)),n.bindFramebuffer(36008,c.__webglMultisampledFramebuffer),n.bindFramebuffer(36009,c.__webglFramebuffer),!0===h&&(t.invalidateFramebuffer(36008,[l]),t.invalidateFramebuffer(36009,[l])),t.blitFramebuffer(0,0,r,o,0,0,r,o,s,9728),t.invalidateFramebuffer(36008,a),n.bindFramebuffer(36008,null),n.bindFramebuffer(36009,c.__webglMultisampledFramebuffer)}},this.setupDepthRenderbuffer=B,this.setupFrameBufferTexture=N,this.useMultisampledRTT=H}function yu(t,e,n){const i=n.isWebGL2;return{convert:function(t,n=null){let r;if(t===Do)return 5121;if(1017===t)return 32819;if(1018===t)return 32820;if(1010===t)return 5120;if(1011===t)return 5122;if(t===Oo)return 5123;if(1013===t)return 5124;if(t===No)return 5125;if(t===zo)return 5126;if(t===Bo)return i?5131:(r=e.get("OES_texture_half_float"),null!==r?r.HALF_FLOAT_OES:null);if(1021===t)return 6406;if(t===Ho)return 6408;if(1024===t)return 6409;if(1025===t)return 6410;if(t===Uo)return 6402;if(t===ko)return 34041;if(1028===t)return 6403;if(1022===t)return console.warn("THREE.WebGLRenderer: THREE.RGBFormat has been removed. Use THREE.RGBAFormat instead. https://github.com/mrdoob/three.js/pull/23228"),6408;if(t===rs)return r=e.get("EXT_sRGB"),null!==r?r.SRGB_ALPHA_EXT:null;if(1029===t)return 36244;if(1030===t)return 33319;if(1031===t)return 33320;if(1033===t)return 36249;if(t===Go||t===Wo||t===Vo||t===jo)if(n===Qo){if(r=e.get("WEBGL_compressed_texture_s3tc_srgb"),null===r)return null;if(t===Go)return r.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(t===Wo)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(t===Vo)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(t===jo)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else{if(r=e.get("WEBGL_compressed_texture_s3tc"),null===r)return null;if(t===Go)return r.COMPRESSED_RGB_S3TC_DXT1_EXT;if(t===Wo)return r.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(t===Vo)return r.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(t===jo)return r.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(35840===t||35841===t||35842===t||35843===t){if(r=e.get("WEBGL_compressed_texture_pvrtc"),null===r)return null;if(35840===t)return r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(35841===t)return r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(35842===t)return r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(35843===t)return r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(36196===t)return r=e.get("WEBGL_compressed_texture_etc1"),null!==r?r.COMPRESSED_RGB_ETC1_WEBGL:null;if(37492===t||37496===t){if(r=e.get("WEBGL_compressed_texture_etc"),null===r)return null;if(37492===t)return n===Qo?r.COMPRESSED_SRGB8_ETC2:r.COMPRESSED_RGB8_ETC2;if(37496===t)return n===Qo?r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:r.COMPRESSED_RGBA8_ETC2_EAC}if(37808===t||37809===t||37810===t||37811===t||37812===t||37813===t||37814===t||37815===t||37816===t||37817===t||37818===t||37819===t||37820===t||37821===t){if(r=e.get("WEBGL_compressed_texture_astc"),null===r)return null;if(37808===t)return n===Qo?r.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:r.COMPRESSED_RGBA_ASTC_4x4_KHR;if(37809===t)return n===Qo?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:r.COMPRESSED_RGBA_ASTC_5x4_KHR;if(37810===t)return n===Qo?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:r.COMPRESSED_RGBA_ASTC_5x5_KHR;if(37811===t)return n===Qo?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:r.COMPRESSED_RGBA_ASTC_6x5_KHR;if(37812===t)return n===Qo?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:r.COMPRESSED_RGBA_ASTC_6x6_KHR;if(37813===t)return n===Qo?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:r.COMPRESSED_RGBA_ASTC_8x5_KHR;if(37814===t)return n===Qo?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:r.COMPRESSED_RGBA_ASTC_8x6_KHR;if(37815===t)return n===Qo?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:r.COMPRESSED_RGBA_ASTC_8x8_KHR;if(37816===t)return n===Qo?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:r.COMPRESSED_RGBA_ASTC_10x5_KHR;if(37817===t)return n===Qo?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:r.COMPRESSED_RGBA_ASTC_10x6_KHR;if(37818===t)return n===Qo?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:r.COMPRESSED_RGBA_ASTC_10x8_KHR;if(37819===t)return n===Qo?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:r.COMPRESSED_RGBA_ASTC_10x10_KHR;if(37820===t)return n===Qo?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:r.COMPRESSED_RGBA_ASTC_12x10_KHR;if(37821===t)return n===Qo?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:r.COMPRESSED_RGBA_ASTC_12x12_KHR}if(36492===t){if(r=e.get("EXT_texture_compression_bptc"),null===r)return null;if(36492===t)return n===Qo?r.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:r.COMPRESSED_RGBA_BPTC_UNORM_EXT}return t===Fo?i?34042:(r=e.get("WEBGL_depth_texture"),null!==r?r.UNSIGNED_INT_24_8_WEBGL:null):void 0}}}mu.prototype.isMeshDistanceMaterial=!0;class xu extends Fl{constructor(t=[]){super(),this.cameras=t}}xu.prototype.isArrayCamera=!0;class bu extends Fa{constructor(){super(),this.type="Group"}}bu.prototype.isGroup=!0;const wu={type:"move"};class Mu{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return null===this._hand&&(this._hand=new bu,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return null===this._targetRay&&(this._targetRay=new bu,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new zs,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new zs),this._targetRay}getGripSpace(){return null===this._grip&&(this._grip=new bu,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new zs,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new zs),this._grip}dispatchEvent(t){return null!==this._targetRay&&this._targetRay.dispatchEvent(t),null!==this._grip&&this._grip.dispatchEvent(t),null!==this._hand&&this._hand.dispatchEvent(t),this}disconnect(t){return this.dispatchEvent({type:"disconnected",data:t}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this}update(t,e,n){let i=null,r=null,o=null;const s=this._targetRay,a=this._grip,l=this._hand;if(t&&"visible-blurred"!==e.session.visibilityState)if(null!==s&&(i=e.getPose(t.targetRaySpace,n),null!==i&&(s.matrix.fromArray(i.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale),i.linearVelocity?(s.hasLinearVelocity=!0,s.linearVelocity.copy(i.linearVelocity)):s.hasLinearVelocity=!1,i.angularVelocity?(s.hasAngularVelocity=!0,s.angularVelocity.copy(i.angularVelocity)):s.hasAngularVelocity=!1,this.dispatchEvent(wu))),l&&t.hand){o=!0;for(const i of t.hand.values()){const t=e.getJointPose(i,n);if(void 0===l.joints[i.jointName]){const t=new bu;t.matrixAutoUpdate=!1,t.visible=!1,l.joints[i.jointName]=t,l.add(t)}const r=l.joints[i.jointName];null!==t&&(r.matrix.fromArray(t.transform.matrix),r.matrix.decompose(r.position,r.rotation,r.scale),r.jointRadius=t.radius),r.visible=null!==t}const i=l.joints["index-finger-tip"],r=l.joints["thumb-tip"],s=i.position.distanceTo(r.position),a=.02,c=.005;l.inputState.pinching&&s>a+c?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!l.inputState.pinching&&s<=a-c&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else null!==a&&t.gripSpace&&(r=e.getPose(t.gripSpace,n),null!==r&&(a.matrix.fromArray(r.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),r.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(r.linearVelocity)):a.hasLinearVelocity=!1,r.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(r.angularVelocity)):a.hasAngularVelocity=!1));return null!==s&&(s.visible=null!==i),null!==a&&(a.visible=null!==r),null!==l&&(l.visible=null!==o),this}}class Su extends Ls{constructor(t,e,n,i,r,o,s,a,l,c){if((c=void 0!==c?c:Uo)!==Uo&&c!==ko)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===n&&c===Uo&&(n=Oo),void 0===n&&c===ko&&(n=Fo),super(null,i,r,o,s,a,c,n,l),this.image={width:t,height:e},this.magFilter=void 0!==s?s:Lo,this.minFilter=void 0!==a?a:Lo,this.flipY=!1,this.generateMipmaps=!1}}Su.prototype.isDepthTexture=!0;class Tu extends os{constructor(t,e){super();const n=this;let i=null,r=1,o=null,s="local-floor",a=null,l=null,c=null,h=null,u=null;const d=e.getContextAttributes();let p=null,f=null;const m=[],g=new Map,_=new Fl;_.layers.enable(1),_.viewport=new Ps;const v=new Fl;v.layers.enable(2),v.viewport=new Ps;const y=[_,v],x=new xu;x.layers.enable(1),x.layers.enable(2);let b=null,w=null;function M(t){const e=g.get(t.inputSource);e&&e.dispatchEvent({type:t.type,data:t.inputSource})}function S(){g.forEach((function(t,e){t.disconnect(e)})),g.clear(),b=null,w=null,t.setRenderTarget(p),h=null,c=null,l=null,i=null,f=null,L.stop(),n.isPresenting=!1,n.dispatchEvent({type:"sessionend"})}function T(t){const e=i.inputSources;for(let t=0;t<m.length;t++)g.set(e[t],m[t]);for(let e=0;e<t.removed.length;e++){const n=t.removed[e],i=g.get(n);i&&(i.dispatchEvent({type:"disconnected",data:n}),g.delete(n))}for(let e=0;e<t.added.length;e++){const n=t.added[e],i=g.get(n);i&&i.dispatchEvent({type:"connected",data:n})}}this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(t){let e=m[t];return void 0===e&&(e=new Mu,m[t]=e),e.getTargetRaySpace()},this.getControllerGrip=function(t){let e=m[t];return void 0===e&&(e=new Mu,m[t]=e),e.getGripSpace()},this.getHand=function(t){let e=m[t];return void 0===e&&(e=new Mu,m[t]=e),e.getHandSpace()},this.setFramebufferScaleFactor=function(t){r=t,!0===n.isPresenting&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(t){s=t,!0===n.isPresenting&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return o},this.getBaseLayer=function(){return null!==c?c:h},this.getBinding=function(){return l},this.getFrame=function(){return u},this.getSession=function(){return i},this.setSession=async function(a){if(i=a,null!==i){if(p=t.getRenderTarget(),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",S),i.addEventListener("inputsourceschange",T),!0!==d.xrCompatible&&await e.makeXRCompatible(),void 0===i.renderState.layers||!1===t.capabilities.isWebGL2){const n={antialias:void 0!==i.renderState.layers||d.antialias,alpha:d.alpha,depth:d.depth,stencil:d.stencil,framebufferScaleFactor:r};h=new XRWebGLLayer(i,e,n),i.updateRenderState({baseLayer:h}),f=new Is(h.framebufferWidth,h.framebufferHeight,{format:Ho,type:Do,encoding:t.outputEncoding})}else{let n=null,o=null,s=null;d.depth&&(s=d.stencil?35056:33190,n=d.stencil?ko:Uo,o=d.stencil?Fo:Oo);const a={colorFormat:t.outputEncoding===Qo?35907:32856,depthFormat:s,scaleFactor:r};l=new XRWebGLBinding(i,e),c=l.createProjectionLayer(a),i.updateRenderState({layers:[c]}),f=new Is(c.textureWidth,c.textureHeight,{format:Ho,type:Do,depthTexture:new Su(c.textureWidth,c.textureHeight,o,void 0,void 0,void 0,void 0,void 0,void 0,n),stencilBuffer:d.stencil,encoding:t.outputEncoding,samples:d.antialias?4:0}),t.properties.get(f).__ignoreDepthValues=c.ignoreDepthValues}f.isXRRenderTarget=!0,this.setFoveation(1),o=await i.requestReferenceSpace(s),L.setContext(i),L.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}};const E=new zs,A=new zs;function C(t,e){null===e?t.matrixWorld.copy(t.matrix):t.matrixWorld.multiplyMatrices(e.matrixWorld,t.matrix),t.matrixWorldInverse.copy(t.matrixWorld).invert()}this.updateCamera=function(t){if(null===i)return;x.near=v.near=_.near=t.near,x.far=v.far=_.far=t.far,b===x.near&&w===x.far||(i.updateRenderState({depthNear:x.near,depthFar:x.far}),b=x.near,w=x.far);const e=t.parent,n=x.cameras;C(x,e);for(let t=0;t<n.length;t++)C(n[t],e);x.matrixWorld.decompose(x.position,x.quaternion,x.scale),t.position.copy(x.position),t.quaternion.copy(x.quaternion),t.scale.copy(x.scale),t.matrix.copy(x.matrix),t.matrixWorld.copy(x.matrixWorld);const r=t.children;for(let t=0,e=r.length;t<e;t++)r[t].updateMatrixWorld(!0);2===n.length?function(t,e,n){E.setFromMatrixPosition(e.matrixWorld),A.setFromMatrixPosition(n.matrixWorld);const i=E.distanceTo(A),r=e.projectionMatrix.elements,o=n.projectionMatrix.elements,s=r[14]/(r[10]-1),a=r[14]/(r[10]+1),l=(r[9]+1)/r[5],c=(r[9]-1)/r[5],h=(r[8]-1)/r[0],u=(o[8]+1)/o[0],d=s*h,p=s*u,f=i/(-h+u),m=f*-h;e.matrixWorld.decompose(t.position,t.quaternion,t.scale),t.translateX(m),t.translateZ(f),t.matrixWorld.compose(t.position,t.quaternion,t.scale),t.matrixWorldInverse.copy(t.matrixWorld).invert();const g=s+f,_=a+f,v=d-m,y=p+(i-m),x=l*a/_*g,b=c*a/_*g;t.projectionMatrix.makePerspective(v,y,x,b,g,_)}(x,_,v):x.projectionMatrix.copy(_.projectionMatrix)},this.getCamera=function(){return x},this.getFoveation=function(){return null!==c?c.fixedFoveation:null!==h?h.fixedFoveation:void 0},this.setFoveation=function(t){null!==c&&(c.fixedFoveation=t),null!==h&&void 0!==h.fixedFoveation&&(h.fixedFoveation=t)};let R=null;const L=new Jl;L.setAnimationLoop((function(e,n){if(a=n.getViewerPose(o),u=n,null!==a){const e=a.views;null!==h&&(t.setRenderTargetFramebuffer(f,h.framebuffer),t.setRenderTarget(f));let n=!1;e.length!==x.cameras.length&&(x.cameras.length=0,n=!0);for(let i=0;i<e.length;i++){const r=e[i];let o=null;if(null!==h)o=h.getViewport(r);else{const e=l.getViewSubImage(c,r);o=e.viewport,0===i&&(t.setRenderTargetTextures(f,e.colorTexture,c.ignoreDepthValues?void 0:e.depthStencilTexture),t.setRenderTarget(f))}const s=y[i];s.matrix.fromArray(r.transform.matrix),s.projectionMatrix.fromArray(r.projectionMatrix),s.viewport.set(o.x,o.y,o.width,o.height),0===i&&x.matrix.copy(s.matrix),!0===n&&x.cameras.push(s)}}const r=i.inputSources;for(let t=0;t<m.length;t++){const e=m[t],i=r[t];e.update(i,n,o)}R&&R(e,n),u=null})),this.setAnimationLoop=function(t){R=t},this.dispose=function(){}}}function Eu(t){function e(e,n){e.opacity.value=n.opacity,n.color&&e.diffuse.value.copy(n.color),n.emissive&&e.emissive.value.copy(n.emissive).multiplyScalar(n.emissiveIntensity),n.map&&(e.map.value=n.map),n.alphaMap&&(e.alphaMap.value=n.alphaMap),n.specularMap&&(e.specularMap.value=n.specularMap),n.alphaTest>0&&(e.alphaTest.value=n.alphaTest);const i=t.get(n).envMap;let r,o;i&&(e.envMap.value=i,e.flipEnvMap.value=i.isCubeTexture&&!1===i.isRenderTargetTexture?-1:1,e.reflectivity.value=n.reflectivity,e.ior.value=n.ior,e.refractionRatio.value=n.refractionRatio),n.lightMap&&(e.lightMap.value=n.lightMap,e.lightMapIntensity.value=n.lightMapIntensity),n.aoMap&&(e.aoMap.value=n.aoMap,e.aoMapIntensity.value=n.aoMapIntensity),n.map?r=n.map:n.specularMap?r=n.specularMap:n.displacementMap?r=n.displacementMap:n.normalMap?r=n.normalMap:n.bumpMap?r=n.bumpMap:n.roughnessMap?r=n.roughnessMap:n.metalnessMap?r=n.metalnessMap:n.alphaMap?r=n.alphaMap:n.emissiveMap?r=n.emissiveMap:n.clearcoatMap?r=n.clearcoatMap:n.clearcoatNormalMap?r=n.clearcoatNormalMap:n.clearcoatRoughnessMap?r=n.clearcoatRoughnessMap:n.specularIntensityMap?r=n.specularIntensityMap:n.specularColorMap?r=n.specularColorMap:n.transmissionMap?r=n.transmissionMap:n.thicknessMap?r=n.thicknessMap:n.sheenColorMap?r=n.sheenColorMap:n.sheenRoughnessMap&&(r=n.sheenRoughnessMap),void 0!==r&&(r.isWebGLRenderTarget&&(r=r.texture),!0===r.matrixAutoUpdate&&r.updateMatrix(),e.uvTransform.value.copy(r.matrix)),n.aoMap?o=n.aoMap:n.lightMap&&(o=n.lightMap),void 0!==o&&(o.isWebGLRenderTarget&&(o=o.texture),!0===o.matrixAutoUpdate&&o.updateMatrix(),e.uv2Transform.value.copy(o.matrix))}function n(e,n){e.roughness.value=n.roughness,e.metalness.value=n.metalness,n.roughnessMap&&(e.roughnessMap.value=n.roughnessMap),n.metalnessMap&&(e.metalnessMap.value=n.metalnessMap),n.emissiveMap&&(e.emissiveMap.value=n.emissiveMap),n.bumpMap&&(e.bumpMap.value=n.bumpMap,e.bumpScale.value=n.bumpScale,1===n.side&&(e.bumpScale.value*=-1)),n.normalMap&&(e.normalMap.value=n.normalMap,e.normalScale.value.copy(n.normalScale),1===n.side&&e.normalScale.value.negate()),n.displacementMap&&(e.displacementMap.value=n.displacementMap,e.displacementScale.value=n.displacementScale,e.displacementBias.value=n.displacementBias),t.get(n).envMap&&(e.envMapIntensity.value=n.envMapIntensity)}return{refreshFogUniforms:function(t,e){t.fogColor.value.copy(e.color),e.isFog?(t.fogNear.value=e.near,t.fogFar.value=e.far):e.isFogExp2&&(t.fogDensity.value=e.density)},refreshMaterialUniforms:function(t,i,r,o,s){i.isMeshBasicMaterial?e(t,i):i.isMeshLambertMaterial?(e(t,i),function(t,e){e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap)}(t,i)):i.isMeshToonMaterial?(e(t,i),function(t,e){e.gradientMap&&(t.gradientMap.value=e.gradientMap),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap),e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,1===e.side&&(t.bumpScale.value*=-1)),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),1===e.side&&t.normalScale.value.negate()),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(t,i)):i.isMeshPhongMaterial?(e(t,i),function(t,e){t.specular.value.copy(e.specular),t.shininess.value=Math.max(e.shininess,1e-4),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap),e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,1===e.side&&(t.bumpScale.value*=-1)),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),1===e.side&&t.normalScale.value.negate()),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(t,i)):i.isMeshStandardMaterial?(e(t,i),i.isMeshPhysicalMaterial?function(t,e,i){n(t,e),t.ior.value=e.ior,e.sheen>0&&(t.sheenColor.value.copy(e.sheenColor).multiplyScalar(e.sheen),t.sheenRoughness.value=e.sheenRoughness,e.sheenColorMap&&(t.sheenColorMap.value=e.sheenColorMap),e.sheenRoughnessMap&&(t.sheenRoughnessMap.value=e.sheenRoughnessMap)),e.clearcoat>0&&(t.clearcoat.value=e.clearcoat,t.clearcoatRoughness.value=e.clearcoatRoughness,e.clearcoatMap&&(t.clearcoatMap.value=e.clearcoatMap),e.clearcoatRoughnessMap&&(t.clearcoatRoughnessMap.value=e.clearcoatRoughnessMap),e.clearcoatNormalMap&&(t.clearcoatNormalScale.value.copy(e.clearcoatNormalScale),t.clearcoatNormalMap.value=e.clearcoatNormalMap,1===e.side&&t.clearcoatNormalScale.value.negate())),e.transmission>0&&(t.transmission.value=e.transmission,t.transmissionSamplerMap.value=i.texture,t.transmissionSamplerSize.value.set(i.width,i.height),e.transmissionMap&&(t.transmissionMap.value=e.transmissionMap),t.thickness.value=e.thickness,e.thicknessMap&&(t.thicknessMap.value=e.thicknessMap),t.attenuationDistance.value=e.attenuationDistance,t.attenuationColor.value.copy(e.attenuationColor)),t.specularIntensity.value=e.specularIntensity,t.specularColor.value.copy(e.specularColor),e.specularIntensityMap&&(t.specularIntensityMap.value=e.specularIntensityMap),e.specularColorMap&&(t.specularColorMap.value=e.specularColorMap)}(t,i,s):n(t,i)):i.isMeshMatcapMaterial?(e(t,i),function(t,e){e.matcap&&(t.matcap.value=e.matcap),e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,1===e.side&&(t.bumpScale.value*=-1)),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),1===e.side&&t.normalScale.value.negate()),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(t,i)):i.isMeshDepthMaterial?(e(t,i),function(t,e){e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(t,i)):i.isMeshDistanceMaterial?(e(t,i),function(t,e){e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias),t.referencePosition.value.copy(e.referencePosition),t.nearDistance.value=e.nearDistance,t.farDistance.value=e.farDistance}(t,i)):i.isMeshNormalMaterial?(e(t,i),function(t,e){e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,1===e.side&&(t.bumpScale.value*=-1)),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),1===e.side&&t.normalScale.value.negate()),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(t,i)):i.isLineBasicMaterial?(function(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity}(t,i),i.isLineDashedMaterial&&function(t,e){t.dashSize.value=e.dashSize,t.totalSize.value=e.dashSize+e.gapSize,t.scale.value=e.scale}(t,i)):i.isPointsMaterial?function(t,e,n,i){let r;t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.size.value=e.size*n,t.scale.value=.5*i,e.map&&(t.map.value=e.map),e.alphaMap&&(t.alphaMap.value=e.alphaMap),e.alphaTest>0&&(t.alphaTest.value=e.alphaTest),e.map?r=e.map:e.alphaMap&&(r=e.alphaMap),void 0!==r&&(!0===r.matrixAutoUpdate&&r.updateMatrix(),t.uvTransform.value.copy(r.matrix))}(t,i,r,o):i.isSpriteMaterial?function(t,e){let n;t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.rotation.value=e.rotation,e.map&&(t.map.value=e.map),e.alphaMap&&(t.alphaMap.value=e.alphaMap),e.alphaTest>0&&(t.alphaTest.value=e.alphaTest),e.map?n=e.map:e.alphaMap&&(n=e.alphaMap),void 0!==n&&(!0===n.matrixAutoUpdate&&n.updateMatrix(),t.uvTransform.value.copy(n.matrix))}(t,i):i.isShadowMaterial?(t.color.value.copy(i.color),t.opacity.value=i.opacity):i.isShaderMaterial&&(i.uniformsNeedUpdate=!1)}}}function Au(t={}){const e=void 0!==t.canvas?t.canvas:function(){const t=_s("canvas");return t.style.display="block",t}(),n=void 0!==t.context?t.context:null,i=void 0===t.depth||t.depth,r=void 0===t.stencil||t.stencil,o=void 0!==t.antialias&&t.antialias,s=void 0===t.premultipliedAlpha||t.premultipliedAlpha,a=void 0!==t.preserveDrawingBuffer&&t.preserveDrawingBuffer,l=void 0!==t.powerPreference?t.powerPreference:"default",c=void 0!==t.failIfMajorPerformanceCaveat&&t.failIfMajorPerformanceCaveat;let h;h=void 0!==t.context?n.getContextAttributes().alpha:void 0!==t.alpha&&t.alpha;let u=null,d=null;const p=[],f=[];this.domElement=e,this.debug={checkShaderErrors:!0},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.outputEncoding=Ko,this.physicallyCorrectLights=!1,this.toneMapping=0,this.toneMappingExposure=1;const m=this;let g=!1,_=0,v=0,y=null,x=-1,b=null;const w=new Ps,M=new Ps;let S=null,T=e.width,E=e.height,A=1,C=null,R=null;const L=new Ps(0,0,T,E),P=new Ps(0,0,T,E);let I=!1;const D=new Zl;let O=!1,N=!1,z=null;const B=new pa,F=new fs,H=new zs,U={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function k(){return null===y?A:1}let G,W,V,j,q,Y,X,Z,J,$,K,Q,tt,et,nt,it,rt,ot,st,at,lt,ct,ht,ut=n;function dt(t,n){for(let i=0;i<t.length;i++){const r=t[i],o=e.getContext(r,n);if(null!==o)return o}return null}try{const t={alpha:!0,depth:i,stencil:r,antialias:o,premultipliedAlpha:s,preserveDrawingBuffer:a,powerPreference:l,failIfMajorPerformanceCaveat:c};if("setAttribute"in e&&e.setAttribute("data-engine","three.js r138"),e.addEventListener("webglcontextlost",mt,!1),e.addEventListener("webglcontextrestored",gt,!1),null===ut){const e=["webgl2","webgl","experimental-webgl"];if(!0===m.isWebGL1Renderer&&e.shift(),ut=dt(e,t),null===ut)throw dt(e)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}void 0===ut.getShaderPrecisionFormat&&(ut.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(t){throw console.error("THREE.WebGLRenderer: "+t.message),t}function pt(){G=new wc(ut),W=new oc(ut,G,t),G.init(W),ct=new yu(ut,G,W),V=new _u(ut,G,W),j=new Tc(ut),q=new iu,Y=new vu(ut,G,V,q,W,ct,j),X=new ac(m),Z=new bc(m),J=new $l(ut,W),ht=new ic(ut,G,J,W),$=new Mc(ut,J,j,ht),K=new Lc(ut,$,J,j),st=new Rc(ut,W,Y),it=new sc(q),Q=new nu(m,X,Z,G,W,ht,it),tt=new Eu(q),et=new au,nt=new pu(G,W),ot=new nc(m,X,V,K,h,s),rt=new gu(m,K,W),at=new rc(ut,G,j,W),lt=new Sc(ut,G,j,W),j.programs=Q.programs,m.capabilities=W,m.extensions=G,m.properties=q,m.renderLists=et,m.shadowMap=rt,m.state=V,m.info=j}pt();const ft=new Tu(m,ut);function mt(t){t.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),g=!0}function gt(){console.log("THREE.WebGLRenderer: Context Restored."),g=!1;const t=j.autoReset,e=rt.enabled,n=rt.autoUpdate,i=rt.needsUpdate,r=rt.type;pt(),j.autoReset=t,rt.enabled=e,rt.autoUpdate=n,rt.needsUpdate=i,rt.type=r}function _t(t){const e=t.target;e.removeEventListener("dispose",_t),function(t){(function(t){const e=q.get(t).programs;void 0!==e&&(e.forEach((function(t){Q.releaseProgram(t)})),t.isShaderMaterial&&Q.releaseShaderCache(t))})(t),q.remove(t)}(e)}this.xr=ft,this.getContext=function(){return ut},this.getContextAttributes=function(){return ut.getContextAttributes()},this.forceContextLoss=function(){const t=G.get("WEBGL_lose_context");t&&t.loseContext()},this.forceContextRestore=function(){const t=G.get("WEBGL_lose_context");t&&t.restoreContext()},this.getPixelRatio=function(){return A},this.setPixelRatio=function(t){void 0!==t&&(A=t,this.setSize(T,E,!1))},this.getSize=function(t){return t.set(T,E)},this.setSize=function(t,n,i){ft.isPresenting?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(T=t,E=n,e.width=Math.floor(t*A),e.height=Math.floor(n*A),!1!==i&&(e.style.width=t+"px",e.style.height=n+"px"),this.setViewport(0,0,t,n))},this.getDrawingBufferSize=function(t){return t.set(T*A,E*A).floor()},this.setDrawingBufferSize=function(t,n,i){T=t,E=n,A=i,e.width=Math.floor(t*i),e.height=Math.floor(n*i),this.setViewport(0,0,t,n)},this.getCurrentViewport=function(t){return t.copy(w)},this.getViewport=function(t){return t.copy(L)},this.setViewport=function(t,e,n,i){t.isVector4?L.set(t.x,t.y,t.z,t.w):L.set(t,e,n,i),V.viewport(w.copy(L).multiplyScalar(A).floor())},this.getScissor=function(t){return t.copy(P)},this.setScissor=function(t,e,n,i){t.isVector4?P.set(t.x,t.y,t.z,t.w):P.set(t,e,n,i),V.scissor(M.copy(P).multiplyScalar(A).floor())},this.getScissorTest=function(){return I},this.setScissorTest=function(t){V.setScissorTest(I=t)},this.setOpaqueSort=function(t){C=t},this.setTransparentSort=function(t){R=t},this.getClearColor=function(t){return t.copy(ot.getClearColor())},this.setClearColor=function(){ot.setClearColor.apply(ot,arguments)},this.getClearAlpha=function(){return ot.getClearAlpha()},this.setClearAlpha=function(){ot.setClearAlpha.apply(ot,arguments)},this.clear=function(t=!0,e=!0,n=!0){let i=0;t&&(i|=16384),e&&(i|=256),n&&(i|=1024),ut.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(){e.removeEventListener("webglcontextlost",mt,!1),e.removeEventListener("webglcontextrestored",gt,!1),et.dispose(),nt.dispose(),q.dispose(),X.dispose(),Z.dispose(),K.dispose(),ht.dispose(),Q.dispose(),ft.dispose(),ft.removeEventListener("sessionstart",yt),ft.removeEventListener("sessionend",xt),z&&(z.dispose(),z=null),bt.stop()},this.renderBufferDirect=function(t,e,n,i,r,o){null===e&&(e=U);const s=r.isMesh&&r.matrixWorld.determinant()<0,a=function(t,e,n,i,r){!0!==e.isScene&&(e=U),Y.resetTextureUnits();const o=e.fog,s=i.isMeshStandardMaterial?e.environment:null,a=null===y?m.outputEncoding:!0===y.isXRRenderTarget?y.texture.encoding:Ko,l=(i.isMeshStandardMaterial?Z:X).get(i.envMap||s),c=!0===i.vertexColors&&!!n.attributes.color&&4===n.attributes.color.itemSize,h=!!i.normalMap&&!!n.attributes.tangent,u=!!n.morphAttributes.position,p=!!n.morphAttributes.normal,f=!!n.morphAttributes.color,g=i.toneMapped?m.toneMapping:0,_=n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color,v=void 0!==_?_.length:0,w=q.get(i),M=d.state.lights;if(!0===O&&(!0===N||t!==b)){const e=t===b&&i.id===x;it.setState(i,t,e)}let S=!1;i.version===w.__version?w.needsLights&&w.lightsStateVersion!==M.state.version||w.outputEncoding!==a||r.isInstancedMesh&&!1===w.instancing?S=!0:r.isInstancedMesh||!0!==w.instancing?r.isSkinnedMesh&&!1===w.skinning?S=!0:r.isSkinnedMesh||!0!==w.skinning?w.envMap!==l||i.fog&&w.fog!==o?S=!0:void 0===w.numClippingPlanes||w.numClippingPlanes===it.numPlanes&&w.numIntersection===it.numIntersection?(w.vertexAlphas!==c||w.vertexTangents!==h||w.morphTargets!==u||w.morphNormals!==p||w.morphColors!==f||w.toneMapping!==g||!0===W.isWebGL2&&w.morphTargetsCount!==v)&&(S=!0):S=!0:S=!0:S=!0:(S=!0,w.__version=i.version);let T=w.currentProgram;!0===S&&(T=Et(i,e,r));let C=!1,R=!1,L=!1;const P=T.getUniforms(),I=w.uniforms;if(V.useProgram(T.program)&&(C=!0,R=!0,L=!0),i.id!==x&&(x=i.id,R=!0),C||b!==t){if(P.setValue(ut,"projectionMatrix",t.projectionMatrix),W.logarithmicDepthBuffer&&P.setValue(ut,"logDepthBufFC",2/(Math.log(t.far+1)/Math.LN2)),b!==t&&(b=t,R=!0,L=!0),i.isShaderMaterial||i.isMeshPhongMaterial||i.isMeshToonMaterial||i.isMeshStandardMaterial||i.envMap){const e=P.map.cameraPosition;void 0!==e&&e.setValue(ut,H.setFromMatrixPosition(t.matrixWorld))}(i.isMeshPhongMaterial||i.isMeshToonMaterial||i.isMeshLambertMaterial||i.isMeshBasicMaterial||i.isMeshStandardMaterial||i.isShaderMaterial)&&P.setValue(ut,"isOrthographic",!0===t.isOrthographicCamera),(i.isMeshPhongMaterial||i.isMeshToonMaterial||i.isMeshLambertMaterial||i.isMeshBasicMaterial||i.isMeshStandardMaterial||i.isShaderMaterial||i.isShadowMaterial||r.isSkinnedMesh)&&P.setValue(ut,"viewMatrix",t.matrixWorldInverse)}if(r.isSkinnedMesh){P.setOptional(ut,r,"bindMatrix"),P.setOptional(ut,r,"bindMatrixInverse");const t=r.skeleton;t&&(W.floatVertexTextures?(null===t.boneTexture&&t.computeBoneTexture(),P.setValue(ut,"boneTexture",t.boneTexture,Y),P.setValue(ut,"boneTextureSize",t.boneTextureSize)):P.setOptional(ut,t,"boneMatrices"))}const D=n.morphAttributes;var B,F;return(void 0!==D.position||void 0!==D.normal||void 0!==D.color&&!0===W.isWebGL2)&&st.update(r,n,i,T),(R||w.receiveShadow!==r.receiveShadow)&&(w.receiveShadow=r.receiveShadow,P.setValue(ut,"receiveShadow",r.receiveShadow)),R&&(P.setValue(ut,"toneMappingExposure",m.toneMappingExposure),w.needsLights&&(F=L,(B=I).ambientLightColor.needsUpdate=F,B.lightProbe.needsUpdate=F,B.directionalLights.needsUpdate=F,B.directionalLightShadows.needsUpdate=F,B.pointLights.needsUpdate=F,B.pointLightShadows.needsUpdate=F,B.spotLights.needsUpdate=F,B.spotLightShadows.needsUpdate=F,B.rectAreaLights.needsUpdate=F,B.hemisphereLights.needsUpdate=F),o&&i.fog&&tt.refreshFogUniforms(I,o),tt.refreshMaterialUniforms(I,i,A,E,z),Oh.upload(ut,w.uniformsList,I,Y)),i.isShaderMaterial&&!0===i.uniformsNeedUpdate&&(Oh.upload(ut,w.uniformsList,I,Y),i.uniformsNeedUpdate=!1),i.isSpriteMaterial&&P.setValue(ut,"center",r.center),P.setValue(ut,"modelViewMatrix",r.modelViewMatrix),P.setValue(ut,"normalMatrix",r.normalMatrix),P.setValue(ut,"modelMatrix",r.matrixWorld),T}(t,e,n,i,r);V.setMaterial(i,s);let l=n.index;const c=n.attributes.position;if(null===l){if(void 0===c||0===c.count)return}else if(0===l.count)return;let h,u=1;!0===i.wireframe&&(l=$.getWireframeAttribute(n),u=2),ht.setup(r,i,a,n,l);let p=at;null!==l&&(h=J.get(l),p=lt,p.setIndex(h));const f=null!==l?l.count:c.count,g=n.drawRange.start*u,_=n.drawRange.count*u,v=null!==o?o.start*u:0,w=null!==o?o.count*u:1/0,M=Math.max(g,v),S=Math.min(f,g+_,v+w)-1,T=Math.max(0,S-M+1);if(0!==T){if(r.isMesh)!0===i.wireframe?(V.setLineWidth(i.wireframeLinewidth*k()),p.setMode(1)):p.setMode(4);else if(r.isLine){let t=i.linewidth;void 0===t&&(t=1),V.setLineWidth(t*k()),r.isLineSegments?p.setMode(1):r.isLineLoop?p.setMode(2):p.setMode(3)}else r.isPoints?p.setMode(0):r.isSprite&&p.setMode(4);if(r.isInstancedMesh)p.renderInstances(M,T,r.count);else if(n.isInstancedBufferGeometry){const t=Math.min(n.instanceCount,n._maxInstanceCount);p.renderInstances(M,T,t)}else p.render(M,T)}},this.compile=function(t,e){d=nt.get(t),d.init(),f.push(d),t.traverseVisible((function(t){t.isLight&&t.layers.test(e.layers)&&(d.pushLight(t),t.castShadow&&d.pushShadow(t))})),d.setupLights(m.physicallyCorrectLights),t.traverse((function(e){const n=e.material;if(n)if(Array.isArray(n))for(let i=0;i<n.length;i++)Et(n[i],t,e);else Et(n,t,e)})),f.pop(),d=null};let vt=null;function yt(){bt.stop()}function xt(){bt.start()}const bt=new Jl;function wt(t,e,n,i){if(!1===t.visible)return;if(t.layers.test(e.layers))if(t.isGroup)n=t.renderOrder;else if(t.isLOD)!0===t.autoUpdate&&t.update(e);else if(t.isLight)d.pushLight(t),t.castShadow&&d.pushShadow(t);else if(t.isSprite){if(!t.frustumCulled||D.intersectsSprite(t)){i&&H.setFromMatrixPosition(t.matrixWorld).applyMatrix4(B);const e=K.update(t),r=t.material;r.visible&&u.push(t,e,r,n,H.z,null)}}else if((t.isMesh||t.isLine||t.isPoints)&&(t.isSkinnedMesh&&t.skeleton.frame!==j.render.frame&&(t.skeleton.update(),t.skeleton.frame=j.render.frame),!t.frustumCulled||D.intersectsObject(t))){i&&H.setFromMatrixPosition(t.matrixWorld).applyMatrix4(B);const e=K.update(t),r=t.material;if(Array.isArray(r)){const i=e.groups;for(let o=0,s=i.length;o<s;o++){const s=i[o],a=r[s.materialIndex];a&&a.visible&&u.push(t,e,a,n,H.z,s)}}else r.visible&&u.push(t,e,r,n,H.z,null)}const r=t.children;for(let t=0,o=r.length;t<o;t++)wt(r[t],e,n,i)}function Mt(t,e,n,i){const r=t.opaque,s=t.transmissive,a=t.transparent;d.setupLightsView(n),s.length>0&&function(t,e,n){const i=W.isWebGL2;null===z&&(z=new Is(1,1,{generateMipmaps:!0,type:null!==ct.convert(Bo)?Bo:Do,minFilter:Io,samples:i&&!0===o?4:0})),m.getDrawingBufferSize(F),i?z.setSize(F.x,F.y):z.setSize(ps(F.x),ps(F.y));const r=m.getRenderTarget();m.setRenderTarget(z),m.clear();const s=m.toneMapping;m.toneMapping=0,St(t,e,n),m.toneMapping=s,Y.updateMultisampleRenderTarget(z),Y.updateRenderTargetMipmap(z),m.setRenderTarget(r)}(r,e,n),i&&V.viewport(w.copy(i)),r.length>0&&St(r,e,n),s.length>0&&St(s,e,n),a.length>0&&St(a,e,n),V.buffers.depth.setTest(!0),V.buffers.depth.setMask(!0),V.buffers.color.setMask(!0),V.setPolygonOffset(!1)}function St(t,e,n){const i=!0===e.isScene?e.overrideMaterial:null;for(let r=0,o=t.length;r<o;r++){const o=t[r],s=o.object,a=o.geometry,l=null===i?o.material:i,c=o.group;s.layers.test(n.layers)&&Tt(s,e,n,a,l,c)}}function Tt(t,e,n,i,r,o){t.onBeforeRender(m,e,n,i,r,o),t.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,t.matrixWorld),t.normalMatrix.getNormalMatrix(t.modelViewMatrix),r.onBeforeRender(m,e,n,i,t,o),!0===r.transparent&&2===r.side?(r.side=1,r.needsUpdate=!0,m.renderBufferDirect(n,e,i,r,t,o),r.side=0,r.needsUpdate=!0,m.renderBufferDirect(n,e,i,r,t,o),r.side=2):m.renderBufferDirect(n,e,i,r,t,o),t.onAfterRender(m,e,n,i,r,o)}function Et(t,e,n){!0!==e.isScene&&(e=U);const i=q.get(t),r=d.state.lights,o=d.state.shadowsArray,s=r.state.version,a=Q.getParameters(t,r.state,o,e,n),l=Q.getProgramCacheKey(a);let c=i.programs;i.environment=t.isMeshStandardMaterial?e.environment:null,i.fog=e.fog,i.envMap=(t.isMeshStandardMaterial?Z:X).get(t.envMap||i.environment),void 0===c&&(t.addEventListener("dispose",_t),c=new Map,i.programs=c);let h=c.get(l);if(void 0!==h){if(i.currentProgram===h&&i.lightsStateVersion===s)return At(t,a),h}else a.uniforms=Q.getUniforms(t),t.onBuild(n,a,m),t.onBeforeCompile(a,m),h=Q.acquireProgram(a,l),c.set(l,h),i.uniforms=a.uniforms;const u=i.uniforms;(t.isShaderMaterial||t.isRawShaderMaterial)&&!0!==t.clipping||(u.clippingPlanes=it.uniform),At(t,a),i.needsLights=function(t){return t.isMeshLambertMaterial||t.isMeshToonMaterial||t.isMeshPhongMaterial||t.isMeshStandardMaterial||t.isShadowMaterial||t.isShaderMaterial&&!0===t.lights}(t),i.lightsStateVersion=s,i.needsLights&&(u.ambientLightColor.value=r.state.ambient,u.lightProbe.value=r.state.probe,u.directionalLights.value=r.state.directional,u.directionalLightShadows.value=r.state.directionalShadow,u.spotLights.value=r.state.spot,u.spotLightShadows.value=r.state.spotShadow,u.rectAreaLights.value=r.state.rectArea,u.ltc_1.value=r.state.rectAreaLTC1,u.ltc_2.value=r.state.rectAreaLTC2,u.pointLights.value=r.state.point,u.pointLightShadows.value=r.state.pointShadow,u.hemisphereLights.value=r.state.hemi,u.directionalShadowMap.value=r.state.directionalShadowMap,u.directionalShadowMatrix.value=r.state.directionalShadowMatrix,u.spotShadowMap.value=r.state.spotShadowMap,u.spotShadowMatrix.value=r.state.spotShadowMatrix,u.pointShadowMap.value=r.state.pointShadowMap,u.pointShadowMatrix.value=r.state.pointShadowMatrix);const p=h.getUniforms(),f=Oh.seqWithValue(p.seq,u);return i.currentProgram=h,i.uniformsList=f,h}function At(t,e){const n=q.get(t);n.outputEncoding=e.outputEncoding,n.instancing=e.instancing,n.skinning=e.skinning,n.morphTargets=e.morphTargets,n.morphNormals=e.morphNormals,n.morphColors=e.morphColors,n.morphTargetsCount=e.morphTargetsCount,n.numClippingPlanes=e.numClippingPlanes,n.numIntersection=e.numClipIntersection,n.vertexAlphas=e.vertexAlphas,n.vertexTangents=e.vertexTangents,n.toneMapping=e.toneMapping}bt.setAnimationLoop((function(t){vt&&vt(t)})),"undefined"!=typeof window&&bt.setContext(window),this.setAnimationLoop=function(t){vt=t,ft.setAnimationLoop(t),null===t?bt.stop():bt.start()},ft.addEventListener("sessionstart",yt),ft.addEventListener("sessionend",xt),this.render=function(t,e){if(void 0!==e&&!0!==e.isCamera)return void console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");if(!0===g)return;!0===t.autoUpdate&&t.updateMatrixWorld(),null===e.parent&&e.updateMatrixWorld(),!0===ft.enabled&&!0===ft.isPresenting&&(!0===ft.cameraAutoUpdate&&ft.updateCamera(e),e=ft.getCamera()),!0===t.isScene&&t.onBeforeRender(m,t,e,y),d=nt.get(t,f.length),d.init(),f.push(d),B.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),D.setFromProjectionMatrix(B),N=this.localClippingEnabled,O=it.init(this.clippingPlanes,N,e),u=et.get(t,p.length),u.init(),p.push(u),wt(t,e,0,m.sortObjects),u.finish(),!0===m.sortObjects&&u.sort(C,R),!0===O&&it.beginShadows();const n=d.state.shadowsArray;if(rt.render(n,t,e),!0===O&&it.endShadows(),!0===this.info.autoReset&&this.info.reset(),ot.render(u,t),d.setupLights(m.physicallyCorrectLights),e.isArrayCamera){const n=e.cameras;for(let e=0,i=n.length;e<i;e++){const i=n[e];Mt(u,t,i,i.viewport)}}else Mt(u,t,e);null!==y&&(Y.updateMultisampleRenderTarget(y),Y.updateRenderTargetMipmap(y)),!0===t.isScene&&t.onAfterRender(m,t,e),ht.resetDefaultState(),x=-1,b=null,f.pop(),d=f.length>0?f[f.length-1]:null,p.pop(),u=p.length>0?p[p.length-1]:null},this.getActiveCubeFace=function(){return _},this.getActiveMipmapLevel=function(){return v},this.getRenderTarget=function(){return y},this.setRenderTargetTextures=function(t,e,n){q.get(t.texture).__webglTexture=e,q.get(t.depthTexture).__webglTexture=n;const i=q.get(t);i.__hasExternalTextures=!0,i.__hasExternalTextures&&(i.__autoAllocateDepthBuffer=void 0===n,i.__autoAllocateDepthBuffer||!0===G.has("WEBGL_multisampled_render_to_texture")&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),i.__useRenderToTexture=!1))},this.setRenderTargetFramebuffer=function(t,e){const n=q.get(t);n.__webglFramebuffer=e,n.__useDefaultFramebuffer=void 0===e},this.setRenderTarget=function(t,e=0,n=0){y=t,_=e,v=n;let i=!0;if(t){const e=q.get(t);void 0!==e.__useDefaultFramebuffer?(V.bindFramebuffer(36160,null),i=!1):void 0===e.__webglFramebuffer?Y.setupRenderTarget(t):e.__hasExternalTextures&&Y.rebindTextures(t,q.get(t.texture).__webglTexture,q.get(t.depthTexture).__webglTexture)}let r=null,o=!1,s=!1;if(t){const n=t.texture;(n.isData3DTexture||n.isDataArrayTexture)&&(s=!0);const i=q.get(t).__webglFramebuffer;t.isWebGLCubeRenderTarget?(r=i[e],o=!0):r=W.isWebGL2&&t.samples>0&&!1===Y.useMultisampledRTT(t)?q.get(t).__webglMultisampledFramebuffer:i,w.copy(t.viewport),M.copy(t.scissor),S=t.scissorTest}else w.copy(L).multiplyScalar(A).floor(),M.copy(P).multiplyScalar(A).floor(),S=I;if(V.bindFramebuffer(36160,r)&&W.drawBuffers&&i&&V.drawBuffers(t,r),V.viewport(w),V.scissor(M),V.setScissorTest(S),o){const i=q.get(t.texture);ut.framebufferTexture2D(36160,36064,34069+e,i.__webglTexture,n)}else if(s){const i=q.get(t.texture),r=e||0;ut.framebufferTextureLayer(36160,36064,i.__webglTexture,n||0,r)}x=-1},this.readRenderTargetPixels=function(t,e,n,i,r,o,s){if(!t||!t.isWebGLRenderTarget)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let a=q.get(t).__webglFramebuffer;if(t.isWebGLCubeRenderTarget&&void 0!==s&&(a=a[s]),a){V.bindFramebuffer(36160,a);try{const s=t.texture,a=s.format,l=s.type;if(a!==Ho&&ct.convert(a)!==ut.getParameter(35739))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");const c=l===Bo&&(G.has("EXT_color_buffer_half_float")||W.isWebGL2&&G.has("EXT_color_buffer_float"));if(!(l===Do||ct.convert(l)===ut.getParameter(35738)||l===zo&&(W.isWebGL2||G.has("OES_texture_float")||G.has("WEBGL_color_buffer_float"))||c))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");36053===ut.checkFramebufferStatus(36160)?e>=0&&e<=t.width-i&&n>=0&&n<=t.height-r&&ut.readPixels(e,n,i,r,ct.convert(a),ct.convert(l),o):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{const t=null!==y?q.get(y).__webglFramebuffer:null;V.bindFramebuffer(36160,t)}}},this.copyFramebufferToTexture=function(t,e,n=0){if(!0!==e.isFramebufferTexture)return void console.error("THREE.WebGLRenderer: copyFramebufferToTexture() can only be used with FramebufferTexture.");const i=Math.pow(2,-n),r=Math.floor(e.image.width*i),o=Math.floor(e.image.height*i);Y.setTexture2D(e,0),ut.copyTexSubImage2D(3553,n,0,0,t.x,t.y,r,o),V.unbindTexture()},this.copyTextureToTexture=function(t,e,n,i=0){const r=e.image.width,o=e.image.height,s=ct.convert(n.format),a=ct.convert(n.type);Y.setTexture2D(n,0),ut.pixelStorei(37440,n.flipY),ut.pixelStorei(37441,n.premultiplyAlpha),ut.pixelStorei(3317,n.unpackAlignment),e.isDataTexture?ut.texSubImage2D(3553,i,t.x,t.y,r,o,s,a,e.image.data):e.isCompressedTexture?ut.compressedTexSubImage2D(3553,i,t.x,t.y,e.mipmaps[0].width,e.mipmaps[0].height,s,e.mipmaps[0].data):ut.texSubImage2D(3553,i,t.x,t.y,s,a,e.image),0===i&&n.generateMipmaps&&ut.generateMipmap(3553),V.unbindTexture()},this.copyTextureToTexture3D=function(t,e,n,i,r=0){if(m.isWebGL1Renderer)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");const o=t.max.x-t.min.x+1,s=t.max.y-t.min.y+1,a=t.max.z-t.min.z+1,l=ct.convert(i.format),c=ct.convert(i.type);let h;if(i.isData3DTexture)Y.setTexture3D(i,0),h=32879;else{if(!i.isDataArrayTexture)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");Y.setTexture2DArray(i,0),h=35866}ut.pixelStorei(37440,i.flipY),ut.pixelStorei(37441,i.premultiplyAlpha),ut.pixelStorei(3317,i.unpackAlignment);const u=ut.getParameter(3314),d=ut.getParameter(32878),p=ut.getParameter(3316),f=ut.getParameter(3315),g=ut.getParameter(32877),_=n.isCompressedTexture?n.mipmaps[0]:n.image;ut.pixelStorei(3314,_.width),ut.pixelStorei(32878,_.height),ut.pixelStorei(3316,t.min.x),ut.pixelStorei(3315,t.min.y),ut.pixelStorei(32877,t.min.z),n.isDataTexture||n.isData3DTexture?ut.texSubImage3D(h,r,e.x,e.y,e.z,o,s,a,l,c,_.data):n.isCompressedTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),ut.compressedTexSubImage3D(h,r,e.x,e.y,e.z,o,s,a,l,_.data)):ut.texSubImage3D(h,r,e.x,e.y,e.z,o,s,a,l,c,_),ut.pixelStorei(3314,u),ut.pixelStorei(32878,d),ut.pixelStorei(3316,p),ut.pixelStorei(3315,f),ut.pixelStorei(32877,g),0===r&&i.generateMipmaps&&ut.generateMipmap(h),V.unbindTexture()},this.initTexture=function(t){Y.setTexture2D(t,0),V.unbindTexture()},this.resetState=function(){_=0,v=0,y=null,V.reset(),ht.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}Au.prototype.isWebGLRenderer=!0,class extends Au{}.prototype.isWebGL1Renderer=!0;class Cu{constructor(t,e=25e-5){this.name="",this.color=new Ss(t),this.density=e}clone(){return new Cu(this.color,this.density)}toJSON(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}}Cu.prototype.isFogExp2=!0;class Ru{constructor(t,e=1,n=1e3){this.name="",this.color=new Ss(t),this.near=e,this.far=n}clone(){return new Ru(this.color,this.near,this.far)}toJSON(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}Ru.prototype.isFog=!0;class Lu extends Fa{constructor(){super(),this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(t,e){return super.copy(t,e),null!==t.background&&(this.background=t.background.clone()),null!==t.environment&&(this.environment=t.environment.clone()),null!==t.fog&&(this.fog=t.fog.clone()),null!==t.overrideMaterial&&(this.overrideMaterial=t.overrideMaterial.clone()),this.autoUpdate=t.autoUpdate,this.matrixAutoUpdate=t.matrixAutoUpdate,this}toJSON(t){const e=super.toJSON(t);return null!==this.fog&&(e.object.fog=this.fog.toJSON()),e}}Lu.prototype.isScene=!0;class Pu{constructor(t,e){this.array=t,this.stride=e,this.count=void 0!==t?t.length/e:0,this.usage=es,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=cs()}onUploadCallback(){}set needsUpdate(t){!0===t&&this.version++}setUsage(t){return this.usage=t,this}copy(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this.usage=t.usage,this}copyAt(t,e,n){t*=this.stride,n*=e.stride;for(let i=0,r=this.stride;i<r;i++)this.array[t+i]=e.array[n+i];return this}set(t,e=0){return this.array.set(t,e),this}clone(t){void 0===t.arrayBuffers&&(t.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=cs()),void 0===t.arrayBuffers[this.array.buffer._uuid]&&(t.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const e=new this.array.constructor(t.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(e,this.stride);return n.setUsage(this.usage),n}onUpload(t){return this.onUploadCallback=t,this}toJSON(t){return void 0===t.arrayBuffers&&(t.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=cs()),void 0===t.arrayBuffers[this.array.buffer._uuid]&&(t.arrayBuffers[this.array.buffer._uuid]=Array.prototype.slice.call(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}Pu.prototype.isInterleavedBuffer=!0;const Iu=new zs;class Du{constructor(t,e,n,i=!1){this.name="",this.data=t,this.itemSize=e,this.offset=n,this.normalized=!0===i}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(t){this.data.needsUpdate=t}applyMatrix4(t){for(let e=0,n=this.data.count;e<n;e++)Iu.x=this.getX(e),Iu.y=this.getY(e),Iu.z=this.getZ(e),Iu.applyMatrix4(t),this.setXYZ(e,Iu.x,Iu.y,Iu.z);return this}applyNormalMatrix(t){for(let e=0,n=this.count;e<n;e++)Iu.x=this.getX(e),Iu.y=this.getY(e),Iu.z=this.getZ(e),Iu.applyNormalMatrix(t),this.setXYZ(e,Iu.x,Iu.y,Iu.z);return this}transformDirection(t){for(let e=0,n=this.count;e<n;e++)Iu.x=this.getX(e),Iu.y=this.getY(e),Iu.z=this.getZ(e),Iu.transformDirection(t),this.setXYZ(e,Iu.x,Iu.y,Iu.z);return this}setX(t,e){return this.data.array[t*this.data.stride+this.offset]=e,this}setY(t,e){return this.data.array[t*this.data.stride+this.offset+1]=e,this}setZ(t,e){return this.data.array[t*this.data.stride+this.offset+2]=e,this}setW(t,e){return this.data.array[t*this.data.stride+this.offset+3]=e,this}getX(t){return this.data.array[t*this.data.stride+this.offset]}getY(t){return this.data.array[t*this.data.stride+this.offset+1]}getZ(t){return this.data.array[t*this.data.stride+this.offset+2]}getW(t){return this.data.array[t*this.data.stride+this.offset+3]}setXY(t,e,n){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=n,this}setXYZ(t,e,n,i){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=n,this.data.array[t+2]=i,this}setXYZW(t,e,n,i,r){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=n,this.data.array[t+2]=i,this.data.array[t+3]=r,this}clone(t){if(void 0===t){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interlaved buffer attribute will deinterleave buffer data.");const t=[];for(let e=0;e<this.count;e++){const n=e*this.data.stride+this.offset;for(let e=0;e<this.itemSize;e++)t.push(this.data.array[n+e])}return new el(new this.array.constructor(t),this.itemSize,this.normalized)}return void 0===t.interleavedBuffers&&(t.interleavedBuffers={}),void 0===t.interleavedBuffers[this.data.uuid]&&(t.interleavedBuffers[this.data.uuid]=this.data.clone(t)),new Du(t.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(t){if(void 0===t){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interlaved buffer attribute will deinterleave buffer data.");const t=[];for(let e=0;e<this.count;e++){const n=e*this.data.stride+this.offset;for(let e=0;e<this.itemSize;e++)t.push(this.data.array[n+e])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}return void 0===t.interleavedBuffers&&(t.interleavedBuffers={}),void 0===t.interleavedBuffers[this.data.uuid]&&(t.interleavedBuffers[this.data.uuid]=this.data.toJSON(t)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}Du.prototype.isInterleavedBufferAttribute=!0;class Ou extends $a{constructor(t){super(),this.type="SpriteMaterial",this.color=new Ss(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.alphaMap=t.alphaMap,this.rotation=t.rotation,this.sizeAttenuation=t.sizeAttenuation,this}}let Nu;Ou.prototype.isSpriteMaterial=!0;const zu=new zs,Bu=new zs,Fu=new zs,Hu=new fs,Uu=new fs,ku=new pa,Gu=new zs,Wu=new zs,Vu=new zs,ju=new fs,qu=new fs,Yu=new fs;function Xu(t,e,n,i,r,o){Hu.subVectors(t,n).addScalar(.5).multiply(i),void 0!==r?(Uu.x=o*Hu.x-r*Hu.y,Uu.y=r*Hu.x+o*Hu.y):Uu.copy(Hu),t.copy(e),t.x+=Uu.x,t.y+=Uu.y,t.applyMatrix4(ku)}(class extends Fa{constructor(t){if(super(),this.type="Sprite",void 0===Nu){Nu=new dl;const t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),e=new Pu(t,5);Nu.setIndex([0,1,2,0,2,3]),Nu.setAttribute("position",new Du(e,3,0,!1)),Nu.setAttribute("uv",new Du(e,2,3,!1))}this.geometry=Nu,this.material=void 0!==t?t:new Ou,this.center=new fs(.5,.5)}raycast(t,e){null===t.camera&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Bu.setFromMatrixScale(this.matrixWorld),ku.copy(t.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(t.camera.matrixWorldInverse,this.matrixWorld),Fu.setFromMatrixPosition(this.modelViewMatrix),t.camera.isPerspectiveCamera&&!1===this.material.sizeAttenuation&&Bu.multiplyScalar(-Fu.z);const n=this.material.rotation;let i,r;0!==n&&(r=Math.cos(n),i=Math.sin(n));const o=this.center;Xu(Gu.set(-.5,-.5,0),Fu,o,Bu,i,r),Xu(Wu.set(.5,-.5,0),Fu,o,Bu,i,r),Xu(Vu.set(.5,.5,0),Fu,o,Bu,i,r),ju.set(0,0),qu.set(1,0),Yu.set(1,1);let s=t.ray.intersectTriangle(Gu,Wu,Vu,!1,zu);if(null===s&&(Xu(Wu.set(-.5,.5,0),Fu,o,Bu,i,r),qu.set(0,1),s=t.ray.intersectTriangle(Gu,Vu,Wu,!1,zu),null===s))return;const a=t.ray.origin.distanceTo(zu);a<t.near||a>t.far||e.push({distance:a,point:zu.clone(),uv:Za.getUV(zu,Gu,Wu,Vu,ju,qu,Yu,new fs),face:null,object:this})}copy(t){return super.copy(t),void 0!==t.center&&this.center.copy(t.center),this.material=t.material,this}}).prototype.isSprite=!0;const Zu=new zs,Ju=new Ps,$u=new Ps,Ku=new zs,Qu=new pa;class td extends Ll{constructor(t,e){super(t,e),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new pa,this.bindMatrixInverse=new pa}copy(t){return super.copy(t),this.bindMode=t.bindMode,this.bindMatrix.copy(t.bindMatrix),this.bindMatrixInverse.copy(t.bindMatrixInverse),this.skeleton=t.skeleton,this}bind(t,e){this.skeleton=t,void 0===e&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),e=this.matrixWorld),this.bindMatrix.copy(e),this.bindMatrixInverse.copy(e).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const t=new Ps,e=this.geometry.attributes.skinWeight;for(let n=0,i=e.count;n<i;n++){t.x=e.getX(n),t.y=e.getY(n),t.z=e.getZ(n),t.w=e.getW(n);const i=1/t.manhattanLength();i!==1/0?t.multiplyScalar(i):t.set(1,0,0,0),e.setXYZW(n,t.x,t.y,t.z,t.w)}}updateMatrixWorld(t){super.updateMatrixWorld(t),"attached"===this.bindMode?this.bindMatrixInverse.copy(this.matrixWorld).invert():"detached"===this.bindMode?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}boneTransform(t,e){const n=this.skeleton,i=this.geometry;Ju.fromBufferAttribute(i.attributes.skinIndex,t),$u.fromBufferAttribute(i.attributes.skinWeight,t),Zu.copy(e).applyMatrix4(this.bindMatrix),e.set(0,0,0);for(let t=0;t<4;t++){const i=$u.getComponent(t);if(0!==i){const r=Ju.getComponent(t);Qu.multiplyMatrices(n.bones[r].matrixWorld,n.boneInverses[r]),e.addScaledVector(Ku.copy(Zu).applyMatrix4(Qu),i)}}return e.applyMatrix4(this.bindMatrixInverse)}}td.prototype.isSkinnedMesh=!0;(class extends Fa{constructor(){super(),this.type="Bone"}}).prototype.isBone=!0;(class extends Ls{constructor(t=null,e=1,n=1,i,r,o,s,a,l=1003,c=1003,h,u){super(null,o,s,a,l,c,i,r,h,u),this.image={data:t,width:e,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}).prototype.isDataTexture=!0;class ed extends el{constructor(t,e,n,i=1){"number"==typeof n&&(i=n,n=!1,console.error("THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument.")),super(t,e,n),this.meshPerAttribute=i}copy(t){return super.copy(t),this.meshPerAttribute=t.meshPerAttribute,this}toJSON(){const t=super.toJSON();return t.meshPerAttribute=this.meshPerAttribute,t.isInstancedBufferAttribute=!0,t}}ed.prototype.isInstancedBufferAttribute=!0;const nd=new pa,id=new pa,rd=[],od=new Ll;class sd extends Ll{constructor(t,e,n){super(t,e),this.instanceMatrix=new ed(new Float32Array(16*n),16),this.instanceColor=null,this.count=n,this.frustumCulled=!1}copy(t){return super.copy(t),this.instanceMatrix.copy(t.instanceMatrix),null!==t.instanceColor&&(this.instanceColor=t.instanceColor.clone()),this.count=t.count,this}getColorAt(t,e){e.fromArray(this.instanceColor.array,3*t)}getMatrixAt(t,e){e.fromArray(this.instanceMatrix.array,16*t)}raycast(t,e){const n=this.matrixWorld,i=this.count;if(od.geometry=this.geometry,od.material=this.material,void 0!==od.material)for(let r=0;r<i;r++){this.getMatrixAt(r,nd),id.multiplyMatrices(n,nd),od.matrixWorld=id,od.raycast(t,rd);for(let t=0,n=rd.length;t<n;t++){const n=rd[t];n.instanceId=r,n.object=this,e.push(n)}rd.length=0}}setColorAt(t,e){null===this.instanceColor&&(this.instanceColor=new ed(new Float32Array(3*this.instanceMatrix.count),3)),e.toArray(this.instanceColor.array,3*t)}setMatrixAt(t,e){e.toArray(this.instanceMatrix.array,16*t)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"})}}sd.prototype.isInstancedMesh=!0;class ad extends $a{constructor(t){super(),this.type="LineBasicMaterial",this.color=new Ss(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.linewidth=t.linewidth,this.linecap=t.linecap,this.linejoin=t.linejoin,this}}ad.prototype.isLineBasicMaterial=!0;const ld=new zs,cd=new zs,hd=new pa,ud=new da,dd=new ra;class pd extends Fa{constructor(t=new dl,e=new ad){super(),this.type="Line",this.geometry=t,this.material=e,this.updateMorphTargets()}copy(t){return super.copy(t),this.material=t.material,this.geometry=t.geometry,this}computeLineDistances(){const t=this.geometry;if(t.isBufferGeometry)if(null===t.index){const e=t.attributes.position,n=[0];for(let t=1,i=e.count;t<i;t++)ld.fromBufferAttribute(e,t-1),cd.fromBufferAttribute(e,t),n[t]=n[t-1],n[t]+=ld.distanceTo(cd);t.setAttribute("lineDistance",new rl(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else t.isGeometry&&console.error("THREE.Line.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");return this}raycast(t,e){const n=this.geometry,i=this.matrixWorld,r=t.params.Line.threshold,o=n.drawRange;if(null===n.boundingSphere&&n.computeBoundingSphere(),dd.copy(n.boundingSphere),dd.applyMatrix4(i),dd.radius+=r,!1===t.ray.intersectsSphere(dd))return;hd.copy(i).invert(),ud.copy(t.ray).applyMatrix4(hd);const s=r/((this.scale.x+this.scale.y+this.scale.z)/3),a=s*s,l=new zs,c=new zs,h=new zs,u=new zs,d=this.isLineSegments?2:1;if(n.isBufferGeometry){const i=n.index,r=n.attributes.position;if(null!==i)for(let n=Math.max(0,o.start),s=Math.min(i.count,o.start+o.count)-1;n<s;n+=d){const o=i.getX(n),s=i.getX(n+1);if(l.fromBufferAttribute(r,o),c.fromBufferAttribute(r,s),ud.distanceSqToSegment(l,c,u,h)>a)continue;u.applyMatrix4(this.matrixWorld);const d=t.ray.origin.distanceTo(u);d<t.near||d>t.far||e.push({distance:d,point:h.clone().applyMatrix4(this.matrixWorld),index:n,face:null,faceIndex:null,object:this})}else for(let n=Math.max(0,o.start),i=Math.min(r.count,o.start+o.count)-1;n<i;n+=d){if(l.fromBufferAttribute(r,n),c.fromBufferAttribute(r,n+1),ud.distanceSqToSegment(l,c,u,h)>a)continue;u.applyMatrix4(this.matrixWorld);const i=t.ray.origin.distanceTo(u);i<t.near||i>t.far||e.push({distance:i,point:h.clone().applyMatrix4(this.matrixWorld),index:n,face:null,faceIndex:null,object:this})}}else n.isGeometry&&console.error("THREE.Line.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}updateMorphTargets(){const t=this.geometry;if(t.isBufferGeometry){const e=t.morphAttributes,n=Object.keys(e);if(n.length>0){const t=e[n[0]];if(void 0!==t){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,n=t.length;e<n;e++){const n=t[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[n]=e}}}}else{const e=t.morphTargets;void 0!==e&&e.length>0&&console.error("THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}}pd.prototype.isLine=!0;const fd=new zs,md=new zs;class gd extends pd{constructor(t,e){super(t,e),this.type="LineSegments"}computeLineDistances(){const t=this.geometry;if(t.isBufferGeometry)if(null===t.index){const e=t.attributes.position,n=[];for(let t=0,i=e.count;t<i;t+=2)fd.fromBufferAttribute(e,t),md.fromBufferAttribute(e,t+1),n[t]=0===t?0:n[t-1],n[t+1]=n[t]+fd.distanceTo(md);t.setAttribute("lineDistance",new rl(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else t.isGeometry&&console.error("THREE.LineSegments.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");return this}}gd.prototype.isLineSegments=!0;(class extends pd{constructor(t,e){super(t,e),this.type="LineLoop"}}).prototype.isLineLoop=!0;class _d extends $a{constructor(t){super(),this.type="PointsMaterial",this.color=new Ss(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.alphaMap=t.alphaMap,this.size=t.size,this.sizeAttenuation=t.sizeAttenuation,this}}_d.prototype.isPointsMaterial=!0;const vd=new pa,yd=new da,xd=new ra,bd=new zs;function wd(t,e,n,i,r,o,s){const a=yd.distanceSqToPoint(t);if(a<n){const n=new zs;yd.closestPointToPoint(t,n),n.applyMatrix4(i);const l=r.ray.origin.distanceTo(n);if(l<r.near||l>r.far)return;o.push({distance:l,distanceToRay:Math.sqrt(a),point:n,index:e,face:null,object:s})}}(class extends Fa{constructor(t=new dl,e=new _d){super(),this.type="Points",this.geometry=t,this.material=e,this.updateMorphTargets()}copy(t){return super.copy(t),this.material=t.material,this.geometry=t.geometry,this}raycast(t,e){const n=this.geometry,i=this.matrixWorld,r=t.params.Points.threshold,o=n.drawRange;if(null===n.boundingSphere&&n.computeBoundingSphere(),xd.copy(n.boundingSphere),xd.applyMatrix4(i),xd.radius+=r,!1===t.ray.intersectsSphere(xd))return;vd.copy(i).invert(),yd.copy(t.ray).applyMatrix4(vd);const s=r/((this.scale.x+this.scale.y+this.scale.z)/3),a=s*s;if(n.isBufferGeometry){const r=n.index,s=n.attributes.position;if(null!==r)for(let n=Math.max(0,o.start),l=Math.min(r.count,o.start+o.count);n<l;n++){const o=r.getX(n);bd.fromBufferAttribute(s,o),wd(bd,o,a,i,t,e,this)}else for(let n=Math.max(0,o.start),r=Math.min(s.count,o.start+o.count);n<r;n++)bd.fromBufferAttribute(s,n),wd(bd,n,a,i,t,e,this)}else console.error("THREE.Points.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}updateMorphTargets(){const t=this.geometry;if(t.isBufferGeometry){const e=t.morphAttributes,n=Object.keys(e);if(n.length>0){const t=e[n[0]];if(void 0!==t){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,n=t.length;e<n;e++){const n=t[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[n]=e}}}}else{const e=t.morphTargets;void 0!==e&&e.length>0&&console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}}).prototype.isPoints=!0,class extends Ls{constructor(t,e,n,i,r,o,s,a,l){super(t,e,n,i,r,o,s,a,l),this.minFilter=void 0!==o?o:Po,this.magFilter=void 0!==r?r:Po,this.generateMipmaps=!1;const c=this;"requestVideoFrameCallback"in t&&t.requestVideoFrameCallback((function e(){c.needsUpdate=!0,t.requestVideoFrameCallback(e)}))}clone(){return new this.constructor(this.image).copy(this)}update(){const t=this.image;!1=="requestVideoFrameCallback"in t&&t.readyState>=t.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}.prototype.isVideoTexture=!0,class extends Ls{constructor(t,e,n){super({width:t,height:e}),this.format=n,this.magFilter=Lo,this.minFilter=Lo,this.generateMipmaps=!1,this.needsUpdate=!0}}.prototype.isFramebufferTexture=!0;(class extends Ls{constructor(t,e,n,i,r,o,s,a,l,c,h,u){super(null,o,s,a,l,c,i,r,h,u),this.image={width:e,height:n},this.mipmaps=t,this.flipY=!1,this.generateMipmaps=!1}}).prototype.isCompressedTexture=!0;class Md extends Ls{constructor(t,e,n,i,r,o,s,a,l){super(t,e,n,i,r,o,s,a,l),this.needsUpdate=!0}}Md.prototype.isCanvasTexture=!0;class Sd extends dl{constructor(t=1,e=1,n=1,i=8,r=1,o=!1,s=0,a=2*Math.PI){super(),this.type="CylinderGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:n,radialSegments:i,heightSegments:r,openEnded:o,thetaStart:s,thetaLength:a};const l=this;i=Math.floor(i),r=Math.floor(r);const c=[],h=[],u=[],d=[];let p=0;const f=[],m=n/2;let g=0;function _(n){const r=p,o=new fs,f=new zs;let _=0;const v=!0===n?t:e,y=!0===n?1:-1;for(let t=1;t<=i;t++)h.push(0,m*y,0),u.push(0,y,0),d.push(.5,.5),p++;const x=p;for(let t=0;t<=i;t++){const e=t/i*a+s,n=Math.cos(e),r=Math.sin(e);f.x=v*r,f.y=m*y,f.z=v*n,h.push(f.x,f.y,f.z),u.push(0,y,0),o.x=.5*n+.5,o.y=.5*r*y+.5,d.push(o.x,o.y),p++}for(let t=0;t<i;t++){const e=r+t,i=x+t;!0===n?c.push(i,i+1,e):c.push(i+1,i,e),_+=3}l.addGroup(g,_,!0===n?1:2),g+=_}!function(){const o=new zs,_=new zs;let v=0;const y=(e-t)/n;for(let l=0;l<=r;l++){const c=[],g=l/r,v=g*(e-t)+t;for(let t=0;t<=i;t++){const e=t/i,r=e*a+s,l=Math.sin(r),f=Math.cos(r);_.x=v*l,_.y=-g*n+m,_.z=v*f,h.push(_.x,_.y,_.z),o.set(l,y,f).normalize(),u.push(o.x,o.y,o.z),d.push(e,1-g),c.push(p++)}f.push(c)}for(let t=0;t<i;t++)for(let e=0;e<r;e++){const n=f[e][t],i=f[e+1][t],r=f[e+1][t+1],o=f[e][t+1];c.push(n,i,o),c.push(i,r,o),v+=6}l.addGroup(g,v,0),g+=v}(),!1===o&&(t>0&&_(!0),e>0&&_(!1)),this.setIndex(c),this.setAttribute("position",new rl(h,3)),this.setAttribute("normal",new rl(u,3)),this.setAttribute("uv",new rl(d,2))}static fromJSON(t){return new Sd(t.radiusTop,t.radiusBottom,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}}class Td extends Sd{constructor(t=1,e=1,n=8,i=1,r=!1,o=0,s=2*Math.PI){super(0,t,e,n,i,r,o,s),this.type="ConeGeometry",this.parameters={radius:t,height:e,radialSegments:n,heightSegments:i,openEnded:r,thetaStart:o,thetaLength:s}}static fromJSON(t){return new Td(t.radius,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}}new zs,new zs,new zs,new Za;class Ed{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(t,e){const n=this.getUtoTmapping(t);return this.getPoint(n,e)}getPoints(t=5){const e=[];for(let n=0;n<=t;n++)e.push(this.getPoint(n/t));return e}getSpacedPoints(t=5){const e=[];for(let n=0;n<=t;n++)e.push(this.getPointAt(n/t));return e}getLength(){const t=this.getLengths();return t[t.length-1]}getLengths(t=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const e=[];let n,i=this.getPoint(0),r=0;e.push(0);for(let o=1;o<=t;o++)n=this.getPoint(o/t),r+=n.distanceTo(i),e.push(r),i=n;return this.cacheArcLengths=e,e}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(t,e){const n=this.getLengths();let i=0;const r=n.length;let o;o=e||t*n[r-1];let s,a=0,l=r-1;for(;a<=l;)if(i=Math.floor(a+(l-a)/2),s=n[i]-o,s<0)a=i+1;else{if(!(s>0)){l=i;break}l=i-1}if(i=l,n[i]===o)return i/(r-1);const c=n[i];return(i+(o-c)/(n[i+1]-c))/(r-1)}getTangent(t,e){const n=1e-4;let i=t-n,r=t+n;i<0&&(i=0),r>1&&(r=1);const o=this.getPoint(i),s=this.getPoint(r),a=e||(o.isVector2?new fs:new zs);return a.copy(s).sub(o).normalize(),a}getTangentAt(t,e){const n=this.getUtoTmapping(t);return this.getTangent(n,e)}computeFrenetFrames(t,e){const n=new zs,i=[],r=[],o=[],s=new zs,a=new pa;for(let e=0;e<=t;e++){const n=e/t;i[e]=this.getTangentAt(n,new zs)}r[0]=new zs,o[0]=new zs;let l=Number.MAX_VALUE;const c=Math.abs(i[0].x),h=Math.abs(i[0].y),u=Math.abs(i[0].z);c<=l&&(l=c,n.set(1,0,0)),h<=l&&(l=h,n.set(0,1,0)),u<=l&&n.set(0,0,1),s.crossVectors(i[0],n).normalize(),r[0].crossVectors(i[0],s),o[0].crossVectors(i[0],r[0]);for(let e=1;e<=t;e++){if(r[e]=r[e-1].clone(),o[e]=o[e-1].clone(),s.crossVectors(i[e-1],i[e]),s.length()>Number.EPSILON){s.normalize();const t=Math.acos(hs(i[e-1].dot(i[e]),-1,1));r[e].applyMatrix4(a.makeRotationAxis(s,t))}o[e].crossVectors(i[e],r[e])}if(!0===e){let e=Math.acos(hs(r[0].dot(r[t]),-1,1));e/=t,i[0].dot(s.crossVectors(r[0],r[t]))>0&&(e=-e);for(let n=1;n<=t;n++)r[n].applyMatrix4(a.makeRotationAxis(i[n],e*n)),o[n].crossVectors(i[n],r[n])}return{tangents:i,normals:r,binormals:o}}clone(){return(new this.constructor).copy(this)}copy(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}toJSON(){const t={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t}fromJSON(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}}class Ad extends Ed{constructor(t=0,e=0,n=1,i=1,r=0,o=2*Math.PI,s=!1,a=0){super(),this.type="EllipseCurve",this.aX=t,this.aY=e,this.xRadius=n,this.yRadius=i,this.aStartAngle=r,this.aEndAngle=o,this.aClockwise=s,this.aRotation=a}getPoint(t,e){const n=e||new fs,i=2*Math.PI;let r=this.aEndAngle-this.aStartAngle;const o=Math.abs(r)<Number.EPSILON;for(;r<0;)r+=i;for(;r>i;)r-=i;r<Number.EPSILON&&(r=o?0:i),!0!==this.aClockwise||o||(r===i?r=-i:r-=i);const s=this.aStartAngle+t*r;let a=this.aX+this.xRadius*Math.cos(s),l=this.aY+this.yRadius*Math.sin(s);if(0!==this.aRotation){const t=Math.cos(this.aRotation),e=Math.sin(this.aRotation),n=a-this.aX,i=l-this.aY;a=n*t-i*e+this.aX,l=n*e+i*t+this.aY}return n.set(a,l)}copy(t){return super.copy(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}toJSON(){const t=super.toJSON();return t.aX=this.aX,t.aY=this.aY,t.xRadius=this.xRadius,t.yRadius=this.yRadius,t.aStartAngle=this.aStartAngle,t.aEndAngle=this.aEndAngle,t.aClockwise=this.aClockwise,t.aRotation=this.aRotation,t}fromJSON(t){return super.fromJSON(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}}Ad.prototype.isEllipseCurve=!0;class Cd extends Ad{constructor(t,e,n,i,r,o){super(t,e,n,n,i,r,o),this.type="ArcCurve"}}function Rd(){let t=0,e=0,n=0,i=0;function r(r,o,s,a){t=r,e=s,n=-3*r+3*o-2*s-a,i=2*r-2*o+s+a}return{initCatmullRom:function(t,e,n,i,o){r(e,n,o*(n-t),o*(i-e))},initNonuniformCatmullRom:function(t,e,n,i,o,s,a){let l=(e-t)/o-(n-t)/(o+s)+(n-e)/s,c=(n-e)/s-(i-e)/(s+a)+(i-n)/a;l*=s,c*=s,r(e,n,l,c)},calc:function(r){const o=r*r;return t+e*r+n*o+i*(o*r)}}}Cd.prototype.isArcCurve=!0;const Ld=new zs,Pd=new Rd,Id=new Rd,Dd=new Rd;class Od extends Ed{constructor(t=[],e=!1,n="centripetal",i=.5){super(),this.type="CatmullRomCurve3",this.points=t,this.closed=e,this.curveType=n,this.tension=i}getPoint(t,e=new zs){const n=e,i=this.points,r=i.length,o=(r-(this.closed?0:1))*t;let s,a,l=Math.floor(o),c=o-l;this.closed?l+=l>0?0:(Math.floor(Math.abs(l)/r)+1)*r:0===c&&l===r-1&&(l=r-2,c=1),this.closed||l>0?s=i[(l-1)%r]:(Ld.subVectors(i[0],i[1]).add(i[0]),s=Ld);const h=i[l%r],u=i[(l+1)%r];if(this.closed||l+2<r?a=i[(l+2)%r]:(Ld.subVectors(i[r-1],i[r-2]).add(i[r-1]),a=Ld),"centripetal"===this.curveType||"chordal"===this.curveType){const t="chordal"===this.curveType?.5:.25;let e=Math.pow(s.distanceToSquared(h),t),n=Math.pow(h.distanceToSquared(u),t),i=Math.pow(u.distanceToSquared(a),t);n<1e-4&&(n=1),e<1e-4&&(e=n),i<1e-4&&(i=n),Pd.initNonuniformCatmullRom(s.x,h.x,u.x,a.x,e,n,i),Id.initNonuniformCatmullRom(s.y,h.y,u.y,a.y,e,n,i),Dd.initNonuniformCatmullRom(s.z,h.z,u.z,a.z,e,n,i)}else"catmullrom"===this.curveType&&(Pd.initCatmullRom(s.x,h.x,u.x,a.x,this.tension),Id.initCatmullRom(s.y,h.y,u.y,a.y,this.tension),Dd.initCatmullRom(s.z,h.z,u.z,a.z,this.tension));return n.set(Pd.calc(c),Id.calc(c),Dd.calc(c)),n}copy(t){super.copy(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){const n=t.points[e];this.points.push(n.clone())}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}toJSON(){const t=super.toJSON();t.points=[];for(let e=0,n=this.points.length;e<n;e++){const n=this.points[e];t.points.push(n.toArray())}return t.closed=this.closed,t.curveType=this.curveType,t.tension=this.tension,t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){const n=t.points[e];this.points.push((new zs).fromArray(n))}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}}function Nd(t,e,n,i,r){const o=.5*(i-e),s=.5*(r-n),a=t*t;return(2*n-2*i+o+s)*(t*a)+(-3*n+3*i-2*o-s)*a+o*t+n}function zd(t,e,n,i){return function(t,e){const n=1-t;return n*n*e}(t,e)+function(t,e){return 2*(1-t)*t*e}(t,n)+function(t,e){return t*t*e}(t,i)}function Bd(t,e,n,i,r){return function(t,e){const n=1-t;return n*n*n*e}(t,e)+function(t,e){const n=1-t;return 3*n*n*t*e}(t,n)+function(t,e){return 3*(1-t)*t*t*e}(t,i)+function(t,e){return t*t*t*e}(t,r)}Od.prototype.isCatmullRomCurve3=!0;class Fd extends Ed{constructor(t=new fs,e=new fs,n=new fs,i=new fs){super(),this.type="CubicBezierCurve",this.v0=t,this.v1=e,this.v2=n,this.v3=i}getPoint(t,e=new fs){const n=e,i=this.v0,r=this.v1,o=this.v2,s=this.v3;return n.set(Bd(t,i.x,r.x,o.x,s.x),Bd(t,i.y,r.y,o.y,s.y)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}}Fd.prototype.isCubicBezierCurve=!0;class Hd extends Ed{constructor(t=new zs,e=new zs,n=new zs,i=new zs){super(),this.type="CubicBezierCurve3",this.v0=t,this.v1=e,this.v2=n,this.v3=i}getPoint(t,e=new zs){const n=e,i=this.v0,r=this.v1,o=this.v2,s=this.v3;return n.set(Bd(t,i.x,r.x,o.x,s.x),Bd(t,i.y,r.y,o.y,s.y),Bd(t,i.z,r.z,o.z,s.z)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}}Hd.prototype.isCubicBezierCurve3=!0;class Ud extends Ed{constructor(t=new fs,e=new fs){super(),this.type="LineCurve",this.v1=t,this.v2=e}getPoint(t,e=new fs){const n=e;return 1===t?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(t).add(this.v1)),n}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e){const n=e||new fs;return n.copy(this.v2).sub(this.v1).normalize(),n}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}Ud.prototype.isLineCurve=!0;class kd extends Ed{constructor(t=new fs,e=new fs,n=new fs){super(),this.type="QuadraticBezierCurve",this.v0=t,this.v1=e,this.v2=n}getPoint(t,e=new fs){const n=e,i=this.v0,r=this.v1,o=this.v2;return n.set(zd(t,i.x,r.x,o.x),zd(t,i.y,r.y,o.y)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}kd.prototype.isQuadraticBezierCurve=!0;class Gd extends Ed{constructor(t=new zs,e=new zs,n=new zs){super(),this.type="QuadraticBezierCurve3",this.v0=t,this.v1=e,this.v2=n}getPoint(t,e=new zs){const n=e,i=this.v0,r=this.v1,o=this.v2;return n.set(zd(t,i.x,r.x,o.x),zd(t,i.y,r.y,o.y),zd(t,i.z,r.z,o.z)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}Gd.prototype.isQuadraticBezierCurve3=!0;class Wd extends Ed{constructor(t=[]){super(),this.type="SplineCurve",this.points=t}getPoint(t,e=new fs){const n=e,i=this.points,r=(i.length-1)*t,o=Math.floor(r),s=r-o,a=i[0===o?o:o-1],l=i[o],c=i[o>i.length-2?i.length-1:o+1],h=i[o>i.length-3?i.length-1:o+2];return n.set(Nd(s,a.x,l.x,c.x,h.x),Nd(s,a.y,l.y,c.y,h.y)),n}copy(t){super.copy(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){const n=t.points[e];this.points.push(n.clone())}return this}toJSON(){const t=super.toJSON();t.points=[];for(let e=0,n=this.points.length;e<n;e++){const n=this.points[e];t.points.push(n.toArray())}return t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){const n=t.points[e];this.points.push((new fs).fromArray(n))}return this}}Wd.prototype.isSplineCurve=!0;var Vd=Object.freeze({__proto__:null,ArcCurve:Cd,CatmullRomCurve3:Od,CubicBezierCurve:Fd,CubicBezierCurve3:Hd,EllipseCurve:Ad,LineCurve:Ud,LineCurve3:class extends Ed{constructor(t=new zs,e=new zs){super(),this.type="LineCurve3",this.isLineCurve3=!0,this.v1=t,this.v2=e}getPoint(t,e=new zs){const n=e;return 1===t?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(t).add(this.v1)),n}getPointAt(t,e){return this.getPoint(t,e)}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}},QuadraticBezierCurve:kd,QuadraticBezierCurve3:Gd,SplineCurve:Wd});class jd extends Ed{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(t){this.curves.push(t)}closePath(){const t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);t.equals(e)||this.curves.push(new Ud(e,t))}getPoint(t,e){const n=t*this.getLength(),i=this.getCurveLengths();let r=0;for(;r<i.length;){if(i[r]>=n){const t=i[r]-n,o=this.curves[r],s=o.getLength(),a=0===s?0:1-t/s;return o.getPointAt(a,e)}r++}return null}getLength(){const t=this.getCurveLengths();return t[t.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const t=[];let e=0;for(let n=0,i=this.curves.length;n<i;n++)e+=this.curves[n].getLength(),t.push(e);return this.cacheLengths=t,t}getSpacedPoints(t=40){const e=[];for(let n=0;n<=t;n++)e.push(this.getPoint(n/t));return this.autoClose&&e.push(e[0]),e}getPoints(t=12){const e=[];let n;for(let i=0,r=this.curves;i<r.length;i++){const o=r[i],s=o.isEllipseCurve?2*t:o.isLineCurve||o.isLineCurve3?1:o.isSplineCurve?t*o.points.length:t,a=o.getPoints(s);for(let t=0;t<a.length;t++){const i=a[t];n&&n.equals(i)||(e.push(i),n=i)}}return this.autoClose&&e.length>1&&!e[e.length-1].equals(e[0])&&e.push(e[0]),e}copy(t){super.copy(t),this.curves=[];for(let e=0,n=t.curves.length;e<n;e++){const n=t.curves[e];this.curves.push(n.clone())}return this.autoClose=t.autoClose,this}toJSON(){const t=super.toJSON();t.autoClose=this.autoClose,t.curves=[];for(let e=0,n=this.curves.length;e<n;e++){const n=this.curves[e];t.curves.push(n.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.autoClose=t.autoClose,this.curves=[];for(let e=0,n=t.curves.length;e<n;e++){const n=t.curves[e];this.curves.push((new Vd[n.type]).fromJSON(n))}return this}}class qd extends jd{constructor(t){super(),this.type="Path",this.currentPoint=new fs,t&&this.setFromPoints(t)}setFromPoints(t){this.moveTo(t[0].x,t[0].y);for(let e=1,n=t.length;e<n;e++)this.lineTo(t[e].x,t[e].y);return this}moveTo(t,e){return this.currentPoint.set(t,e),this}lineTo(t,e){const n=new Ud(this.currentPoint.clone(),new fs(t,e));return this.curves.push(n),this.currentPoint.set(t,e),this}quadraticCurveTo(t,e,n,i){const r=new kd(this.currentPoint.clone(),new fs(t,e),new fs(n,i));return this.curves.push(r),this.currentPoint.set(n,i),this}bezierCurveTo(t,e,n,i,r,o){const s=new Fd(this.currentPoint.clone(),new fs(t,e),new fs(n,i),new fs(r,o));return this.curves.push(s),this.currentPoint.set(r,o),this}splineThru(t){const e=[this.currentPoint.clone()].concat(t),n=new Wd(e);return this.curves.push(n),this.currentPoint.copy(t[t.length-1]),this}arc(t,e,n,i,r,o){const s=this.currentPoint.x,a=this.currentPoint.y;return this.absarc(t+s,e+a,n,i,r,o),this}absarc(t,e,n,i,r,o){return this.absellipse(t,e,n,n,i,r,o),this}ellipse(t,e,n,i,r,o,s,a){const l=this.currentPoint.x,c=this.currentPoint.y;return this.absellipse(t+l,e+c,n,i,r,o,s,a),this}absellipse(t,e,n,i,r,o,s,a){const l=new Ad(t,e,n,i,r,o,s,a);if(this.curves.length>0){const t=l.getPoint(0);t.equals(this.currentPoint)||this.lineTo(t.x,t.y)}this.curves.push(l);const c=l.getPoint(1);return this.currentPoint.copy(c),this}copy(t){return super.copy(t),this.currentPoint.copy(t.currentPoint),this}toJSON(){const t=super.toJSON();return t.currentPoint=this.currentPoint.toArray(),t}fromJSON(t){return super.fromJSON(t),this.currentPoint.fromArray(t.currentPoint),this}}class Yd extends qd{constructor(t){super(t),this.uuid=cs(),this.type="Shape",this.holes=[]}getPointsHoles(t){const e=[];for(let n=0,i=this.holes.length;n<i;n++)e[n]=this.holes[n].getPoints(t);return e}extractPoints(t){return{shape:this.getPoints(t),holes:this.getPointsHoles(t)}}copy(t){super.copy(t),this.holes=[];for(let e=0,n=t.holes.length;e<n;e++){const n=t.holes[e];this.holes.push(n.clone())}return this}toJSON(){const t=super.toJSON();t.uuid=this.uuid,t.holes=[];for(let e=0,n=this.holes.length;e<n;e++){const n=this.holes[e];t.holes.push(n.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.uuid=t.uuid,this.holes=[];for(let e=0,n=t.holes.length;e<n;e++){const n=t.holes[e];this.holes.push((new qd).fromJSON(n))}return this}}function Xd(t,e,n,i,r){let o,s;if(r===function(t,e,n,i){let r=0;for(let o=e,s=n-i;o<n;o+=i)r+=(t[s]-t[o])*(t[o+1]+t[s+1]),s=o;return r}(t,e,n,i)>0)for(o=e;o<n;o+=i)s=mp(o,t[o],t[o+1],s);else for(o=n-i;o>=e;o-=i)s=mp(o,t[o],t[o+1],s);return s&&cp(s,s.next)&&(gp(s),s=s.next),s}function Zd(t,e){if(!t)return t;e||(e=t);let n,i=t;do{if(n=!1,i.steiner||!cp(i,i.next)&&0!==lp(i.prev,i,i.next))i=i.next;else{if(gp(i),i=e=i.prev,i===i.next)break;n=!0}}while(n||i!==e);return e}function Jd(t,e,n,i,r,o,s){if(!t)return;!s&&o&&function(t,e,n,i){let r=t;do{null===r.z&&(r.z=rp(r.x,r.y,e,n,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,function(t){let e,n,i,r,o,s,a,l,c=1;do{for(n=t,t=null,o=null,s=0;n;){for(s++,i=n,a=0,e=0;e<c&&(a++,i=i.nextZ,i);e++);for(l=c;a>0||l>0&&i;)0!==a&&(0===l||!i||n.z<=i.z)?(r=n,n=n.nextZ,a--):(r=i,i=i.nextZ,l--),o?o.nextZ=r:t=r,r.prevZ=o,o=r;n=i}o.nextZ=null,c*=2}while(s>1)}(r)}(t,i,r,o);let a,l,c=t;for(;t.prev!==t.next;)if(a=t.prev,l=t.next,o?Kd(t,i,r,o):$d(t))e.push(a.i/n),e.push(t.i/n),e.push(l.i/n),gp(t),t=l.next,c=l.next;else if((t=l)===c){s?1===s?Jd(t=Qd(Zd(t),e,n),e,n,i,r,o,2):2===s&&tp(t,e,n,i,r,o):Jd(Zd(t),e,n,i,r,o,1);break}}function $d(t){const e=t.prev,n=t,i=t.next;if(lp(e,n,i)>=0)return!1;let r=t.next.next;for(;r!==t.prev;){if(sp(e.x,e.y,n.x,n.y,i.x,i.y,r.x,r.y)&&lp(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}function Kd(t,e,n,i){const r=t.prev,o=t,s=t.next;if(lp(r,o,s)>=0)return!1;const a=r.x<o.x?r.x<s.x?r.x:s.x:o.x<s.x?o.x:s.x,l=r.y<o.y?r.y<s.y?r.y:s.y:o.y<s.y?o.y:s.y,c=r.x>o.x?r.x>s.x?r.x:s.x:o.x>s.x?o.x:s.x,h=r.y>o.y?r.y>s.y?r.y:s.y:o.y>s.y?o.y:s.y,u=rp(a,l,e,n,i),d=rp(c,h,e,n,i);let p=t.prevZ,f=t.nextZ;for(;p&&p.z>=u&&f&&f.z<=d;){if(p!==t.prev&&p!==t.next&&sp(r.x,r.y,o.x,o.y,s.x,s.y,p.x,p.y)&&lp(p.prev,p,p.next)>=0)return!1;if(p=p.prevZ,f!==t.prev&&f!==t.next&&sp(r.x,r.y,o.x,o.y,s.x,s.y,f.x,f.y)&&lp(f.prev,f,f.next)>=0)return!1;f=f.nextZ}for(;p&&p.z>=u;){if(p!==t.prev&&p!==t.next&&sp(r.x,r.y,o.x,o.y,s.x,s.y,p.x,p.y)&&lp(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;f&&f.z<=d;){if(f!==t.prev&&f!==t.next&&sp(r.x,r.y,o.x,o.y,s.x,s.y,f.x,f.y)&&lp(f.prev,f,f.next)>=0)return!1;f=f.nextZ}return!0}function Qd(t,e,n){let i=t;do{const r=i.prev,o=i.next.next;!cp(r,o)&&hp(r,i,i.next,o)&&pp(r,o)&&pp(o,r)&&(e.push(r.i/n),e.push(i.i/n),e.push(o.i/n),gp(i),gp(i.next),i=t=o),i=i.next}while(i!==t);return Zd(i)}function tp(t,e,n,i,r,o){let s=t;do{let t=s.next.next;for(;t!==s.prev;){if(s.i!==t.i&&ap(s,t)){let a=fp(s,t);return s=Zd(s,s.next),a=Zd(a,a.next),Jd(s,e,n,i,r,o),void Jd(a,e,n,i,r,o)}t=t.next}s=s.next}while(s!==t)}function ep(t,e){return t.x-e.x}function np(t,e){if(e=function(t,e){let n=e;const i=t.x,r=t.y;let o,s=-1/0;do{if(r<=n.y&&r>=n.next.y&&n.next.y!==n.y){const t=n.x+(r-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(t<=i&&t>s){if(s=t,t===i){if(r===n.y)return n;if(r===n.next.y)return n.next}o=n.x<n.next.x?n:n.next}}n=n.next}while(n!==e);if(!o)return null;if(i===s)return o;const a=o,l=o.x,c=o.y;let h,u=1/0;n=o;do{i>=n.x&&n.x>=l&&i!==n.x&&sp(r<c?i:s,r,l,c,r<c?s:i,r,n.x,n.y)&&(h=Math.abs(r-n.y)/(i-n.x),pp(n,t)&&(h<u||h===u&&(n.x>o.x||n.x===o.x&&ip(o,n)))&&(o=n,u=h)),n=n.next}while(n!==a);return o}(t,e),e){const n=fp(e,t);Zd(e,e.next),Zd(n,n.next)}}function ip(t,e){return lp(t.prev,t,e.prev)<0&&lp(e.next,t,t.next)<0}function rp(t,e,n,i,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-n)*r)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-i)*r)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function op(t){let e=t,n=t;do{(e.x<n.x||e.x===n.x&&e.y<n.y)&&(n=e),e=e.next}while(e!==t);return n}function sp(t,e,n,i,r,o,s,a){return(r-s)*(e-a)-(t-s)*(o-a)>=0&&(t-s)*(i-a)-(n-s)*(e-a)>=0&&(n-s)*(o-a)-(r-s)*(i-a)>=0}function ap(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){let n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&hp(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}(t,e)&&(pp(t,e)&&pp(e,t)&&function(t,e){let n=t,i=!1;const r=(t.x+e.x)/2,o=(t.y+e.y)/2;do{n.y>o!=n.next.y>o&&n.next.y!==n.y&&r<(n.next.x-n.x)*(o-n.y)/(n.next.y-n.y)+n.x&&(i=!i),n=n.next}while(n!==t);return i}(t,e)&&(lp(t.prev,t,e.prev)||lp(t,e.prev,e))||cp(t,e)&&lp(t.prev,t,t.next)>0&&lp(e.prev,e,e.next)>0)}function lp(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function cp(t,e){return t.x===e.x&&t.y===e.y}function hp(t,e,n,i){const r=dp(lp(t,e,n)),o=dp(lp(t,e,i)),s=dp(lp(n,i,t)),a=dp(lp(n,i,e));return r!==o&&s!==a||!(0!==r||!up(t,n,e))||!(0!==o||!up(t,i,e))||!(0!==s||!up(n,t,i))||!(0!==a||!up(n,e,i))}function up(t,e,n){return e.x<=Math.max(t.x,n.x)&&e.x>=Math.min(t.x,n.x)&&e.y<=Math.max(t.y,n.y)&&e.y>=Math.min(t.y,n.y)}function dp(t){return t>0?1:t<0?-1:0}function pp(t,e){return lp(t.prev,t,t.next)<0?lp(t,e,t.next)>=0&&lp(t,t.prev,e)>=0:lp(t,e,t.prev)<0||lp(t,t.next,e)<0}function fp(t,e){const n=new _p(t.i,t.x,t.y),i=new _p(e.i,e.x,e.y),r=t.next,o=e.prev;return t.next=e,e.prev=t,n.next=r,r.prev=n,i.next=n,n.prev=i,o.next=i,i.prev=o,i}function mp(t,e,n,i){const r=new _p(t,e,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 gp(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function _p(t,e,n){this.i=t,this.x=e,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}class vp{static area(t){const e=t.length;let n=0;for(let i=e-1,r=0;r<e;i=r++)n+=t[i].x*t[r].y-t[r].x*t[i].y;return.5*n}static isClockWise(t){return vp.area(t)<0}static triangulateShape(t,e){const n=[],i=[],r=[];yp(t),xp(n,t);let o=t.length;e.forEach(yp);for(let t=0;t<e.length;t++)i.push(o),o+=e[t].length,xp(n,e[t]);const s=function(t,e,n=2){const i=e&&e.length,r=i?e[0]*n:t.length;let o=Xd(t,0,r,n,!0);const s=[];if(!o||o.next===o.prev)return s;let a,l,c,h,u,d,p;if(i&&(o=function(t,e,n,i){const r=[];let o,s,a,l,c;for(o=0,s=e.length;o<s;o++)a=e[o]*i,l=o<s-1?e[o+1]*i:t.length,c=Xd(t,a,l,i,!1),c===c.next&&(c.steiner=!0),r.push(op(c));for(r.sort(ep),o=0;o<r.length;o++)np(r[o],n),n=Zd(n,n.next);return n}(t,e,o,n)),t.length>80*n){a=c=t[0],l=h=t[1];for(let e=n;e<r;e+=n)u=t[e],d=t[e+1],u<a&&(a=u),d<l&&(l=d),u>c&&(c=u),d>h&&(h=d);p=Math.max(c-a,h-l),p=0!==p?1/p:0}return Jd(o,s,n,a,l,p),s}(n,i);for(let t=0;t<s.length;t+=3)r.push(s.slice(t,t+3));return r}}function yp(t){const e=t.length;e>2&&t[e-1].equals(t[0])&&t.pop()}function xp(t,e){for(let n=0;n<e.length;n++)t.push(e[n].x),t.push(e[n].y)}class bp extends dl{constructor(t=new Yd([new fs(.5,.5),new fs(-.5,.5),new fs(-.5,-.5),new fs(.5,-.5)]),e={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:t,options:e},t=Array.isArray(t)?t:[t];const n=this,i=[],r=[];for(let e=0,n=t.length;e<n;e++)o(t[e]);function o(t){const o=[],s=void 0!==e.curveSegments?e.curveSegments:12,a=void 0!==e.steps?e.steps:1;let l=void 0!==e.depth?e.depth:1,c=void 0===e.bevelEnabled||e.bevelEnabled,h=void 0!==e.bevelThickness?e.bevelThickness:.2,u=void 0!==e.bevelSize?e.bevelSize:h-.1,d=void 0!==e.bevelOffset?e.bevelOffset:0,p=void 0!==e.bevelSegments?e.bevelSegments:3;const f=e.extrudePath,m=void 0!==e.UVGenerator?e.UVGenerator:wp;void 0!==e.amount&&(console.warn("THREE.ExtrudeBufferGeometry: amount has been renamed to depth."),l=e.amount);let g,_,v,y,x,b=!1;f&&(g=f.getSpacedPoints(a),b=!0,c=!1,_=f.computeFrenetFrames(a,!1),v=new zs,y=new zs,x=new zs),c||(p=0,h=0,u=0,d=0);const w=t.extractPoints(s);let M=w.shape;const S=w.holes;if(!vp.isClockWise(M)){M=M.reverse();for(let t=0,e=S.length;t<e;t++){const e=S[t];vp.isClockWise(e)&&(S[t]=e.reverse())}}const T=vp.triangulateShape(M,S),E=M;for(let t=0,e=S.length;t<e;t++){const e=S[t];M=M.concat(e)}function A(t,e,n){return e||console.error("THREE.ExtrudeGeometry: vec does not exist"),e.clone().multiplyScalar(n).add(t)}const C=M.length,R=T.length;function L(t,e,n){let i,r,o;const s=t.x-e.x,a=t.y-e.y,l=n.x-t.x,c=n.y-t.y,h=s*s+a*a,u=s*c-a*l;if(Math.abs(u)>Number.EPSILON){const u=Math.sqrt(h),d=Math.sqrt(l*l+c*c),p=e.x-a/u,f=e.y+s/u,m=((n.x-c/d-p)*c-(n.y+l/d-f)*l)/(s*c-a*l);i=p+s*m-t.x,r=f+a*m-t.y;const g=i*i+r*r;if(g<=2)return new fs(i,r);o=Math.sqrt(g/2)}else{let t=!1;s>Number.EPSILON?l>Number.EPSILON&&(t=!0):s<-Number.EPSILON?l<-Number.EPSILON&&(t=!0):Math.sign(a)===Math.sign(c)&&(t=!0),t?(i=-a,r=s,o=Math.sqrt(h)):(i=s,r=a,o=Math.sqrt(h/2))}return new fs(i/o,r/o)}const P=[];for(let t=0,e=E.length,n=e-1,i=t+1;t<e;t++,n++,i++)n===e&&(n=0),i===e&&(i=0),P[t]=L(E[t],E[n],E[i]);const I=[];let D,O=P.concat();for(let t=0,e=S.length;t<e;t++){const e=S[t];D=[];for(let t=0,n=e.length,i=n-1,r=t+1;t<n;t++,i++,r++)i===n&&(i=0),r===n&&(r=0),D[t]=L(e[t],e[i],e[r]);I.push(D),O=O.concat(D)}for(let t=0;t<p;t++){const e=t/p,n=h*Math.cos(e*Math.PI/2),i=u*Math.sin(e*Math.PI/2)+d;for(let t=0,e=E.length;t<e;t++){const e=A(E[t],P[t],i);B(e.x,e.y,-n)}for(let t=0,e=S.length;t<e;t++){const e=S[t];D=I[t];for(let t=0,r=e.length;t<r;t++){const r=A(e[t],D[t],i);B(r.x,r.y,-n)}}}const N=u+d;for(let t=0;t<C;t++){const e=c?A(M[t],O[t],N):M[t];b?(y.copy(_.normals[0]).multiplyScalar(e.x),v.copy(_.binormals[0]).multiplyScalar(e.y),x.copy(g[0]).add(y).add(v),B(x.x,x.y,x.z)):B(e.x,e.y,0)}for(let t=1;t<=a;t++)for(let e=0;e<C;e++){const n=c?A(M[e],O[e],N):M[e];b?(y.copy(_.normals[t]).multiplyScalar(n.x),v.copy(_.binormals[t]).multiplyScalar(n.y),x.copy(g[t]).add(y).add(v),B(x.x,x.y,x.z)):B(n.x,n.y,l/a*t)}for(let t=p-1;t>=0;t--){const e=t/p,n=h*Math.cos(e*Math.PI/2),i=u*Math.sin(e*Math.PI/2)+d;for(let t=0,e=E.length;t<e;t++){const e=A(E[t],P[t],i);B(e.x,e.y,l+n)}for(let t=0,e=S.length;t<e;t++){const e=S[t];D=I[t];for(let t=0,r=e.length;t<r;t++){const r=A(e[t],D[t],i);b?B(r.x,r.y+g[a-1].y,g[a-1].x+n):B(r.x,r.y,l+n)}}}function z(t,e){let n=t.length;for(;--n>=0;){const i=n;let r=n-1;r<0&&(r=t.length-1);for(let t=0,n=a+2*p;t<n;t++){const n=C*t,o=C*(t+1);H(e+i+n,e+r+n,e+r+o,e+i+o)}}}function B(t,e,n){o.push(t),o.push(e),o.push(n)}function F(t,e,r){U(t),U(e),U(r);const o=i.length/3,s=m.generateTopUV(n,i,o-3,o-2,o-1);k(s[0]),k(s[1]),k(s[2])}function H(t,e,r,o){U(t),U(e),U(o),U(e),U(r),U(o);const s=i.length/3,a=m.generateSideWallUV(n,i,s-6,s-3,s-2,s-1);k(a[0]),k(a[1]),k(a[3]),k(a[1]),k(a[2]),k(a[3])}function U(t){i.push(o[3*t+0]),i.push(o[3*t+1]),i.push(o[3*t+2])}function k(t){r.push(t.x),r.push(t.y)}!function(){const t=i.length/3;if(c){let t=0,e=C*t;for(let t=0;t<R;t++){const n=T[t];F(n[2]+e,n[1]+e,n[0]+e)}t=a+2*p,e=C*t;for(let t=0;t<R;t++){const n=T[t];F(n[0]+e,n[1]+e,n[2]+e)}}else{for(let t=0;t<R;t++){const e=T[t];F(e[2],e[1],e[0])}for(let t=0;t<R;t++){const e=T[t];F(e[0]+C*a,e[1]+C*a,e[2]+C*a)}}n.addGroup(t,i.length/3-t,0)}(),function(){const t=i.length/3;let e=0;z(E,e),e+=E.length;for(let t=0,n=S.length;t<n;t++){const n=S[t];z(n,e),e+=n.length}n.addGroup(t,i.length/3-t,1)}()}this.setAttribute("position",new rl(i,3)),this.setAttribute("uv",new rl(r,2)),this.computeVertexNormals()}toJSON(){const t=super.toJSON();return function(t,e,n){if(n.shapes=[],Array.isArray(t))for(let e=0,i=t.length;e<i;e++){const i=t[e];n.shapes.push(i.uuid)}else n.shapes.push(t.uuid);return void 0!==e.extrudePath&&(n.options.extrudePath=e.extrudePath.toJSON()),n}(this.parameters.shapes,this.parameters.options,t)}static fromJSON(t,e){const n=[];for(let i=0,r=t.shapes.length;i<r;i++){const r=e[t.shapes[i]];n.push(r)}const i=t.options.extrudePath;return void 0!==i&&(t.options.extrudePath=(new Vd[i.type]).fromJSON(i)),new bp(n,t.options)}}const wp={generateTopUV:function(t,e,n,i,r){const o=e[3*n],s=e[3*n+1],a=e[3*i],l=e[3*i+1],c=e[3*r],h=e[3*r+1];return[new fs(o,s),new fs(a,l),new fs(c,h)]},generateSideWallUV:function(t,e,n,i,r,o){const s=e[3*n],a=e[3*n+1],l=e[3*n+2],c=e[3*i],h=e[3*i+1],u=e[3*i+2],d=e[3*r],p=e[3*r+1],f=e[3*r+2],m=e[3*o],g=e[3*o+1],_=e[3*o+2];return Math.abs(a-h)<Math.abs(s-c)?[new fs(s,1-l),new fs(c,1-u),new fs(d,1-f),new fs(m,1-_)]:[new fs(a,1-l),new fs(h,1-u),new fs(p,1-f),new fs(g,1-_)]}};class Mp extends dl{constructor(t=new Yd([new fs(0,.5),new fs(-.5,-.5),new fs(.5,-.5)]),e=12){super(),this.type="ShapeGeometry",this.parameters={shapes:t,curveSegments:e};const n=[],i=[],r=[],o=[];let s=0,a=0;if(!1===Array.isArray(t))l(t);else for(let e=0;e<t.length;e++)l(t[e]),this.addGroup(s,a,e),s+=a,a=0;function l(t){const s=i.length/3,l=t.extractPoints(e);let c=l.shape;const h=l.holes;!1===vp.isClockWise(c)&&(c=c.reverse());for(let t=0,e=h.length;t<e;t++){const e=h[t];!0===vp.isClockWise(e)&&(h[t]=e.reverse())}const u=vp.triangulateShape(c,h);for(let t=0,e=h.length;t<e;t++){const e=h[t];c=c.concat(e)}for(let t=0,e=c.length;t<e;t++){const e=c[t];i.push(e.x,e.y,0),r.push(0,0,1),o.push(e.x,e.y)}for(let t=0,e=u.length;t<e;t++){const e=u[t],i=e[0]+s,r=e[1]+s,o=e[2]+s;n.push(i,r,o),a+=3}}this.setIndex(n),this.setAttribute("position",new rl(i,3)),this.setAttribute("normal",new rl(r,3)),this.setAttribute("uv",new rl(o,2))}toJSON(){const t=super.toJSON();return function(t,e){if(e.shapes=[],Array.isArray(t))for(let n=0,i=t.length;n<i;n++){const i=t[n];e.shapes.push(i.uuid)}else e.shapes.push(t.uuid);return e}(this.parameters.shapes,t)}static fromJSON(t,e){const n=[];for(let i=0,r=t.shapes.length;i<r;i++){const r=e[t.shapes[i]];n.push(r)}return new Mp(n,t.curveSegments)}}class Sp extends $a{constructor(t){super(),this.type="ShadowMaterial",this.color=new Ss(0),this.transparent=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this}}Sp.prototype.isShadowMaterial=!0;class Tp extends zl{constructor(t){super(t),this.type="RawShaderMaterial"}}Tp.prototype.isRawShaderMaterial=!0;class Ep extends $a{constructor(t){super(),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new Ss(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 Ss(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new fs(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.flatShading=!1,this.setValues(t)}copy(t){return super.copy(t),this.defines={STANDARD:""},this.color.copy(t.color),this.roughness=t.roughness,this.metalness=t.metalness,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.roughnessMap=t.roughnessMap,this.metalnessMap=t.metalnessMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapIntensity=t.envMapIntensity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this}}Ep.prototype.isMeshStandardMaterial=!0;class Ap extends Ep{constructor(t){super(),this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new fs(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return hs(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.sheenColor=new Ss(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=0,this.attenuationColor=new Ss(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new Ss(1,1,1),this.specularColorMap=null,this._sheen=0,this._clearcoat=0,this._transmission=0,this.setValues(t)}get sheen(){return this._sheen}set sheen(t){this._sheen>0!=t>0&&this.version++,this._sheen=t}get clearcoat(){return this._clearcoat}set clearcoat(t){this._clearcoat>0!=t>0&&this.version++,this._clearcoat=t}get transmission(){return this._transmission}set transmission(t){this._transmission>0!=t>0&&this.version++,this._transmission=t}copy(t){return super.copy(t),this.defines={STANDARD:"",PHYSICAL:""},this.clearcoat=t.clearcoat,this.clearcoatMap=t.clearcoatMap,this.clearcoatRoughness=t.clearcoatRoughness,this.clearcoatRoughnessMap=t.clearcoatRoughnessMap,this.clearcoatNormalMap=t.clearcoatNormalMap,this.clearcoatNormalScale.copy(t.clearcoatNormalScale),this.ior=t.ior,this.sheen=t.sheen,this.sheenColor.copy(t.sheenColor),this.sheenColorMap=t.sheenColorMap,this.sheenRoughness=t.sheenRoughness,this.sheenRoughnessMap=t.sheenRoughnessMap,this.transmission=t.transmission,this.transmissionMap=t.transmissionMap,this.thickness=t.thickness,this.thicknessMap=t.thicknessMap,this.attenuationDistance=t.attenuationDistance,this.attenuationColor.copy(t.attenuationColor),this.specularIntensity=t.specularIntensity,this.specularIntensityMap=t.specularIntensityMap,this.specularColor.copy(t.specularColor),this.specularColorMap=t.specularColorMap,this}}Ap.prototype.isMeshPhysicalMaterial=!0;class Cp extends $a{constructor(t){super(),this.type="MeshPhongMaterial",this.color=new Ss(16777215),this.specular=new Ss(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ss(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new fs(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.specular.copy(t.specular),this.shininess=t.shininess,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this}}Cp.prototype.isMeshPhongMaterial=!0;class Rp extends $a{constructor(t){super(),this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new Ss(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ss(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new fs(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.gradientMap=t.gradientMap,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this}}Rp.prototype.isMeshToonMaterial=!0;class Lp extends $a{constructor(t){super(),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new fs(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.flatShading=!1,this.setValues(t)}copy(t){return super.copy(t),this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.flatShading=t.flatShading,this}}Lp.prototype.isMeshNormalMaterial=!0;class Pp extends $a{constructor(t){super(),this.type="MeshLambertMaterial",this.color=new Ss(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ss(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this}}Pp.prototype.isMeshLambertMaterial=!0;class Ip extends $a{constructor(t){super(),this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Ss(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new fs(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.setValues(t)}copy(t){return super.copy(t),this.defines={MATCAP:""},this.color.copy(t.color),this.matcap=t.matcap,this.map=t.map,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.flatShading=t.flatShading,this}}Ip.prototype.isMeshMatcapMaterial=!0;class Dp extends ad{constructor(t){super(),this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(t)}copy(t){return super.copy(t),this.scale=t.scale,this.dashSize=t.dashSize,this.gapSize=t.gapSize,this}}Dp.prototype.isLineDashedMaterial=!0;const Op={ShadowMaterial:Sp,SpriteMaterial:Ou,RawShaderMaterial:Tp,ShaderMaterial:zl,PointsMaterial:_d,MeshPhysicalMaterial:Ap,MeshStandardMaterial:Ep,MeshPhongMaterial:Cp,MeshToonMaterial:Rp,MeshNormalMaterial:Lp,MeshLambertMaterial:Pp,MeshDepthMaterial:fu,MeshDistanceMaterial:mu,MeshBasicMaterial:Ka,MeshMatcapMaterial:Ip,LineDashedMaterial:Dp,LineBasicMaterial:ad,Material:$a};$a.fromType=function(t){return new Op[t]};const Np={arraySlice:function(t,e,n){return Np.isTypedArray(t)?new t.constructor(t.subarray(e,void 0!==n?n:t.length)):t.slice(e,n)},convertArray:function(t,e,n){return!t||!n&&t.constructor===e?t:"number"==typeof e.BYTES_PER_ELEMENT?new e(t):Array.prototype.slice.call(t)},isTypedArray:function(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)},getKeyframeOrder:function(t){const e=t.length,n=new Array(e);for(let t=0;t!==e;++t)n[t]=t;return n.sort((function(e,n){return t[e]-t[n]})),n},sortedArray:function(t,e,n){const i=t.length,r=new t.constructor(i);for(let o=0,s=0;s!==i;++o){const i=n[o]*e;for(let n=0;n!==e;++n)r[s++]=t[i+n]}return r},flattenJSON:function(t,e,n,i){let r=1,o=t[0];for(;void 0!==o&&void 0===o[i];)o=t[r++];if(void 0===o)return;let s=o[i];if(void 0!==s)if(Array.isArray(s))do{s=o[i],void 0!==s&&(e.push(o.time),n.push.apply(n,s)),o=t[r++]}while(void 0!==o);else if(void 0!==s.toArray)do{s=o[i],void 0!==s&&(e.push(o.time),s.toArray(n,n.length)),o=t[r++]}while(void 0!==o);else do{s=o[i],void 0!==s&&(e.push(o.time),n.push(s)),o=t[r++]}while(void 0!==o)},subclip:function(t,e,n,i,r=30){const o=t.clone();o.name=e;const s=[];for(let t=0;t<o.tracks.length;++t){const e=o.tracks[t],a=e.getValueSize(),l=[],c=[];for(let t=0;t<e.times.length;++t){const o=e.times[t]*r;if(!(o<n||o>=i)){l.push(e.times[t]);for(let n=0;n<a;++n)c.push(e.values[t*a+n])}}0!==l.length&&(e.times=Np.convertArray(l,e.times.constructor),e.values=Np.convertArray(c,e.values.constructor),s.push(e))}o.tracks=s;let a=1/0;for(let t=0;t<o.tracks.length;++t)a>o.tracks[t].times[0]&&(a=o.tracks[t].times[0]);for(let t=0;t<o.tracks.length;++t)o.tracks[t].shift(-1*a);return o.resetDuration(),o},makeClipAdditive:function(t,e=0,n=t,i=30){i<=0&&(i=30);const r=n.tracks.length,o=e/i;for(let e=0;e<r;++e){const i=n.tracks[e],r=i.ValueTypeName;if("bool"===r||"string"===r)continue;const s=t.tracks.find((function(t){return t.name===i.name&&t.ValueTypeName===r}));if(void 0===s)continue;let a=0;const l=i.getValueSize();i.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(a=l/3);let c=0;const h=s.getValueSize();s.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(c=h/3);const u=i.times.length-1;let d;if(o<=i.times[0]){const t=a,e=l-a;d=Np.arraySlice(i.values,t,e)}else if(o>=i.times[u]){const t=u*l+a,e=t+l-a;d=Np.arraySlice(i.values,t,e)}else{const t=i.createInterpolant(),e=a,n=l-a;t.evaluate(o),d=Np.arraySlice(t.resultBuffer,e,n)}"quaternion"===r&&(new Ns).fromArray(d).normalize().conjugate().toArray(d);const p=s.times.length;for(let t=0;t<p;++t){const e=t*h+c;if("quaternion"===r)Ns.multiplyQuaternionsFlat(s.values,e,d,0,s.values,e);else{const t=h-2*c;for(let n=0;n<t;++n)s.values[e+n]-=d[n]}}}return t.blendMode=2501,t}};class zp{constructor(t,e,n,i){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=void 0!==i?i:new e.constructor(n),this.sampleValues=e,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(t){const e=this.parameterPositions;let n=this._cachedIndex,i=e[n],r=e[n-1];t:{e:{let o;n:{i:if(!(t<i)){for(let o=n+2;;){if(void 0===i){if(t<r)break i;return n=e.length,this._cachedIndex=n,this.afterEnd_(n-1,t,r)}if(n===o)break;if(r=i,i=e[++n],t<i)break e}o=e.length;break n}if(t>=r)break t;{const s=e[1];t<s&&(n=2,r=s);for(let o=n-2;;){if(void 0===r)return this._cachedIndex=0,this.beforeStart_(0,t,i);if(n===o)break;if(i=r,r=e[--n-1],t>=r)break e}o=n,n=0}}for(;n<o;){const i=n+o>>>1;t<e[i]?o=i:n=i+1}if(i=e[n],r=e[n-1],void 0===r)return this._cachedIndex=0,this.beforeStart_(0,t,i);if(void 0===i)return n=e.length,this._cachedIndex=n,this.afterEnd_(n-1,r,t)}this._cachedIndex=n,this.intervalChanged_(n,r,i)}return this.interpolate_(n,r,t,i)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(t){const e=this.resultBuffer,n=this.sampleValues,i=this.valueSize,r=t*i;for(let t=0;t!==i;++t)e[t]=n[r+t];return e}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}zp.prototype.beforeStart_=zp.prototype.copySampleValue_,zp.prototype.afterEnd_=zp.prototype.copySampleValue_;class Bp extends zp{constructor(t,e,n,i){super(t,e,n,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:Zo,endingEnd:Zo}}intervalChanged_(t,e,n){const i=this.parameterPositions;let r=t-2,o=t+1,s=i[r],a=i[o];if(void 0===s)switch(this.getSettings_().endingStart){case Jo:r=t,s=2*e-n;break;case $o:r=i.length-2,s=e+i[r]-i[r+1];break;default:r=t,s=n}if(void 0===a)switch(this.getSettings_().endingEnd){case Jo:o=t,a=2*n-e;break;case $o:o=1,a=n+i[1]-i[0];break;default:o=t-1,a=e}const l=.5*(n-e),c=this.valueSize;this._weightPrev=l/(e-s),this._weightNext=l/(a-n),this._offsetPrev=r*c,this._offsetNext=o*c}interpolate_(t,e,n,i){const r=this.resultBuffer,o=this.sampleValues,s=this.valueSize,a=t*s,l=a-s,c=this._offsetPrev,h=this._offsetNext,u=this._weightPrev,d=this._weightNext,p=(n-e)/(i-e),f=p*p,m=f*p,g=-u*m+2*u*f-u*p,_=(1+u)*m+(-1.5-2*u)*f+(-.5+u)*p+1,v=(-1-d)*m+(1.5+d)*f+.5*p,y=d*m-d*f;for(let t=0;t!==s;++t)r[t]=g*o[c+t]+_*o[l+t]+v*o[a+t]+y*o[h+t];return r}}class Fp extends zp{constructor(t,e,n,i){super(t,e,n,i)}interpolate_(t,e,n,i){const r=this.resultBuffer,o=this.sampleValues,s=this.valueSize,a=t*s,l=a-s,c=(n-e)/(i-e),h=1-c;for(let t=0;t!==s;++t)r[t]=o[l+t]*h+o[a+t]*c;return r}}class Hp extends zp{constructor(t,e,n,i){super(t,e,n,i)}interpolate_(t){return this.copySampleValue_(t-1)}}class Up{constructor(t,e,n,i){if(void 0===t)throw new Error("THREE.KeyframeTrack: track name is undefined");if(void 0===e||0===e.length)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+t);this.name=t,this.times=Np.convertArray(e,this.TimeBufferType),this.values=Np.convertArray(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}static toJSON(t){const e=t.constructor;let n;if(e.toJSON!==this.toJSON)n=e.toJSON(t);else{n={name:t.name,times:Np.convertArray(t.times,Array),values:Np.convertArray(t.values,Array)};const e=t.getInterpolation();e!==t.DefaultInterpolation&&(n.interpolation=e)}return n.type=t.ValueTypeName,n}InterpolantFactoryMethodDiscrete(t){return new Hp(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodLinear(t){return new Fp(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodSmooth(t){return new Bp(this.times,this.values,this.getValueSize(),t)}setInterpolation(t){let e;switch(t){case qo:e=this.InterpolantFactoryMethodDiscrete;break;case Yo:e=this.InterpolantFactoryMethodLinear;break;case Xo:e=this.InterpolantFactoryMethodSmooth}if(void 0===e){const e="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(t===this.DefaultInterpolation)throw new Error(e);this.setInterpolation(this.DefaultInterpolation)}return console.warn("THREE.KeyframeTrack:",e),this}return this.createInterpolant=e,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return qo;case this.InterpolantFactoryMethodLinear:return Yo;case this.InterpolantFactoryMethodSmooth:return Xo}}getValueSize(){return this.values.length/this.times.length}shift(t){if(0!==t){const e=this.times;for(let n=0,i=e.length;n!==i;++n)e[n]+=t}return this}scale(t){if(1!==t){const e=this.times;for(let n=0,i=e.length;n!==i;++n)e[n]*=t}return this}trim(t,e){const n=this.times,i=n.length;let r=0,o=i-1;for(;r!==i&&n[r]<t;)++r;for(;-1!==o&&n[o]>e;)--o;if(++o,0!==r||o!==i){r>=o&&(o=Math.max(o,1),r=o-1);const t=this.getValueSize();this.times=Np.arraySlice(n,r,o),this.values=Np.arraySlice(this.values,r*t,o*t)}return this}validate(){let t=!0;const e=this.getValueSize();e-Math.floor(e)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),t=!1);const n=this.times,i=this.values,r=n.length;0===r&&(console.error("THREE.KeyframeTrack: Track is empty.",this),t=!1);let o=null;for(let e=0;e!==r;e++){const i=n[e];if("number"==typeof i&&isNaN(i)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,e,i),t=!1;break}if(null!==o&&o>i){console.error("THREE.KeyframeTrack: Out of order keys.",this,e,i,o),t=!1;break}o=i}if(void 0!==i&&Np.isTypedArray(i))for(let e=0,n=i.length;e!==n;++e){const n=i[e];if(isNaN(n)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,e,n),t=!1;break}}return t}optimize(){const t=Np.arraySlice(this.times),e=Np.arraySlice(this.values),n=this.getValueSize(),i=this.getInterpolation()===Xo,r=t.length-1;let o=1;for(let s=1;s<r;++s){let r=!1;const a=t[s];if(a!==t[s+1]&&(1!==s||a!==t[0]))if(i)r=!0;else{const t=s*n,i=t-n,o=t+n;for(let s=0;s!==n;++s){const n=e[t+s];if(n!==e[i+s]||n!==e[o+s]){r=!0;break}}}if(r){if(s!==o){t[o]=t[s];const i=s*n,r=o*n;for(let t=0;t!==n;++t)e[r+t]=e[i+t]}++o}}if(r>0){t[o]=t[r];for(let t=r*n,i=o*n,s=0;s!==n;++s)e[i+s]=e[t+s];++o}return o!==t.length?(this.times=Np.arraySlice(t,0,o),this.values=Np.arraySlice(e,0,o*n)):(this.times=t,this.values=e),this}clone(){const t=Np.arraySlice(this.times,0),e=Np.arraySlice(this.values,0),n=new(0,this.constructor)(this.name,t,e);return n.createInterpolant=this.createInterpolant,n}}Up.prototype.TimeBufferType=Float32Array,Up.prototype.ValueBufferType=Float32Array,Up.prototype.DefaultInterpolation=Yo;class kp extends Up{}kp.prototype.ValueTypeName="bool",kp.prototype.ValueBufferType=Array,kp.prototype.DefaultInterpolation=qo,kp.prototype.InterpolantFactoryMethodLinear=void 0,kp.prototype.InterpolantFactoryMethodSmooth=void 0;class Gp extends Up{}Gp.prototype.ValueTypeName="color";class Wp extends Up{}Wp.prototype.ValueTypeName="number";class Vp extends zp{constructor(t,e,n,i){super(t,e,n,i)}interpolate_(t,e,n,i){const r=this.resultBuffer,o=this.sampleValues,s=this.valueSize,a=(n-e)/(i-e);let l=t*s;for(let t=l+s;l!==t;l+=4)Ns.slerpFlat(r,0,o,l-s,o,l,a);return r}}class jp extends Up{InterpolantFactoryMethodLinear(t){return new Vp(this.times,this.values,this.getValueSize(),t)}}jp.prototype.ValueTypeName="quaternion",jp.prototype.DefaultInterpolation=Yo,jp.prototype.InterpolantFactoryMethodSmooth=void 0;class qp extends Up{}qp.prototype.ValueTypeName="string",qp.prototype.ValueBufferType=Array,qp.prototype.DefaultInterpolation=qo,qp.prototype.InterpolantFactoryMethodLinear=void 0,qp.prototype.InterpolantFactoryMethodSmooth=void 0;class Yp extends Up{}Yp.prototype.ValueTypeName="vector";class Xp{constructor(t,e=-1,n,i=2500){this.name=t,this.tracks=n,this.duration=e,this.blendMode=i,this.uuid=cs(),this.duration<0&&this.resetDuration()}static parse(t){const e=[],n=t.tracks,i=1/(t.fps||1);for(let t=0,r=n.length;t!==r;++t)e.push(Zp(n[t]).scale(i));const r=new this(t.name,t.duration,e,t.blendMode);return r.uuid=t.uuid,r}static toJSON(t){const e=[],n=t.tracks,i={name:t.name,duration:t.duration,tracks:e,uuid:t.uuid,blendMode:t.blendMode};for(let t=0,i=n.length;t!==i;++t)e.push(Up.toJSON(n[t]));return i}static CreateFromMorphTargetSequence(t,e,n,i){const r=e.length,o=[];for(let t=0;t<r;t++){let s=[],a=[];s.push((t+r-1)%r,t,(t+1)%r),a.push(0,1,0);const l=Np.getKeyframeOrder(s);s=Np.sortedArray(s,1,l),a=Np.sortedArray(a,1,l),i||0!==s[0]||(s.push(r),a.push(a[0])),o.push(new Wp(".morphTargetInfluences["+e[t].name+"]",s,a).scale(1/n))}return new this(t,-1,o)}static findByName(t,e){let n=t;if(!Array.isArray(t)){const e=t;n=e.geometry&&e.geometry.animations||e.animations}for(let t=0;t<n.length;t++)if(n[t].name===e)return n[t];return null}static CreateClipsFromMorphTargetSequences(t,e,n){const i={},r=/^([\w-]*?)([\d]+)$/;for(let e=0,n=t.length;e<n;e++){const n=t[e],o=n.name.match(r);if(o&&o.length>1){const t=o[1];let e=i[t];e||(i[t]=e=[]),e.push(n)}}const o=[];for(const t in i)o.push(this.CreateFromMorphTargetSequence(t,i[t],e,n));return o}static parseAnimation(t,e){if(!t)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const n=function(t,e,n,i,r){if(0!==n.length){const o=[],s=[];Np.flattenJSON(n,o,s,i),0!==o.length&&r.push(new t(e,o,s))}},i=[],r=t.name||"default",o=t.fps||30,s=t.blendMode;let a=t.length||-1;const l=t.hierarchy||[];for(let t=0;t<l.length;t++){const r=l[t].keys;if(r&&0!==r.length)if(r[0].morphTargets){const t={};let e;for(e=0;e<r.length;e++)if(r[e].morphTargets)for(let n=0;n<r[e].morphTargets.length;n++)t[r[e].morphTargets[n]]=-1;for(const n in t){const t=[],o=[];for(let i=0;i!==r[e].morphTargets.length;++i){const i=r[e];t.push(i.time),o.push(i.morphTarget===n?1:0)}i.push(new Wp(".morphTargetInfluence["+n+"]",t,o))}a=t.length*o}else{const o=".bones["+e[t].name+"]";n(Yp,o+".position",r,"pos",i),n(jp,o+".quaternion",r,"rot",i),n(Yp,o+".scale",r,"scl",i)}}return 0===i.length?null:new this(r,a,i,s)}resetDuration(){let t=0;for(let e=0,n=this.tracks.length;e!==n;++e){const n=this.tracks[e];t=Math.max(t,n.times[n.times.length-1])}return this.duration=t,this}trim(){for(let t=0;t<this.tracks.length;t++)this.tracks[t].trim(0,this.duration);return this}validate(){let t=!0;for(let e=0;e<this.tracks.length;e++)t=t&&this.tracks[e].validate();return t}optimize(){for(let t=0;t<this.tracks.length;t++)this.tracks[t].optimize();return this}clone(){const t=[];for(let e=0;e<this.tracks.length;e++)t.push(this.tracks[e].clone());return new this.constructor(this.name,this.duration,t,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}}function Zp(t){if(void 0===t.type)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=function(t){switch(t.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Wp;case"vector":case"vector2":case"vector3":case"vector4":return Yp;case"color":return Gp;case"quaternion":return jp;case"bool":case"boolean":return kp;case"string":return qp}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+t)}(t.type);if(void 0===t.times){const e=[],n=[];Np.flattenJSON(t.keys,e,n,"value"),t.times=e,t.values=n}return void 0!==e.parse?e.parse(t):new e(t.name,t.times,t.values,t.interpolation)}const Jp={enabled:!1,files:{},add:function(t,e){!1!==this.enabled&&(this.files[t]=e)},get:function(t){if(!1!==this.enabled)return this.files[t]},remove:function(t){delete this.files[t]},clear:function(){this.files={}}};const $p=new class{constructor(t,e,n){const i=this;let r,o=!1,s=0,a=0;const l=[];this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=n,this.itemStart=function(t){a++,!1===o&&void 0!==i.onStart&&i.onStart(t,s,a),o=!0},this.itemEnd=function(t){s++,void 0!==i.onProgress&&i.onProgress(t,s,a),s===a&&(o=!1,void 0!==i.onLoad&&i.onLoad())},this.itemError=function(t){void 0!==i.onError&&i.onError(t)},this.resolveURL=function(t){return r?r(t):t},this.setURLModifier=function(t){return r=t,this},this.addHandler=function(t,e){return l.push(t,e),this},this.removeHandler=function(t){const e=l.indexOf(t);return-1!==e&&l.splice(e,2),this},this.getHandler=function(t){for(let e=0,n=l.length;e<n;e+=2){const n=l[e],i=l[e+1];if(n.global&&(n.lastIndex=0),n.test(t))return i}return null}}};class Kp{constructor(t){this.manager=void 0!==t?t:$p,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(t,e){const n=this;return new Promise((function(i,r){n.load(t,i,e,r)}))}parse(){}setCrossOrigin(t){return this.crossOrigin=t,this}setWithCredentials(t){return this.withCredentials=t,this}setPath(t){return this.path=t,this}setResourcePath(t){return this.resourcePath=t,this}setRequestHeader(t){return this.requestHeader=t,this}}const Qp={};class tf extends Kp{constructor(t){super(t)}load(t,e,n,i){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const r=Jp.get(t);if(void 0!==r)return this.manager.itemStart(t),setTimeout((()=>{e&&e(r),this.manager.itemEnd(t)}),0),r;if(void 0!==Qp[t])return void Qp[t].push({onLoad:e,onProgress:n,onError:i});Qp[t]=[],Qp[t].push({onLoad:e,onProgress:n,onError:i});const o=new Request(t,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),s=this.mimeType,a=this.responseType;fetch(o).then((e=>{if(200===e.status||0===e.status){if(0===e.status&&console.warn("THREE.FileLoader: HTTP Status 0 received."),"undefined"==typeof ReadableStream||void 0===e.body||void 0===e.body.getReader)return e;const n=Qp[t],i=e.body.getReader(),r=e.headers.get("Content-Length"),o=r?parseInt(r):0,s=0!==o;let a=0;const l=new ReadableStream({start(t){!function e(){i.read().then((({done:i,value:r})=>{if(i)t.close();else{a+=r.byteLength;const i=new ProgressEvent("progress",{lengthComputable:s,loaded:a,total:o});for(let t=0,e=n.length;t<e;t++){const e=n[t];e.onProgress&&e.onProgress(i)}t.enqueue(r),e()}}))}()}});return new Response(l)}throw Error(`fetch for "${e.url}" responded with ${e.status}: ${e.statusText}`)})).then((t=>{switch(a){case"arraybuffer":return t.arrayBuffer();case"blob":return t.blob();case"document":return t.text().then((t=>(new DOMParser).parseFromString(t,s)));case"json":return t.json();default:if(void 0===s)return t.text();{const e=/charset="?([^;"\s]*)"?/i.exec(s),n=e&&e[1]?e[1].toLowerCase():void 0,i=new TextDecoder(n);return t.arrayBuffer().then((t=>i.decode(t)))}}})).then((e=>{Jp.add(t,e);const n=Qp[t];delete Qp[t];for(let t=0,i=n.length;t<i;t++){const i=n[t];i.onLoad&&i.onLoad(e)}})).catch((e=>{const n=Qp[t];if(void 0===n)throw this.manager.itemError(t),e;delete Qp[t];for(let t=0,i=n.length;t<i;t++){const i=n[t];i.onError&&i.onError(e)}this.manager.itemError(t)})).finally((()=>{this.manager.itemEnd(t)})),this.manager.itemStart(t)}setResponseType(t){return this.responseType=t,this}setMimeType(t){return this.mimeType=t,this}}class ef extends Kp{constructor(t){super(t)}load(t,e,n,i){void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const r=this,o=Jp.get(t);if(void 0!==o)return r.manager.itemStart(t),setTimeout((function(){e&&e(o),r.manager.itemEnd(t)}),0),o;const s=_s("img");function a(){c(),Jp.add(t,this),e&&e(this),r.manager.itemEnd(t)}function l(e){c(),i&&i(e),r.manager.itemError(t),r.manager.itemEnd(t)}function c(){s.removeEventListener("load",a,!1),s.removeEventListener("error",l,!1)}return s.addEventListener("load",a,!1),s.addEventListener("error",l,!1),"data:"!==t.slice(0,5)&&void 0!==this.crossOrigin&&(s.crossOrigin=this.crossOrigin),r.manager.itemStart(t),s.src=t,s}}class nf extends Kp{constructor(t){super(t)}load(t,e,n,i){const r=new kl,o=new ef(this.manager);o.setCrossOrigin(this.crossOrigin),o.setPath(this.path);let s=0;function a(n){o.load(t[n],(function(t){r.images[n]=t,s++,6===s&&(r.needsUpdate=!0,e&&e(r))}),void 0,i)}for(let e=0;e<t.length;++e)a(e);return r}}class rf extends Kp{constructor(t){super(t)}load(t,e,n,i){const r=new Ls,o=new ef(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(t,(function(t){r.image=t,r.needsUpdate=!0,void 0!==e&&e(r)}),n,i),r}}class of extends Fa{constructor(t,e=1){super(),this.type="Light",this.color=new Ss(t),this.intensity=e}dispose(){}copy(t){return super.copy(t),this.color.copy(t.color),this.intensity=t.intensity,this}toJSON(t){const e=super.toJSON(t);return e.object.color=this.color.getHex(),e.object.intensity=this.intensity,void 0!==this.groundColor&&(e.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(e.object.distance=this.distance),void 0!==this.angle&&(e.object.angle=this.angle),void 0!==this.decay&&(e.object.decay=this.decay),void 0!==this.penumbra&&(e.object.penumbra=this.penumbra),void 0!==this.shadow&&(e.object.shadow=this.shadow.toJSON()),e}}of.prototype.isLight=!0;(class extends of{constructor(t,e,n){super(t,n),this.type="HemisphereLight",this.position.copy(Fa.DefaultUp),this.updateMatrix(),this.groundColor=new Ss(e)}copy(t){return of.prototype.copy.call(this,t),this.groundColor.copy(t.groundColor),this}}).prototype.isHemisphereLight=!0;const sf=new pa,af=new zs,lf=new zs;class cf{constructor(t){this.camera=t,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new fs(512,512),this.map=null,this.mapPass=null,this.matrix=new pa,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Zl,this._frameExtents=new fs(1,1),this._viewportCount=1,this._viewports=[new Ps(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(t){const e=this.camera,n=this.matrix;af.setFromMatrixPosition(t.matrixWorld),e.position.copy(af),lf.setFromMatrixPosition(t.target.matrixWorld),e.lookAt(lf),e.updateMatrixWorld(),sf.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),this._frustum.setFromProjectionMatrix(sf),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(e.projectionMatrix),n.multiply(e.matrixWorldInverse)}getViewport(t){return this._viewports[t]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(t){return this.camera=t.camera.clone(),this.bias=t.bias,this.radius=t.radius,this.mapSize.copy(t.mapSize),this}clone(){return(new this.constructor).copy(this)}toJSON(){const t={};return 0!==this.bias&&(t.bias=this.bias),0!==this.normalBias&&(t.normalBias=this.normalBias),1!==this.radius&&(t.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(t.mapSize=this.mapSize.toArray()),t.camera=this.camera.toJSON(!1).object,delete t.camera.matrix,t}}class hf extends cf{constructor(){super(new Fl(50,1,.5,500)),this.focus=1}updateMatrices(t){const e=this.camera,n=2*ls*t.angle*this.focus,i=this.mapSize.width/this.mapSize.height,r=t.distance||e.far;n===e.fov&&i===e.aspect&&r===e.far||(e.fov=n,e.aspect=i,e.far=r,e.updateProjectionMatrix()),super.updateMatrices(t)}copy(t){return super.copy(t),this.focus=t.focus,this}}hf.prototype.isSpotLightShadow=!0;(class extends of{constructor(t,e,n=0,i=Math.PI/3,r=0,o=1){super(t,e),this.type="SpotLight",this.position.copy(Fa.DefaultUp),this.updateMatrix(),this.target=new Fa,this.distance=n,this.angle=i,this.penumbra=r,this.decay=o,this.shadow=new hf}get power(){return this.intensity*Math.PI}set power(t){this.intensity=t/Math.PI}dispose(){this.shadow.dispose()}copy(t){return super.copy(t),this.distance=t.distance,this.angle=t.angle,this.penumbra=t.penumbra,this.decay=t.decay,this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}).prototype.isSpotLight=!0;const uf=new pa,df=new zs,pf=new zs;class ff extends cf{constructor(){super(new Fl(90,1,.5,500)),this._frameExtents=new fs(4,2),this._viewportCount=6,this._viewports=[new Ps(2,1,1,1),new Ps(0,1,1,1),new Ps(3,1,1,1),new Ps(1,1,1,1),new Ps(3,0,1,1),new Ps(1,0,1,1)],this._cubeDirections=[new zs(1,0,0),new zs(-1,0,0),new zs(0,0,1),new zs(0,0,-1),new zs(0,1,0),new zs(0,-1,0)],this._cubeUps=[new zs(0,1,0),new zs(0,1,0),new zs(0,1,0),new zs(0,1,0),new zs(0,0,1),new zs(0,0,-1)]}updateMatrices(t,e=0){const n=this.camera,i=this.matrix,r=t.distance||n.far;r!==n.far&&(n.far=r,n.updateProjectionMatrix()),df.setFromMatrixPosition(t.matrixWorld),n.position.copy(df),pf.copy(n.position),pf.add(this._cubeDirections[e]),n.up.copy(this._cubeUps[e]),n.lookAt(pf),n.updateMatrixWorld(),i.makeTranslation(-df.x,-df.y,-df.z),uf.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(uf)}}ff.prototype.isPointLightShadow=!0;(class extends of{constructor(t,e,n=0,i=1){super(t,e),this.type="PointLight",this.distance=n,this.decay=i,this.shadow=new ff}get power(){return 4*this.intensity*Math.PI}set power(t){this.intensity=t/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(t){return super.copy(t),this.distance=t.distance,this.decay=t.decay,this.shadow=t.shadow.clone(),this}}).prototype.isPointLight=!0;class mf extends cf{constructor(){super(new lc(-5,5,5,-5,.5,500))}}mf.prototype.isDirectionalLightShadow=!0;(class extends of{constructor(t,e){super(t,e),this.type="DirectionalLight",this.position.copy(Fa.DefaultUp),this.updateMatrix(),this.target=new Fa,this.shadow=new mf}dispose(){this.shadow.dispose()}copy(t){return super.copy(t),this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}).prototype.isDirectionalLight=!0;(class extends of{constructor(t,e){super(t,e),this.type="AmbientLight"}}).prototype.isAmbientLight=!0;(class extends of{constructor(t,e,n=10,i=10){super(t,e),this.type="RectAreaLight",this.width=n,this.height=i}get power(){return this.intensity*this.width*this.height*Math.PI}set power(t){this.intensity=t/(this.width*this.height*Math.PI)}copy(t){return super.copy(t),this.width=t.width,this.height=t.height,this}toJSON(t){const e=super.toJSON(t);return e.object.width=this.width,e.object.height=this.height,e}}).prototype.isRectAreaLight=!0;class gf{constructor(){this.coefficients=[];for(let t=0;t<9;t++)this.coefficients.push(new zs)}set(t){for(let e=0;e<9;e++)this.coefficients[e].copy(t[e]);return this}zero(){for(let t=0;t<9;t++)this.coefficients[t].set(0,0,0);return this}getAt(t,e){const n=t.x,i=t.y,r=t.z,o=this.coefficients;return e.copy(o[0]).multiplyScalar(.282095),e.addScaledVector(o[1],.488603*i),e.addScaledVector(o[2],.488603*r),e.addScaledVector(o[3],.488603*n),e.addScaledVector(o[4],n*i*1.092548),e.addScaledVector(o[5],i*r*1.092548),e.addScaledVector(o[6],.315392*(3*r*r-1)),e.addScaledVector(o[7],n*r*1.092548),e.addScaledVector(o[8],.546274*(n*n-i*i)),e}getIrradianceAt(t,e){const n=t.x,i=t.y,r=t.z,o=this.coefficients;return e.copy(o[0]).multiplyScalar(.886227),e.addScaledVector(o[1],1.023328*i),e.addScaledVector(o[2],1.023328*r),e.addScaledVector(o[3],1.023328*n),e.addScaledVector(o[4],.858086*n*i),e.addScaledVector(o[5],.858086*i*r),e.addScaledVector(o[6],.743125*r*r-.247708),e.addScaledVector(o[7],.858086*n*r),e.addScaledVector(o[8],.429043*(n*n-i*i)),e}add(t){for(let e=0;e<9;e++)this.coefficients[e].add(t.coefficients[e]);return this}addScaledSH(t,e){for(let n=0;n<9;n++)this.coefficients[n].addScaledVector(t.coefficients[n],e);return this}scale(t){for(let e=0;e<9;e++)this.coefficients[e].multiplyScalar(t);return this}lerp(t,e){for(let n=0;n<9;n++)this.coefficients[n].lerp(t.coefficients[n],e);return this}equals(t){for(let e=0;e<9;e++)if(!this.coefficients[e].equals(t.coefficients[e]))return!1;return!0}copy(t){return this.set(t.coefficients)}clone(){return(new this.constructor).copy(this)}fromArray(t,e=0){const n=this.coefficients;for(let i=0;i<9;i++)n[i].fromArray(t,e+3*i);return this}toArray(t=[],e=0){const n=this.coefficients;for(let i=0;i<9;i++)n[i].toArray(t,e+3*i);return t}static getBasisAt(t,e){const n=t.x,i=t.y,r=t.z;e[0]=.282095,e[1]=.488603*i,e[2]=.488603*r,e[3]=.488603*n,e[4]=1.092548*n*i,e[5]=1.092548*i*r,e[6]=.315392*(3*r*r-1),e[7]=1.092548*n*r,e[8]=.546274*(n*n-i*i)}}gf.prototype.isSphericalHarmonics3=!0;class _f extends of{constructor(t=new gf,e=1){super(void 0,e),this.sh=t}copy(t){return super.copy(t),this.sh.copy(t.sh),this}fromJSON(t){return this.intensity=t.intensity,this.sh.fromArray(t.sh),this}toJSON(t){const e=super.toJSON(t);return e.object.sh=this.sh.toArray(),e}}_f.prototype.isLightProbe=!0;class vf extends dl{constructor(){super(),this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(t){return super.copy(t),this.instanceCount=t.instanceCount,this}clone(){return(new this.constructor).copy(this)}toJSON(){const t=super.toJSON(this);return t.instanceCount=this.instanceCount,t.isInstancedBufferGeometry=!0,t}}vf.prototype.isInstancedBufferGeometry=!0;class yf extends Kp{constructor(t){super(t),"undefined"==typeof createImageBitmap&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),"undefined"==typeof fetch&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(t){return this.options=t,this}load(t,e,n,i){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const r=this,o=Jp.get(t);if(void 0!==o)return r.manager.itemStart(t),setTimeout((function(){e&&e(o),r.manager.itemEnd(t)}),0),o;const s={};s.credentials="anonymous"===this.crossOrigin?"same-origin":"include",s.headers=this.requestHeader,fetch(t,s).then((function(t){return t.blob()})).then((function(t){return createImageBitmap(t,Object.assign(r.options,{colorSpaceConversion:"none"}))})).then((function(n){Jp.add(t,n),e&&e(n),r.manager.itemEnd(t)})).catch((function(e){i&&i(e),r.manager.itemError(t),r.manager.itemEnd(t)})),r.manager.itemStart(t)}}let xf;yf.prototype.isImageBitmapLoader=!0;class bf extends Kp{constructor(t){super(t)}load(t,e,n,i){const r=this,o=new tf(this.manager);o.setResponseType("arraybuffer"),o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(t,(function(n){try{const t=n.slice(0);(void 0===xf&&(xf=new(window.AudioContext||window.webkitAudioContext)),xf).decodeAudioData(t,(function(t){e(t)}))}catch(e){i?i(e):console.error(e),r.manager.itemError(t)}}),n,i)}}(class extends _f{constructor(t,e,n=1){super(void 0,n);const i=(new Ss).set(t),r=(new Ss).set(e),o=new zs(i.r,i.g,i.b),s=new zs(r.r,r.g,r.b),a=Math.sqrt(Math.PI),l=a*Math.sqrt(.75);this.sh.coefficients[0].copy(o).add(s).multiplyScalar(a),this.sh.coefficients[1].copy(o).sub(s).multiplyScalar(l)}}).prototype.isHemisphereLightProbe=!0,class extends _f{constructor(t,e=1){super(void 0,e);const n=(new Ss).set(t);this.sh.coefficients[0].set(n.r,n.g,n.b).multiplyScalar(2*Math.sqrt(Math.PI))}}.prototype.isAmbientLightProbe=!0;class wf{constructor(t=!0){this.autoStart=t,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=Mf(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let t=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const e=Mf();t=(e-this.oldTime)/1e3,this.oldTime=e,this.elapsedTime+=t}return t}}function Mf(){return("undefined"==typeof performance?Date:performance).now()}class Sf{constructor(t,e,n){let i,r,o;switch(this.binding=t,this.valueSize=n,e){case"quaternion":i=this._slerp,r=this._slerpAdditive,o=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(6*n),this._workIndex=5;break;case"string":case"bool":i=this._select,r=this._select,o=this._setAdditiveIdentityOther,this.buffer=new Array(5*n);break;default:i=this._lerp,r=this._lerpAdditive,o=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(5*n)}this._mixBufferRegion=i,this._mixBufferRegionAdditive=r,this._setIdentity=o,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(t,e){const n=this.buffer,i=this.valueSize,r=t*i+i;let o=this.cumulativeWeight;if(0===o){for(let t=0;t!==i;++t)n[r+t]=n[t];o=e}else{o+=e;const t=e/o;this._mixBufferRegion(n,r,0,t,i)}this.cumulativeWeight=o}accumulateAdditive(t){const e=this.buffer,n=this.valueSize,i=n*this._addIndex;0===this.cumulativeWeightAdditive&&this._setIdentity(),this._mixBufferRegionAdditive(e,i,0,t,n),this.cumulativeWeightAdditive+=t}apply(t){const e=this.valueSize,n=this.buffer,i=t*e+e,r=this.cumulativeWeight,o=this.cumulativeWeightAdditive,s=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,r<1){const t=e*this._origIndex;this._mixBufferRegion(n,i,t,1-r,e)}o>0&&this._mixBufferRegionAdditive(n,i,this._addIndex*e,1,e);for(let t=e,r=e+e;t!==r;++t)if(n[t]!==n[t+e]){s.setValue(n,i);break}}saveOriginalState(){const t=this.binding,e=this.buffer,n=this.valueSize,i=n*this._origIndex;t.getValue(e,i);for(let t=n,r=i;t!==r;++t)e[t]=e[i+t%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const t=3*this.valueSize;this.binding.setValue(this.buffer,t)}_setAdditiveIdentityNumeric(){const t=this._addIndex*this.valueSize,e=t+this.valueSize;for(let n=t;n<e;n++)this.buffer[n]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){const t=this._origIndex*this.valueSize,e=this._addIndex*this.valueSize;for(let n=0;n<this.valueSize;n++)this.buffer[e+n]=this.buffer[t+n]}_select(t,e,n,i,r){if(i>=.5)for(let i=0;i!==r;++i)t[e+i]=t[n+i]}_slerp(t,e,n,i){Ns.slerpFlat(t,e,t,e,t,n,i)}_slerpAdditive(t,e,n,i,r){const o=this._workIndex*r;Ns.multiplyQuaternionsFlat(t,o,t,e,t,n),Ns.slerpFlat(t,e,t,e,t,o,i)}_lerp(t,e,n,i,r){const o=1-i;for(let s=0;s!==r;++s){const r=e+s;t[r]=t[r]*o+t[n+s]*i}}_lerpAdditive(t,e,n,i,r){for(let o=0;o!==r;++o){const r=e+o;t[r]=t[r]+t[n+o]*i}}}const Tf=new RegExp("[\\[\\]\\.:\\/]","g"),Ef="[^\\[\\]\\.:\\/]",Af="[^"+"\\[\\]\\.:\\/".replace("\\.","")+"]",Cf=/((?:WC+[\/:])*)/.source.replace("WC",Ef),Rf=/(WCOD+)?/.source.replace("WCOD",Af),Lf=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Ef),Pf=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Ef),If=new RegExp("^"+Cf+Rf+Lf+Pf+"$"),Df=["material","materials","bones"];class Of{constructor(t,e,n){this.path=e,this.parsedPath=n||Of.parseTrackName(e),this.node=Of.findNode(t,this.parsedPath.nodeName)||t,this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,e,n){return t&&t.isAnimationObjectGroup?new Of.Composite(t,e,n):new Of(t,e,n)}static sanitizeNodeName(t){return t.replace(/\s/g,"_").replace(Tf,"")}static parseTrackName(t){const e=If.exec(t);if(null===e)throw new Error("PropertyBinding: Cannot parse trackName: "+t);const n={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(void 0!==i&&-1!==i){const t=n.nodeName.substring(i+1);-1!==Df.indexOf(t)&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=t)}if(null===n.propertyName||0===n.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return n}static findNode(t,e){if(void 0===e||""===e||"."===e||-1===e||e===t.name||e===t.uuid)return t;if(t.skeleton){const n=t.skeleton.getBoneByName(e);if(void 0!==n)return n}if(t.children){const n=function(t){for(let i=0;i<t.length;i++){const r=t[i];if(r.name===e||r.uuid===e)return r;const o=n(r.children);if(o)return o}return null},i=n(t.children);if(i)return i}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(t,e){t[e]=this.targetObject[this.propertyName]}_getValue_array(t,e){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)t[e++]=n[i]}_getValue_arrayElement(t,e){t[e]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(t,e){this.resolvedProperty.toArray(t,e)}_setValue_direct(t,e){this.targetObject[this.propertyName]=t[e]}_setValue_direct_setNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(t,e){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=t[e++]}_setValue_array_setNeedsUpdate(t,e){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=t[e++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(t,e){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=t[e++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(t,e){this.resolvedProperty[this.propertyIndex]=t[e]}_setValue_arrayElement_setNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(t,e){this.resolvedProperty.fromArray(t,e)}_setValue_fromArray_setNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(t,e){this.bind(),this.getValue(t,e)}_setValue_unbound(t,e){this.bind(),this.setValue(t,e)}bind(){let t=this.node;const e=this.parsedPath,n=e.objectName,i=e.propertyName;let r=e.propertyIndex;if(t||(t=Of.findNode(this.rootNode,e.nodeName)||this.rootNode,this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t)return void console.error("THREE.PropertyBinding: Trying to update node for track: "+this.path+" but it wasn't found.");if(n){let i=e.objectIndex;switch(n){case"materials":if(!t.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!t.material.materials)return void console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);t=t.material.materials;break;case"bones":if(!t.skeleton)return void console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);t=t.skeleton.bones;for(let e=0;e<t.length;e++)if(t[e].name===i){i=e;break}break;default:if(void 0===t[n])return void console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);t=t[n]}if(void 0!==i){if(void 0===t[i])return void console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,t);t=t[i]}}const o=t[i];if(void 0===o){const n=e.nodeName;return void console.error("THREE.PropertyBinding: Trying to update property for track: "+n+"."+i+" but it wasn't found.",t)}let s=this.Versioning.None;this.targetObject=t,void 0!==t.needsUpdate?s=this.Versioning.NeedsUpdate:void 0!==t.matrixWorldNeedsUpdate&&(s=this.Versioning.MatrixWorldNeedsUpdate);let a=this.BindingType.Direct;if(void 0!==r){if("morphTargetInfluences"===i){if(!t.geometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);if(!t.geometry.isBufferGeometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences on THREE.Geometry. Use THREE.BufferGeometry instead.",this);if(!t.geometry.morphAttributes)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);void 0!==t.morphTargetDictionary[r]&&(r=t.morphTargetDictionary[r])}a=this.BindingType.ArrayElement,this.resolvedProperty=o,this.propertyIndex=r}else void 0!==o.fromArray&&void 0!==o.toArray?(a=this.BindingType.HasFromToArray,this.resolvedProperty=o):Array.isArray(o)?(a=this.BindingType.EntireArray,this.resolvedProperty=o):this.propertyName=i;this.getValue=this.GetterByBindingType[a],this.setValue=this.SetterByBindingTypeAndVersioning[a][s]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}Of.Composite=class{constructor(t,e,n){const i=n||Of.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,i)}getValue(t,e){this.bind();const n=this._targetGroup.nCachedObjects_,i=this._bindings[n];void 0!==i&&i.getValue(t,e)}setValue(t,e){const n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,r=n.length;i!==r;++i)n[i].setValue(t,e)}bind(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].bind()}unbind(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].unbind()}},Of.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Of.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},Of.prototype.GetterByBindingType=[Of.prototype._getValue_direct,Of.prototype._getValue_array,Of.prototype._getValue_arrayElement,Of.prototype._getValue_toArray],Of.prototype.SetterByBindingTypeAndVersioning=[[Of.prototype._setValue_direct,Of.prototype._setValue_direct_setNeedsUpdate,Of.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Of.prototype._setValue_array,Of.prototype._setValue_array_setNeedsUpdate,Of.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Of.prototype._setValue_arrayElement,Of.prototype._setValue_arrayElement_setNeedsUpdate,Of.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Of.prototype._setValue_fromArray,Of.prototype._setValue_fromArray_setNeedsUpdate,Of.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class Nf{constructor(t,e,n=null,i=e.blendMode){this._mixer=t,this._clip=e,this._localRoot=n,this.blendMode=i;const r=e.tracks,o=r.length,s=new Array(o),a={endingStart:Zo,endingEnd:Zo};for(let t=0;t!==o;++t){const e=r[t].createInterpolant(null);s[t]=e,e.settings=a}this._interpolantSettings=a,this._interpolants=s,this._propertyBindings=new Array(o),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=2201,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(t){return this._startTime=t,this}setLoop(t,e){return this.loop=t,this.repetitions=e,this}setEffectiveWeight(t){return this.weight=t,this._effectiveWeight=this.enabled?t:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(t){return this._scheduleFading(t,0,1)}fadeOut(t){return this._scheduleFading(t,1,0)}crossFadeFrom(t,e,n){if(t.fadeOut(e),this.fadeIn(e),n){const n=this._clip.duration,i=t._clip.duration,r=i/n,o=n/i;t.warp(1,r,e),this.warp(o,1,e)}return this}crossFadeTo(t,e,n){return t.crossFadeFrom(this,e,n)}stopFading(){const t=this._weightInterpolant;return null!==t&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}setEffectiveTimeScale(t){return this.timeScale=t,this._effectiveTimeScale=this.paused?0:t,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(t){return this.timeScale=this._clip.duration/t,this.stopWarping()}syncWith(t){return this.time=t.time,this.timeScale=t.timeScale,this.stopWarping()}halt(t){return this.warp(this._effectiveTimeScale,0,t)}warp(t,e,n){const i=this._mixer,r=i.time,o=this.timeScale;let s=this._timeScaleInterpolant;null===s&&(s=i._lendControlInterpolant(),this._timeScaleInterpolant=s);const a=s.parameterPositions,l=s.sampleValues;return a[0]=r,a[1]=r+n,l[0]=t/o,l[1]=e/o,this}stopWarping(){const t=this._timeScaleInterpolant;return null!==t&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(t,e,n,i){if(!this.enabled)return void this._updateWeight(t);const r=this._startTime;if(null!==r){const i=(t-r)*n;if(i<0||0===n)return;this._startTime=null,e=n*i}e*=this._updateTimeScale(t);const o=this._updateTime(e),s=this._updateWeight(t);if(s>0){const t=this._interpolants,e=this._propertyBindings;if(2501===this.blendMode)for(let n=0,i=t.length;n!==i;++n)t[n].evaluate(o),e[n].accumulateAdditive(s);else for(let n=0,r=t.length;n!==r;++n)t[n].evaluate(o),e[n].accumulate(i,s)}}_updateWeight(t){let e=0;if(this.enabled){e=this.weight;const n=this._weightInterpolant;if(null!==n){const i=n.evaluate(t)[0];e*=i,t>n.parameterPositions[1]&&(this.stopFading(),0===i&&(this.enabled=!1))}}return this._effectiveWeight=e,e}_updateTimeScale(t){let e=0;if(!this.paused){e=this.timeScale;const n=this._timeScaleInterpolant;null!==n&&(e*=n.evaluate(t)[0],t>n.parameterPositions[1]&&(this.stopWarping(),0===e?this.paused=!0:this.timeScale=e))}return this._effectiveTimeScale=e,e}_updateTime(t){const e=this._clip.duration,n=this.loop;let i=this.time+t,r=this._loopCount;const o=2202===n;if(0===t)return-1===r?i:o&&1==(1&r)?e-i:i;if(2200===n){-1===r&&(this._loopCount=0,this._setEndings(!0,!0,!1));t:{if(i>=e)i=e;else{if(!(i<0)){this.time=i;break t}i=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:t<0?-1:1})}}else{if(-1===r&&(t>=0?(r=0,this._setEndings(!0,0===this.repetitions,o)):this._setEndings(0===this.repetitions,!0,o)),i>=e||i<0){const n=Math.floor(i/e);i-=e*n,r+=Math.abs(n);const s=this.repetitions-r;if(s<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=t>0?e:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:t>0?1:-1});else{if(1===s){const e=t<0;this._setEndings(e,!e,o)}else this._setEndings(!1,!1,o);this._loopCount=r,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:n})}}else this.time=i;if(o&&1==(1&r))return e-i}return i}_setEndings(t,e,n){const i=this._interpolantSettings;n?(i.endingStart=Jo,i.endingEnd=Jo):(i.endingStart=t?this.zeroSlopeAtStart?Jo:Zo:$o,i.endingEnd=e?this.zeroSlopeAtEnd?Jo:Zo:$o)}_scheduleFading(t,e,n){const i=this._mixer,r=i.time;let o=this._weightInterpolant;null===o&&(o=i._lendControlInterpolant(),this._weightInterpolant=o);const s=o.parameterPositions,a=o.sampleValues;return s[0]=r,a[0]=e,s[1]=r+t,a[1]=n,this}}(class extends os{constructor(t){super(),this._root=t,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(t,e){const n=t._localRoot||this._root,i=t._clip.tracks,r=i.length,o=t._propertyBindings,s=t._interpolants,a=n.uuid,l=this._bindingsByRootAndName;let c=l[a];void 0===c&&(c={},l[a]=c);for(let t=0;t!==r;++t){const r=i[t],l=r.name;let h=c[l];if(void 0!==h)++h.referenceCount,o[t]=h;else{if(h=o[t],void 0!==h){null===h._cacheIndex&&(++h.referenceCount,this._addInactiveBinding(h,a,l));continue}const i=e&&e._propertyBindings[t].binding.parsedPath;h=new Sf(Of.create(n,l,i),r.ValueTypeName,r.getValueSize()),++h.referenceCount,this._addInactiveBinding(h,a,l),o[t]=h}s[t].resultBuffer=h.buffer}}_activateAction(t){if(!this._isActiveAction(t)){if(null===t._cacheIndex){const e=(t._localRoot||this._root).uuid,n=t._clip.uuid,i=this._actionsByClip[n];this._bindAction(t,i&&i.knownActions[0]),this._addInactiveAction(t,n,e)}const e=t._propertyBindings;for(let t=0,n=e.length;t!==n;++t){const n=e[t];0==n.useCount++&&(this._lendBinding(n),n.saveOriginalState())}this._lendAction(t)}}_deactivateAction(t){if(this._isActiveAction(t)){const e=t._propertyBindings;for(let t=0,n=e.length;t!==n;++t){const n=e[t];0==--n.useCount&&(n.restoreOriginalState(),this._takeBackBinding(n))}this._takeBackAction(t)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const t=this;this.stats={actions:{get total(){return t._actions.length},get inUse(){return t._nActiveActions}},bindings:{get total(){return t._bindings.length},get inUse(){return t._nActiveBindings}},controlInterpolants:{get total(){return t._controlInterpolants.length},get inUse(){return t._nActiveControlInterpolants}}}}_isActiveAction(t){const e=t._cacheIndex;return null!==e&&e<this._nActiveActions}_addInactiveAction(t,e,n){const i=this._actions,r=this._actionsByClip;let o=r[e];if(void 0===o)o={knownActions:[t],actionByRoot:{}},t._byClipCacheIndex=0,r[e]=o;else{const e=o.knownActions;t._byClipCacheIndex=e.length,e.push(t)}t._cacheIndex=i.length,i.push(t),o.actionByRoot[n]=t}_removeInactiveAction(t){const e=this._actions,n=e[e.length-1],i=t._cacheIndex;n._cacheIndex=i,e[i]=n,e.pop(),t._cacheIndex=null;const r=t._clip.uuid,o=this._actionsByClip,s=o[r],a=s.knownActions,l=a[a.length-1],c=t._byClipCacheIndex;l._byClipCacheIndex=c,a[c]=l,a.pop(),t._byClipCacheIndex=null,delete s.actionByRoot[(t._localRoot||this._root).uuid],0===a.length&&delete o[r],this._removeInactiveBindingsForAction(t)}_removeInactiveBindingsForAction(t){const e=t._propertyBindings;for(let t=0,n=e.length;t!==n;++t){const n=e[t];0==--n.referenceCount&&this._removeInactiveBinding(n)}}_lendAction(t){const e=this._actions,n=t._cacheIndex,i=this._nActiveActions++,r=e[i];t._cacheIndex=i,e[i]=t,r._cacheIndex=n,e[n]=r}_takeBackAction(t){const e=this._actions,n=t._cacheIndex,i=--this._nActiveActions,r=e[i];t._cacheIndex=i,e[i]=t,r._cacheIndex=n,e[n]=r}_addInactiveBinding(t,e,n){const i=this._bindingsByRootAndName,r=this._bindings;let o=i[e];void 0===o&&(o={},i[e]=o),o[n]=t,t._cacheIndex=r.length,r.push(t)}_removeInactiveBinding(t){const e=this._bindings,n=t.binding,i=n.rootNode.uuid,r=n.path,o=this._bindingsByRootAndName,s=o[i],a=e[e.length-1],l=t._cacheIndex;a._cacheIndex=l,e[l]=a,e.pop(),delete s[r],0===Object.keys(s).length&&delete o[i]}_lendBinding(t){const e=this._bindings,n=t._cacheIndex,i=this._nActiveBindings++,r=e[i];t._cacheIndex=i,e[i]=t,r._cacheIndex=n,e[n]=r}_takeBackBinding(t){const e=this._bindings,n=t._cacheIndex,i=--this._nActiveBindings,r=e[i];t._cacheIndex=i,e[i]=t,r._cacheIndex=n,e[n]=r}_lendControlInterpolant(){const t=this._controlInterpolants,e=this._nActiveControlInterpolants++;let n=t[e];return void 0===n&&(n=new Fp(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer),n.__cacheIndex=e,t[e]=n),n}_takeBackControlInterpolant(t){const e=this._controlInterpolants,n=t.__cacheIndex,i=--this._nActiveControlInterpolants,r=e[i];t.__cacheIndex=i,e[i]=t,r.__cacheIndex=n,e[n]=r}clipAction(t,e,n){const i=e||this._root,r=i.uuid;let o="string"==typeof t?Xp.findByName(i,t):t;const s=null!==o?o.uuid:t,a=this._actionsByClip[s];let l=null;if(void 0===n&&(n=null!==o?o.blendMode:2500),void 0!==a){const t=a.actionByRoot[r];if(void 0!==t&&t.blendMode===n)return t;l=a.knownActions[0],null===o&&(o=l._clip)}if(null===o)return null;const c=new Nf(this,o,e,n);return this._bindAction(c,l),this._addInactiveAction(c,s,r),c}existingAction(t,e){const n=e||this._root,i=n.uuid,r="string"==typeof t?Xp.findByName(n,t):t,o=r?r.uuid:t,s=this._actionsByClip[o];return void 0!==s&&s.actionByRoot[i]||null}stopAllAction(){const t=this._actions;for(let e=this._nActiveActions-1;e>=0;--e)t[e].stop();return this}update(t){t*=this.timeScale;const e=this._actions,n=this._nActiveActions,i=this.time+=t,r=Math.sign(t),o=this._accuIndex^=1;for(let s=0;s!==n;++s)e[s]._update(i,t,r,o);const s=this._bindings,a=this._nActiveBindings;for(let t=0;t!==a;++t)s[t].apply(o);return this}setTime(t){this.time=0;for(let t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(t)}getRoot(){return this._root}uncacheClip(t){const e=this._actions,n=t.uuid,i=this._actionsByClip,r=i[n];if(void 0!==r){const t=r.knownActions;for(let n=0,i=t.length;n!==i;++n){const i=t[n];this._deactivateAction(i);const r=i._cacheIndex,o=e[e.length-1];i._cacheIndex=null,i._byClipCacheIndex=null,o._cacheIndex=r,e[r]=o,e.pop(),this._removeInactiveBindingsForAction(i)}delete i[n]}}uncacheRoot(t){const e=t.uuid,n=this._actionsByClip;for(const t in n){const i=n[t].actionByRoot[e];void 0!==i&&(this._deactivateAction(i),this._removeInactiveAction(i))}const i=this._bindingsByRootAndName[e];if(void 0!==i)for(const t in i){const e=i[t];e.restoreOriginalState(),this._removeInactiveBinding(e)}}uncacheAction(t,e){const n=this.existingAction(t,e);null!==n&&(this._deactivateAction(n),this._removeInactiveAction(n))}}).prototype._controlInterpolantsResultBuffer=new Float32Array(1);class zf{constructor(t){"string"==typeof t&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),t=arguments[1]),this.value=t}clone(){return new zf(void 0===this.value.clone?this.value:this.value.clone())}}(class extends Pu{constructor(t,e,n=1){super(t,e),this.meshPerAttribute=n}copy(t){return super.copy(t),this.meshPerAttribute=t.meshPerAttribute,this}clone(t){const e=super.clone(t);return e.meshPerAttribute=this.meshPerAttribute,e}toJSON(t){const e=super.toJSON(t);return e.isInstancedInterleavedBuffer=!0,e.meshPerAttribute=this.meshPerAttribute,e}}).prototype.isInstancedInterleavedBuffer=!0;const Bf=new fs;class Ff{constructor(t=new fs(1/0,1/0),e=new fs(-1/0,-1/0)){this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromPoints(t){this.makeEmpty();for(let e=0,n=t.length;e<n;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){const n=Bf.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(n),this.max.copy(t).add(n),this}clone(){return(new this.constructor).copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(t){return this.isEmpty()?t.set(0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}containsPoint(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y)}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return Bf.copy(t).clamp(this.min,this.max).sub(t).length()}intersect(t){return this.min.max(t.min),this.max.min(t.max),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}Ff.prototype.isBox2=!0;const Hf=new zs,Uf=new pa,kf=new pa;function Gf(t){const e=[];!0===t.isBone&&e.push(t);for(let n=0;n<t.children.length;n++)e.push.apply(e,Gf(t.children[n]));return e}class Wf extends gd{constructor(t=1){const e=[0,0,0,t,0,0,0,0,0,0,t,0,0,0,0,0,0,t],n=new dl;n.setAttribute("position",new rl(e,3)),n.setAttribute("color",new rl([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3)),super(n,new ad({vertexColors:!0,toneMapped:!1})),this.type="AxesHelper"}setColors(t,e,n){const i=new Ss,r=this.geometry.attributes.color.array;return i.set(t),i.toArray(r,0),i.toArray(r,3),i.set(e),i.toArray(r,6),i.toArray(r,9),i.set(n),i.toArray(r,12),i.toArray(r,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}const Vf=new Float32Array(1);new Int32Array(Vf.buffer),Ed.create=function(t,e){return console.log("THREE.Curve.create() has been deprecated"),t.prototype=Object.create(Ed.prototype),t.prototype.constructor=t,t.prototype.getPoint=e,t},qd.prototype.fromPoints=function(t){return console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints()."),this.setFromPoints(t)},class extends gd{constructor(t=10,e=10,n=4473924,i=8947848){n=new Ss(n),i=new Ss(i);const r=e/2,o=t/e,s=t/2,a=[],l=[];for(let t=0,c=0,h=-s;t<=e;t++,h+=o){a.push(-s,0,h,s,0,h),a.push(h,0,-s,h,0,s);const e=t===r?n:i;e.toArray(l,c),c+=3,e.toArray(l,c),c+=3,e.toArray(l,c),c+=3,e.toArray(l,c),c+=3}const c=new dl;c.setAttribute("position",new rl(a,3)),c.setAttribute("color",new rl(l,3)),super(c,new ad({vertexColors:!0,toneMapped:!1})),this.type="GridHelper"}}.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")},class extends gd{constructor(t){const e=Gf(t),n=new dl,i=[],r=[],o=new Ss(0,0,1),s=new Ss(0,1,0);for(let t=0;t<e.length;t++){const n=e[t];n.parent&&n.parent.isBone&&(i.push(0,0,0),i.push(0,0,0),r.push(o.r,o.g,o.b),r.push(s.r,s.g,s.b))}n.setAttribute("position",new rl(i,3)),n.setAttribute("color",new rl(r,3)),super(n,new ad({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0})),this.type="SkeletonHelper",this.isSkeletonHelper=!0,this.root=t,this.bones=e,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1}updateMatrixWorld(t){const e=this.bones,n=this.geometry,i=n.getAttribute("position");kf.copy(this.root.matrixWorld).invert();for(let t=0,n=0;t<e.length;t++){const r=e[t];r.parent&&r.parent.isBone&&(Uf.multiplyMatrices(kf,r.matrixWorld),Hf.setFromMatrixPosition(Uf),i.setXYZ(n,Hf.x,Hf.y,Hf.z),Uf.multiplyMatrices(kf,r.parent.matrixWorld),Hf.setFromMatrixPosition(Uf),i.setXYZ(n+1,Hf.x,Hf.y,Hf.z),n+=2)}n.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(t)}}.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")},Kp.prototype.extractUrlBase=function(t){return console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead."),class{static decodeText(t){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(t);let e="";for(let n=0,i=t.length;n<i;n++)e+=String.fromCharCode(t[n]);try{return decodeURIComponent(escape(e))}catch(t){return e}}static extractUrlBase(t){const e=t.lastIndexOf("/");return-1===e?"./":t.slice(0,e+1)}static resolveURL(t,e){return"string"!=typeof t||""===t?"":(/^https?:\/\//i.test(e)&&/^\//.test(t)&&(e=e.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(t)||/^data:.*,.*$/i.test(t)||/^blob:.*$/i.test(t)?t:e+t)}}.extractUrlBase(t)},Kp.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.")}},Ff.prototype.center=function(t){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(t)},Ff.prototype.empty=function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()},Ff.prototype.isIntersectionBox=function(t){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},Ff.prototype.size=function(t){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(t)},Hs.prototype.center=function(t){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(t)},Hs.prototype.empty=function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()},Hs.prototype.isIntersectionBox=function(t){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},Hs.prototype.isIntersectionSphere=function(t){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(t)},Hs.prototype.size=function(t){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(t)},Ma.prototype.toVector3=function(){console.error("THREE.Euler: .toVector3() has been removed. Use Vector3.setFromEuler() instead")},ra.prototype.empty=function(){return console.warn("THREE.Sphere: .empty() has been renamed to .isEmpty()."),this.isEmpty()},Zl.prototype.setFromMatrix=function(t){return console.warn("THREE.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix()."),this.setFromProjectionMatrix(t)},ms.prototype.flattenToArrayOffset=function(t,e){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(t,e)},ms.prototype.multiplyVector3=function(t){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),t.applyMatrix3(this)},ms.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.")},ms.prototype.applyToBufferAttribute=function(t){return console.warn("THREE.Matrix3: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix3( matrix ) instead."),t.applyMatrix3(this)},ms.prototype.applyToVector3Array=function(){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")},ms.prototype.getInverse=function(t){return console.warn("THREE.Matrix3: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(t).invert()},pa.prototype.extractPosition=function(t){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(t)},pa.prototype.flattenToArrayOffset=function(t,e){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(t,e)},pa.prototype.getPosition=function(){return console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),(new zs).setFromMatrixColumn(this,3)},pa.prototype.setRotationFromQuaternion=function(t){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(t)},pa.prototype.multiplyToArray=function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")},pa.prototype.multiplyVector3=function(t){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},pa.prototype.multiplyVector4=function(t){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},pa.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.")},pa.prototype.rotateAxis=function(t){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),t.transformDirection(this)},pa.prototype.crossVector=function(t){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},pa.prototype.translate=function(){console.error("THREE.Matrix4: .translate() has been removed.")},pa.prototype.rotateX=function(){console.error("THREE.Matrix4: .rotateX() has been removed.")},pa.prototype.rotateY=function(){console.error("THREE.Matrix4: .rotateY() has been removed.")},pa.prototype.rotateZ=function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")},pa.prototype.rotateByAxis=function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")},pa.prototype.applyToBufferAttribute=function(t){return console.warn("THREE.Matrix4: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},pa.prototype.applyToVector3Array=function(){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")},pa.prototype.makeFrustum=function(t,e,n,i,r,o){return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."),this.makePerspective(t,e,i,n,r,o)},pa.prototype.getInverse=function(t){return console.warn("THREE.Matrix4: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(t).invert()},ql.prototype.isIntersectionLine=function(t){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(t)},Ns.prototype.multiplyVector3=function(t){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),t.applyQuaternion(this)},Ns.prototype.inverse=function(){return console.warn("THREE.Quaternion: .inverse() has been renamed to invert()."),this.invert()},da.prototype.isIntersectionBox=function(t){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},da.prototype.isIntersectionPlane=function(t){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(t)},da.prototype.isIntersectionSphere=function(t){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(t)},Za.prototype.area=function(){return console.warn("THREE.Triangle: .area() has been renamed to .getArea()."),this.getArea()},Za.prototype.barycoordFromPoint=function(t,e){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),this.getBarycoord(t,e)},Za.prototype.midpoint=function(t){return console.warn("THREE.Triangle: .midpoint() has been renamed to .getMidpoint()."),this.getMidpoint(t)},Za.prototypenormal=function(t){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),this.getNormal(t)},Za.prototype.plane=function(t){return console.warn("THREE.Triangle: .plane() has been renamed to .getPlane()."),this.getPlane(t)},Za.barycoordFromPoint=function(t,e,n,i,r){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),Za.getBarycoord(t,e,n,i,r)},Za.normal=function(t,e,n,i){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),Za.getNormal(t,e,n,i)},Yd.prototype.extractAllPoints=function(t){return console.warn("THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead."),this.extractPoints(t)},Yd.prototype.extrude=function(t){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new bp(this,t)},Yd.prototype.makeGeometry=function(t){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new Mp(this,t)},fs.prototype.fromAttribute=function(t,e,n){return console.warn("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,n)},fs.prototype.distanceToManhattan=function(t){return console.warn("THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(t)},fs.prototype.lengthManhattan=function(){return console.warn("THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},zs.prototype.setEulerFromRotationMatrix=function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},zs.prototype.setEulerFromQuaternion=function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},zs.prototype.getPositionFromMatrix=function(t){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(t)},zs.prototype.getScaleFromMatrix=function(t){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(t)},zs.prototype.getColumnFromMatrix=function(t,e){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(e,t)},zs.prototype.applyProjection=function(t){return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."),this.applyMatrix4(t)},zs.prototype.fromAttribute=function(t,e,n){return console.warn("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,n)},zs.prototype.distanceToManhattan=function(t){return console.warn("THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(t)},zs.prototype.lengthManhattan=function(){return console.warn("THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},Ps.prototype.fromAttribute=function(t,e,n){return console.warn("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,n)},Ps.prototype.lengthManhattan=function(){return console.warn("THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},Fa.prototype.getChildByName=function(t){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(t)},Fa.prototype.renderDepth=function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},Fa.prototype.translate=function(t,e){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(e,t)},Fa.prototype.getWorldRotation=function(){console.error("THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.")},Fa.prototype.applyMatrix=function(t){return console.warn("THREE.Object3D: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(t)},Object.defineProperties(Fa.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(t){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=t}},useQuaternion:{get:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}}}),Ll.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(Ll.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.")}}}),td.prototype.initBones=function(){console.error("THREE.SkinnedMesh: initBones() has been removed.")},Fl.prototype.setLens=function(t,e){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),void 0!==e&&(this.filmGauge=e),this.setFocalLength(t)},Object.defineProperties(of.prototype,{onlyShadow:{set:function(){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(t){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=t}},shadowCameraLeft:{set:function(t){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=t}},shadowCameraRight:{set:function(t){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=t}},shadowCameraTop:{set:function(t){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=t}},shadowCameraBottom:{set:function(t){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=t}},shadowCameraNear:{set:function(t){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=t}},shadowCameraFar:{set:function(t){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=t}},shadowCameraVisible:{set:function(){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(t){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=t}},shadowDarkness:{set:function(){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(t){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=t}},shadowMapHeight:{set:function(t){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=t}}}),Object.defineProperties(el.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===ns},set:function(){console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.setUsage(ns)}}}),el.prototype.setDynamic=function(t){return console.warn("THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===t?ns:es),this},el.prototype.copyIndicesArray=function(){console.error("THREE.BufferAttribute: .copyIndicesArray() has been removed.")},el.prototype.setArray=function(){console.error("THREE.BufferAttribute: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")},dl.prototype.addIndex=function(t){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(t)},dl.prototype.addAttribute=function(t,e){return console.warn("THREE.BufferGeometry: .addAttribute() has been renamed to .setAttribute()."),e&&e.isBufferAttribute||e&&e.isInterleavedBufferAttribute?"index"===t?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(e),this):this.setAttribute(t,e):(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.setAttribute(t,new el(arguments[1],arguments[2])))},dl.prototype.addDrawCall=function(t,e,n){void 0!==n&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(t,e)},dl.prototype.clearDrawCalls=function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()},dl.prototype.computeOffsets=function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")},dl.prototype.removeAttribute=function(t){return console.warn("THREE.BufferGeometry: .removeAttribute() has been renamed to .deleteAttribute()."),this.deleteAttribute(t)},dl.prototype.applyMatrix=function(t){return console.warn("THREE.BufferGeometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(t)},Object.defineProperties(dl.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}}}),Pu.prototype.setDynamic=function(t){return console.warn("THREE.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===t?ns:es),this},Pu.prototype.setArray=function(){console.error("THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")},bp.prototype.getArrays=function(){console.error("THREE.ExtrudeGeometry: .getArrays() has been removed.")},bp.prototype.addShapeList=function(){console.error("THREE.ExtrudeGeometry: .addShapeList() has been removed.")},bp.prototype.addShape=function(){console.error("THREE.ExtrudeGeometry: .addShape() has been removed.")},Lu.prototype.dispose=function(){console.error("THREE.Scene: .dispose() has been removed.")},zf.prototype.onUpdate=function(){return console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."),this},Object.defineProperties($a.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 Ss}},shading:{get:function(){console.error("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead.")},set:function(t){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===t}},stencilMask:{get:function(){return console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask},set:function(t){console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask=t}},vertexTangents:{get:function(){console.warn("THREE."+this.type+": .vertexTangents has been removed.")},set:function(){console.warn("THREE."+this.type+": .vertexTangents has been removed.")}}}),Object.defineProperties(zl.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(t){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=t}}}),Au.prototype.clearTarget=function(t,e,n,i){console.warn("THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead."),this.setRenderTarget(t),this.clear(e,n,i)},Au.prototype.animate=function(t){console.warn("THREE.WebGLRenderer: .animate() is now .setAnimationLoop()."),this.setAnimationLoop(t)},Au.prototype.getCurrentRenderTarget=function(){return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),this.getRenderTarget()},Au.prototype.getMaxAnisotropy=function(){return console.warn("THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy()."),this.capabilities.getMaxAnisotropy()},Au.prototype.getPrecision=function(){return console.warn("THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision."),this.capabilities.precision},Au.prototype.resetGLState=function(){return console.warn("THREE.WebGLRenderer: .resetGLState() is now .state.reset()."),this.state.reset()},Au.prototype.supportsFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")},Au.prototype.supportsHalfFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")},Au.prototype.supportsStandardDerivatives=function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")},Au.prototype.supportsCompressedTextureS3TC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")},Au.prototype.supportsCompressedTexturePVRTC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")},Au.prototype.supportsBlendMinMax=function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")},Au.prototype.supportsVertexTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),this.capabilities.vertexTextures},Au.prototype.supportsInstancedArrays=function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")},Au.prototype.enableScissorTest=function(t){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(t)},Au.prototype.initMaterial=function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")},Au.prototype.addPrePlugin=function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")},Au.prototype.addPostPlugin=function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")},Au.prototype.updateShadowMap=function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")},Au.prototype.setFaceCulling=function(){console.warn("THREE.WebGLRenderer: .setFaceCulling() has been removed.")},Au.prototype.allocTextureUnit=function(){console.warn("THREE.WebGLRenderer: .allocTextureUnit() has been removed.")},Au.prototype.setTexture=function(){console.warn("THREE.WebGLRenderer: .setTexture() has been removed.")},Au.prototype.setTexture2D=function(){console.warn("THREE.WebGLRenderer: .setTexture2D() has been removed.")},Au.prototype.setTextureCube=function(){console.warn("THREE.WebGLRenderer: .setTextureCube() has been removed.")},Au.prototype.getActiveMipMapLevel=function(){return console.warn("THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel()."),this.getActiveMipmapLevel()},Object.defineProperties(Au.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=t}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=t}},shadowMapCullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")}},context:{get:function(){return console.warn("THREE.WebGLRenderer: .context has been removed. Use .getContext() instead."),this.getContext()}},vr:{get:function(){return console.warn("THREE.WebGLRenderer: .vr has been renamed to .xr"),this.xr}},gammaInput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead."),!1},set:function(){console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead.")}},gammaOutput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),!1},set:function(t){console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),this.outputEncoding=!0===t?Qo:Ko}},toneMappingWhitePoint:{get:function(){return console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed."),1},set:function(){console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed.")}},gammaFactor:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaFactor has been removed."),2},set:function(){console.warn("THREE.WebGLRenderer: .gammaFactor has been removed.")}}}),Object.defineProperties(gu.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(Is.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(t){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=t}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(t){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=t}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(t){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=t}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(t){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=t}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(t){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=t}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(t){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=t}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(t){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=t}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(t){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=t}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(t){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=t}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(t){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=t}}}),class extends Fa{constructor(t){super(),this.type="Audio",this.listener=t,this.context=t.context,this.gain=this.context.createGain(),this.gain.connect(t.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(t){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=t,this.connect(),this}setMediaElementSource(t){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(t),this.connect(),this}setMediaStreamSource(t){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(t),this.connect(),this}setBuffer(t){return this.buffer=t,this.sourceType="buffer",this.autoplay&&this.play(),this}play(t=0){if(!0===this.isPlaying)return void console.warn("THREE.Audio: Audio is already playing.");if(!1===this.hasPlaybackControl)return void console.warn("THREE.Audio: this Audio has no playback control.");this._startedAt=this.context.currentTime+t;const e=this.context.createBufferSource();return e.buffer=this.buffer,e.loop=this.loop,e.loopStart=this.loopStart,e.loopEnd=this.loopEnd,e.onended=this.onEnded.bind(this),e.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=e,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(!1!==this.hasPlaybackControl)return!0===this.isPlaying&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,!0===this.loop&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this;console.warn("THREE.Audio: this Audio has no playback control.")}stop(){if(!1!==this.hasPlaybackControl)return this._progress=0,this.source.stop(),this.source.onended=null,this.isPlaying=!1,this;console.warn("THREE.Audio: this Audio has no playback control.")}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let t=1,e=this.filters.length;t<e;t++)this.filters[t-1].connect(this.filters[t]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}disconnect(){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let t=1,e=this.filters.length;t<e;t++)this.filters[t-1].disconnect(this.filters[t]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}getFilters(){return this.filters}setFilters(t){return t||(t=[]),!0===this._connected?(this.disconnect(),this.filters=t.slice(),this.connect()):this.filters=t.slice(),this}setDetune(t){if(this.detune=t,void 0!==this.source.detune)return!0===this.isPlaying&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(t){return this.setFilters(t?[t]:[])}setPlaybackRate(t){if(!1!==this.hasPlaybackControl)return this.playbackRate=t,!0===this.isPlaying&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this;console.warn("THREE.Audio: this Audio has no playback control.")}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1}getLoop(){return!1===this.hasPlaybackControl?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop}setLoop(t){if(!1!==this.hasPlaybackControl)return this.loop=t,!0===this.isPlaying&&(this.source.loop=this.loop),this;console.warn("THREE.Audio: this Audio has no playback control.")}setLoopStart(t){return this.loopStart=t,this}setLoopEnd(t){return this.loopEnd=t,this}getVolume(){return this.gain.gain.value}setVolume(t){return this.gain.gain.setTargetAtTime(t,this.context.currentTime,.01),this}}.prototype.load=function(t){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");const e=this;return(new bf).load(t,(function(t){e.setBuffer(t)})),this},Ul.prototype.updateCubeMap=function(t,e){return console.warn("THREE.CubeCamera: .updateCubeMap() is now .update()."),this.update(t,e)},Ul.prototype.clear=function(t,e,n,i){return console.warn("THREE.CubeCamera: .clear() is now .renderTarget.clear()."),this.renderTarget.clear(t,e,n,i)},Es.crossOrigin=void 0,Es.loadTexture=function(t,e,n,i){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");const r=new rf;r.setCrossOrigin(this.crossOrigin);const o=r.load(t,n,void 0,i);return e&&(o.mapping=e),o},Es.loadTextureCube=function(t,e,n,i){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");const r=new nf;r.setCrossOrigin(this.crossOrigin);const o=r.load(t,n,void 0,i);return e&&(o.mapping=e),o},Es.loadCompressedTexture=function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")},Es.loadCompressedTextureCube=function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"138"}})),"undefined"!=typeof window&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__="138");class jf extends zp{constructor(t,e,n,i){super(t,e,n,i)}copySampleValue_(t){const e=this.resultBuffer,n=this.sampleValues,i=this.valueSize,r=t*i*3+i;for(let t=0;t!==i;t++)e[t]=n[r+t];return e}}jf.prototype.beforeStart_=jf.prototype.copySampleValue_,jf.prototype.afterEnd_=jf.prototype.copySampleValue_,jf.prototype.interpolate_=function(t,e,n,i){const r=this.resultBuffer,o=this.sampleValues,s=this.valueSize,a=2*s,l=3*s,c=i-e,h=(n-e)/c,u=h*h,d=u*h,p=t*l,f=p-l,m=-2*d+3*u,g=d-u,_=1-m,v=g-u+h;for(let t=0;t!==s;t++){const e=o[f+t+s],n=o[f+t+a]*c,i=o[p+t+s],l=o[p+t]*c;r[t]=_*e+v*n+m*i+g*l}return r},new Ns,Int8Array,Uint8Array,Int16Array,Uint16Array,Uint32Array,Float32Array,new WeakMap;var qf=window.ASSETS_REVISION,Yf=new zs(0,0,0),Xf=new Ma(0,0,0),Zf=new Ns,Jf=(new pa,new zs(0,1,0)),$f=new zs(1,0,0),Kf=new zs(0,0,1),Qf={position:new zs(0,0,0),rotation:new Ma(0,0,0)},tm={position:new zs(0,0,0),rotation:new Ma(0,0,0),scale:new zs(1,1,1)},em=new pa,nm=new pa;function im(t,e,n){return Math.min(1,Math.max(0,(n-t)/(e-t)))}var rm=function(){function t(t,e,n,i){this._group=t,this._index=e,this._cameraTransform=i,this._positions=n,this._posLen=this._positions.length/3;var r=n.length/3;this._curve=new Od(ar.range(r).map((function(t){return new zs(n[t*=3],n[t+1],n[t+2])})));var o=3*(this._posLen-1),s=3*(this._posLen-2);this._firstPos=[n[0],n[1],n[2]],this._lastPos=[n[o],n[o+1],n[o+2]],this._minusDir=[this._firstPos[0]-n[3],this._firstPos[1]-n[4],this._firstPos[2]-n[5]],this._plusDir=[this._lastPos[0]-n[s],this._lastPos[1]-n[s+1],this._lastPos[2]-n[s+2]],this._length=this._curve.getLength()}return Object.defineProperty(t.prototype,"cameraTransform",{get:function(){return this._cameraTransform},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"length",{get:function(){return this._length},enumerable:!1,configurable:!0}),t.prototype.getPointByMeter=function(t){var e=t/this._length;if(e<0){var n=-e*this._posLen;return[this._firstPos[0]+this._minusDir[0]*n,this._firstPos[1]+this._minusDir[1]*n,this._firstPos[2]+this._minusDir[2]*n]}if(e>1)return n=(e-1)*this._posLen,[this._lastPos[0]+this._plusDir[0]*n,this._lastPos[1]+this._plusDir[1]*n,this._lastPos[2]+this._plusDir[2]*n];var i=e*(this._posLen-1),r=Math.floor(i),o=i-r,s=3*r,a=3*Math.ceil(i);return[yr(this._positions[s],this._positions[a],o),yr(this._positions[s+1],this._positions[a+1],o),yr(this._positions[s+2],this._positions[a+2],o)]},t}();function om(t,e,n,i){t.x=yr(e.x,n.x,i),t.y=yr(e.y,n.y,i),t.z=yr(e.z,n.z,i)}function sm(t,e,n,i){om(t.position,e.position,n.position,i),om(t.rotation,e.rotation,n.rotation,i),t.scale&&om(t.scale,e.scale,n.scale,i)}function am(t,e){t.position.copy(e.position),t.rotation.copy(e.rotation),t.scale&&t.scale.copy(e.scale)}var lm=bo.isLandscape?vo.retina?"data-src-pc-retina":"data-src-pc":"data-src-sp",cm=function(t){return t.attr(lm)+"?"+qf},hm=vo.android||vo.tablet||hr.includes("low"),um=new Ss("#ebebeb"),dm={kvTitle:cm(Mr.find$(".js_content_kv")[0]),bouquetCircleBg:"assets/img/"+(bo.isLandscape?"pc":"sp")+"/bouquet-bg.png"},pm=[{intervalMeter:bo.isLandscape?3:2.5,speedScale:bo.isLandscape?.7:1,sectionMoveScale:1,groupMoveScale:.5,waveScale:1},{intervalMeter:bo.isLandscape?3:2.5,speedScale:bo.isLandscape?1:1.5,sectionMoveScale:1,groupMoveScale:1,waveScale:1},{intervalMeter:4,speedScale:2,sectionMoveScale:(bo.isLandscape,.7),groupMoveScale:1,waveScale:3},{intervalMeter:5,speedScale:2,sectionMoveScale:1,groupMoveScale:1,waveScale:1},{intervalMeter:bo.isLandscape?4:5,speedScale:1,sectionMoveScale:1,groupMoveScale:1,waveScale:2}],fm=pm.length,mm=[0,0,1,1,2,2,2,2,3,4],gm=[{name:"fl_flat_big",colors:["blue","red","white"]},{name:"fl_flat_carn1",colors:["pink","white","red","yellow"]},{name:"fl_flat_carn2",colors:["pink","white","red","yellow"]},{name:"fl_flat_tulip",colors:["red","white"]},{name:"fl_pon_asynL",colors:["red","yellow","white","pink","blue"]},{name:"fl_pon_asynR",colors:["red","yellow","white","pink","blue"]},{name:"fl_pon_five",colors:["blue","red","white"]},{name:"fl_pon_tong",colors:["blue","pink","green","yellow"]}],_m=[{name:"gr_leaf_regular"},{name:"gr_leaf_waveM"},{name:"gr_leaf_waveS"},{name:"gr_stem1"},{name:"gr_stem3"}],vm=function(t){var e=new Ss(t);return"vec3("+e.r+","+e.g+","+e.b+")"},ym={IS_FLOWER:1,C_BIG_BLUE:vm("#2356a6"),C_BIG_BLUE_STAMEN:vm("#e25740"),C_BIG_BLUE_BACK:vm("#0e3d89"),C_BIG_RED:vm("#eb5b3d"),C_BIG_RED_STAMEN:vm("#ffffff"),C_BIG_RED_BACK:vm("#d82b18"),C_BIG_WHITE_1:vm("#fffafe"),C_BIG_WHITE_2:vm("#ffebf6"),C_BIG_WHITE_STAMEN:vm("#f6ac19"),C_BIG_WHITE_BACK:vm("#ffcaca"),C_BIG_ROOT:vm("#143e8d"),C_CARN_PINK_FRONT:vm("#ffcaca"),C_CARN_PINK_BACK:vm("#f88a78"),C_CARN_PINK_SUB_1:vm("#fedae1"),C_CARN_PINK_SUB_2:vm("#f98d7c"),C_CARN_PINK_SUB_BACK:vm("#f7775e"),C_CARN_WHITE_FRONT:vm("#ffffff"),C_CARN_WHITE_BACK:vm("#ffeef7"),C_CARN_WHITE_SUB_1:vm("#fffcfe"),C_CARN_WHITE_SUB_2:vm("#ffe1f6"),C_CARN_WHITE_SUB_BACK:vm("#fff8fc"),C_CARN_RED_FRONT:vm("#d82b18"),C_CARN_RED_BACK:vm("#f7775e"),C_CARN_RED_SUB_1:vm("#eb5b3d"),C_CARN_RED_SUB_2:vm("#d92f1b"),C_CARN_RED_SUB_BACK:vm("#eb5b3d"),C_CARN_YELLOW_FRONT_1:vm("#eb603c"),C_CARN_YELLOW_FRONT_2:vm("#edb427"),C_CARN_YELLOW_BACK_1:vm("#edaf28"),C_CARN_YELLOW_BACK_2:vm("#eb6c39"),C_CARN_YELLOW_SUB_1:vm("#eb673a"),C_CARN_YELLOW_SUB_2:vm("#edb427"),C_CARN_YELLOW_SUB_BACK:vm("#f2b31d"),C_CARN_ROOT:vm("#2356a6"),C_TULIP_RED_1:vm("#da301c"),C_TULIP_RED_2:vm("#ea573a"),C_TULIP_RED_BACK:vm("#f5ac18"),C_TULIP_WHITE_1:vm("#fffdfe"),C_TULIP_WHITE_2:vm("#ffeaf5"),C_TULIP_WHITE_BACK:vm("#d82b18"),C_ASYN_RED_1:vm("#d82b18"),C_ASYN_RED_2:vm("#ea593c"),C_ASYN_RED_STAMEN:vm("#f5ac18"),C_ASYN_YELLOW:vm("#f5ac18"),C_ASYN_YELLOW_STAMEN:vm("#eb5b3d"),C_ASYN_WHITE_1:vm("#fee6f3"),C_ASYN_WHITE_2:vm("#fffdfe"),C_ASYN_WHITE_STAMEN:vm("#f6ac19"),C_ASYN_PINK:vm("#ffcaca"),C_ASYN_PINK_STAMEN:vm("#ec5b3e"),C_ASYN_BLUE:vm("#174392"),C_ASYN_BLUE_STAMEN:vm("#f5ac18"),C_FIVE_BLUE:vm("#2356a6"),C_FIVE_BLUE_STAMEN:vm("#f7775e"),C_FIVE_RED:vm("#d82b18"),C_FIVE_RED_STAMEN:vm("#edbd25"),C_FIVE_WHITE_1:vm("#fffeff"),C_FIVE_WHITE_2:vm("#fee7f3"),C_FIVE_WHITE_STAMEN:vm("#edbd25"),C_TONG_BLUE:vm("#2356a6"),C_TONG_BLUE_STAMEN:vm("#f7775e"),C_TONG_PINK:vm("#f7775e"),C_TONG_PINK_STAMEN:vm("#0e3d89"),C_TONG_GREEN:vm("#1ba8ab"),C_TONG_GREEN_STAMEN:vm("#f5ac18"),C_TONG_YELLOW:vm("#edab29"),C_TONG_YELLOW_STAMEN:vm("#2356a6")},xm={IS_FLOWER:0,C_REGULAR_1:vm("#1c9aaa"),C_REGULAR_2:vm("#225ea7"),C_WAVE_M_1:vm("#2cbdbd"),C_WAVE_M_2:vm("#f2e6f2"),C_WAVE_S_1:vm("#1dabad"),C_WAVE_S_2:vm("#28bcbc")},bm="fl_flat_big__blue",wm="fl_flat_carn2__white",Mm="fl_flat_carn2__red",Sm="fl_flat_carn2__yellow",Tm="fl_flat_tulip__red",Em="fl_flat_tulip__white",Am="fl_pon_asynL__yellow",Cm="fl_pon_asynL__white",Rm="fl_pon_asynR__red",Lm="fl_pon_asynR__blue",Pm="fl_pon_five__blue",Im="fl_pon_five__red",Dm="fl_pon_five__white",Om="fl_pon_tong__pink",Nm="fl_pon_tong__green",zm="fl_pon_tong__yellow",Bm=(bo.isLandscape?[Dm,bm,Mm]:[Sm,Im,Dm,bm,Mm]).concat([Am,Nm,"fl_pon_asynR__pink",Dm,Tm,Lm,Rm,Pm,Nm,Om,Em,zm,Im,wm,Nm,"fl_pon_asynL__blue","fl_flat_big__white",Sm,Om,wm,Lm,Im,Cm,"fl_pon_asynL__pink",Tm,zm,"fl_flat_big__red",Dm,Nm,"fl_pon_asynR__white",Om,Pm,Rm,Em,Am,Om,Lm,Cm,Tm]).slice(0,hm?50:100),Fm=Bm.length;function Hm(t,e){return t<0?0:t>1?1:_r()[e](t,0,1,1)}var Um=function(){function t(t,e,n,i){this._cameraTransform={position:new zs,rotation:new Ma},this._blend=0,this._totalBlend=0,this._index=t,this._startCopyNum=e,this._maxCopyNum=n,this._items=i,this._count=this._items.length,this._averangeLength=i.reduce((function(t,e){return t+e.length}),0)/i.length,this._refresh()}return Object.defineProperty(t.prototype,"cameraTransform",{get:function(){return this._cameraTransform},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"length",{get:function(){return this._length},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"averangeLength",{get:function(){return this._averangeLength},enumerable:!1,configurable:!0}),t.prototype._refresh=function(){var t=(this._totalBlend+99999*this._count)%this._count,e=Math.floor(t),n=(e+1)%this._count;this._item0=this._items[e],this._item1=this._items[n],this._alpha=Hm(im(.1,.9,t-e),"easeInOutQuart"),sm(this._cameraTransform,this._item0.cameraTransform,this._item1.cameraTransform,this._alpha),this._length=yr(this._item0.length,this._item1.length,this._alpha)},t.prototype.resetBlend=function(){this._blend=0},t.prototype.tick=function(t,e){Math.abs(t.kv)>.5&&(this._blend+=8e-4*e);var n=this._blend+.2*Math.max(0,Math.min(this._maxCopyNum,t.copyNum-this._startCopyNum));this._totalBlend!==n&&(this._totalBlend=n,this._refresh())},t.prototype.getPointByMeter=function(t){if(this._item0===this._item1)return this._item0.getPointByMeter(t);var e=this._item0.getPointByMeter(t),n=this._item1.getPointByMeter(t);return[yr(e[0],n[0],this._alpha),yr(e[1],n[1],this._alpha),yr(e[2],n[2],this._alpha)]},t}();function km(t){return void 0===t&&(t=Qf),{position:(new zs).copy(t.position),rotation:(new Ma).copy(t.rotation),scale:t.scale?(new zs).copy(t.scale):null}}var Gm=new Ns,Wm=function(){function t(t,e){this._transform=km(),this._positions=t,this._quaternions=e,this._totalFrames=this._positions.length/3}return Object.defineProperty(t.prototype,"transform",{get:function(){return this._transform},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"positions",{get:function(){return this._positions},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"quaternions",{get:function(){return this._quaternions},enumerable:!1,configurable:!0}),t.prototype.goto=function(t){var e=Math.floor(t),n=Math.ceil(t),i=t-e,r=3*e,o=4*e,s=3*n,a=4*n;this._transform.position.set(yr(this._positions[r],this._positions[s],i),yr(this._positions[r+1],this._positions[s+1],i),yr(this._positions[r+2],this._positions[s+2],i)),Gm.set(yr(this._quaternions[o],this._quaternions[a],i),yr(this._quaternions[o+1],this._quaternions[a+1],i),yr(this._quaternions[o+2],this._quaternions[a+2],i),yr(this._quaternions[o+3],this._quaternions[a+3],i)),this._transform.rotation.setFromQuaternion(Gm)},t.prototype.gotoByPer=function(t){this.goto((this._totalFrames-1)*t)},t}(),Vm=new(function(){function t(){this._data={},this._isBuilt=!1,this._none="yes"===window.sessionStorage.getItem("logger-removed"),vo.touch&&(this._none=!0)}return t.prototype.add=function(t,e){},t.prototype._build=function(){this._isBuilt||(this._isBuilt=!0,this.$=Mr('<div class="js_logger"><div class="js_logger_inner"></div><button class="js_logger_close">✕</button></div>'),this.$inner=this.$.find$(".js_logger_inner")[0],document.body.appendChild(this.$.el),this.$.find$(".js_logger_close")[0].on("click",this._close.bind(this)))},t.prototype._close=function(){this.$.remove(),window.sessionStorage.setItem("logger-removed","yes")},t.prototype.updated=function(){},t}()),jm={},qm=function(){function t(){}return t.prototype.it=function(t){var e=this;this.abort(),(t=ar.assignIn({method:"GET",url:"/",data:{},responseType:"",success:function(t){},error:function(){}},t)).method=t.method.toUpperCase();var n;n="string"==typeof t.data?t.data:ar.reduce(t.data,(function(t,e,n){return t+(""!==t?"&":"")+n+"="+e}),"");var i=t.url+(n&&"GET"===t.method?"?"+n:"");if("GET"===t.method&&jm[i])return t.success(jm[i]);this._xhr=new XMLHttpRequest,this._xhr.open(t.method,i,!0),this._xhr.onerror=t.error,t.responseType&&(this._xhr.responseType=t.responseType),this._xhr.onload=function(){if(e._xhr.status>=200&&e._xhr.status<400){var n=e._xhr.response||"";"GET"===t.method&&(jm[i]=n),t.success(n)}else t.error()},"POST"===t.method?(this._xhr.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8"),this._xhr.send(n)):this._xhr.send()},t.prototype.abort=function(){this._xhr&&(this._xhr.abort&&this._xhr.abort(),this._xhr=null)},t}(),Ym=qm,Xm=function(){function t(t){this._data={},this._jsonName=(bo.isLandscape?"pc":"sp")+".json",this._jsonName=t}return t.prototype.add=function(t,e){this._data[t]=e},t.prototype.addFloat32Array=function(t,e){this._data[t]=Array.prototype.slice.call(e)},t.prototype.get=function(t){return this._data[t]},t.prototype.getAsTree=function(t){return this._data[t]},t.prototype.getAsTransform=function(t){return this.toTransform(this._data[t])},t.prototype.load=function(){var t=this;return new Promise((function(e,n){(new Ym).it({method:"GET",url:"assets/data/"+t._jsonName+"?v="+qf,success:function(n){t._data=JSON.parse(n),e(null)}})}))},t.prototype.save=function(){var t=this;return new Promise((function(e,n){(new Ym).it({method:"POST",url:"save.php",data:{name:t._jsonName,body:JSON.stringify(t._data)},success:function(t){e(null)}})}))},t.prototype.obj3ToItem=function(t){return[t.position.x,t.position.y,t.position.z,t.rotation.x,t.rotation.y,t.rotation.z,t.scale.x,t.scale.y,t.scale.z]},t.prototype.createTree=function(t,e){var n=this;return void 0===e&&(e=[]),t.reduce((function(t,i){if(e.length>0){var r=!1;if(e.forEach((function(t){0===i.name.indexOf(t)&&(r=!0)})),!r)return t}return t[i.name]=n.obj3ToItem(i),t}),{})},t.prototype.toTransform=function(t){return{position:new zs(t[0],t[1],t[2]),rotation:new Ma(t[3],t[4],t[5]),scale:new zs(t[6],t[7],t[8])}},t}(),Zm=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),Jm=new(function(t){function e(){return t.call(this,(bo.isLandscape?"pc":"sp")+".json")||this}return Zm(e,t),e}(Xm));function $m(t,e){var n;return t.children.forEach((function(t){t.name===e&&(n=t)})),n}var Km=new pa,Qm={position:new zs(0,11,0),rotation:new Ma},tg=new(function(){function t(){this._cameraTransform=km(),this._cameraMat=new pa,this._roadItems=[],this._roadMixers=[]}return Object.defineProperty(t.prototype,"gAlpha",{get:function(){return this._gAlpha},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"gi1",{get:function(){return this._gi1},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"gi0",{get:function(){return this._gi0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"roadMixers",{get:function(){return this._roadMixers},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"currentRoadLength",{get:function(){return this._currentRoadLength},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"cameraMat",{get:function(){return this._cameraMat},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"addScrollNum",{get:function(){return this._addScrollNum},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"cameraAnime",{get:function(){return this._cameraAnime},enumerable:!1,configurable:!0}),t.prototype.setup=function(){return Jm.load().then(this._build.bind(this))},t.prototype._loaded=function(t){var e=t.scene,n=$m(e,"bouquetWrap").children[0];Jm.add("bouquet",Jm.obj3ToItem(n)),Jm.add("bouquet.circle_bg",Jm.obj3ToItem($m(n,"circle_bg"))),Jm.add("bouquet.children",Jm.createTree(n.children,["fl_","gr_"]));var i=$m(e,"gardenWrap").children[0];Jm.add("garden.bloomLine",Jm.obj3ToItem($m(i,"bloomLine"))),Jm.add("garden.children",Jm.createTree(i.children,["fl_"]));var r=t.cameras[0];Jm.add("perspectiveCamera",Jm.obj3ToItem(r)),Jm.add("perspectiveCamera.fov",r.fov),t.animations.forEach((function(t){t.name.includes("cameraAction")&&(Jm.addFloat32Array("camera.position",ar.find(t.tracks,{name:"camera.position"}).values),Jm.addFloat32Array("camera.quaternion",ar.find(t.tracks,{name:"camera.quaternion"}).values))}));var o=[];return t.animations.forEach((function(t){var e=t.tracks[0].name,n=e.split("mark-")[1];if(n){var i=n.split(".")[0].split("_"),r=i[0],s=i[1];r&&s||console.error("[TimelineStore] invalid track name: "+e),t.tracks.forEach((function(t){if(t.name.includes(".position")){var e=parseInt(r)-1,n=parseInt(s)-1;o[e]=o[e]||[],o[e][n]=Array.prototype.slice.call(t.values)}}))}})),Jm.add("marks",o),Jm.save(),Promise.resolve()},t.prototype._build=function(){var t=this;this._cameraAnime=new Wm(Jm.get("camera.position"),Jm.get("camera.quaternion")),this._perspectiveCameraTransform=Jm.getAsTransform("perspectiveCamera"),Jm.get("marks").forEach((function(e,n){e.forEach((function(e,i){var r=10*n+(n===fm-1?0:i);t._cameraAnime.goto(r);var o=km(t._cameraAnime.transform),s=new rm(n,i,e,o);t._roadItems[n]=t._roadItems[n]||[],t._roadItems[n][i]=s}))})),this._roadMixers=this._roadItems.map((function(t,e){var n=mm.indexOf(e),i=Math.max(1,mm.indexOf(e+1))-1;return new Um(e,n,i,t)})),this._currentRoadLength=this._roadMixers[0].length,this._addScrollNumList=mm.map((function(e,n){if(n===mm.length-1)return 0;var i=mm[n+1],r=t._roadMixers[e].averangeLength,o=pm[e],s=i!==e,a=r*(s?(bo.isLandscape?.8:.9)*o.groupMoveScale:(bo.isLandscape,.3*o.sectionMoveScale)),l=s?30:15;return a>l&&(a=.3*(a-l)+l),a/o.intervalMeter}))},t.prototype.update=function(t){var e,n,i,r=this,o=t.kv,s=t.roadCopyNum,a=0;if(t.isRoadHidden)a=0;else if(o<0)a=fm-1;else if(o>=1){var l=Math.floor(s),c=Math.ceil(s),h=s-l;a=yr(mm[l],mm[c],h)}if(Vm.add("timeline.groupNum",a),this._gi0=Math.floor(a),this._gi1=Math.ceil(a),this._groupNum!=a&&(this._groupNum=a,this._gAlpha=Hm(a-this._gi0,"easeInOutSine"),this._roadMixer0=this._roadMixers[this._gi0],this._roadMixer1=this._roadMixers[this._gi1]),this._roadMixers.forEach((function(e,n){n===r._gi0&&n===r._gi1?e.tick(t,1):n===r._gi0?e.tick(t,r._gAlpha):n===r._gi1?e.tick(t,1-r._gAlpha):e.resetBlend()})),this._currentRoadLength=yr(this._roadMixer0.length,this._roadMixer1.length,this._gAlpha),o>=0&&o<1){var u=Hm(im(.4,1,o),"easeInOutQuad");sm(this._cameraTransform,Qm,this._roadMixer0.cameraTransform,u)}else if(o<0){var d=yr(40,100,1- -o);this._cameraAnime.goto(d),am(this._cameraTransform,this._cameraAnime.transform)}else o>=1&&sm(this._cameraTransform,this._roadMixer0.cameraTransform,this._roadMixer1.cameraTransform,this._gAlpha);this._addScrollNum=this._addScrollNumList.reduce((function(t,e,n){return t+yr(0,e,s-n)}),0),e=this._cameraMat,n=this._cameraTransform,void 0===i&&(i=!1),em.identity(),nm.identity(),em.makeRotationFromEuler(n.rotation),nm.makeTranslation(n.position.x,n.position.y,n.position.z),e.identity(),i?(em.invert(),nm.invert(),e.multiply(nm).multiply(em)):e.multiply(nm).multiply(em),this._cameraMat.multiply(Km.identity().makeRotationFromEuler(this._perspectiveCameraTransform.rotation))},t.prototype.getPointByMeter=function(t){if(this._roadMixer0===this._roadMixer1)return this._roadMixer0.getPointByMeter(t);var e=this._roadMixer0.getPointByMeter(t),n=this._roadMixer1.getPointByMeter(t);return[yr(e[0],n[0],this._gAlpha),yr(e[1],n[1],this._gAlpha),yr(e[2],n[2],this._gAlpha)]},t}());var eg=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),ng=(Math.random(),new(function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._renderFlag=1,e}return eg(e,t),Object.defineProperty(e.prototype,"baseZ",{get:function(){return this._baseZ},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"renderer",{get:function(){return this._renderer},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fovHeight",{get:function(){return this._fovHeight},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"scene",{get:function(){return this._scene},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"root",{get:function(){return this._root},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"camera",{get:function(){return this._camera},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"w",{get:function(){return this._w},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"h",{get:function(){return this._h},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"paused",{get:function(){return this._paused},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"oribital",{get:function(){return this._oribital},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"equalRoot",{get:function(){return this._equalRoot},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"focusRoot",{get:function(){return this._focusRoot},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"frontRoot",{get:function(){return this._frontRoot},enumerable:!1,configurable:!0}),e.prototype.preSetup=function(t,e){this.$wrap=t,this.$canvas=e;try{this._renderer=new Au({canvas:e.el,antialias:!0,alpha:!1,preserveDrawingBuffer:!0,premultipliedAlpha:!1,logarithmicDepthBuffer:!1})}catch(t){this._loseContext()}this._renderer.setPixelRatio(this._pixelRatio),this._rendererDefault=this._renderer;var n=this._renderer.getContext();n&&n.canvas.addEventListener("webglcontextlost",this._loseContext.bind(this),!1)},e.prototype.setup=function(t){this._props=t,this._scene=new Lu,this._clock=new wf,this._pixelRatio=vo.pixelratio,this._camera=new Fl(this._props.fov||30,1,.1,5e5),this._fovHeight=Math.tan(this._camera.fov*Math.PI/360),void 0!==this._props.sceneBackgroundColor&&(this._scene.background=new Ss(this._props.sceneBackgroundColor)),this._root=new Fa,this._scene.add(this._root),this._equalWrap=new Fa,this._scene.add(this._equalWrap),this._equalRoot=new Fa,this._equalWrap.add(this._equalRoot),this._focusRoot=new Fa,this._focusRoot.position.z=-11,this._equalWrap.add(this._focusRoot),this._frontRoot=new Fa,this._equalWrap.add(this._frontRoot)},e.prototype._loseContext=function(){},e.prototype.addAxisHelper=function(){this._root.add(new Wf(300))},e.prototype.dispose=function(){this._scene.remove(this._root),this._renderer.dispose(),this._scene=null,bo.off(bo.e.resizeFirst,this._bindedResizeHdl).off(bo.e.update,this._bindedUpdateHdl)},e.prototype.doDraw=function(){this._draw()},e.prototype.switchPaused=function(t){this._paused!==t&&(this._paused=t,this.$wrap.attr("data-paused",t?1:0))},e.prototype.applyCameraMatrix=function(t){(function(t,e){!function(t){t.position.copy(Yf),t.rotation.copy(Xf)}(t),t.applyMatrix4(e)})(this._camera,t),this._equalWrap.position.copy(this._camera.position),this._equalWrap.rotation.copy(this._camera.rotation)},e.prototype.resized=function(){var t=this.$wrap.width(),e=this.$wrap.height();t===this._w&&this._props.spFull&&vo.touch&&(e=Math.max(e,this._h),e=Math.max(e,window.innerHeight));var n=t;if(this._props.maxWidth>0&&(t=Math.min(this._props.maxWidth,t)),0===t&&0===e)return!1;if(this._w===t&&this._h===e)return!1;this._pixelRatio,this._pixelRatio,this._w=t,this._h=e,this.$canvas.css({left:.5*(n-t),width:t}),this._camera.aspect=t/e,this._baseZ=e/this._fovHeight/2,this._camera.updateProjectionMatrix(),this._equalRoot.position.z=-this._baseZ,this._frontRoot.position.z=-1;var i=this._fovHeight*-this._frontRoot.position.z*2,r=this._fovHeight*this._baseZ*2;return this._frontRoot.scale.setScalar(i/r),this._renderer.setPixelRatio(this._pixelRatio),this._renderer.setSize(t,e),this._paused&&this._draw(),!0},e.prototype.updated=function(){this._paused||this._props.checkNeedUpdate&&!this._props.checkNeedUpdate()||this._props.renderInterval&&(this._renderFlag=1-this._renderFlag,1===this._renderFlag)||(this._delta=this._clock.getDelta(),this._draw())},e.prototype._draw=function(){mr.state.elapsedTime,this.emit("update"),void 0!==this._props.clearColor&&this._renderer.setClearColor(this._props.clearColor,0),this._renderer.render(this._scene,this._camera)},e.prototype.calcVisibleHeight=function(t){return this._fovHeight*t*2},e}(lr)));function ig(t){return t<0?-1:1}var rg,og=function(){function t(t,e){this._distWheelDelta=0,this._wheelDelta=0,this._tickWheelDelta=0,this._history=[],this.$=t,this._options=e,this._boundWheelEnd=this._wheelEnd.bind(this),this.$.on("wheel",this._wheeled.bind(this)),bo.on(bo.e.update,this._tick.bind(this))}return Object.defineProperty(t.prototype,"isWheeling",{get:function(){return this._isWheeling},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"wheelDelta",{get:function(){return this._wheelDelta},enumerable:!1,configurable:!0}),t.prototype._tick=function(){var t=this,e=this._distWheelDelta-this._wheelDelta;if(this._wheelDelta+=e*mr.correctDumping(.2),this._history.length>3&&this._history.shift(),this._history.push(Math.abs(this._wheelDelta)),this._isWheeling){var n=!0;this._history.forEach((function(e,i){0!==i&&e>t._history[i-1]&&(n=!1)})),n&&(this._isWheeling=!1,this._options.onToggle&&this._options.onToggle(!1,ig(this._wheelDelta)))}else if(Math.abs(this._wheelDelta)>10){var i=!0;this._history.forEach((function(e,n){0!==n&&e<t._history[n-1]&&(i=!1)})),i&&(this._isWheeling=!0,this._options.onToggle&&this._options.onToggle(!0,ig(this._wheelDelta)))}this._isWheeling&&this._options.onWheel&&this._options.onWheel(this._tickWheelDelta),this._options.onUpdate&&this._options.onUpdate(this._tickWheelDelta),this._tickWheelDelta=0,this._distWheelDelta*=.8},t.prototype._wheeled=function(t){var e=-1*function(t){var e=t.deltaX?-t.deltaX:0,n=t.deltaY?-t.deltaY:t.wheelDelta?t.wheelDelta:-t.detail;return vo.firefox&&(e*=15,n*=15),{x:e,y:n}}(t).y;this._distWheelDelta+=e,this._tickWheelDelta+=e},t.prototype._wheelEnd=function(){this._isWheeling=!1,this._distWheelDelta=0},t}(),sg=function(){function t(t){this._height=0,this.$=t.$el}return Object.defineProperty(t.prototype,"height",{get:function(){return this._height},enumerable:!1,configurable:!0}),t.prototype.resized=function(){this.$?this._height=bo.state.innerHeight:this._height=4*bo.state.innerHeight},t}(),ag=function(){function t(t){var e=this;this._started=!1,this._callbacks={},this._binded={},this._locked=!1,this._options={disabled:!1,horizontalOnly:!1,downOnly:!1,upOnly:!1,checkEnabled:void 0,preventDefault:!1,ignoreContext:""},this._el=t.el||document.body,this._callbacks.start=t.start,this._callbacks.move=t.move,this._callbacks.update=t.update,this._callbacks.end=t.end,this._callbacks.click=t.click,this._binded.start=this._startHdl.bind(this),this._binded.move=this._moveHdl.bind(this),this._binded.update=this._updateHdl.bind(this),this._binded.end=this._endHdl.bind(this),ar.assignIn(this._options,t.options),bo.on(bo.e.dragStart,this._binded.start).on(bo.e.dragMove,this._binded.move),this._el.addEventListener("click",(function(t){e._doClick(t)}))}return t.prototype.dispose=function(){},t.prototype.setDisabled=function(t){this._options.disabled=t},t.prototype._startHdl=function(t){if(this._contains(t)&&!this._options.disabled&&(!this._options.checkEnabled||this._options.checkEnabled())){if(this._options.ignoreContext){var e=!1;if(Mr.find(this._options.ignoreContext).forEach((function(n){(n.contains(t.target)||n===t.target)&&(e=!0)})),e)return}this._options.preventDefault&&this._preventDefault(t),this._locked=!1,this._isStartTriggered=!1,this._options.horizontalOnly||this._options.downOnly||this._options.upOnly||this._start(t)}},t.prototype._start=function(t){this._started=!0,this._onceMoved=!1,bo.on(bo.e.update,this._binded.update).on(bo.e.dragEnd,this._binded.end),this._options.startWithOnceMoved||(this._isStartTriggered=!0,this._startTime=Date.now(),this._callbacks.start&&this._callbacks.start(bo.state.dragDiff,t))},t.prototype._moveHdl=function(t){this._started||(this._options.horizontalOnly&&this._isHorizontal(bo.state.dragDiff)||this._options.downOnly&&this._isDown(bo.state.dragDiff)||this._options.upOnly&&this._isUp(bo.state.dragDiff))&&this._contains(t)&&(this._locked=!0,this._start(t)),this._options.checkLocked&&this._options.checkLocked(this._isDown(bo.state.dragDiff))&&(this._locked=!0),this._started&&((this._locked||this._options.preventDefault)&&this._preventDefault(t),this._isStartTriggered||(this._isStartTriggered=!0,this._callbacks.start&&this._callbacks.start(bo.state.dragDiff,t)),this._onceMoved=!0,this._callbacks.move&&this._callbacks.move(bo.state.dragDiff,t))},t.prototype._updateHdl=function(){this._started&&this._callbacks.update&&this._callbacks.update(bo.state.dragDiff)},t.prototype._endHdl=function(t){if(this._started){(this._locked||this._options.preventDefault)&&this._preventDefault(t),bo.off(bo.e.update,this._binded.update).off(bo.e.dragEnd,this._binded.end);var e=Math.abs(bo.state.dragDiff.dx)+Math.abs(bo.state.dragDiff.dy),n=Date.now()-this._startTime;(0===e||vo.android&&n<1e3&&e<5)&&(this._onceMoved=!1);var i=!this._onceMoved;this._callbacks.end&&this._callbacks.end(bo.state.dragDiff,i),i&&this._doClick(t),this._started=!1,this._onceMoved=!1}},t.prototype._doClick=function(t){var e=this;if(!this._isClickKilling){if(this._options.linkEnabled){var n=t.target,i=n.href;"button"===n.nodeName.toLowerCase()?Mr(n).trigger("click"):i&&window.open(i)}this._callbacks.click&&this._callbacks.click(t),this._isClickKilling=!0,setTimeout((function(){e._isClickKilling=!1}),100)}},t.prototype._contains=function(t){return this._el.contains(t.target)||this._el===t.target},t.prototype._isHorizontal=function(t){return Math.abs(t.dx)>Math.abs(t.dy)},t.prototype._isDown=function(t){return Math.abs(t.dy)>Math.abs(t.dx)&&t.dy>0},t.prototype._isUp=function(t){return Math.abs(t.dy)>Math.abs(t.dx)&&t.dy<0},t.prototype._preventDefault=function(t){t.preventDefault(),t.stopPropagation()},t}(),lg=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),cg=new Ns,hg=new pa,ug=new(function(t){function e(){var e=t.call(this)||this;return e._onIntro=!0,e._state={progress:0,scale:0,fix:0,bloom:0,bg:0,edgeDownScale:1},e._bouquetIntroMatrix=new pa,e}return lg(e,t),Object.defineProperty(e.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onIntro",{get:function(){return this._onIntro},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"bouquetIntroMatrix",{get:function(){return this._bouquetIntroMatrix},enumerable:!1,configurable:!0}),e.prototype._changeProgress=function(t){this._state.progress=t,this._state.scale=im(0,.6,t),this._state.fix=im(.3,1,t),this._state.bloom=im(.35,.95,t),this._state.bg=im(.5,.87,t),this._state.edgeDownScale=1-im(.7,1,t);var e=1-Hm(t,"easeOutQuart");this._bouquetIntroMatrix.identity(),this._bouquetIntroMatrix.makeRotationFromQuaternion(cg.setFromAxisAngle($f,e*Math.PI*1.5)).multiply(hg.identity().makeRotationFromQuaternion(cg.setFromAxisAngle(Jf,e*Math.PI*3)))},e.prototype.startIntro=function(){var t=this;return new Promise((function(e,n){var i=hr.includes("skip")?0:4e3;setTimeout(e,Math.max(0,i-500)),(new vr).it({start:0,end:1,duration:i,easing:"linear",onProgress:t._changeProgress.bind(t),onComplete:function(){t._onIntro=!1}})}))},e}(lr)),dg=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),pg=cr.num||0,fg={kv:0,kvPos:0,copyPos:0,copyScroll:0,copyNum:0,roadCopyNum:0,attentionRatio:1,attentionOpacity:1,roadBloomMax:0,isRoadHidden:!0},mg=new(function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.e={resize:"resize",update:"update"},e._tw=new vr,e._distNum=pg,e._num=pg,e._easedNum=pg,e._state=Object.assign({},fg),e._easedState=Object.assign({},fg),e._accel=0,e._accel2=0,e._scrollDir=0,e._dragState={numAtStarted:0,moveDist:0,oldDY:0},e._accelTw=new vr,e._oldNum=0,e}return dg(e,t),Object.defineProperty(e.prototype,"sectionCount",{get:function(){return this._sectionCount},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"easedState",{get:function(){return this._easedState},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"scrollDir",{get:function(){return this._scrollDir},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"accel",{get:function(){return this._accel},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"accel2",{get:function(){return this._accel2},enumerable:!1,configurable:!0}),e.prototype.setup=function(){var t=[{}];Mr.find$(".js_content_copySection").forEach((function(e,n){t.push({$el:e})})),this._sections=t.map((function(t,e){return new sg(t)})),this._sectionCount=this._sections.length,this._boundAccelEnd=this._addAccelEnd.bind(this),vo.desktop?this._wheelCtrl=new og(bo.$body,{onToggle:this._wheelToggle.bind(this),onUpdate:this._updated.bind(this)}):(this._d=new ag({el:bo.$body.el,start:this._dragStarted.bind(this),move:this._dragMoved.bind(this),end:this._dragEnded.bind(this),click:this._dragClick.bind(this),options:{preventDefault:!0,linkEnabled:!0,ignoreContext:"#onetrust-consent-sdk"}}),bo.on(bo.e.update,this._updated.bind(this))),bo.on(bo.e.resize,this._resized.bind(this)),this._resized(),this._changedNum()},e.prototype._resized=function(){this._sections.forEach((function(t){t.resized()})),this.emit(this.e.resize)},e.prototype._wheelToggle=function(t,e){var n=this;if(t)this._tw.stop(),this._isThrowing=!1,this._numAtWheelStarted=Math.round(this._num);else{var i=e>0?Math.ceil(this._num):Math.floor(this._num),r=i-this._numAtWheelStarted;Math.abs(r)>=2&&(i=this._numAtWheelStarted+ig(r));var o=this._getDuration(this._distNum,i,e),s=o.duration,a=o.easing;this._isThrowing=!0,this._tw.it({start:this._distNum,end:i,duration:s,easing:a,onProgress:function(t){n._distNum=t,n._changedNum()}})}},e.prototype._dragStarted=function(){this._tw.stop(),this._isDragging=!0,this._dragState.numAtStarted=this._num,this._dragState.moveDist=0,this._dragState.oldDY=0},e.prototype._dragMoved=function(t){var e=ig(-t.dy),n=this._getMaxHeight(this._dragState.numAtStarted,e),i=this._checkIsCopy(Math.round(this._dragState.numAtStarted)),r=this._checkIsCopy(Math.round(this._dragState.numAtStarted)+e),o=i?r?1:e>0?4:1.5:e>0?1:.4;this._num=this._dragState.numAtStarted-t.dy/(n*o),this._dragState.moveDist=-t.dy,this._changedNum(),this._addAccel2(-(t.dy-this._dragState.oldDY)/(.5*bo.state.innerHeight)),this._dragState.oldDY=t.dy},e.prototype._checkIsCopy=function(t){var e=this._toLoop(Math.round(t));return e>0&&e<this._sectionCount},e.prototype._dragEnded=function(t){var e,n=this;this._isDragging=!1;var i=(e=Math.abs(t.ay)<5&&Math.abs(t.dy)<50?Math.round(this._num):ig(-(Math.abs(t.ay)>5?t.ay:t.dy))>0?Math.ceil(this._num):Math.floor(this._num))-Math.round(this._dragState.numAtStarted);Math.abs(i);var r=this._getDuration(this._num,e,-ig(t.dy)),o=r.duration,s=r.easing;this._tw.it({start:this._num,end:e,duration:o,easing:s,onProgress:function(t){n._num=t,n._changedNum()}})},e.prototype._getDuration=function(t,e,n){var i=[this._toLoop(Math.floor(t)),this._toLoop(Math.floor(e))],r=i.includes(0),o=i.includes(this._sectionCount-1)&&!i.includes(this._sectionCount-2),s=vo.desktop?500:800,a="easeOutQuart";return(r||o)&&(a="linear",s=o?n>0?7e3:6e3:vo.desktop?n>0?1200:600:n>0?1500:1200),{duration:s*=Math.abs(Math.abs(t)-Math.abs(e)),easing:a}},e.prototype._dragClick=function(t){},e.prototype._updated=function(t){if(vo.desktop){if(!this._tw.onProcess){if(this._wheelCtrl.isWheeling){var e=t;e*=.8;var n=Math.abs(e);n>15&&(e=(15+.2*(n-15))*ig(e));var i=ig(e);this._addAccel(i);var r=this._getMaxHeight(this._distNum,i);this._distNum+=e/(1*r),this._addAccel2(e/(.5*bo.state.innerHeight))}this._changedNum()}}else this._isDragging&&this._addAccel(ig(this._dragState.moveDist));ug.onIntro&&(this._distNum=this._num=pg),this._accel2*=mr.correctDecrease(.97);var o,s=this._toLoop(this._num),a=Math.min(1,Math.max(0,Math.max(2-s,s-(this._sectionCount-2))));vo.desktop?o=yr(.015,.05,a):(o=yr(.04,.08,a),this._isDragging&&yr(o,.2,1-Math.abs(this._state.kv))),this._easedNum+=(this._num-this._easedNum)*mr.correctDumping(o);var l=Math.round(1e4*this._easedNum)/1e4;this._calcState(this._easedState,l),Vm.add("ScrollStore.distNum",this._distNum),Vm.add("ScrollStore.num",this._num),Vm.add("ScrollStore.easedNum",l),Vm.add("ScrollStore.accel2",this._accel2),this.emit(this.e.update),Vm.updated()},e.prototype._addAccel=function(t){var e=t>=0?1:-1;this._accel+=(e-this._accel)*mr.correctDumping(.09),this._accelTw.stop(),clearTimeout(this._accelDelayId),this._accelDelayId=setTimeout(this._boundAccelEnd,100)},e.prototype._addAccelEnd=function(){var t=this;this._accelTw.it({start:this._accel,end:0,duration:1200,easing:"easeInOutQuart",onProgress:function(e){t._accel=e}})},e.prototype._addAccel2=function(t){ig(t=t)!==ig(this._accel2)&&(this._accel2*=-1),this._accel2+=t},e.prototype._changedNum=function(){if(vo.desktop){var t=this._distNum-this._num;Math.abs(t)<1e-5?this._num=this._distNum:this._num+=t*mr.correctDumping(.15)}this._scrollDir=this._num>=this._oldNum?1:-1,this._oldNum=this._num,this._calcState(this._state,this._num),Vm.add("state.kv",this._state.kv),Vm.add("state.copyNum",this._state.copyNum),Vm.add("state.roadCopyNum",this._state.roadCopyNum),Vm.add("state.copyPos",this._state.copyPos),Vm.add("state.copyScroll",this._state.copyScroll),Vm.add("state.attentionOpacity",this._state.attentionOpacity),Vm.add("state.attentionRatio",this._state.attentionRatio),Vm.add("state.accel2",this._accel2)},e.prototype._calcState=function(t,e){var n=this._toLoop(e);t.kv=Math.min(1,n),n>=this._sectionCount-1&&(t.kv=-1*(1-(n-(this._sectionCount-1))));var i=ig(t.kv);t.kvPos=i*Hm(im(0,i?.7:.3,Math.abs(t.kv)),"easeInOutQuad"),t.copyPos=0,n<=1?t.copyPos=n-1:n>=this._sectionCount-1&&(t.copyPos=n-(this._sectionCount-1));var r=ig(t.copyPos);t.copyPos=r*im(0,r<0?.7:.3,Math.abs(t.copyPos)),t.copyScroll=Math.min(1,Math.max(0,(n-1)/(this._sectionCount-2))),n>=this._sectionCount-1&&(t.copyScroll=1),t.copyNum=t.copyScroll*(this._sectionCount-2),t.attentionOpacity=1,t.attentionRatio=Hm(1-im(0,.7,t.kv),"easeInOutQuad"),t.kv<0&&(t.attentionOpacity=1-im(0,.2,-t.kv),t.kv<-.2&&(t.attentionOpacity=t.kv>-.5?0:1,t.attentionRatio=0)),t.kv>=0?t.roadBloomMax=Hm(im(.7,1,t.kv),"easeInOutQuart"):t.roadBloomMax=1,t.isRoadHidden=t.kv<=0&&t.kv>=-.5||ug.onIntro,t.roadCopyNum=t.isRoadHidden?0:t.copyNum},e.prototype._getMaxHeight=function(t,e){var n=this._sections[this._toLoop(Math.floor(t))],i=this._sections[this._toLoop(Math.ceil(t))];return Math.max(1,Math.max(n.height,i.height))},e.prototype._toLoop=function(t){return(t+9999*this._sectionCount)%this._sectionCount},e}(lr)),gg=function(){function t(t,e){this._visible=!1,this._offsetY=0,this._flowerItem=t,this._posRandom=e<5?0:2*Math.random()-1,t.props.name.includes("tulip")&&(this._offsetY=-1)}return Object.defineProperty(t.prototype,"posMeter",{get:function(){return this._posMeter},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"flowerItem",{get:function(){return this._flowerItem},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"posRandom",{get:function(){return this._posRandom},enumerable:!1,configurable:!0}),t.prototype.updated=function(t,e,n,i){if(this._posMeter=n,this._visible!==t&&(this._visible=t,this._flowerItem.tweenBloomPer({end:t?1:0,duration:e?0:t?1500+500*Math.random():900,delay:e||!t?0:(vo.desktop?200:0)+600*Math.random()})),t||this._flowerItem.onBloomTweening){var r=(rg=tg.getPointByMeter(n))[0],o=rg[1],s=rg[2];o+=this._offsetY,this._flowerItem.transform.position.set(r,o,s),this._flowerItem.changeRoadEdgeScale(i)}},t}(),_g=function(t,e){var n=e?"fl_":"gr_",i=ar.compact(t.map((function(t){if(t.name.substr(0,3)===n)return t}))),r=new vf;return i.forEach((function(t,n){var i=t.name.split(".")[0].split("--")[0].replace(/[0-9][0-9][0-9]$/,""),o=0===n,s=0,a=[],l=[],c=[],h=[];(t.children.length>0?t.children:[t]).sort((function(t,e){return t.name<e.name?-1:1})).forEach((function(t){var n=t.geometry;hr.includes("log")&&console.log(i,t.name,n.attributes.position.array.length/3);var r=t.name.includes("hidden"),u=Array.prototype.slice.call(n.attributes.position.array);if(r&&u.fill(0),a=a.concat(u),e){var d=0;t.name.includes("sub")?d=1:t.name.includes("stamen")&&(d=2),h=h.concat(ar.range(u.length/3).fill(d))}if(o){var p=Array.prototype.slice.call(n.attributes.uv.array);l=l.concat(p);var f=Array.prototype.slice.call(n.index.array);c=c.concat(f.map((function(t){return t+s}))),s+=u.length/3}})),o?(r.setAttribute("position",new Du(new Pu(new Float32Array(a),3),3,0)),r.setAttribute("uv",new Du(new Pu(new Float32Array(l),2),2,0)),e&&r.setAttribute("part",new Du(new Pu(new Float32Array(h),1),1,0)),r.setIndex(c)):r.setAttribute("position_"+i,new Du(new Pu(new Float32Array(a),3),3,0))})),hr.includes("log")&&console.log(r),r},vg=function(t){var e,n={attributes:{},index:Array.prototype.slice.call(t.index.array)};for(var i in t.attributes)n.attributes[i]=(e=t.attributes[i].data.array,Array.prototype.slice.call(e).map((function(t){return Math.round(1e4*t)/1e4})));return n},yg=function(t){var e=new vf;for(var n in t.attributes){var i=3;"uv"===n?i=2:"part"===n&&(i=1),e.setAttribute(n,new Du(new Pu(new Float32Array(t.attributes[n]),i),i,0))}return e.setIndex(t.index),e},xg=new Ns,bg=function(t,e){return void 0===e&&(e=3),parseInt(t.reduce((function(t,n,i){return t+("000000"+n).substr(-e)}),""))},wg=km(tm),Mg=(Math.PI,function(){function t(t){this._bloomPer=0,this._bloomForColor=0,this._bloomTw=new vr,this._mat=new pa,this._bloomScale=0,this._roadEdgeScale=1,this._props=t,this._originalTransform=t.transform,this._transform=km(t.transform)}return Object.defineProperty(t.prototype,"props",{get:function(){return this._props},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isCenter",{get:function(){return this._isCenter},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"seq",{get:function(){return this._seq},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"cluster",{get:function(){return this._cluster},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isDirectBloom",{get:function(){return this._isDirectBloom},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"bloomPer",{get:function(){return this._bloomPer},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"transform",{get:function(){return this._transform},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"originalTransform",{get:function(){return this._originalTransform},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onBloomTweening",{get:function(){return this._bloomTw.onProcess},enumerable:!1,configurable:!0}),t.prototype.init=function(t,e){this._cluster=t,this._seq=e,this._color=new Ss,this._color.r=bg([Math.floor(1e3*Math.random()),Math.floor(1e3*Math.random()),Math.floor(1e3*Math.random())],3);var n=this._props.name.split(".")[0].split("--")[0].replace(/[0-9][0-9][0-9]$/,"");if(this._props.isFlower){var i=n.split("__"),r=i[0],o=i[1];o||console.error("[Flowers_item] "+this._props.name+" has no __color");var s=ar.findIndex(gm,{name:r}),a=gm[s];a||console.error("[Flowers_item] "+this._props.name+" does not match shape");var l=a.colors.indexOf(o);l<0&&console.error("[Flowers_item] "+this._props.name+" has no matched color");var c=this._props.isRoad?1:0,h=this._props.isRoadGarden?1:0;this._flowerType={shape:s,colorNum:l,road:c,roadGarden:h},this._refreshType(),this._color.b=0}else s=ar.findIndex(_m,{name:n}),this._color.g=s;this._props.isRoad||this.changeBloomPer(1),this._cluster.setColorAt(this._seq,this._color)},t.prototype.toggleCenter=function(t,e){this._isCenter=t,this._centerTransform=e,this._refreshType()},t.prototype._refreshType=function(){var t=this._isCenter?1:0;this._color.g=bg([this._flowerType.shape,this._flowerType.colorNum,this._flowerType.road,this._flowerType.roadGarden,t],1),this._cluster.setColorAt(this._seq,this._color)},t.prototype.lerpOriginalTransform=function(t){sm(this._transform,this._transform,this._originalTransform,t)},t.prototype.directBloom=function(){this._isDirectBloom=!0,this.changeBloomPer(1)},t.prototype.changeBloomPer=function(t){this._bloomPer=t,this._bloomScale=Hm(im(0,.7,this._bloomPer),"easeInOutQuart"),this._bloomForColor=Hm(this._bloomPer,"easeInOutQuart"),this._color.b=this._bloomForColor,this._cluster.setColorAt(this._seq,this._color)},t.prototype.tweenBloomPer=function(t){this._bloomTw.it(Object.assign({start:this._bloomPer,easing:"linear",onProgress:this.changeBloomPer.bind(this)},t))},t.prototype.changeRoadEdgeScale=function(t){this._roadEdgeScale=t},t.prototype.updated=function(){var t,e,n=mg.easedState;am(wg,this._transform),(this._props.isRoad||!this._props.isRoad&&!ug.onIntro)&&wg.scale.copy(this._transform.scale).multiplyScalar(this._bloomScale*this._roadEdgeScale),this._isCenter&&sm(wg,wg,this._centerTransform,n.attentionRatio),t=this._mat,e=wg,t.identity().compose(e.position,xg.setFromEuler(e.rotation),e.scale),this._cluster.setMatrixAt(this._seq,this._mat)},t}()),Sg=function(t){return new zl({vertexShader:n(1290).Z,fragmentShader:n(6955).Z,uniforms:{uTime:{value:0},uRandoms:{value:[Math.random(),Math.random(),Math.random(),Math.random()]},uBouquetIntroMatrix:{value:ug.bouquetIntroMatrix},uRoadWrapMatrix:{value:new pa},uBouquetWrapMatrix:{value:new pa},uBouquetInnerMatrix:{value:new pa},uIsBouquetVisible:{value:1},uCenterMatrix:{value:new pa},uCenterOpacity:{value:1},uIsLowSpec:{value:hm?1:0},uTmpBloom:{value:1},uRoadBloomMax:{value:0},uCenterBloomMax:{value:1},uIsRoadHidden:{value:1},isCenterHidden:{value:1},uRoadWaveScale:{value:1},uAccel:{value:0},uRoadAxis:{value:new zs}},defines:t?ym:xm,transparent:!1,side:2})},Tg=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),Eg=new(function(t){function e(){return t.call(this,"flowers"+(hm?"-low":"")+".json")||this}return Tg(e,t),e}(Xm)),Ag=new(function(){function t(){}return Object.defineProperty(t.prototype,"greenMatarial",{get:function(){return this._greenMatarial},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"flowerMatarial",{get:function(){return this._flowerMatarial},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"greenItems",{get:function(){return this._greenItems},set:function(t){this._greenItems=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"roadFlowerItems",{get:function(){return this._roadFlowerItems},set:function(t){this._roadFlowerItems=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"gardenFlowerItems",{get:function(){return this._gardenFlowerItems},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"bouquetFlowerItems",{get:function(){return this._bouquetFlowerItems},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"object",{get:function(){return this._object},enumerable:!1,configurable:!0}),t.prototype.preload=function(){return Eg.load().then(this._dataLoaded.bind(this))},t.prototype._dataLoaded=function(){this._flowerGeometry=yg(Eg.get("fl")),this._greenGeometry=yg(Eg.get("gr"))},t.prototype._gltfLoaded=function(t){this._flowerGeometry=_g(t.scene.children,!0),this._greenGeometry=_g(t.scene.children,!1),Eg.add("fl",vg(this._flowerGeometry)),Eg.add("gr",vg(this._greenGeometry)),Eg.save()},t.prototype.setup=function(){var t=this;this._object=new Fa,this._flowerMatarial=Sg(!0),this._bouquetFlowerItems=this._makeItems(Jm.getAsTree("bouquet.children"),{isFlower:!0,isRoad:!1}),this._gardenFlowerItems=this._makeItems(Jm.getAsTree("garden.children"),{isFlower:!0,isRoad:!0,isRoadGarden:!0}),this._roadFlowerItems=this._sortedRoadFlowerNames().map((function(t){var e=km(tm);return new Mg({name:t,transform:e,isFlower:!0,isRoad:!0,isRoadGarden:!1})})),this._flowerItems=this._bouquetFlowerItems.concat(this._gardenFlowerItems).concat(this._roadFlowerItems),this._flowerCluster=new sd(this._flowerGeometry,this._flowerMatarial,this._flowerItems.length),this._flowerItems.forEach((function(e,n){e.init(t._flowerCluster,n)})),this._object.add(this._flowerCluster),this._greenMatarial=Sg(!1),this._greenItems=this._makeItems(Jm.getAsTree("bouquet.children"),{isFlower:!1,isRoad:!1}),this._greenCluster=new sd(this._greenGeometry,this._greenMatarial,this._greenItems.length),this._greenItems.forEach((function(e,n){e.init(t._greenCluster,n)})),this._object.add(this._greenCluster),this._allItems=this._flowerItems.concat(this._greenItems)},t.prototype._sortedRoadFlowerNames=function(){var t=pm[0],e=Math.ceil(tg.currentRoadLength/t.intervalMeter),n=Bm.slice(0,e),i=Bm.slice(e);return n.reverse().concat(i.reverse())},t.prototype._makeItems=function(t,e){var n=e.isFlower?"fl_":"gr_",i=[];for(var r in t)0===r.indexOf(n)&&i.push(new Mg({name:r,transform:Jm.toTransform(t[r]),isFlower:e.isFlower,isRoad:e.isRoad,isRoadGarden:e.isRoadGarden}));return i},t.prototype.updated=function(){this._flowerMatarial.uniforms.uTime.value=this._greenMatarial.uniforms.uTime.value=.001*mr.state.elapsedTime,this._allItems.forEach((function(t){t.updated()})),this._flowerCluster.instanceMatrix.needsUpdate=!0,this._flowerCluster.instanceColor.needsUpdate=!0,this._greenCluster.instanceMatrix.needsUpdate=!0,this._greenCluster.instanceColor.needsUpdate=!0},t}()),Cg=function(){function t(){this._bloom=!1,this._bloomTw=new vr,this._visibleLimit=vo.desktop?.5:.8,this._offset=(new zs).setScalar(0),this._object=new Fa,this._object.add(new Ll(new Td(2,2),new Ka({color:"#f00",wireframe:!0}))),this._lastMixer=tg.roadMixers[tg.roadMixers.length-1],this._lastIntervalMeter=pm[pm.length-1].intervalMeter,this._items=Ag.gardenFlowerItems;var t=Jm.getAsTransform("garden.bloomLine");this._items.forEach((function(e){e.originalTransform.position.z>t.position.z&&e.directBloom()}))}return Object.defineProperty(t.prototype,"object",{get:function(){return this._object},enumerable:!1,configurable:!0}),t.prototype.updated=function(){var t=this,e=mg.easedState,n=Math.max(0,Math.min(1,e.roadCopyNum-(mg.sectionCount-3)));if(this._visiblePer!==n){this._visiblePer=n;var i=1-im(.6,1,n);this._offset.y=-2.8*i,this._offset.z=3.2*i;var r=this._lastMixer.getPointByMeter(0);this._object.position.set(r[0],r[1],r[2]),this._items.forEach((function(e){e.transform.position.x=e.originalTransform.position.x+r[0]+t._offset.x,e.transform.position.y=e.originalTransform.position.y+r[1]+t._offset.y,e.transform.position.z=e.originalTransform.position.z+r[2]+t._offset.z}));var o=n>this._visibleLimit;this._bloom!==o&&(this._bloom=o,this._items.forEach((function(t){t.isDirectBloom||t.tweenBloomPer({end:o?1:0,duration:o?2e3+500*Math.random():900,delay:o?1e3*Math.random():0})})))}},t}(),Rg=bo.isLandscape?{size:10,y:55,moveY:28,hideY:100}:{size:9,y:60,moveY:21,hideY:100},Lg=new zs(0,.3,1),Pg=bo.isLandscape?1:1.5,Ig=function(){function t(){this._moveNum=bo.isLandscape?-.65:.5,this._attentionTw=new vr,this._attentionProgress=0,this._hiddenPer=1,this._centerTransform=km(tm),this._roadDir=new zs(0,0,0),this._roadAxis=new zs(0,0,0),this._accel=0,this._largeScale=1,this._center={pos:new zs,q:new Ns,scale:(new zs).setScalar(1),mat:new pa},this._isLarge=!1,this._isIntroFinished=!1,this._items=Ag.roadFlowerItems.map((function(t,e){return new gg(t,e)})),this._garden=new Cg,Ag.flowerMatarial.uniforms.uCenterMatrix.value=this._center.mat,Ag.flowerMatarial.uniforms.uRoadAxis.value=Ag.greenMatarial.uniforms.uRoadAxis.value=this._roadAxis}return t.prototype._attentionLoop=function(t,e){var n=this;void 0===t&&(t=0),void 0===e&&(e=null),this._attentionTw.it({start:this._attentionProgress,end:1,duration:1500,delay:t,easing:"easeInOutQuart",onProgress:function(t){n._attentionProgress=t,e&&e(t)},onComplete:function(){n._attentionTw.it({start:n._attentionProgress,end:0,duration:800,easing:"easeInOutQuart",onProgress:function(t){n._attentionProgress=t},onComplete:function(){n._attentionLoop(0)}})}})},t.prototype.introFinished=function(){var t=this;setTimeout((function(){t._attentionLoop(0,(function(e){t._hiddenPer=1-e})),t._isIntroFinished=!0,t._toggleLarge(!0,5e3)}),800)},t.prototype._toggleLarge=function(t,e){var n=this;void 0===e&&(e=0),this._isLarge!==t&&(this._isLarge=t,clearTimeout(this._largeDelayId),t||(this._onceLargeShrinked=!0),this._largeTw=this._largeTw||new vr,t?this._largeTw.it({start:this._largeScale,end:3.2,duration:800,delay:e,easing:"easeInOutQuart",onProgress:function(t){n._largeScale=t},onComplete:function(){n._largeTw.it({start:n._largeScale,end:1.4,duration:1e3,easing:"easeInOutQuart",onProgress:function(t){n._largeScale=t}})}}):this._largeTw.it({start:this._largeScale,end:1,duration:1200,delay:e,easing:"easeInOutQuart",onProgress:function(t){n._largeScale=t}}))},t.prototype.updated=function(){var t=mg.easedState;this._isIntroFinished&&!this._onceLargeShrinked&&this._toggleLarge(Math.abs(t.kv)<.5);var e=pm[tg.gi0],n=pm[tg.gi1],i={intervalMeter:yr(e.intervalMeter,n.intervalMeter,tg.gAlpha),speedScale:yr(e.speedScale,n.speedScale,tg.gAlpha),waveScale:yr(e.waveScale,n.waveScale,tg.gAlpha)},r=t.roadCopyNum<1;Ag.flowerMatarial.uniforms.uRoadBloomMax.value=t.roadBloomMax,Ag.flowerMatarial.uniforms.uCenterOpacity.value=t.attentionOpacity,Ag.flowerMatarial.uniforms.uCenterBloomMax.value=1-t.attentionRatio,Ag.flowerMatarial.uniforms.uIsRoadHidden.value=t.isRoadHidden?1:0,Ag.flowerMatarial.uniforms.uRoadWaveScale.value=i.waveScale;var o,s,a,l,c,h=tg.currentRoadLength,u=.5*h,d=this._moveNum+tg.addScrollNum,p=Math.abs(t.kv)<.3,f=999999,m=-1;this._items.forEach((function(t,e){if(o=(e+.1*t.posRandom+d)%Fm*i.intervalMeter,a=!(s=o>=0&&o<=h)||p,l=Math.abs((o-u)/u),c=1-im(.97,1,l),t.updated(s,a,o,c),r&&s){var n=t.flowerItem.transform.position.length();n<f&&(f=n,m=e)}})),Math.abs(t.kv)>.9&&(this._moveNum+=mr.correctDumping(.0025)*i.speedScale);var g=this._items[m];if(g&&this._currentCenterItem!==g&&(this._currentCenterItem&&this._currentCenterItem.flowerItem.toggleCenter(!1),this._currentCenterItem=g,g.flowerItem.toggleCenter(!0,this._centerTransform)),Math.abs(t.kv)<1){var _=ng.calcVisibleHeight(-ng.focusRoot.position.z)/ng.calcVisibleHeight(ng.baseZ),v=2*this._attentionProgress-1,y=.5*-bo.state.innerHeight+bo.viewScale*(Rg.y+Rg.moveY*v-Rg.hideY*(1-t.attentionOpacity)-Rg.hideY*this._hiddenPer);this._centerTransform.position.y=y*_,this._centerTransform.rotation.x=.6*Math.PI,this._centerTransform.scale.setScalar(Rg.size*this._largeScale/2*bo.viewScale*_);var x=Hm(1-Math.abs(v),"easeInOutQuad");this._centerTransform.scale.x*=1-.4*x,this._centerTransform.scale.y*=.8+.3*x}ng.focusRoot.getWorldPosition(this._center.pos),ng.focusRoot.getWorldQuaternion(this._center.q),this._center.pos.lerp(Yf,1-t.attentionRatio),this._center.q.slerp(Zf,1-t.attentionRatio),this._center.mat.compose(this._center.pos,this._center.q,this._center.scale);var b=Math.max(-1,Math.min(1,mg.accel2));this._accel+=(b-this._accel)*mr.correctDumping(.1),Ag.flowerMatarial.uniforms.uAccel.value=Ag.greenMatarial.uniforms.uAccel.value=this._accel*Pg;var w=tg.getPointByMeter(.1),M=tg.getPointByMeter(.8*tg.currentRoadLength);this._roadDir.set(M[0]-w[0],M[1]-w[1],M[2]-w[2]).lerp(Lg,1-Math.abs(t.kv)),this._roadAxis.crossVectors(Jf,this._roadDir),this._garden.updated()},t}(),Dg=!!window.createImageBitmap,Og=new yf;Og.setOptions({imageOrientation:"flipY"});var Ng={},zg={},Bg={};function Fg(t){return new Promise((function(e,n){if(zg[t.url])return e(zg[t.url]);if(Bg[t.url]||(Bg[t.url]=[]),Bg[t.url].push(e),!Ng[t.url]){Ng[t.url]=!0;var i=function(e){e.wrapS=e.wrapT=Co,t.pow2||(e.minFilter=Po),e.needsUpdate=!0,Ng[t.url]=!1,zg[t.url]=e,Bg[t.url].forEach((function(t){return t(e)}))},r=function(){},o=function(e){console.error("[u_loadTexture] error "+t.url,e),n()};setTimeout((function(){Dg?Og.load(t.url,(function(t){var e=new Md(null);e.generateMipmaps=!1,e.image=t,i(e)}),r,o):(new ef).load(t.url,(function(t){var e=new Ls;e.generateMipmaps=!1,e.image=t,i(e)}),r,o)}),t.delay||0)}}))}var Hg=function(){function t(t,e,n){this._tw=new vr,this.$=t,this._material=n,this.$line=this.$.find$(".js_content_copySectionLinkItemLine")[0],this._uniOpacity=n.uniforms["uLinkLineOpacity"+(e+1)],this._rect=n.uniforms["uLinkLineRect"+(e+1)].value,vo.desktop&&this.$.on("mouseover",this._toggleHover.bind(this,!0)).on("mouseout",this._toggleHover.bind(this,!1))}return t.prototype.resized=function(t){if(!(t.height<=0)){var e=this.$line.clientRect(),n=e.left-t.left,i=e.top-t.top;this._rect.set(n/t.width,(n+e.width)/t.width,1-(i+e.height)/t.height,1-i/t.height)}},t.prototype._toggleHover=function(t){var e=this;this._tw.it({start:this._uniOpacity.value,end:t?0:1,duration:t?50:500,easing:"easeOutQuart",onProgress:function(t){e._uniOpacity.value=t}})},t}(),Ug=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),kg=new Kl(1,1,10,10),Gg=function(t){function e(e,i,r,o,s,a,l){var c=t.call(this)||this;c.e={resize:"resize"},c._minusMargin=0,c._bounds=new Ps,c._visible=!1,c._opacity=0,c._opacity2=0,c._tw=new vr,c._tw2=new vr,c._liftHeight=0,c.$=e,c._index=i,c._count=r,c._isLast=i===r-1,c.$inner=c.$.find$(".js_content_copySectionInner")[0];var h=function(t){return new zl({vertexShader:n(9750).Z,fragmentShader:n(3970).Z,uniforms:{uTime:{value:0},uMap:{value:null},uIsPc:{value:bo.isPc?1:0},uIsFront:{value:t?1:0},uIsLast:{value:c._isLast?1:0},uLastOpacity:{value:c._opacity},uLastOpacity2:{value:c._opacity2},uBgColor:{value:um},uPosOpacity:{value:0},uColor:{value:a},uAccel:{value:0},uFocusY1:{value:o},uFocusY2:{value:s},uVisibleRange:{value:l},uBounds:{value:c._bounds},uHasLine:{value:0},uLinkLineOpacity1:{value:1},uLinkLineOpacity2:{value:1},uLinkLineRect1:{value:new Ps},uLinkLineRect2:{value:new Ps}},transparent:!0})};return c._backMaterial=h(!1),c._frontMaterial=h(!0),c._backMesh=new Ll(kg,c._backMaterial),c._frontMesh=new Ll(kg,c._frontMaterial),c._linkItems=c.$.find$(".js_content_copySectionLinkItem").map((function(t,e){return new Hg(t,e,c._frontMaterial)})),c._linkItems.length&&(c._frontMaterial.uniforms.uHasLine.value=1),c}return Ug(e,t),Object.defineProperty(e.prototype,"backMesh",{get:function(){return this._backMesh},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"frontMesh",{get:function(){return this._frontMesh},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"innerDomRect",{get:function(){return this._innerDomRect},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"outerDomRect",{get:function(){return this._outerDomRect},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"boundsTop",{get:function(){return this._bounds.y},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"boundsBottom",{get:function(){return this._bounds.y+this._bounds.w},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"boundsHeight",{get:function(){return this._bounds.w},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"minusMargin",{get:function(){return this._minusMargin},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"liftHeight",{get:function(){return this._liftHeight},enumerable:!1,configurable:!0}),e.prototype.startLoad=function(){var t=this;return Fg({url:cm(this.$)}).then((function(e){t._imageSize={x:e.image.width,y:e.image.height},t.$inner.css("padding-top",e.image.height/e.image.width*100+"%"),t._backMaterial.uniforms.uMap.value=t._frontMaterial.uniforms.uMap.value=e,ng.renderer.initTexture(e),t.emit(t.e.resize)})).then((66,function(){return new Promise((function(t,e){setTimeout(t,66)}))}))},e.prototype.resized=function(){var t=this;this._innerDomRect=this.$inner.clientRect(),this._outerDomRect=this.$.clientRect(),this._linkItems.forEach((function(e){return e.resized(t._innerDomRect)}))},e.prototype.calcBounds=function(t,e){var n=t,i=e.height,r=this._innerDomRect.left-e.left,o=this._innerDomRect.top-e.top,s=this._innerDomRect.width,a=this._innerDomRect.height,l=r/n,c=o/i,h=s/n,u=a/i;this._bounds.set(l,c,h,u),this._frontMesh.position.x=this._backMesh.position.x=r+.5*s,this._frontMesh.position.y=this._backMesh.position.y=-o-.5*a,this._frontMesh.scale.x=this._backMesh.scale.x=s,this._frontMesh.scale.y=this._backMesh.scale.y=a},e.prototype.updated=function(t){var e=this;if(this._backMaterial.uniforms.uTime.value=this._frontMaterial.uniforms.uTime.value=.001*mr.state.elapsedTime,this._backMaterial.uniforms.uAccel.value=this._frontMaterial.uniforms.uAccel.value=.7*mg.accel,this._backMaterial.uniforms.uPosOpacity.value=this._frontMaterial.uniforms.uPosOpacity.value=t,this._isLast){var n=mg.state.copyNum>=this._count-1-.5;if(this._visible!==n){this._visible=n;var i=n&&this._opacity<.1?600:0;this._tw.it({start:this._opacity,end:n?1:0,duration:n?1500:200,delay:i,easing:"easeInOutSine",onProgress:function(t){e._opacity=t,e._backMaterial.uniforms.uLastOpacity.value=e._frontMaterial.uniforms.uLastOpacity.value=t}}),this._tw2.it({start:this._opacity2,end:n?1:0,duration:n?1500:200,delay:i+(n?700:0),easing:"easeInOutSine",onProgress:function(t){e._opacity2=t,e._backMaterial.uniforms.uLastOpacity2.value=e._frontMaterial.uniforms.uLastOpacity2.value=t}}),n&&(this._onceVisible=!0)}}},e}(lr),Wg=Gg,Vg=.12,jg=.1,qg=ar.shuffle([new Ss("#f7775e"),new Ss("#2356a6")]),Yg=function(){function t(){var t=this;this._domBounds=new Ps(0,0,0,0),this._visibleRange=new Ps(0,1,0,0),this._focusY1=new Ps(0,0,0,0),this._focusY2=new Ps(0,0,0,0),this._color=new Ss,this._colorPool=[],this._posList=[],this._y1={topL:0,topR:0,bottomL:0,bottomR:0},this._y2={topL:0,topR:0,bottomL:0,bottomR:0},this._colorTw=new vr,this._back=new Fa,this._front=new Fa,this.$=Mr.find$(".js_content_copy")[0],this.$inner=Mr.find$(".js_content_copyInner")[0];var e=Mr.find$(".js_content_copySection");this._sections=e.map((function(n,i){var r=new Wg(n,i,e.length,t._focusY1,t._focusY2,t._color,t._visibleRange);return r.on(r.e.resize,t.resized.bind(t)),t._back.add(r.backMesh),t._front.add(r.frontMesh),r})),this._changeColor()}return Object.defineProperty(t.prototype,"back",{get:function(){return this._back},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"front",{get:function(){return this._front},enumerable:!1,configurable:!0}),t.prototype.startLoad=function(){return this._sections.reduce((function(t,e){return t.then(e.startLoad.bind(e))}),Promise.resolve())},t.prototype._changeColor=function(){var t=this;if(this._currentColor){var e=this._currentColor;this._currentColor=this._sampleColor(),this._colorTw.it({start:0,end:1,duration:1500,delay:1200,easing:"easeInOutQuad",onProgress:function(n){t._color.lerpColors(e,t._currentColor,n)},onComplete:this._changeColor.bind(this)})}else this._currentColor=this._sampleColor(),this._color.copy(this._currentColor),this._changeColor()},t.prototype._sampleColor=function(){return 0===this._colorPool.length&&(this._colorPool=qg.slice()),this._colorPool.splice(0,1)[0]},t.prototype.resized=function(){var t=this,e=this.$inner.clientRect(),n=0,i=0;this._sections.forEach((function(t,e){t.resized(),n=Math.max(n,t.innerDomRect.width),i=Math.max(i,t.innerDomRect.height)})),this._maxH=i;var r=0;this._sections.forEach((function(e,n){var i=e.outerDomRect.height-e.innerDomRect.height;t._posList[n]=.5*e.outerDomRect.height+r-.5*i-.5*e.minusMargin,r+=e.outerDomRect.height})),this._sections.forEach((function(t){t.calcBounds(n,e)})),this._padding=(this._sections[0].outerDomRect.height-this._sections[0].innerDomRect.height)/e.height,this._domBounds.x=e.left,this._domBounds.z=n,this._domBounds.w=e.height,this._back.position.x=this._front.position.x=.5*-bo.state.innerWidth+e.left},t.prototype.updated=function(){var t=mg.state.copyNum,e=mg.easedState.copyPos,n=Math.floor(t),i=Math.ceil(t),r=this._sections[n],o=this._sections[i],s=t-n;this._back.visible=this._front.visible=Math.abs(e)<.9;var a=yr(this._posList[n],this._posList[i],s),l=(a+=bo.state.innerHeight*e)+.5*yr(this._maxH-r.innerDomRect.height,this._maxH-o.innerDomRect.height,s);this._back.position.y=this._front.position.y=l,this.$.transformMatrix3d(0,-l+.5*bo.state.innerHeight);var c=yr(r.boundsTop,o.boundsTop,s)-.5*this._padding,h=yr(r.boundsBottom,o.boundsBottom,s)+.5*this._padding;if(Math.abs(e)>0){var u=r.boundsHeight;c+=u*e,h+=u*e}Math.abs(e)>.08&&e<0&&(h=c);var d=a-.5*bo.state.innerHeight,p=d/this._domBounds.w,f=(d+bo.state.innerHeight)/this._domBounds.w;this._visibleRange.set(p,f,(h-c)/(f-p),0);var m=c,g=c,_=h,v=h,y=mg.scrollDir>0;this._y1.topL+=(m-this._y1.topL)*mr.correctDumping(y?.045:.15),this._y1.topR+=(g-this._y1.topR)*mr.correctDumping(y?Vg:.03),this._y1.bottomL+=(_-this._y1.bottomL)*mr.correctDumping(y?.15:Vg),this._y1.bottomR+=(v-this._y1.bottomR)*mr.correctDumping(y?.03:Vg),this._y2.topL+=(this._y1.topL-this._y2.topL)*mr.correctDumping(jg),this._y2.topR+=(this._y1.topR-this._y2.topR)*mr.correctDumping(jg),this._y2.bottomL+=(this._y1.bottomL-this._y2.bottomL)*mr.correctDumping(jg),this._y2.bottomR+=(this._y1.bottomR-this._y2.bottomR)*mr.correctDumping(jg),this._focusY1.set(this._y1.topL,this._y1.topR,this._y1.bottomL,this._y1.bottomR),this._focusY2.set(this._y2.topL,this._y2.topR,this._y2.bottomL,this._y2.bottomR);var x=Hm(1-im(0,.5,Math.abs(e)),"easeInOutSine");this._sections.forEach((function(t){t.updated(x)}))},t}(),Xg=function(){function t(){var t=this;this._baseY=0,this._showOpacity=0,this._preX=new fs(0,0),this._afterX=new fs(0,0),this.$title=Mr.find$(".js_content_kvTitleInner")[0],this._material=new zl({vertexShader:n(3044).Z,fragmentShader:n(1742).Z,uniforms:{uTime:{value:0},uMap:{value:null},uPreX:{value:this._preX},uAfterX:{value:this._afterX},uBgColor:{value:um},uOpacity:{value:0}},transparent:!1}),Fg({url:dm.kvTitle}).then((function(e){t._material.uniforms.uMap.value=e})),this._object=new Ll(new Kl(1,1),this._material)}return Object.defineProperty(t.prototype,"object",{get:function(){return this._object},enumerable:!1,configurable:!0}),t.prototype.show=function(){var t=this;(new vr).it({start:0,end:1,duration:1200,delay:0,easing:"easeInOutSine",onProgress:function(e){t._showOpacity=e}})},t.prototype.resized=function(){var t=this.$title.clientRect();this._object.scale.x=t.width,this._object.scale.y=t.height,this._baseY=-t.top+.5*bo.state.innerHeight},t.prototype.updated=function(){var t=mg.easedState;this._object.position.y=this._baseY+t.kvPos*bo.state.innerHeight;var e=1-im(0,.1,Math.abs(t.kv));e=Math.min(this._showOpacity,e),this._material.uniforms.uOpacity.value=e},t}(),Zg=function(){function t(t){this._spiralSetting={radius:bo.isLandscape?8:5,roll:-Math.PI*(bo.isLandscape,2.5),angleMod:.56*Math.PI},this._item=t;var e=t.originalTransform;this._angle=Math.atan2(e.position.z,e.position.x)+Math.PI,this._length=e.position.length()}return Object.defineProperty(t.prototype,"item",{get:function(){return this._item},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"length",{get:function(){return this._length},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"angle",{get:function(){return this._angle},enumerable:!1,configurable:!0}),t.prototype.setCenterAngle=function(t,e){this._centerAngle=t,this._farPer=e},t.prototype.updated=function(t,e,n){var i=this._centerAngle+n*this._spiralSetting.roll+this._spiralSetting.angleMod,r=Hm(im(0,.9,t-.1*(1-this._farPer)),"easeInOutQuart"),o=-20*this._farPer-yr(20,5,this._farPer)*e;this._item.transform.position.x=yr(this._item.originalTransform.position.x,Math.cos(i)*this._spiralSetting.radius,r),this._item.transform.position.z=yr(this._item.originalTransform.position.z,Math.sin(i)*this._spiralSetting.radius,r),this._item.transform.position.y=yr(this._item.originalTransform.position.y,o,Hm(t,"easeInOutQuart")),this._item.transform.rotation.y=yr(this._item.originalTransform.rotation.y,-i+.5*Math.PI,r),this._item.changeBloomPer(1-e)},t}(),Jg=new Ns,$g=new pa,Kg=Math.sqrt(2),Qg=function(){function t(t){this._bouquetRadius=3,this._sphereScale=.3,this._spherePos=new zs,this._item=t;var e=bo.isLandscape?1:.66;this._bouquetRadius*=e,this._sphereScale*=e}return Object.defineProperty(t.prototype,"item",{get:function(){return this._item},enumerable:!1,configurable:!0}),t.prototype.setViewPos=function(t,e){this.viewX=t,this.viewY=e,this._sphereAxis=new zs(this.viewX,this.viewY,0).cross(Kf).normalize()},t.prototype.updated=function(){var t=ug.state,e=this.radius/Kg,n=Hm(im(0,.7,t.fix-.3*e),"easeInOutQuart"),i=Hm(im(0,.6,t.scale-.4*e),"easeInOutQuart"),r=Hm(im(0,.7,t.bloom-.3*e),"easeInOutQuart");this._spherePos.copy(Kf).multiplyScalar(this._bouquetRadius),this._spherePos.applyQuaternion(Jg.setFromAxisAngle(this._sphereAxis,-this.radius*Math.PI*.75)),this._item.transform.rotation.setFromRotationMatrix($g.lookAt(this._spherePos,Yf,Jf)),this._item.transform.position.copy(this._spherePos),this._item.transform.position.multiplyScalar(i),this._item.transform.scale.setScalar(this._sphereScale*i),this._item.lerpOriginalTransform(n),this._item.changeBloomPer(r)},t}(),t_=2*Math.PI,e_=function(){function t(){var t=this;this._object=new Fa;var e=Jm.getAsTransform("bouquet");this._inner=new Fa,this._object.add(this._inner),this._inner.position.y=e.position.y,this._material=new zl({vertexShader:n(2961).Z,fragmentShader:n(2406).Z,uniforms:{uTime:{value:0},uMap:{value:null},uBgColor:{value:um},uPicScale:{value:1},uFrameScale:{value:0}},transparent:!1});var i=Jm.getAsTransform("bouquet.circle_bg");this._bg=new Ll(new Kl(2,2),this._material),this._bg.position.copy(i.position),this._bg.scale.copy(i.scale),this._inner.add(this._bg),tg.cameraAnime.gotoByPer(1),this._lastFrameTransform=km(tg.cameraAnime.transform),Fg({url:dm.bouquetCircleBg}).then((function(e){t._material.uniforms.uMap.value=e})),this._items=Ag.bouquetFlowerItems.concat(Ag.greenItems),Ag.flowerMatarial.uniforms.uBouquetWrapMatrix.value=Ag.greenMatarial.uniforms.uBouquetWrapMatrix.value=this.object.matrix,Ag.flowerMatarial.uniforms.uBouquetInnerMatrix.value=Ag.greenMatarial.uniforms.uBouquetInnerMatrix.value=this._inner.matrix,this._initIntro(),this._initSpiral()}return Object.defineProperty(t.prototype,"object",{get:function(){return this._object},enumerable:!1,configurable:!0}),t.prototype._initIntro=function(){var t=0,e=0,n=0,i=ng.fovHeight*-ng.focusRoot.position.z*2;this._introItems=this._items.map((function(r){var o=new Qg(r),s=r.originalTransform.position,a=s.x,l=s.y,c=s.z,h=ng.fovHeight*-(ng.focusRoot.position.z+c)*2,u=i/h;return o.setViewPos(a*u,l*u),t=Math.max(t,Math.abs(o.viewX)),e=Math.max(e,Math.abs(o.viewY)),n=Math.max(n,c),o})),this._introItems.forEach((function(i){var r=i.viewX/t,o=i.viewY/e;i.angle=Math.atan2(o,r),i.radius=Math.sqrt(r*r+o*o);var s=i.item.originalTransform.position.z/n;i.radius-=.3*im(.75,.8,s)}))},t.prototype._initSpiral=function(){var t=t_/12,e=this._items.map((function(t){return new Zg(t)})),n=e.length,i=function(n,r){if(1===e.length)return e.splice(0,1)[0];var o=[];if(e.forEach((function(t,e){Math.abs((t.angle-n)%t_)<=r&&o.push(t)})),0===o.length)return i(n,r+.5*t);var s,a=0;return o.forEach((function(t,e){t.length>a&&(a=t.length,s=t)})),e.splice(e.indexOf(s),1)[0]};this._spiralItems=ar.range(e.length).map((function(e){var r=(t*e+.5*t+t_*(bo.isLandscape?.43:-.385))%t_,o=i(r,.5*t);return o.setCenterAngle(r,1-e/(n-1)),o}))},t.prototype.updated=function(){this._material.uniforms.uTime.value=.001*mr.state.elapsedTime;var t,e=mg.easedState,n=im(0,.9,Math.max(0,-e.kv));(t=this._object).position.copy(Yf),t.rotation.copy(Xf),t.scale&&t.scale.setScalar(1),this._inner.rotation.x=0;var i=!0;if(n<=0&&(this._object.rotation.x=-.5*Math.PI),this._items.forEach((function(t){t.lerpOriginalTransform(1)})),ug.onIntro){var r=Hm(ug.state.bg,"easeInOutQuart");return this._material.uniforms.uPicScale.value=yr(2,1,r),this._material.uniforms.uFrameScale.value=r,void this._introItems.forEach((function(t){return t.updated()}))}if(n>0){this._object.position.copy(this._lastFrameTransform.position),this._object.position.z+=ng.focusRoot.position.z;var o=Hm(im(0,.4,n),"easeInOutQuart");this._material.uniforms.uPicScale.value=yr(1,4,o),this._material.uniforms.uFrameScale.value=yr(1,0,o)}else{var s=im(0,.5,Math.max(0,e.kv));this._object.position.z=-30*s,this._object.position.y=-10*s,this._inner.rotation.x=s*Math.PI*-.5,i=s<1;var a=im(0,.1,s);this._material.uniforms.uPicScale.value=yr(1,2,a),this._material.uniforms.uFrameScale.value=yr(1,0,a)}var l=im(0,.58,n),c=Hm(im(.5,1,n),"easeInOutQuad"),h=Hm(im(0,1,n),"easeInOutQuart");this._spiralItems.forEach((function(t){t.updated(l,c,h)})),this._visible!==i&&(this._visible=i,this._object.visible=i,Ag.flowerMatarial.uniforms.uIsBouquetVisible.value=Ag.greenMatarial.uniforms.uIsBouquetVisible.value=i?1:0)},t}(),n_=e_,i_=function(){function t(){hr.includes("debug")&&bo.$html.addClass("html_debug"),Promise.resolve().then(this._initShared.bind(this)).then(this._initCommon.bind(this))}return t.prototype._initShared=function(){return Promise.resolve().then(mr.setup.bind(mr)).then(wo).then(bo.setup.bind(bo))},t.prototype._initCommon=function(){return this.$=Mr.find$("#js_stage")[0],ng.preSetup(this.$,this.$.find$("canvas")[0]),Promise.all([tg.setup(),Ag.preload(),this._preLoadImages()]).then(mg.setup.bind(mg)).then(Ag.setup.bind(Ag)).then(this._start.bind(this))},t.prototype._preLoadImages=function(){return Promise.all([dm.kvTitle,dm.bouquetCircleBg].map((function(t){return Fg({url:t}).then((function(t){ng.renderer.initTexture(t)}))})))},t.prototype._start=function(){var t=this;ng.setup({sceneBackgroundColor:"#ebebeb",fov:Jm.get("perspectiveCamera.fov")}),this._copy=new Yg,this._copy.startLoad(),ng.equalRoot.add(this._copy.back),ng.frontRoot.add(this._copy.front),this._kv=new Xg,ng.equalRoot.add(this._kv.object),this._bouquet=new n_,ng.root.add(this._bouquet.object),this._road=new Ig,ng.root.add(Ag.object),mg.on(mg.e.resize,this._resized.bind(this)).on(mg.e.update,this._updated.bind(this)),this._resized(),ug.startIntro().then((function(){bo.triggerResize(),setTimeout((function(){t._copy.startLoad(),t._kv.show(),t._road.introFinished()}),33)}))},t.prototype._resized=function(){ng.resized(),this._kv.resized(),this._copy.resized()},t.prototype._updated=function(){mg.state;var t=mg.easedState;tg.update(t),ng.applyCameraMatrix(tg.cameraMat),this._road.updated(),this._bouquet.updated(),this._kv.updated(),this._copy.updated(),Ag.updated(),ng.updated()},t}();new i_}()}();