12345678 |
- (function(t,e){"object"===typeof exports&&"object"===typeof module?module.exports=e(require("vue")):"function"===typeof define&&define.amd?define([],e):"object"===typeof exports?exports["vue-3d-model"]=e(require("vue")):t["vue-3d-model"]=e(t["Vue"])})("undefined"!==typeof self?self:this,(function(t){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"===typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t["default"]}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s="fb15")}({"00b4":function(t,e,n){"use strict";n("ac1f");var r=n("23e7"),i=n("c65b"),s=n("e330"),o=n("1626"),a=n("861d"),c=function(){var t=!1,e=/[ac]/;return e.exec=function(){return t=!0,/./.exec.apply(this,arguments)},!0===e.test("abc")&&t}(),l=TypeError,u=s(/./.test);r({target:"RegExp",proto:!0,forced:!c},{test:function(t){var e=this.exec;if(!o(e))return u(this,t);var n=i(e,this,t);if(null!==n&&!a(n))throw new l("RegExp exec method returned something other than an Object or null");return!!n}})},"00ee":function(t,e,n){var r=n("b622"),i=r("toStringTag"),s={};s[i]="z",t.exports="[object z]"===String(s)},"0366":function(t,e,n){var r=n("e330"),i=n("59ed"),s=n("40d5"),o=r(r.bind);t.exports=function(t,e){return i(t),void 0===e?t:s?o(t,e):function(){return t.apply(e,arguments)}}},"04d1":function(t,e,n){var r=n("342f"),i=r.match(/firefox\/(\d+)/i);t.exports=!!i&&+i[1]},"057f":function(t,e,n){var r=n("c6b6"),i=n("fc6a"),s=n("241c").f,o=n("4dae"),a="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],c=function(t){try{return s(t)}catch(e){return o(a)}};t.exports.f=function(t){return a&&"Window"==r(t)?c(t):s(i(t))}},"06cf":function(t,e,n){var r=n("83ab"),i=n("c65b"),s=n("d1e7"),o=n("5c6c"),a=n("fc6a"),c=n("a04b"),l=n("1a2d"),u=n("0cfb"),h=Object.getOwnPropertyDescriptor;e.f=r?h:function(t,e){if(t=a(t),e=c(e),u)try{return h(t,e)}catch(n){}if(l(t,e))return o(!i(s.f,t,e),t[e])}},"07fa":function(t,e,n){var r=n("50c4");t.exports=function(t){return r(t.length)}},"083a":function(t,e,n){"use strict";var r=n("0d51"),i=TypeError;t.exports=function(t,e){if(!delete t[e])throw i("Cannot delete property "+r(e)+" of "+r(t))}},"0b25":function(t,e,n){var r=n("5926"),i=n("50c4"),s=RangeError;t.exports=function(t){if(void 0===t)return 0;var e=r(t),n=i(e);if(e!==n)throw s("Wrong length or index");return n}},"0b42":function(t,e,n){var r=n("e8b5"),i=n("68ee"),s=n("861d"),o=n("b622"),a=o("species"),c=Array;t.exports=function(t){var e;return r(t)&&(e=t.constructor,i(e)&&(e===c||r(e.prototype))?e=void 0:s(e)&&(e=e[a],null===e&&(e=void 0))),void 0===e?c:e}},"0cfb":function(t,e,n){var r=n("83ab"),i=n("d039"),s=n("cc12");t.exports=!r&&!i((function(){return 7!=Object.defineProperty(s("div"),"a",{get:function(){return 7}}).a}))},"0d51":function(t,e){var n=String;t.exports=function(t){try{return n(t)}catch(e){return"Object"}}},"107c":function(t,e,n){var r=n("d039"),i=n("da84"),s=i.RegExp;t.exports=r((function(){var t=s("(?<a>b)","g");return"b"!==t.exec("b").groups.a||"bc"!=="b".replace(t,"$<a>c")}))},"13d2":function(t,e,n){var r=n("d039"),i=n("1626"),s=n("1a2d"),o=n("83ab"),a=n("5e77").CONFIGURABLE,c=n("8925"),l=n("69f3"),u=l.enforce,h=l.get,d=Object.defineProperty,p=o&&!r((function(){return 8!==d((function(){}),"length",{value:8}).length})),f=String(String).split("String"),m=t.exports=function(t,e,n){"Symbol("===String(e).slice(0,7)&&(e="["+String(e).replace(/^Symbol\(([^)]*)\)/,"$1")+"]"),n&&n.getter&&(e="get "+e),n&&n.setter&&(e="set "+e),(!s(t,"name")||a&&t.name!==e)&&(o?d(t,"name",{value:e,configurable:!0}):t.name=e),p&&n&&s(n,"arity")&&t.length!==n.arity&&d(t,"length",{value:n.arity});try{n&&s(n,"constructor")&&n.constructor?o&&d(t,"prototype",{writable:!1}):t.prototype&&(t.prototype=void 0)}catch(i){}var r=u(t);return s(r,"source")||(r.source=f.join("string"==typeof e?e:"")),t};Function.prototype.toString=m((function(){return i(this)&&h(this).source||c(this)}),"toString")},1448:function(t,e,n){var r=n("dfb9"),i=n("b6b7");t.exports=function(t,e){return r(i(t),e)}},"145e":function(t,e,n){"use strict";var r=n("7b0b"),i=n("23cb"),s=n("07fa"),o=n("083a"),a=Math.min;t.exports=[].copyWithin||function(t,e){var n=r(this),c=s(n),l=i(t,c),u=i(e,c),h=arguments.length>2?arguments[2]:void 0,d=a((void 0===h?c:i(h,c))-u,c-l),p=1;u<l&&l<u+d&&(p=-1,u+=d-1,l+=d-1);while(d-- >0)u in n?n[l]=n[u]:o(n,l),l+=p,u+=p;return n}},"159b":function(t,e,n){var r=n("da84"),i=n("fdbc"),s=n("785a"),o=n("17c2"),a=n("9112"),c=function(t){if(t&&t.forEach!==o)try{a(t,"forEach",o)}catch(e){t.forEach=o}};for(var l in i)i[l]&&c(r[l]&&r[l].prototype);c(s)},1626:function(t,e){t.exports=function(t){return"function"==typeof t}},"170b":function(t,e,n){"use strict";var r=n("ebb5"),i=n("50c4"),s=n("23cb"),o=n("b6b7"),a=r.aTypedArray,c=r.exportTypedArrayMethod;c("subarray",(function(t,e){var n=a(this),r=n.length,c=s(t,r),l=o(n);return new l(n.buffer,n.byteOffset+c*n.BYTES_PER_ELEMENT,i((void 0===e?r:s(e,r))-c))}))},"17c2":function(t,e,n){"use strict";var r=n("b727").forEach,i=n("a640"),s=i("forEach");t.exports=s?[].forEach:function(t){return r(this,t,arguments.length>1?arguments[1]:void 0)}},"182d":function(t,e,n){var r=n("f8cd"),i=RangeError;t.exports=function(t,e){var n=r(t);if(n%e)throw i("Wrong offset");return n}},"19aa":function(t,e,n){var r=n("3a9b"),i=TypeError;t.exports=function(t,e){if(r(e,t))return t;throw i("Incorrect invocation")}},"1a2d":function(t,e,n){var r=n("e330"),i=n("7b0b"),s=r({}.hasOwnProperty);t.exports=Object.hasOwn||function(t,e){return s(i(t),e)}},"1be4":function(t,e,n){var r=n("d066");t.exports=r("document","documentElement")},"1c7e":function(t,e,n){var r=n("b622"),i=r("iterator"),s=!1;try{var o=0,a={next:function(){return{done:!!o++}},return:function(){s=!0}};a[i]=function(){return this},Array.from(a,(function(){throw 2}))}catch(c){}t.exports=function(t,e){if(!e&&!s)return!1;var n=!1;try{var r={};r[i]=function(){return{next:function(){return{done:n=!0}}}},t(r)}catch(c){}return n}},"1d02":function(t,e,n){"use strict";var r=n("ebb5"),i=n("a258").findLastIndex,s=r.aTypedArray,o=r.exportTypedArrayMethod;o("findLastIndex",(function(t){return i(s(this),t,arguments.length>1?arguments[1]:void 0)}))},"1d80":function(t,e){var n=TypeError;t.exports=function(t){if(void 0==t)throw n("Can't call method on "+t);return t}},"1dde":function(t,e,n){var r=n("d039"),i=n("b622"),s=n("2d00"),o=i("species");t.exports=function(t){return s>=51||!r((function(){var e=[],n=e.constructor={};return n[o]=function(){return{foo:1}},1!==e[t](Boolean).foo}))}},"219c":function(t,e,n){"use strict";var r=n("da84"),i=n("e330"),s=n("d039"),o=n("59ed"),a=n("addb"),c=n("ebb5"),l=n("04d1"),u=n("d998"),h=n("2d00"),d=n("512c"),p=c.aTypedArray,f=c.exportTypedArrayMethod,m=r.Uint16Array,g=m&&i(m.prototype.sort),v=!!g&&!(s((function(){g(new m(2),null)}))&&s((function(){g(new m(2),{})}))),y=!!g&&!s((function(){if(h)return h<74;if(l)return l<67;if(u)return!0;if(d)return d<602;var t,e,n=new m(516),r=Array(516);for(t=0;t<516;t++)e=t%4,n[t]=515-t,r[t]=t-2*e+3;for(g(n,(function(t,e){return(t/4|0)-(e/4|0)})),t=0;t<516;t++)if(n[t]!==r[t])return!0})),x=function(t){return function(e,n){return void 0!==t?+t(e,n)||0:n!==n?-1:e!==e?1:0===e&&0===n?1/e>0&&1/n<0?1:-1:e>n}};f("sort",(function(t){return void 0!==t&&o(t),y?g(this,t):a(p(this),x(t))}),!y||v)},"23cb":function(t,e,n){var r=n("5926"),i=Math.max,s=Math.min;t.exports=function(t,e){var n=r(t);return n<0?i(n+e,0):s(n,e)}},"23e7":function(t,e,n){var r=n("da84"),i=n("06cf").f,s=n("9112"),o=n("cb2d"),a=n("6374"),c=n("e893"),l=n("94ca");t.exports=function(t,e){var n,u,h,d,p,f,m=t.target,g=t.global,v=t.stat;if(u=g?r:v?r[m]||a(m,{}):(r[m]||{}).prototype,u)for(h in e){if(p=e[h],t.dontCallGetSet?(f=i(u,h),d=f&&f.value):d=u[h],n=l(g?h:m+(v?".":"#")+h,t.forced),!n&&void 0!==d){if(typeof p==typeof d)continue;c(p,d)}(t.sham||d&&d.sham)&&s(p,"sham",!0),o(u,h,p,t)}}},"241c":function(t,e,n){var r=n("ca84"),i=n("7839"),s=i.concat("length","prototype");e.f=Object.getOwnPropertyNames||function(t){return r(t,s)}},"25a1":function(t,e,n){"use strict";var r=n("ebb5"),i=n("d58f").right,s=r.aTypedArray,o=r.exportTypedArrayMethod;o("reduceRight",(function(t){var e=arguments.length;return i(s(this),t,e,e>1?arguments[1]:void 0)}))},2626:function(t,e,n){"use strict";var r=n("d066"),i=n("9bf2"),s=n("b622"),o=n("83ab"),a=s("species");t.exports=function(t){var e=r(t),n=i.f;o&&e&&!e[a]&&n(e,a,{configurable:!0,get:function(){return this}})}},2954:function(t,e,n){"use strict";var r=n("ebb5"),i=n("b6b7"),s=n("d039"),o=n("f36a"),a=r.aTypedArray,c=r.exportTypedArrayMethod,l=s((function(){new Int8Array(1).slice()}));c("slice",(function(t,e){var n=o(a(this),t,e),r=i(this),s=0,c=n.length,l=new r(c);while(c>s)l[s]=n[s++];return l}),l)},"2a62":function(t,e,n){var r=n("c65b"),i=n("825a"),s=n("dc4a");t.exports=function(t,e,n){var o,a;i(t);try{if(o=s(t,"return"),!o){if("throw"===e)throw n;return n}o=r(o,t)}catch(c){a=!0,o=c}if("throw"===e)throw n;if(a)throw o;return i(o),n}},"2ba4":function(t,e,n){var r=n("40d5"),i=Function.prototype,s=i.apply,o=i.call;t.exports="object"==typeof Reflect&&Reflect.apply||(r?o.bind(s):function(){return o.apply(s,arguments)})},"2d00":function(t,e,n){var r,i,s=n("da84"),o=n("342f"),a=s.process,c=s.Deno,l=a&&a.versions||c&&c.version,u=l&&l.v8;u&&(r=u.split("."),i=r[0]>0&&r[0]<4?1:+(r[0]+r[1])),!i&&o&&(r=o.match(/Edge\/(\d+)/),(!r||r[1]>=74)&&(r=o.match(/Chrome\/(\d+)/),r&&(i=+r[1]))),t.exports=i},3280:function(t,e,n){"use strict";var r=n("ebb5"),i=n("2ba4"),s=n("e58c"),o=r.aTypedArray,a=r.exportTypedArrayMethod;a("lastIndexOf",(function(t){var e=arguments.length;return i(s,o(this),e>1?[t,arguments[1]]:[t])}))},"342f":function(t,e,n){var r=n("d066");t.exports=r("navigator","userAgent")||""},"35a1":function(t,e,n){var r=n("f5df"),i=n("dc4a"),s=n("3f8c"),o=n("b622"),a=o("iterator");t.exports=function(t){if(void 0!=t)return i(t,a)||i(t,"@@iterator")||s[r(t)]}},"37e8":function(t,e,n){var r=n("83ab"),i=n("aed9"),s=n("9bf2"),o=n("825a"),a=n("fc6a"),c=n("df75");e.f=r&&!i?Object.defineProperties:function(t,e){o(t);var n,r=a(e),i=c(e),l=i.length,u=0;while(l>u)s.f(t,n=i[u++],r[n]);return t}},"3a7b":function(t,e,n){"use strict";var r=n("ebb5"),i=n("b727").findIndex,s=r.aTypedArray,o=r.exportTypedArrayMethod;o("findIndex",(function(t){return i(s(this),t,arguments.length>1?arguments[1]:void 0)}))},"3a9b":function(t,e,n){var r=n("e330");t.exports=r({}.isPrototypeOf)},"3bbe":function(t,e,n){var r=n("1626"),i=String,s=TypeError;t.exports=function(t){if("object"==typeof t||r(t))return t;throw s("Can't set "+i(t)+" as a prototype")}},"3c5d":function(t,e,n){"use strict";var r=n("da84"),i=n("c65b"),s=n("ebb5"),o=n("07fa"),a=n("182d"),c=n("7b0b"),l=n("d039"),u=r.RangeError,h=r.Int8Array,d=h&&h.prototype,p=d&&d.set,f=s.aTypedArray,m=s.exportTypedArrayMethod,g=!l((function(){var t=new Uint8ClampedArray(2);return i(p,t,{length:1,0:3},1),3!==t[1]})),v=g&&s.NATIVE_ARRAY_BUFFER_VIEWS&&l((function(){var t=new h(2);return t.set(1),t.set("2",1),0!==t[0]||2!==t[1]}));m("set",(function(t){f(this);var e=a(arguments.length>1?arguments[1]:void 0,1),n=c(t);if(g)return i(p,this,n,e);var r=this.length,s=o(n),l=0;if(s+e>r)throw u("Wrong length");while(l<s)this[e+l]=n[l++]}),!g||v)},"3ca3":function(t,e,n){"use strict";var r=n("6547").charAt,i=n("577e"),s=n("69f3"),o=n("7dd0"),a="String Iterator",c=s.set,l=s.getterFor(a);o(String,"String",(function(t){c(this,{type:a,string:i(t),index:0})}),(function(){var t,e=l(this),n=e.string,i=e.index;return i>=n.length?{value:void 0,done:!0}:(t=r(n,i),e.index+=t.length,{value:t,done:!1})}))},"3d87":function(t,e,n){var r=n("4930");t.exports=r&&!!Symbol["for"]&&!!Symbol.keyFor},"3f8c":function(t,e){t.exports={}},"3fcc":function(t,e,n){"use strict";var r=n("ebb5"),i=n("b727").map,s=n("b6b7"),o=r.aTypedArray,a=r.exportTypedArrayMethod;a("map",(function(t){return i(o(this),t,arguments.length>1?arguments[1]:void 0,(function(t,e){return new(s(t))(e)}))}))},"408a":function(t,e,n){var r=n("e330");t.exports=r(1..valueOf)},"40d5":function(t,e,n){var r=n("d039");t.exports=!r((function(){var t=function(){}.bind();return"function"!=typeof t||t.hasOwnProperty("prototype")}))},"428f":function(t,e,n){var r=n("da84");t.exports=r},"44ad":function(t,e,n){var r=n("e330"),i=n("d039"),s=n("c6b6"),o=Object,a=r("".split);t.exports=i((function(){return!o("z").propertyIsEnumerable(0)}))?function(t){return"String"==s(t)?a(t,""):o(t)}:o},"44d2":function(t,e,n){var r=n("b622"),i=n("7c73"),s=n("9bf2").f,o=r("unscopables"),a=Array.prototype;void 0==a[o]&&s(a,o,{configurable:!0,value:i(null)}),t.exports=function(t){a[o][t]=!0}},4840:function(t,e,n){var r=n("825a"),i=n("5087"),s=n("b622"),o=s("species");t.exports=function(t,e){var n,s=r(t).constructor;return void 0===s||void 0==(n=r(s)[o])?e:i(n)}},"485a":function(t,e,n){var r=n("c65b"),i=n("1626"),s=n("861d"),o=TypeError;t.exports=function(t,e){var n,a;if("string"===e&&i(n=t.toString)&&!s(a=r(n,t)))return a;if(i(n=t.valueOf)&&!s(a=r(n,t)))return a;if("string"!==e&&i(n=t.toString)&&!s(a=r(n,t)))return a;throw o("Can't convert object to primitive value")}},4930:function(t,e,n){var r=n("2d00"),i=n("d039");t.exports=!!Object.getOwnPropertySymbols&&!i((function(){var t=Symbol();return!String(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&r&&r<41}))},"4d64":function(t,e,n){var r=n("fc6a"),i=n("23cb"),s=n("07fa"),o=function(t){return function(e,n,o){var a,c=r(e),l=s(c),u=i(o,l);if(t&&n!=n){while(l>u)if(a=c[u++],a!=a)return!0}else for(;l>u;u++)if((t||u in c)&&c[u]===n)return t||u||0;return!t&&-1}};t.exports={includes:o(!0),indexOf:o(!1)}},"4dae":function(t,e,n){var r=n("23cb"),i=n("07fa"),s=n("8418"),o=Array,a=Math.max;t.exports=function(t,e,n){for(var c=i(t),l=r(e,c),u=r(void 0===n?c:n,c),h=o(a(u-l,0)),d=0;l<u;l++,d++)s(h,d,t[l]);return h.length=d,h}},"4df4":function(t,e,n){"use strict";var r=n("0366"),i=n("c65b"),s=n("7b0b"),o=n("9bdd"),a=n("e95a"),c=n("68ee"),l=n("07fa"),u=n("8418"),h=n("9a1f"),d=n("35a1"),p=Array;t.exports=function(t){var e=s(t),n=c(this),f=arguments.length,m=f>1?arguments[1]:void 0,g=void 0!==m;g&&(m=r(m,f>2?arguments[2]:void 0));var v,y,x,b,w,_,M=d(e),S=0;if(!M||this===p&&a(M))for(v=l(e),y=n?new this(v):p(v);v>S;S++)_=g?m(e[S],S):e[S],u(y,S,_);else for(b=h(e,M),w=b.next,y=n?new this:[];!(x=i(w,b)).done;S++)_=g?o(b,m,[x.value,S],!0):x.value,u(y,S,_);return y.length=S,y}},5087:function(t,e,n){var r=n("68ee"),i=n("0d51"),s=TypeError;t.exports=function(t){if(r(t))return t;throw s(i(t)+" is not a constructor")}},"50c4":function(t,e,n){var r=n("5926"),i=Math.min;t.exports=function(t){return t>0?i(r(t),9007199254740991):0}},"512c":function(t,e,n){var r=n("342f"),i=r.match(/AppleWebKit\/(\d+)\./);t.exports=!!i&&+i[1]},5692:function(t,e,n){var r=n("c430"),i=n("c6cd");(t.exports=function(t,e){return i[t]||(i[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.24.1",mode:r?"pure":"global",copyright:"© 2014-2022 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.24.1/LICENSE",source:"https://github.com/zloirock/core-js"})},"56ef":function(t,e,n){var r=n("d066"),i=n("e330"),s=n("241c"),o=n("7418"),a=n("825a"),c=i([].concat);t.exports=r("Reflect","ownKeys")||function(t){var e=s.f(a(t)),n=o.f;return n?c(e,n(t)):e}},"577e":function(t,e,n){var r=n("f5df"),i=String;t.exports=function(t){if("Symbol"===r(t))throw TypeError("Cannot convert a Symbol value to a string");return i(t)}},"57b9":function(t,e,n){var r=n("c65b"),i=n("d066"),s=n("b622"),o=n("cb2d");t.exports=function(){var t=i("Symbol"),e=t&&t.prototype,n=e&&e.valueOf,a=s("toPrimitive");e&&!e[a]&&o(e,a,(function(t){return r(n,this)}),{arity:1})}},5899:function(t,e){t.exports="\t\n\v\f\r \u2028\u2029\ufeff"},"58a8":function(t,e,n){var r=n("e330"),i=n("1d80"),s=n("577e"),o=n("5899"),a=r("".replace),c="["+o+"]",l=RegExp("^"+c+c+"*"),u=RegExp(c+c+"*$"),h=function(t){return function(e){var n=s(i(e));return 1&t&&(n=a(n,l,"")),2&t&&(n=a(n,u,"")),n}};t.exports={start:h(1),end:h(2),trim:h(3)}},5926:function(t,e,n){var r=n("b42e");t.exports=function(t){var e=+t;return e!==e||0===e?0:r(e)}},"59ed":function(t,e,n){var r=n("1626"),i=n("0d51"),s=TypeError;t.exports=function(t){if(r(t))return t;throw s(i(t)+" is not a function")}},"5a47":function(t,e,n){var r=n("23e7"),i=n("4930"),s=n("d039"),o=n("7418"),a=n("7b0b"),c=!i||s((function(){o.f(1)}));r({target:"Object",stat:!0,forced:c},{getOwnPropertySymbols:function(t){var e=o.f;return e?e(a(t)):[]}})},"5c6c":function(t,e){t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},"5e77":function(t,e,n){var r=n("83ab"),i=n("1a2d"),s=Function.prototype,o=r&&Object.getOwnPropertyDescriptor,a=i(s,"name"),c=a&&"something"===function(){}.name,l=a&&(!r||r&&o(s,"name").configurable);t.exports={EXISTS:a,PROPER:c,CONFIGURABLE:l}},"5f96":function(t,e,n){"use strict";var r=n("ebb5"),i=n("e330"),s=r.aTypedArray,o=r.exportTypedArrayMethod,a=i([].join);o("join",(function(t){return a(s(this),t)}))},"60bd":function(t,e,n){"use strict";var r=n("da84"),i=n("d039"),s=n("e330"),o=n("ebb5"),a=n("e260"),c=n("b622"),l=c("iterator"),u=r.Uint8Array,h=s(a.values),d=s(a.keys),p=s(a.entries),f=o.aTypedArray,m=o.exportTypedArrayMethod,g=u&&u.prototype,v=!i((function(){g[l].call([1])})),y=!!g&&g.values&&g[l]===g.values&&"values"===g.values.name,x=function(){return h(f(this))};m("entries",(function(){return p(f(this))}),v),m("keys",(function(){return d(f(this))}),v),m("values",x,v||!y,{name:"values"}),m(l,x,v||!y,{name:"values"})},"60da":function(t,e,n){"use strict";var r=n("83ab"),i=n("e330"),s=n("c65b"),o=n("d039"),a=n("df75"),c=n("7418"),l=n("d1e7"),u=n("7b0b"),h=n("44ad"),d=Object.assign,p=Object.defineProperty,f=i([].concat);t.exports=!d||o((function(){if(r&&1!==d({b:1},d(p({},"a",{enumerable:!0,get:function(){p(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var t={},e={},n=Symbol(),i="abcdefghijklmnopqrst";return t[n]=7,i.split("").forEach((function(t){e[t]=t})),7!=d({},t)[n]||a(d({},e)).join("")!=i}))?function(t,e){var n=u(t),i=arguments.length,o=1,d=c.f,p=l.f;while(i>o){var m,g=h(arguments[o++]),v=d?f(a(g),d(g)):a(g),y=v.length,x=0;while(y>x)m=v[x++],r&&!s(p,g,m)||(n[m]=g[m])}return n}:d},"621a":function(t,e,n){"use strict";var r=n("da84"),i=n("e330"),s=n("83ab"),o=n("a981"),a=n("5e77"),c=n("9112"),l=n("6964"),u=n("d039"),h=n("19aa"),d=n("5926"),p=n("50c4"),f=n("0b25"),m=n("77a7"),g=n("e163"),v=n("d2bb"),y=n("241c").f,x=n("9bf2").f,b=n("81d5"),w=n("4dae"),_=n("d44e"),M=n("69f3"),S=a.PROPER,T=a.CONFIGURABLE,E=M.get,A=M.set,L="ArrayBuffer",R="DataView",C="prototype",P="Wrong length",I="Wrong index",N=r[L],O=N,D=O&&O[C],k=r[R],z=k&&k[C],F=Object.prototype,U=r.Array,B=r.RangeError,H=i(b),G=i([].reverse),V=m.pack,W=m.unpack,j=function(t){return[255&t]},q=function(t){return[255&t,t>>8&255]},X=function(t){return[255&t,t>>8&255,t>>16&255,t>>24&255]},Y=function(t){return t[3]<<24|t[2]<<16|t[1]<<8|t[0]},J=function(t){return V(t,23,4)},Z=function(t){return V(t,52,8)},K=function(t,e){x(t[C],e,{get:function(){return E(this)[e]}})},$=function(t,e,n,r){var i=f(n),s=E(t);if(i+e>s.byteLength)throw B(I);var o=E(s.buffer).bytes,a=i+s.byteOffset,c=w(o,a,a+e);return r?c:G(c)},Q=function(t,e,n,r,i,s){var o=f(n),a=E(t);if(o+e>a.byteLength)throw B(I);for(var c=E(a.buffer).bytes,l=o+a.byteOffset,u=r(+i),h=0;h<e;h++)c[l+h]=u[s?h:e-h-1]};if(o){var tt=S&&N.name!==L;if(u((function(){N(1)}))&&u((function(){new N(-1)}))&&!u((function(){return new N,new N(1.5),new N(NaN),tt&&!T})))tt&&T&&c(N,"name",L);else{O=function(t){return h(this,D),new N(f(t))},O[C]=D;for(var et,nt=y(N),rt=0;nt.length>rt;)(et=nt[rt++])in O||c(O,et,N[et]);D.constructor=O}v&&g(z)!==F&&v(z,F);var it=new k(new O(2)),st=i(z.setInt8);it.setInt8(0,2147483648),it.setInt8(1,2147483649),!it.getInt8(0)&&it.getInt8(1)||l(z,{setInt8:function(t,e){st(this,t,e<<24>>24)},setUint8:function(t,e){st(this,t,e<<24>>24)}},{unsafe:!0})}else O=function(t){h(this,D);var e=f(t);A(this,{bytes:H(U(e),0),byteLength:e}),s||(this.byteLength=e)},D=O[C],k=function(t,e,n){h(this,z),h(t,D);var r=E(t).byteLength,i=d(e);if(i<0||i>r)throw B("Wrong offset");if(n=void 0===n?r-i:p(n),i+n>r)throw B(P);A(this,{buffer:t,byteLength:n,byteOffset:i}),s||(this.buffer=t,this.byteLength=n,this.byteOffset=i)},z=k[C],s&&(K(O,"byteLength"),K(k,"buffer"),K(k,"byteLength"),K(k,"byteOffset")),l(z,{getInt8:function(t){return $(this,1,t)[0]<<24>>24},getUint8:function(t){return $(this,1,t)[0]},getInt16:function(t){var e=$(this,2,t,arguments.length>1?arguments[1]:void 0);return(e[1]<<8|e[0])<<16>>16},getUint16:function(t){var e=$(this,2,t,arguments.length>1?arguments[1]:void 0);return e[1]<<8|e[0]},getInt32:function(t){return Y($(this,4,t,arguments.length>1?arguments[1]:void 0))},getUint32:function(t){return Y($(this,4,t,arguments.length>1?arguments[1]:void 0))>>>0},getFloat32:function(t){return W($(this,4,t,arguments.length>1?arguments[1]:void 0),23)},getFloat64:function(t){return W($(this,8,t,arguments.length>1?arguments[1]:void 0),52)},setInt8:function(t,e){Q(this,1,t,j,e)},setUint8:function(t,e){Q(this,1,t,j,e)},setInt16:function(t,e){Q(this,2,t,q,e,arguments.length>2?arguments[2]:void 0)},setUint16:function(t,e){Q(this,2,t,q,e,arguments.length>2?arguments[2]:void 0)},setInt32:function(t,e){Q(this,4,t,X,e,arguments.length>2?arguments[2]:void 0)},setUint32:function(t,e){Q(this,4,t,X,e,arguments.length>2?arguments[2]:void 0)},setFloat32:function(t,e){Q(this,4,t,J,e,arguments.length>2?arguments[2]:void 0)},setFloat64:function(t,e){Q(this,8,t,Z,e,arguments.length>2?arguments[2]:void 0)}});_(O,L),_(k,R),t.exports={ArrayBuffer:O,DataView:k}},6374:function(t,e,n){var r=n("da84"),i=Object.defineProperty;t.exports=function(t,e){try{i(r,t,{value:e,configurable:!0,writable:!0})}catch(n){r[t]=e}return e}},"649e":function(t,e,n){"use strict";var r=n("ebb5"),i=n("b727").some,s=r.aTypedArray,o=r.exportTypedArrayMethod;o("some",(function(t){return i(s(this),t,arguments.length>1?arguments[1]:void 0)}))},6547:function(t,e,n){var r=n("e330"),i=n("5926"),s=n("577e"),o=n("1d80"),a=r("".charAt),c=r("".charCodeAt),l=r("".slice),u=function(t){return function(e,n){var r,u,h=s(o(e)),d=i(n),p=h.length;return d<0||d>=p?t?"":void 0:(r=c(h,d),r<55296||r>56319||d+1===p||(u=c(h,d+1))<56320||u>57343?t?a(h,d):r:t?l(h,d,d+2):u-56320+(r-55296<<10)+65536)}};t.exports={codeAt:u(!1),charAt:u(!0)}},"65f0":function(t,e,n){var r=n("0b42");t.exports=function(t,e){return new(r(t))(0===e?0:e)}},"68ee":function(t,e,n){var r=n("e330"),i=n("d039"),s=n("1626"),o=n("f5df"),a=n("d066"),c=n("8925"),l=function(){},u=[],h=a("Reflect","construct"),d=/^\s*(?:class|function)\b/,p=r(d.exec),f=!d.exec(l),m=function(t){if(!s(t))return!1;try{return h(l,u,t),!0}catch(e){return!1}},g=function(t){if(!s(t))return!1;switch(o(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return f||!!p(d,c(t))}catch(e){return!0}};g.sham=!0,t.exports=!h||i((function(){var t;return m(m.call)||!m(Object)||!m((function(){t=!0}))||t}))?g:m},6964:function(t,e,n){var r=n("cb2d");t.exports=function(t,e,n){for(var i in e)r(t,i,e[i],n);return t}},"69f3":function(t,e,n){var r,i,s,o=n("7f9a"),a=n("da84"),c=n("e330"),l=n("861d"),u=n("9112"),h=n("1a2d"),d=n("c6cd"),p=n("f772"),f=n("d012"),m="Object already initialized",g=a.TypeError,v=a.WeakMap,y=function(t){return s(t)?i(t):r(t,{})},x=function(t){return function(e){var n;if(!l(e)||(n=i(e)).type!==t)throw g("Incompatible receiver, "+t+" required");return n}};if(o||d.state){var b=d.state||(d.state=new v),w=c(b.get),_=c(b.has),M=c(b.set);r=function(t,e){if(_(b,t))throw new g(m);return e.facade=t,M(b,t,e),e},i=function(t){return w(b,t)||{}},s=function(t){return _(b,t)}}else{var S=p("state");f[S]=!0,r=function(t,e){if(h(t,S))throw new g(m);return e.facade=t,u(t,S,e),e},i=function(t){return h(t,S)?t[S]:{}},s=function(t){return h(t,S)}}t.exports={set:r,get:i,has:s,enforce:y,getterFor:x}},7156:function(t,e,n){var r=n("1626"),i=n("861d"),s=n("d2bb");t.exports=function(t,e,n){var o,a;return s&&r(o=e.constructor)&&o!==n&&i(a=o.prototype)&&a!==n.prototype&&s(t,a),t}},"72f7":function(t,e,n){"use strict";var r=n("ebb5").exportTypedArrayMethod,i=n("d039"),s=n("da84"),o=n("e330"),a=s.Uint8Array,c=a&&a.prototype||{},l=[].toString,u=o([].join);i((function(){l.call({})}))&&(l=function(){return u(this)});var h=c.toString!=l;r("toString",l,h)},"735e":function(t,e,n){"use strict";var r=n("ebb5"),i=n("81d5"),s=n("f495"),o=n("f5df"),a=n("c65b"),c=n("e330"),l=n("d039"),u=r.aTypedArray,h=r.exportTypedArrayMethod,d=c("".slice),p=l((function(){var t=0;return new Int8Array(2).fill({valueOf:function(){return t++}}),1!==t}));h("fill",(function(t){var e=arguments.length;u(this);var n="Big"===d(o(this),0,3)?s(t):+t;return a(i,this,n,e>1?arguments[1]:void 0,e>2?arguments[2]:void 0)}),p)},7418:function(t,e){e.f=Object.getOwnPropertySymbols},"746f":function(t,e,n){var r=n("428f"),i=n("1a2d"),s=n("e538"),o=n("9bf2").f;t.exports=function(t){var e=r.Symbol||(r.Symbol={});i(e,t)||o(e,t,{value:s.f(t)})}},"74e8":function(t,e,n){"use strict";var r=n("23e7"),i=n("da84"),s=n("c65b"),o=n("83ab"),a=n("8aa7"),c=n("ebb5"),l=n("621a"),u=n("19aa"),h=n("5c6c"),d=n("9112"),p=n("eac5"),f=n("50c4"),m=n("0b25"),g=n("182d"),v=n("a04b"),y=n("1a2d"),x=n("f5df"),b=n("861d"),w=n("d9b5"),_=n("7c73"),M=n("3a9b"),S=n("d2bb"),T=n("241c").f,E=n("a078"),A=n("b727").forEach,L=n("2626"),R=n("9bf2"),C=n("06cf"),P=n("69f3"),I=n("7156"),N=P.get,O=P.set,D=P.enforce,k=R.f,z=C.f,F=Math.round,U=i.RangeError,B=l.ArrayBuffer,H=B.prototype,G=l.DataView,V=c.NATIVE_ARRAY_BUFFER_VIEWS,W=c.TYPED_ARRAY_TAG,j=c.TypedArray,q=c.TypedArrayPrototype,X=c.aTypedArrayConstructor,Y=c.isTypedArray,J="BYTES_PER_ELEMENT",Z="Wrong length",K=function(t,e){X(t);var n=0,r=e.length,i=new t(r);while(r>n)i[n]=e[n++];return i},$=function(t,e){k(t,e,{get:function(){return N(this)[e]}})},Q=function(t){var e;return M(H,t)||"ArrayBuffer"==(e=x(t))||"SharedArrayBuffer"==e},tt=function(t,e){return Y(t)&&!w(e)&&e in t&&p(+e)&&e>=0},et=function(t,e){return e=v(e),tt(t,e)?h(2,t[e]):z(t,e)},nt=function(t,e,n){return e=v(e),!(tt(t,e)&&b(n)&&y(n,"value"))||y(n,"get")||y(n,"set")||n.configurable||y(n,"writable")&&!n.writable||y(n,"enumerable")&&!n.enumerable?k(t,e,n):(t[e]=n.value,t)};o?(V||(C.f=et,R.f=nt,$(q,"buffer"),$(q,"byteOffset"),$(q,"byteLength"),$(q,"length")),r({target:"Object",stat:!0,forced:!V},{getOwnPropertyDescriptor:et,defineProperty:nt}),t.exports=function(t,e,n){var o=t.match(/\d+$/)[0]/8,c=t+(n?"Clamped":"")+"Array",l="get"+t,h="set"+t,p=i[c],v=p,y=v&&v.prototype,x={},w=function(t,e){var n=N(t);return n.view[l](e*o+n.byteOffset,!0)},M=function(t,e,r){var i=N(t);n&&(r=(r=F(r))<0?0:r>255?255:255&r),i.view[h](e*o+i.byteOffset,r,!0)},R=function(t,e){k(t,e,{get:function(){return w(this,e)},set:function(t){return M(this,e,t)},enumerable:!0})};V?a&&(v=e((function(t,e,n,r){return u(t,y),I(function(){return b(e)?Q(e)?void 0!==r?new p(e,g(n,o),r):void 0!==n?new p(e,g(n,o)):new p(e):Y(e)?K(v,e):s(E,v,e):new p(m(e))}(),t,v)})),S&&S(v,j),A(T(p),(function(t){t in v||d(v,t,p[t])})),v.prototype=y):(v=e((function(t,e,n,r){u(t,y);var i,a,c,l=0,h=0;if(b(e)){if(!Q(e))return Y(e)?K(v,e):s(E,v,e);i=e,h=g(n,o);var d=e.byteLength;if(void 0===r){if(d%o)throw U(Z);if(a=d-h,a<0)throw U(Z)}else if(a=f(r)*o,a+h>d)throw U(Z);c=a/o}else c=m(e),a=c*o,i=new B(a);O(t,{buffer:i,byteOffset:h,byteLength:a,length:c,view:new G(i)});while(l<c)R(t,l++)})),S&&S(v,j),y=v.prototype=_(q)),y.constructor!==v&&d(y,"constructor",v),D(y).TypedArrayConstructor=v,W&&d(y,W,c);var C=v!=p;x[c]=v,r({global:!0,constructor:!0,forced:C,sham:!V},x),J in v||d(v,J,o),J in y||d(y,J,o),L(c)}):t.exports=function(){}},"77a7":function(t,e){var n=Array,r=Math.abs,i=Math.pow,s=Math.floor,o=Math.log,a=Math.LN2,c=function(t,e,c){var l,u,h,d=n(c),p=8*c-e-1,f=(1<<p)-1,m=f>>1,g=23===e?i(2,-24)-i(2,-77):0,v=t<0||0===t&&1/t<0?1:0,y=0;t=r(t),t!=t||t===1/0?(u=t!=t?1:0,l=f):(l=s(o(t)/a),h=i(2,-l),t*h<1&&(l--,h*=2),t+=l+m>=1?g/h:g*i(2,1-m),t*h>=2&&(l++,h/=2),l+m>=f?(u=0,l=f):l+m>=1?(u=(t*h-1)*i(2,e),l+=m):(u=t*i(2,m-1)*i(2,e),l=0));while(e>=8)d[y++]=255&u,u/=256,e-=8;l=l<<e|u,p+=e;while(p>0)d[y++]=255&l,l/=256,p-=8;return d[--y]|=128*v,d},l=function(t,e){var n,r=t.length,s=8*r-e-1,o=(1<<s)-1,a=o>>1,c=s-7,l=r-1,u=t[l--],h=127&u;u>>=7;while(c>0)h=256*h+t[l--],c-=8;n=h&(1<<-c)-1,h>>=-c,c+=e;while(c>0)n=256*n+t[l--],c-=8;if(0===h)h=1-a;else{if(h===o)return n?NaN:u?-1/0:1/0;n+=i(2,e),h-=a}return(u?-1:1)*n*i(2,h-e)};t.exports={pack:c,unpack:l}},"77d9":function(t,e,n){n("1d02")},7839:function(t,e){t.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},"785a":function(t,e,n){var r=n("cc12"),i=r("span").classList,s=i&&i.constructor&&i.constructor.prototype;t.exports=s===Object.prototype?void 0:s},"7b0b":function(t,e,n){var r=n("1d80"),i=Object;t.exports=function(t){return i(r(t))}},"7c73":function(t,e,n){var r,i=n("825a"),s=n("37e8"),o=n("7839"),a=n("d012"),c=n("1be4"),l=n("cc12"),u=n("f772"),h=">",d="<",p="prototype",f="script",m=u("IE_PROTO"),g=function(){},v=function(t){return d+f+h+t+d+"/"+f+h},y=function(t){t.write(v("")),t.close();var e=t.parentWindow.Object;return t=null,e},x=function(){var t,e=l("iframe"),n="java"+f+":";return e.style.display="none",c.appendChild(e),e.src=String(n),t=e.contentWindow.document,t.open(),t.write(v("document.F=Object")),t.close(),t.F},b=function(){try{r=new ActiveXObject("htmlfile")}catch(e){}b="undefined"!=typeof document?document.domain&&r?y(r):x():y(r);var t=o.length;while(t--)delete b[p][o[t]];return b()};a[m]=!0,t.exports=Object.create||function(t,e){var n;return null!==t?(g[p]=i(t),n=new g,g[p]=null,n[m]=t):n=b(),void 0===e?n:s.f(n,e)}},"7dd0":function(t,e,n){"use strict";var r=n("23e7"),i=n("c65b"),s=n("c430"),o=n("5e77"),a=n("1626"),c=n("9ed3"),l=n("e163"),u=n("d2bb"),h=n("d44e"),d=n("9112"),p=n("cb2d"),f=n("b622"),m=n("3f8c"),g=n("ae93"),v=o.PROPER,y=o.CONFIGURABLE,x=g.IteratorPrototype,b=g.BUGGY_SAFARI_ITERATORS,w=f("iterator"),_="keys",M="values",S="entries",T=function(){return this};t.exports=function(t,e,n,o,f,g,E){c(n,e,o);var A,L,R,C=function(t){if(t===f&&D)return D;if(!b&&t in N)return N[t];switch(t){case _:return function(){return new n(this,t)};case M:return function(){return new n(this,t)};case S:return function(){return new n(this,t)}}return function(){return new n(this)}},P=e+" Iterator",I=!1,N=t.prototype,O=N[w]||N["@@iterator"]||f&&N[f],D=!b&&O||C(f),k="Array"==e&&N.entries||O;if(k&&(A=l(k.call(new t)),A!==Object.prototype&&A.next&&(s||l(A)===x||(u?u(A,x):a(A[w])||p(A,w,T)),h(A,P,!0,!0),s&&(m[P]=T))),v&&f==M&&O&&O.name!==M&&(!s&&y?d(N,"name",M):(I=!0,D=function(){return i(O,this)})),f)if(L={values:C(M),keys:g?D:C(_),entries:C(S)},E)for(R in L)(b||I||!(R in N))&&p(N,R,L[R]);else r({target:e,proto:!0,forced:b||I},L);return s&&!E||N[w]===D||p(N,w,D,{name:f}),m[e]=D,L}},"7f9a":function(t,e,n){var r=n("da84"),i=n("1626"),s=n("8925"),o=r.WeakMap;t.exports=i(o)&&/native code/.test(s(o))},"81d5":function(t,e,n){"use strict";var r=n("7b0b"),i=n("23cb"),s=n("07fa");t.exports=function(t){var e=r(this),n=s(e),o=arguments.length,a=i(o>1?arguments[1]:void 0,n),c=o>2?arguments[2]:void 0,l=void 0===c?n:i(c,n);while(l>a)e[a++]=t;return e}},"825a":function(t,e,n){var r=n("861d"),i=String,s=TypeError;t.exports=function(t){if(r(t))return t;throw s(i(t)+" is not an object")}},"82f8":function(t,e,n){"use strict";var r=n("ebb5"),i=n("4d64").includes,s=r.aTypedArray,o=r.exportTypedArrayMethod;o("includes",(function(t){return i(s(this),t,arguments.length>1?arguments[1]:void 0)}))},"83ab":function(t,e,n){var r=n("d039");t.exports=!r((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]}))},8418:function(t,e,n){"use strict";var r=n("a04b"),i=n("9bf2"),s=n("5c6c");t.exports=function(t,e,n){var o=r(e);o in t?i.f(t,o,s(0,n)):t[o]=n}},"861d":function(t,e,n){var r=n("1626");t.exports=function(t){return"object"==typeof t?null!==t:r(t)}},8875:function(t,e,n){var r,i,s;(function(n,o){i=[],r=o,s="function"===typeof r?r.apply(e,i):r,void 0===s||(t.exports=s)})("undefined"!==typeof self&&self,(function(){function t(){var e=Object.getOwnPropertyDescriptor(document,"currentScript");if(!e&&"currentScript"in document&&document.currentScript)return document.currentScript;if(e&&e.get!==t&&document.currentScript)return document.currentScript;try{throw new Error}catch(p){var n,r,i,s=/.*at [^(]*\((.*):(.+):(.+)\)$/gi,o=/@([^@]*):(\d+):(\d+)\s*$/gi,a=s.exec(p.stack)||o.exec(p.stack),c=a&&a[1]||!1,l=a&&a[2]||!1,u=document.location.href.replace(document.location.hash,""),h=document.getElementsByTagName("script");c===u&&(n=document.documentElement.outerHTML,r=new RegExp("(?:[^\\n]+?\\n){0,"+(l-2)+"}[^<]*<script>([\\d\\D]*?)<\\/script>[\\d\\D]*","i"),i=n.replace(r,"$1").trim());for(var d=0;d<h.length;d++){if("interactive"===h[d].readyState)return h[d];if(h[d].src===c)return h[d];if(c===u&&h[d].innerHTML&&h[d].innerHTML.trim()===i)return h[d]}return null}}return t}))},8925:function(t,e,n){var r=n("e330"),i=n("1626"),s=n("c6cd"),o=r(Function.toString);i(s.inspectSource)||(s.inspectSource=function(t){return o(t)}),t.exports=s.inspectSource},"8aa7":function(t,e,n){var r=n("da84"),i=n("d039"),s=n("1c7e"),o=n("ebb5").NATIVE_ARRAY_BUFFER_VIEWS,a=r.ArrayBuffer,c=r.Int8Array;t.exports=!o||!i((function(){c(1)}))||!i((function(){new c(-1)}))||!s((function(t){new c,new c(null),new c(1.5),new c(t)}),!0)||i((function(){return 1!==new c(new a(2),1,void 0).length}))},"8bbf":function(e,n){e.exports=t},"907a":function(t,e,n){"use strict";var r=n("ebb5"),i=n("07fa"),s=n("5926"),o=r.aTypedArray,a=r.exportTypedArrayMethod;a("at",(function(t){var e=o(this),n=i(e),r=s(t),a=r>=0?r:n+r;return a<0||a>=n?void 0:e[a]}))},"90e3":function(t,e,n){var r=n("e330"),i=0,s=Math.random(),o=r(1..toString);t.exports=function(t){return"Symbol("+(void 0===t?"":t)+")_"+o(++i+s,36)}},9112:function(t,e,n){var r=n("83ab"),i=n("9bf2"),s=n("5c6c");t.exports=r?function(t,e,n){return i.f(t,e,s(1,n))}:function(t,e,n){return t[e]=n,t}},9263:function(t,e,n){"use strict";var r=n("c65b"),i=n("e330"),s=n("577e"),o=n("ad6d"),a=n("9f7f"),c=n("5692"),l=n("7c73"),u=n("69f3").get,h=n("fce3"),d=n("107c"),p=c("native-string-replace",String.prototype.replace),f=RegExp.prototype.exec,m=f,g=i("".charAt),v=i("".indexOf),y=i("".replace),x=i("".slice),b=function(){var t=/a/,e=/b*/g;return r(f,t,"a"),r(f,e,"a"),0!==t.lastIndex||0!==e.lastIndex}(),w=a.BROKEN_CARET,_=void 0!==/()??/.exec("")[1],M=b||_||w||h||d;M&&(m=function(t){var e,n,i,a,c,h,d,M=this,S=u(M),T=s(t),E=S.raw;if(E)return E.lastIndex=M.lastIndex,e=r(m,E,T),M.lastIndex=E.lastIndex,e;var A=S.groups,L=w&&M.sticky,R=r(o,M),C=M.source,P=0,I=T;if(L&&(R=y(R,"y",""),-1===v(R,"g")&&(R+="g"),I=x(T,M.lastIndex),M.lastIndex>0&&(!M.multiline||M.multiline&&"\n"!==g(T,M.lastIndex-1))&&(C="(?: "+C+")",I=" "+I,P++),n=new RegExp("^(?:"+C+")",R)),_&&(n=new RegExp("^"+C+"$(?!\\s)",R)),b&&(i=M.lastIndex),a=r(f,L?n:M,I),L?a?(a.input=x(a.input,P),a[0]=x(a[0],P),a.index=M.lastIndex,M.lastIndex+=a[0].length):M.lastIndex=0:b&&a&&(M.lastIndex=M.global?a.index+a[0].length:i),_&&a&&a.length>1&&r(p,a[0],n,(function(){for(c=1;c<arguments.length-2;c++)void 0===arguments[c]&&(a[c]=void 0)})),a&&A)for(a.groups=h=l(null),c=0;c<A.length;c++)d=A[c],h[d[0]]=a[d[1]];return a}),t.exports=m},"94ca":function(t,e,n){var r=n("d039"),i=n("1626"),s=/#|\.prototype\./,o=function(t,e){var n=c[a(t)];return n==u||n!=l&&(i(e)?r(e):!!e)},a=o.normalize=function(t){return String(t).replace(s,".").toLowerCase()},c=o.data={},l=o.NATIVE="N",u=o.POLYFILL="P";t.exports=o},"986a":function(t,e,n){"use strict";var r=n("ebb5"),i=n("a258").findLast,s=r.aTypedArray,o=r.exportTypedArrayMethod;o("findLast",(function(t){return i(s(this),t,arguments.length>1?arguments[1]:void 0)}))},"9a1f":function(t,e,n){var r=n("c65b"),i=n("59ed"),s=n("825a"),o=n("0d51"),a=n("35a1"),c=TypeError;t.exports=function(t,e){var n=arguments.length<2?a(t):e;if(i(n))return s(r(n,t));throw c(o(t)+" is not iterable")}},"9a8c":function(t,e,n){"use strict";var r=n("e330"),i=n("ebb5"),s=n("145e"),o=r(s),a=i.aTypedArray,c=i.exportTypedArrayMethod;c("copyWithin",(function(t,e){return o(a(this),t,e,arguments.length>2?arguments[2]:void 0)}))},"9bdd":function(t,e,n){var r=n("825a"),i=n("2a62");t.exports=function(t,e,n,s){try{return s?e(r(n)[0],n[1]):e(n)}catch(o){i(t,"throw",o)}}},"9bf2":function(t,e,n){var r=n("83ab"),i=n("0cfb"),s=n("aed9"),o=n("825a"),a=n("a04b"),c=TypeError,l=Object.defineProperty,u=Object.getOwnPropertyDescriptor,h="enumerable",d="configurable",p="writable";e.f=r?s?function(t,e,n){if(o(t),e=a(e),o(n),"function"===typeof t&&"prototype"===e&&"value"in n&&p in n&&!n[p]){var r=u(t,e);r&&r[p]&&(t[e]=n.value,n={configurable:d in n?n[d]:r[d],enumerable:h in n?n[h]:r[h],writable:!1})}return l(t,e,n)}:l:function(t,e,n){if(o(t),e=a(e),o(n),i)try{return l(t,e,n)}catch(r){}if("get"in n||"set"in n)throw c("Accessors not supported");return"value"in n&&(t[e]=n.value),t}},"9ed3":function(t,e,n){"use strict";var r=n("ae93").IteratorPrototype,i=n("7c73"),s=n("5c6c"),o=n("d44e"),a=n("3f8c"),c=function(){return this};t.exports=function(t,e,n,l){var u=e+" Iterator";return t.prototype=i(r,{next:s(+!l,n)}),o(t,u,!1,!0),a[u]=c,t}},"9f7f":function(t,e,n){var r=n("d039"),i=n("da84"),s=i.RegExp,o=r((function(){var t=s("a","y");return t.lastIndex=2,null!=t.exec("abcd")})),a=o||r((function(){return!s("a","y").sticky})),c=o||r((function(){var t=s("^r","gy");return t.lastIndex=2,null!=t.exec("str")}));t.exports={BROKEN_CARET:c,MISSED_STICKY:a,UNSUPPORTED_Y:o}},a04b:function(t,e,n){var r=n("c04e"),i=n("d9b5");t.exports=function(t){var e=r(t,"string");return i(e)?e:e+""}},a078:function(t,e,n){var r=n("0366"),i=n("c65b"),s=n("5087"),o=n("7b0b"),a=n("07fa"),c=n("9a1f"),l=n("35a1"),u=n("e95a"),h=n("ebb5").aTypedArrayConstructor;t.exports=function(t){var e,n,d,p,f,m,g=s(this),v=o(t),y=arguments.length,x=y>1?arguments[1]:void 0,b=void 0!==x,w=l(v);if(w&&!u(w)){f=c(v,w),m=f.next,v=[];while(!(p=i(m,f)).done)v.push(p.value)}for(b&&y>2&&(x=r(x,arguments[2])),n=a(v),d=new(h(g))(n),e=0;n>e;e++)d[e]=b?x(v[e],e):v[e];return d}},a258:function(t,e,n){var r=n("0366"),i=n("44ad"),s=n("7b0b"),o=n("07fa"),a=function(t){var e=1==t;return function(n,a,c){var l,u,h=s(n),d=i(h),p=r(a,c),f=o(d);while(f-- >0)if(l=d[f],u=p(l,f,h),u)switch(t){case 0:return l;case 1:return f}return e?-1:void 0}};t.exports={findLast:a(0),findLastIndex:a(1)}},a4d3:function(t,e,n){n("d9f5"),n("b4f8"),n("c513"),n("e9c4"),n("5a47")},a630:function(t,e,n){var r=n("23e7"),i=n("4df4"),s=n("1c7e"),o=!s((function(t){Array.from(t)}));r({target:"Array",stat:!0,forced:o},{from:i})},a640:function(t,e,n){"use strict";var r=n("d039");t.exports=function(t,e){var n=[][t];return!!n&&r((function(){n.call(null,e||function(){return 1},1)}))}},a975:function(t,e,n){"use strict";var r=n("ebb5"),i=n("b727").every,s=r.aTypedArray,o=r.exportTypedArrayMethod;o("every",(function(t){return i(s(this),t,arguments.length>1?arguments[1]:void 0)}))},a981:function(t,e){t.exports="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView},a9e3:function(t,e,n){"use strict";var r=n("83ab"),i=n("da84"),s=n("e330"),o=n("94ca"),a=n("cb2d"),c=n("1a2d"),l=n("7156"),u=n("3a9b"),h=n("d9b5"),d=n("c04e"),p=n("d039"),f=n("241c").f,m=n("06cf").f,g=n("9bf2").f,v=n("408a"),y=n("58a8").trim,x="Number",b=i[x],w=b.prototype,_=i.TypeError,M=s("".slice),S=s("".charCodeAt),T=function(t){var e=d(t,"number");return"bigint"==typeof e?e:E(e)},E=function(t){var e,n,r,i,s,o,a,c,l=d(t,"number");if(h(l))throw _("Cannot convert a Symbol value to a number");if("string"==typeof l&&l.length>2)if(l=y(l),e=S(l,0),43===e||45===e){if(n=S(l,2),88===n||120===n)return NaN}else if(48===e){switch(S(l,1)){case 66:case 98:r=2,i=49;break;case 79:case 111:r=8,i=55;break;default:return+l}for(s=M(l,2),o=s.length,a=0;a<o;a++)if(c=S(s,a),c<48||c>i)return NaN;return parseInt(s,r)}return+l};if(o(x,!b(" 0o1")||!b("0b1")||b("+0x1"))){for(var A,L=function(t){var e=arguments.length<1?0:b(T(t)),n=this;return u(w,n)&&p((function(){v(n)}))?l(Object(e),n,L):e},R=r?f(b):"MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,isFinite,isInteger,isNaN,isSafeInteger,parseFloat,parseInt,fromString,range".split(","),C=0;R.length>C;C++)c(b,A=R[C])&&!c(L,A)&&g(L,A,m(b,A));L.prototype=w,w.constructor=L,a(i,x,L,{constructor:!0})}},ab36:function(t,e,n){var r=n("861d"),i=n("9112");t.exports=function(t,e){r(e)&&"cause"in e&&i(t,"cause",e.cause)}},ac1f:function(t,e,n){"use strict";var r=n("23e7"),i=n("9263");r({target:"RegExp",proto:!0,forced:/./.exec!==i},{exec:i})},ace4:function(t,e,n){"use strict";var r=n("23e7"),i=n("e330"),s=n("d039"),o=n("621a"),a=n("825a"),c=n("23cb"),l=n("50c4"),u=n("4840"),h=o.ArrayBuffer,d=o.DataView,p=d.prototype,f=i(h.prototype.slice),m=i(p.getUint8),g=i(p.setUint8),v=s((function(){return!new h(2).slice(1,void 0).byteLength}));r({target:"ArrayBuffer",proto:!0,unsafe:!0,forced:v},{slice:function(t,e){if(f&&void 0===e)return f(a(this),t);var n=a(this).byteLength,r=c(t,n),i=c(void 0===e?n:e,n),s=new(u(this,h))(l(i-r)),o=new d(this),p=new d(s),v=0;while(r<i)g(p,v++,m(o,r++));return s}})},ad6d:function(t,e,n){"use strict";var r=n("825a");t.exports=function(){var t=r(this),e="";return t.hasIndices&&(e+="d"),t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),t.dotAll&&(e+="s"),t.unicode&&(e+="u"),t.unicodeSets&&(e+="v"),t.sticky&&(e+="y"),e}},addb:function(t,e,n){var r=n("4dae"),i=Math.floor,s=function(t,e){var n=t.length,c=i(n/2);return n<8?o(t,e):a(t,s(r(t,0,c),e),s(r(t,c),e),e)},o=function(t,e){var n,r,i=t.length,s=1;while(s<i){r=s,n=t[s];while(r&&e(t[r-1],n)>0)t[r]=t[--r];r!==s++&&(t[r]=n)}return t},a=function(t,e,n,r){var i=e.length,s=n.length,o=0,a=0;while(o<i||a<s)t[o+a]=o<i&&a<s?r(e[o],n[a])<=0?e[o++]:n[a++]:o<i?e[o++]:n[a++];return t};t.exports=s},ae93:function(t,e,n){"use strict";var r,i,s,o=n("d039"),a=n("1626"),c=n("7c73"),l=n("e163"),u=n("cb2d"),h=n("b622"),d=n("c430"),p=h("iterator"),f=!1;[].keys&&(s=[].keys(),"next"in s?(i=l(l(s)),i!==Object.prototype&&(r=i)):f=!0);var m=void 0==r||o((function(){var t={};return r[p].call(t)!==t}));m?r={}:d&&(r=c(r)),a(r[p])||u(r,p,(function(){return this})),t.exports={IteratorPrototype:r,BUGGY_SAFARI_ITERATORS:f}},aeb0:function(t,e,n){var r=n("9bf2").f;t.exports=function(t,e,n){n in t||r(t,n,{configurable:!0,get:function(){return e[n]},set:function(t){e[n]=t}})}},aed9:function(t,e,n){var r=n("83ab"),i=n("d039");t.exports=r&&i((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype}))},b041:function(t,e,n){"use strict";var r=n("00ee"),i=n("f5df");t.exports=r?{}.toString:function(){return"[object "+i(this)+"]"}},b0c0:function(t,e,n){var r=n("83ab"),i=n("5e77").EXISTS,s=n("e330"),o=n("9bf2").f,a=Function.prototype,c=s(a.toString),l=/function\b(?:\s|\/\*[\S\s]*?\*\/|\/\/[^\n\r]*[\n\r]+)*([^\s(/]*)/,u=s(l.exec),h="name";r&&!i&&o(a,h,{configurable:!0,get:function(){try{return u(l,c(this))[1]}catch(t){return""}}})},b39a:function(t,e,n){"use strict";var r=n("da84"),i=n("2ba4"),s=n("ebb5"),o=n("d039"),a=n("f36a"),c=r.Int8Array,l=s.aTypedArray,u=s.exportTypedArrayMethod,h=[].toLocaleString,d=!!c&&o((function(){h.call(new c(1))})),p=o((function(){return[1,2].toLocaleString()!=new c([1,2]).toLocaleString()}))||!o((function(){c.prototype.toLocaleString.call([1,2])}));u("toLocaleString",(function(){return i(h,d?a(l(this)):l(this),a(arguments))}),p)},b42e:function(t,e){var n=Math.ceil,r=Math.floor;t.exports=Math.trunc||function(t){var e=+t;return(e>0?r:n)(e)}},b4f8:function(t,e,n){var r=n("23e7"),i=n("d066"),s=n("1a2d"),o=n("577e"),a=n("5692"),c=n("3d87"),l=a("string-to-symbol-registry"),u=a("symbol-to-string-registry");r({target:"Symbol",stat:!0,forced:!c},{for:function(t){var e=o(t);if(s(l,e))return l[e];var n=i("Symbol")(e);return l[e]=n,u[n]=e,n}})},b622:function(t,e,n){var r=n("da84"),i=n("5692"),s=n("1a2d"),o=n("90e3"),a=n("4930"),c=n("fdbf"),l=i("wks"),u=r.Symbol,h=u&&u["for"],d=c?u:u&&u.withoutSetter||o;t.exports=function(t){if(!s(l,t)||!a&&"string"!=typeof l[t]){var e="Symbol."+t;a&&s(u,t)?l[t]=u[t]:l[t]=c&&h?h(e):d(e)}return l[t]}},b6b7:function(t,e,n){var r=n("ebb5"),i=n("4840"),s=r.aTypedArrayConstructor,o=r.getTypedArrayConstructor;t.exports=function(t){return s(i(t,o(t)))}},b727:function(t,e,n){var r=n("0366"),i=n("e330"),s=n("44ad"),o=n("7b0b"),a=n("07fa"),c=n("65f0"),l=i([].push),u=function(t){var e=1==t,n=2==t,i=3==t,u=4==t,h=6==t,d=7==t,p=5==t||h;return function(f,m,g,v){for(var y,x,b=o(f),w=s(b),_=r(m,g),M=a(w),S=0,T=v||c,E=e?T(f,M):n||d?T(f,0):void 0;M>S;S++)if((p||S in w)&&(y=w[S],x=_(y,S,b),t))if(e)E[S]=x;else if(x)switch(t){case 3:return!0;case 5:return y;case 6:return S;case 2:l(E,y)}else switch(t){case 4:return!1;case 7:l(E,y)}return h?-1:i||u?u:E}};t.exports={forEach:u(0),map:u(1),filter:u(2),some:u(3),every:u(4),find:u(5),findIndex:u(6),filterReject:u(7)}},b980:function(t,e,n){var r=n("d039"),i=n("5c6c");t.exports=!r((function(){var t=Error("a");return!("stack"in t)||(Object.defineProperty(t,"stack",i(1,7)),7!==t.stack)}))},c04e:function(t,e,n){var r=n("c65b"),i=n("861d"),s=n("d9b5"),o=n("dc4a"),a=n("485a"),c=n("b622"),l=TypeError,u=c("toPrimitive");t.exports=function(t,e){if(!i(t)||s(t))return t;var n,c=o(t,u);if(c){if(void 0===e&&(e="default"),n=r(c,t,e),!i(n)||s(n))return n;throw l("Can't convert object to primitive value")}return void 0===e&&(e="number"),a(t,e)}},c1ac:function(t,e,n){"use strict";var r=n("ebb5"),i=n("b727").filter,s=n("1448"),o=r.aTypedArray,a=r.exportTypedArrayMethod;a("filter",(function(t){var e=i(o(this),t,arguments.length>1?arguments[1]:void 0);return s(this,e)}))},c430:function(t,e){t.exports=!1},c513:function(t,e,n){var r=n("23e7"),i=n("1a2d"),s=n("d9b5"),o=n("0d51"),a=n("5692"),c=n("3d87"),l=a("symbol-to-string-registry");r({target:"Symbol",stat:!0,forced:!c},{keyFor:function(t){if(!s(t))throw TypeError(o(t)+" is not a symbol");if(i(l,t))return l[t]}})},c65b:function(t,e,n){var r=n("40d5"),i=Function.prototype.call;t.exports=r?i.bind(i):function(){return i.apply(i,arguments)}},c6b6:function(t,e,n){var r=n("e330"),i=r({}.toString),s=r("".slice);t.exports=function(t){return s(i(t),8,-1)}},c6cd:function(t,e,n){var r=n("da84"),i=n("6374"),s="__core-js_shared__",o=r[s]||i(s,{});t.exports=o},c770:function(t,e,n){var r=n("e330"),i=Error,s=r("".replace),o=function(t){return String(i(t).stack)}("zxcasd"),a=/\n\s*at [^:]*:[^\n]*/,c=a.test(o);t.exports=function(t,e){if(c&&"string"==typeof t&&!i.prepareStackTrace)while(e--)t=s(t,a,"");return t}},c8ba:function(t,e){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(r){"object"===typeof window&&(n=window)}t.exports=n},ca84:function(t,e,n){var r=n("e330"),i=n("1a2d"),s=n("fc6a"),o=n("4d64").indexOf,a=n("d012"),c=r([].push);t.exports=function(t,e){var n,r=s(t),l=0,u=[];for(n in r)!i(a,n)&&i(r,n)&&c(u,n);while(e.length>l)i(r,n=e[l++])&&(~o(u,n)||c(u,n));return u}},ca91:function(t,e,n){"use strict";var r=n("ebb5"),i=n("d58f").left,s=r.aTypedArray,o=r.exportTypedArrayMethod;o("reduce",(function(t){var e=arguments.length;return i(s(this),t,e,e>1?arguments[1]:void 0)}))},cb2d:function(t,e,n){var r=n("1626"),i=n("9bf2"),s=n("13d2"),o=n("6374");t.exports=function(t,e,n,a){a||(a={});var c=a.enumerable,l=void 0!==a.name?a.name:e;if(r(n)&&s(n,l,a),a.global)c?t[e]=n:o(e,n);else{try{a.unsafe?t[e]&&(c=!0):delete t[e]}catch(u){}c?t[e]=n:i.f(t,e,{value:n,enumerable:!1,configurable:!a.nonConfigurable,writable:!a.nonWritable})}return t}},cc12:function(t,e,n){var r=n("da84"),i=n("861d"),s=r.document,o=i(s)&&i(s.createElement);t.exports=function(t){return o?s.createElement(t):{}}},cca6:function(t,e,n){var r=n("23e7"),i=n("60da");r({target:"Object",stat:!0,arity:2,forced:Object.assign!==i},{assign:i})},cd26:function(t,e,n){"use strict";var r=n("ebb5"),i=r.aTypedArray,s=r.exportTypedArrayMethod,o=Math.floor;s("reverse",(function(){var t,e=this,n=i(e).length,r=o(n/2),s=0;while(s<r)t=e[s],e[s++]=e[--n],e[n]=t;return e}))},cfc3:function(t,e,n){var r=n("74e8");r("Float32",(function(t){return function(e,n,r){return t(this,e,n,r)}}))},d012:function(t,e){t.exports={}},d039:function(t,e){t.exports=function(t){try{return!!t()}catch(e){return!0}}},d066:function(t,e,n){var r=n("da84"),i=n("1626"),s=function(t){return i(t)?t:void 0};t.exports=function(t,e){return arguments.length<2?s(r[t]):r[t]&&r[t][e]}},d139:function(t,e,n){"use strict";var r=n("ebb5"),i=n("b727").find,s=r.aTypedArray,o=r.exportTypedArrayMethod;o("find",(function(t){return i(s(this),t,arguments.length>1?arguments[1]:void 0)}))},d1e7:function(t,e,n){"use strict";var r={}.propertyIsEnumerable,i=Object.getOwnPropertyDescriptor,s=i&&!r.call({1:2},1);e.f=s?function(t){var e=i(this,t);return!!e&&e.enumerable}:r},d28b:function(t,e,n){var r=n("746f");r("iterator")},d2bb:function(t,e,n){var r=n("e330"),i=n("825a"),s=n("3bbe");t.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var t,e=!1,n={};try{t=r(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set),t(n,[]),e=n instanceof Array}catch(o){}return function(n,r){return i(n),s(r),e?t(n,r):n.__proto__=r,n}}():void 0)},d3b7:function(t,e,n){var r=n("00ee"),i=n("cb2d"),s=n("b041");r||i(Object.prototype,"toString",s,{unsafe:!0})},d44e:function(t,e,n){var r=n("9bf2").f,i=n("1a2d"),s=n("b622"),o=s("toStringTag");t.exports=function(t,e,n){t&&!n&&(t=t.prototype),t&&!i(t,o)&&r(t,o,{configurable:!0,value:e})}},d58f:function(t,e,n){var r=n("59ed"),i=n("7b0b"),s=n("44ad"),o=n("07fa"),a=TypeError,c=function(t){return function(e,n,c,l){r(n);var u=i(e),h=s(u),d=o(u),p=t?d-1:0,f=t?-1:1;if(c<2)while(1){if(p in h){l=h[p],p+=f;break}if(p+=f,t?p<0:d<=p)throw a("Reduce of empty array with no initial value")}for(;t?p>=0:d>p;p+=f)p in h&&(l=n(l,h[p],p,u));return l}};t.exports={left:c(!1),right:c(!0)}},d5d6:function(t,e,n){"use strict";var r=n("ebb5"),i=n("b727").forEach,s=r.aTypedArray,o=r.exportTypedArrayMethod;o("forEach",(function(t){i(s(this),t,arguments.length>1?arguments[1]:void 0)}))},d998:function(t,e,n){var r=n("342f");t.exports=/MSIE|Trident/.test(r)},d9b5:function(t,e,n){var r=n("d066"),i=n("1626"),s=n("3a9b"),o=n("fdbf"),a=Object;t.exports=o?function(t){return"symbol"==typeof t}:function(t){var e=r("Symbol");return i(e)&&s(e.prototype,a(t))}},d9e2:function(t,e,n){var r=n("23e7"),i=n("da84"),s=n("2ba4"),o=n("e5cb"),a="WebAssembly",c=i[a],l=7!==Error("e",{cause:7}).cause,u=function(t,e){var n={};n[t]=o(t,e,l),r({global:!0,constructor:!0,arity:1,forced:l},n)},h=function(t,e){if(c&&c[t]){var n={};n[t]=o(a+"."+t,e,l),r({target:a,stat:!0,constructor:!0,arity:1,forced:l},n)}};u("Error",(function(t){return function(e){return s(t,this,arguments)}})),u("EvalError",(function(t){return function(e){return s(t,this,arguments)}})),u("RangeError",(function(t){return function(e){return s(t,this,arguments)}})),u("ReferenceError",(function(t){return function(e){return s(t,this,arguments)}})),u("SyntaxError",(function(t){return function(e){return s(t,this,arguments)}})),u("TypeError",(function(t){return function(e){return s(t,this,arguments)}})),u("URIError",(function(t){return function(e){return s(t,this,arguments)}})),h("CompileError",(function(t){return function(e){return s(t,this,arguments)}})),h("LinkError",(function(t){return function(e){return s(t,this,arguments)}})),h("RuntimeError",(function(t){return function(e){return s(t,this,arguments)}}))},d9f5:function(t,e,n){"use strict";var r=n("23e7"),i=n("da84"),s=n("c65b"),o=n("e330"),a=n("c430"),c=n("83ab"),l=n("4930"),u=n("d039"),h=n("1a2d"),d=n("3a9b"),p=n("825a"),f=n("fc6a"),m=n("a04b"),g=n("577e"),v=n("5c6c"),y=n("7c73"),x=n("df75"),b=n("241c"),w=n("057f"),_=n("7418"),M=n("06cf"),S=n("9bf2"),T=n("37e8"),E=n("d1e7"),A=n("cb2d"),L=n("5692"),R=n("f772"),C=n("d012"),P=n("90e3"),I=n("b622"),N=n("e538"),O=n("746f"),D=n("57b9"),k=n("d44e"),z=n("69f3"),F=n("b727").forEach,U=R("hidden"),B="Symbol",H="prototype",G=z.set,V=z.getterFor(B),W=Object[H],j=i.Symbol,q=j&&j[H],X=i.TypeError,Y=i.QObject,J=M.f,Z=S.f,K=w.f,$=E.f,Q=o([].push),tt=L("symbols"),et=L("op-symbols"),nt=L("wks"),rt=!Y||!Y[H]||!Y[H].findChild,it=c&&u((function(){return 7!=y(Z({},"a",{get:function(){return Z(this,"a",{value:7}).a}})).a}))?function(t,e,n){var r=J(W,e);r&&delete W[e],Z(t,e,n),r&&t!==W&&Z(W,e,r)}:Z,st=function(t,e){var n=tt[t]=y(q);return G(n,{type:B,tag:t,description:e}),c||(n.description=e),n},ot=function(t,e,n){t===W&&ot(et,e,n),p(t);var r=m(e);return p(n),h(tt,r)?(n.enumerable?(h(t,U)&&t[U][r]&&(t[U][r]=!1),n=y(n,{enumerable:v(0,!1)})):(h(t,U)||Z(t,U,v(1,{})),t[U][r]=!0),it(t,r,n)):Z(t,r,n)},at=function(t,e){p(t);var n=f(e),r=x(n).concat(dt(n));return F(r,(function(e){c&&!s(lt,n,e)||ot(t,e,n[e])})),t},ct=function(t,e){return void 0===e?y(t):at(y(t),e)},lt=function(t){var e=m(t),n=s($,this,e);return!(this===W&&h(tt,e)&&!h(et,e))&&(!(n||!h(this,e)||!h(tt,e)||h(this,U)&&this[U][e])||n)},ut=function(t,e){var n=f(t),r=m(e);if(n!==W||!h(tt,r)||h(et,r)){var i=J(n,r);return!i||!h(tt,r)||h(n,U)&&n[U][r]||(i.enumerable=!0),i}},ht=function(t){var e=K(f(t)),n=[];return F(e,(function(t){h(tt,t)||h(C,t)||Q(n,t)})),n},dt=function(t){var e=t===W,n=K(e?et:f(t)),r=[];return F(n,(function(t){!h(tt,t)||e&&!h(W,t)||Q(r,tt[t])})),r};l||(j=function(){if(d(q,this))throw X("Symbol is not a constructor");var t=arguments.length&&void 0!==arguments[0]?g(arguments[0]):void 0,e=P(t),n=function(t){this===W&&s(n,et,t),h(this,U)&&h(this[U],e)&&(this[U][e]=!1),it(this,e,v(1,t))};return c&&rt&&it(W,e,{configurable:!0,set:n}),st(e,t)},q=j[H],A(q,"toString",(function(){return V(this).tag})),A(j,"withoutSetter",(function(t){return st(P(t),t)})),E.f=lt,S.f=ot,T.f=at,M.f=ut,b.f=w.f=ht,_.f=dt,N.f=function(t){return st(I(t),t)},c&&(Z(q,"description",{configurable:!0,get:function(){return V(this).description}}),a||A(W,"propertyIsEnumerable",lt,{unsafe:!0}))),r({global:!0,constructor:!0,wrap:!0,forced:!l,sham:!l},{Symbol:j}),F(x(nt),(function(t){O(t)})),r({target:B,stat:!0,forced:!l},{useSetter:function(){rt=!0},useSimple:function(){rt=!1}}),r({target:"Object",stat:!0,forced:!l,sham:!c},{create:ct,defineProperty:ot,defineProperties:at,getOwnPropertyDescriptor:ut}),r({target:"Object",stat:!0,forced:!l},{getOwnPropertyNames:ht}),D(),k(j,B),C[U]=!0},da84:function(t,e,n){(function(e){var n=function(t){return t&&t.Math==Math&&t};t.exports=n("object"==typeof globalThis&&globalThis)||n("object"==typeof window&&window)||n("object"==typeof self&&self)||n("object"==typeof e&&e)||function(){return this}()||Function("return this")()}).call(this,n("c8ba"))},dc4a:function(t,e,n){var r=n("59ed");t.exports=function(t,e){var n=t[e];return null==n?void 0:r(n)}},ddb0:function(t,e,n){var r=n("da84"),i=n("fdbc"),s=n("785a"),o=n("e260"),a=n("9112"),c=n("b622"),l=c("iterator"),u=c("toStringTag"),h=o.values,d=function(t,e){if(t){if(t[l]!==h)try{a(t,l,h)}catch(r){t[l]=h}if(t[u]||a(t,u,e),i[e])for(var n in o)if(t[n]!==o[n])try{a(t,n,o[n])}catch(r){t[n]=o[n]}}};for(var p in i)d(r[p]&&r[p].prototype,p);d(s,"DOMTokenList")},df75:function(t,e,n){var r=n("ca84"),i=n("7839");t.exports=Object.keys||function(t){return r(t,i)}},dfb9:function(t,e,n){var r=n("07fa");t.exports=function(t,e){var n=0,i=r(e),s=new t(i);while(i>n)s[n]=e[n++];return s}},e01a:function(t,e,n){"use strict";var r=n("23e7"),i=n("83ab"),s=n("da84"),o=n("e330"),a=n("1a2d"),c=n("1626"),l=n("3a9b"),u=n("577e"),h=n("9bf2").f,d=n("e893"),p=s.Symbol,f=p&&p.prototype;if(i&&c(p)&&(!("description"in f)||void 0!==p().description)){var m={},g=function(){var t=arguments.length<1||void 0===arguments[0]?void 0:u(arguments[0]),e=l(f,this)?new p(t):void 0===t?p():p(t);return""===t&&(m[e]=!0),e};d(g,p),g.prototype=f,f.constructor=g;var v="Symbol(test)"==String(p("test")),y=o(f.toString),x=o(f.valueOf),b=/^Symbol\((.*)\)[^)]+$/,w=o("".replace),_=o("".slice);h(f,"description",{configurable:!0,get:function(){var t=x(this),e=y(t);if(a(m,t))return"";var n=v?_(e,7,-1):w(e,b,"$1");return""===n?void 0:n}}),r({global:!0,constructor:!0,forced:!0},{Symbol:g})}},e163:function(t,e,n){var r=n("1a2d"),i=n("1626"),s=n("7b0b"),o=n("f772"),a=n("e177"),c=o("IE_PROTO"),l=Object,u=l.prototype;t.exports=a?l.getPrototypeOf:function(t){var e=s(t);if(r(e,c))return e[c];var n=e.constructor;return i(n)&&e instanceof n?n.prototype:e instanceof l?u:null}},e177:function(t,e,n){var r=n("d039");t.exports=!r((function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype}))},e260:function(t,e,n){"use strict";var r=n("fc6a"),i=n("44d2"),s=n("3f8c"),o=n("69f3"),a=n("9bf2").f,c=n("7dd0"),l=n("c430"),u=n("83ab"),h="Array Iterator",d=o.set,p=o.getterFor(h);t.exports=c(Array,"Array",(function(t,e){d(this,{type:h,target:r(t),index:0,kind:e})}),(function(){var t=p(this),e=t.target,n=t.kind,r=t.index++;return!e||r>=e.length?(t.target=void 0,{value:void 0,done:!0}):"keys"==n?{value:r,done:!1}:"values"==n?{value:e[r],done:!1}:{value:[r,e[r]],done:!1}}),"values");var f=s.Arguments=s.Array;if(i("keys"),i("values"),i("entries"),!l&&u&&"values"!==f.name)try{a(f,"name",{value:"values"})}catch(m){}},e330:function(t,e,n){var r=n("40d5"),i=Function.prototype,s=i.bind,o=i.call,a=r&&s.bind(o,o);t.exports=r?function(t){return t&&a(t)}:function(t){return t&&function(){return o.apply(t,arguments)}}},e391:function(t,e,n){var r=n("577e");t.exports=function(t,e){return void 0===t?arguments.length<2?"":e:r(t)}},e538:function(t,e,n){var r=n("b622");e.f=r},e58c:function(t,e,n){"use strict";var r=n("2ba4"),i=n("fc6a"),s=n("5926"),o=n("07fa"),a=n("a640"),c=Math.min,l=[].lastIndexOf,u=!!l&&1/[1].lastIndexOf(1,-0)<0,h=a("lastIndexOf"),d=u||!h;t.exports=d?function(t){if(u)return r(l,this,arguments)||0;var e=i(this),n=o(e),a=n-1;for(arguments.length>1&&(a=c(a,s(arguments[1]))),a<0&&(a=n+a);a>=0;a--)if(a in e&&e[a]===t)return a||0;return-1}:l},e5cb:function(t,e,n){"use strict";var r=n("d066"),i=n("1a2d"),s=n("9112"),o=n("3a9b"),a=n("d2bb"),c=n("e893"),l=n("aeb0"),u=n("7156"),h=n("e391"),d=n("ab36"),p=n("c770"),f=n("b980"),m=n("83ab"),g=n("c430");t.exports=function(t,e,n,v){var y="stackTraceLimit",x=v?2:1,b=t.split("."),w=b[b.length-1],_=r.apply(null,b);if(_){var M=_.prototype;if(!g&&i(M,"cause")&&delete M.cause,!n)return _;var S=r("Error"),T=e((function(t,e){var n=h(v?e:t,void 0),r=v?new _(t):new _;return void 0!==n&&s(r,"message",n),f&&s(r,"stack",p(r.stack,2)),this&&o(M,this)&&u(r,this,T),arguments.length>x&&d(r,arguments[x]),r}));if(T.prototype=M,"Error"!==w?a?a(T,S):c(T,S,{name:!0}):m&&y in _&&(l(T,_,y),l(T,_,"prepareStackTrace")),c(T,_),!g)try{M.name!==w&&s(M,"name",w),M.constructor=T}catch(E){}return T}}},e893:function(t,e,n){var r=n("1a2d"),i=n("56ef"),s=n("06cf"),o=n("9bf2");t.exports=function(t,e,n){for(var a=i(e),c=o.f,l=s.f,u=0;u<a.length;u++){var h=a[u];r(t,h)||n&&r(n,h)||c(t,h,l(e,h))}}},e8b5:function(t,e,n){var r=n("c6b6");t.exports=Array.isArray||function(t){return"Array"==r(t)}},e91f:function(t,e,n){"use strict";var r=n("ebb5"),i=n("4d64").indexOf,s=r.aTypedArray,o=r.exportTypedArrayMethod;o("indexOf",(function(t){return i(s(this),t,arguments.length>1?arguments[1]:void 0)}))},e95a:function(t,e,n){var r=n("b622"),i=n("3f8c"),s=r("iterator"),o=Array.prototype;t.exports=function(t){return void 0!==t&&(i.Array===t||o[s]===t)}},e9c4:function(t,e,n){var r=n("23e7"),i=n("d066"),s=n("2ba4"),o=n("c65b"),a=n("e330"),c=n("d039"),l=n("e8b5"),u=n("1626"),h=n("861d"),d=n("d9b5"),p=n("f36a"),f=n("4930"),m=i("JSON","stringify"),g=a(/./.exec),v=a("".charAt),y=a("".charCodeAt),x=a("".replace),b=a(1..toString),w=/[\uD800-\uDFFF]/g,_=/^[\uD800-\uDBFF]$/,M=/^[\uDC00-\uDFFF]$/,S=!f||c((function(){var t=i("Symbol")();return"[null]"!=m([t])||"{}"!=m({a:t})||"{}"!=m(Object(t))})),T=c((function(){return'"\\udf06\\ud834"'!==m("\udf06\ud834")||'"\\udead"'!==m("\udead")})),E=function(t,e){var n=p(arguments),r=e;if((h(e)||void 0!==t)&&!d(t))return l(e)||(e=function(t,e){if(u(r)&&(e=o(r,this,t,e)),!d(e))return e}),n[1]=e,s(m,null,n)},A=function(t,e,n){var r=v(n,e-1),i=v(n,e+1);return g(_,t)&&!g(M,i)||g(M,t)&&!g(_,r)?"\\u"+b(y(t,0),16):t};m&&r({target:"JSON",stat:!0,arity:3,forced:S||T},{stringify:function(t,e,n){var r=p(arguments),i=s(S?E:m,null,r);return T&&"string"==typeof i?x(i,w,A):i}})},eac5:function(t,e,n){var r=n("861d"),i=Math.floor;t.exports=Number.isInteger||function(t){return!r(t)&&isFinite(t)&&i(t)===t}},ebb5:function(t,e,n){"use strict";var r,i,s,o=n("a981"),a=n("83ab"),c=n("da84"),l=n("1626"),u=n("861d"),h=n("1a2d"),d=n("f5df"),p=n("0d51"),f=n("9112"),m=n("cb2d"),g=n("9bf2").f,v=n("3a9b"),y=n("e163"),x=n("d2bb"),b=n("b622"),w=n("90e3"),_=n("69f3"),M=_.enforce,S=_.get,T=c.Int8Array,E=T&&T.prototype,A=c.Uint8ClampedArray,L=A&&A.prototype,R=T&&y(T),C=E&&y(E),P=Object.prototype,I=c.TypeError,N=b("toStringTag"),O=w("TYPED_ARRAY_TAG"),D="TypedArrayConstructor",k=o&&!!x&&"Opera"!==d(c.opera),z=!1,F={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},U={BigInt64Array:8,BigUint64Array:8},B=function(t){if(!u(t))return!1;var e=d(t);return"DataView"===e||h(F,e)||h(U,e)},H=function(t){var e=y(t);if(u(e)){var n=S(e);return n&&h(n,D)?n[D]:H(e)}},G=function(t){if(!u(t))return!1;var e=d(t);return h(F,e)||h(U,e)},V=function(t){if(G(t))return t;throw I("Target is not a typed array")},W=function(t){if(l(t)&&(!x||v(R,t)))return t;throw I(p(t)+" is not a typed array constructor")},j=function(t,e,n,r){if(a){if(n)for(var i in F){var s=c[i];if(s&&h(s.prototype,t))try{delete s.prototype[t]}catch(o){try{s.prototype[t]=e}catch(l){}}}C[t]&&!n||m(C,t,n?e:k&&E[t]||e,r)}},q=function(t,e,n){var r,i;if(a){if(x){if(n)for(r in F)if(i=c[r],i&&h(i,t))try{delete i[t]}catch(s){}if(R[t]&&!n)return;try{return m(R,t,n?e:k&&R[t]||e)}catch(s){}}for(r in F)i=c[r],!i||i[t]&&!n||m(i,t,e)}};for(r in F)i=c[r],s=i&&i.prototype,s?M(s)[D]=i:k=!1;for(r in U)i=c[r],s=i&&i.prototype,s&&(M(s)[D]=i);if((!k||!l(R)||R===Function.prototype)&&(R=function(){throw I("Incorrect invocation")},k))for(r in F)c[r]&&x(c[r],R);if((!k||!C||C===P)&&(C=R.prototype,k))for(r in F)c[r]&&x(c[r].prototype,C);if(k&&y(L)!==C&&x(L,C),a&&!h(C,N))for(r in z=!0,g(C,N,{get:function(){return u(this)?this[O]:void 0}}),F)c[r]&&f(c[r],O,r);t.exports={NATIVE_ARRAY_BUFFER_VIEWS:k,TYPED_ARRAY_TAG:z&&O,aTypedArray:V,aTypedArrayConstructor:W,exportTypedArrayMethod:j,exportTypedArrayStaticMethod:q,getTypedArrayConstructor:H,isView:B,isTypedArray:G,TypedArray:R,TypedArrayPrototype:C}},f36a:function(t,e,n){var r=n("e330");t.exports=r([].slice)},f495:function(t,e,n){var r=n("c04e"),i=TypeError;t.exports=function(t){var e=r(t,"number");if("number"==typeof e)throw i("Can't convert number to bigint");return BigInt(e)}},f5df:function(t,e,n){var r=n("00ee"),i=n("1626"),s=n("c6b6"),o=n("b622"),a=o("toStringTag"),c=Object,l="Arguments"==s(function(){return arguments}()),u=function(t,e){try{return t[e]}catch(n){}};t.exports=r?s:function(t){var e,n,r;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(n=u(e=c(t),a))?n:l?s(e):"Object"==(r=s(e))&&i(e.callee)?"Arguments":r}},f772:function(t,e,n){var r=n("5692"),i=n("90e3"),s=r("keys");t.exports=function(t){return s[t]||(s[t]=i(t))}},f8cd:function(t,e,n){var r=n("5926"),i=RangeError;t.exports=function(t){var e=r(t);if(e<0)throw i("The argument can't be less than 0");return e}},fa9e:function(t,e,n){n("986a")},fb15:function(t,e,n){"use strict";n.r(e),n.d(e,"install",(function(){return Ow})),n.d(e,"ModelObj",(function(){return qg})),n.d(e,"ModelFbx",(function(){return ib})),n.d(e,"ModelThree",(function(){return cb})),n.d(e,"ModelJson",(function(){return Pw})),n.d(e,"ModelStl",(function(){return mb})),n.d(e,"ModelPly",(function(){return _b})),n.d(e,"ModelCollada",(function(){return Cb})),n.d(e,"ModelDae",(function(){return Iw})),n.d(e,"ModelGltf",(function(){return Cw}));var r={};if(n.r(r),n.d(r,"Deflate",(function(){return fy})),n.d(r,"AsyncDeflate",(function(){return my})),n.d(r,"deflate",(function(){return gy})),n.d(r,"deflateSync",(function(){return vy})),n.d(r,"Inflate",(function(){return yy})),n.d(r,"AsyncInflate",(function(){return xy})),n.d(r,"inflate",(function(){return by})),n.d(r,"inflateSync",(function(){return wy})),n.d(r,"Gzip",(function(){return _y})),n.d(r,"AsyncGzip",(function(){return My})),n.d(r,"gzip",(function(){return Sy})),n.d(r,"gzipSync",(function(){return Ty})),n.d(r,"Gunzip",(function(){return Ey})),n.d(r,"AsyncGunzip",(function(){return Ay})),n.d(r,"gunzip",(function(){return Ly})),n.d(r,"gunzipSync",(function(){return Ry})),n.d(r,"Zlib",(function(){return Cy})),n.d(r,"AsyncZlib",(function(){return Py})),n.d(r,"zlib",(function(){return Iy})),n.d(r,"zlibSync",(function(){return Ny})),n.d(r,"Unzlib",(function(){return Oy})),n.d(r,"AsyncUnzlib",(function(){return Dy})),n.d(r,"unzlib",(function(){return ky})),n.d(r,"unzlibSync",(function(){return zy})),n.d(r,"compress",(function(){return Sy})),n.d(r,"AsyncCompress",(function(){return My})),n.d(r,"compressSync",(function(){return Ty})),n.d(r,"Compress",(function(){return _y})),n.d(r,"Decompress",(function(){return Fy})),n.d(r,"AsyncDecompress",(function(){return Uy})),n.d(r,"decompress",(function(){return By})),n.d(r,"decompressSync",(function(){return Hy})),n.d(r,"DecodeUTF8",(function(){return Xy})),n.d(r,"EncodeUTF8",(function(){return Yy})),n.d(r,"strToU8",(function(){return Jy})),n.d(r,"strFromU8",(function(){return Zy})),n.d(r,"ZipPassThrough",(function(){return ix})),n.d(r,"ZipDeflate",(function(){return sx})),n.d(r,"AsyncZipDeflate",(function(){return ox})),n.d(r,"Zip",(function(){return ax})),n.d(r,"zip",(function(){return cx})),n.d(r,"zipSync",(function(){return lx})),n.d(r,"UnzipPassThrough",(function(){return ux})),n.d(r,"UnzipInflate",(function(){return hx})),n.d(r,"AsyncUnzipInflate",(function(){return dx})),n.d(r,"Unzip",(function(){return px})),n.d(r,"unzip",(function(){return fx})),n.d(r,"unzipSync",(function(){return mx})),"undefined"!==typeof window){var i=window.document.currentScript,s=n("8875");i=s(),"currentScript"in document||Object.defineProperty(document,"currentScript",{get:s});var o=i&&i.src.match(/(.+\/)[^/]+\.js(\?.*)?$/);o&&(n.p=o[1])}n("d3b7"),n("159b"),n("b0c0");var a=n("8bbf"),c=n.n(a);n("ac1f");
- /**
- * @license
- * Copyright 2010-2021 Three.js Authors
- * SPDX-License-Identifier: MIT
- */
- const l="135",u={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},h={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},d=0,p=1,f=2,m=1,g=2,v=3,y=0,x=1,b=2,w=1,_=0,M=1,S=2,T=3,E=4,A=5,L=100,R=101,C=102,P=103,I=104,N=200,O=201,D=202,k=203,z=204,F=205,U=206,B=207,H=208,G=209,V=210,W=0,j=1,q=2,X=3,Y=4,J=5,Z=6,K=7,$=0,Q=1,tt=2,et=0,nt=1,rt=2,it=3,st=4,ot=5,at=300,ct=301,lt=302,ut=303,ht=304,dt=306,pt=307,ft=1e3,mt=1001,gt=1002,vt=1003,yt=1004,xt=1005,bt=1006,wt=1007,_t=1008,Mt=1009,St=1010,Tt=1011,Et=1012,At=1013,Lt=1014,Rt=1015,Ct=1016,Pt=1017,It=1018,Nt=1019,Ot=1020,Dt=1021,kt=1022,zt=1023,Ft=1024,Ut=1025,Bt=zt,Ht=1026,Gt=1027,Vt=1028,Wt=1029,jt=1030,qt=1031,Xt=1032,Yt=1033,Jt=33776,Zt=33777,Kt=33778,$t=33779,Qt=35840,te=35841,ee=35842,ne=35843,re=36196,ie=37492,se=37496,oe=37808,ae=37809,ce=37810,le=37811,ue=37812,he=37813,de=37814,pe=37815,fe=37816,me=37817,ge=37818,ve=37819,ye=37820,xe=37821,be=36492,we=37840,_e=37841,Me=37842,Se=37843,Te=37844,Ee=37845,Ae=37846,Le=37847,Re=37848,Ce=37849,Pe=37850,Ie=37851,Ne=37852,Oe=37853,De=2200,ke=2201,ze=2202,Fe=2300,Ue=2301,Be=2302,He=2400,Ge=2401,Ve=2402,We=2500,je=2501,qe=0,Xe=1,Ye=2,Je=3e3,Ze=3001,Ke=3007,$e=3002,Qe=3004,tn=3005,en=3006,nn=3200,rn=3201,sn=0,on=1,an=7680,cn=519,ln=35044,un=35048,hn="300 es";class dn{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,r=n[t];if(void 0!==r){const t=r.indexOf(e);-1!==t&&r.splice(t,1)}}dispatchEvent(t){if(void 0===this._listeners)return;const e=this._listeners,n=e[t.type];if(void 0!==n){t.target=this;const e=n.slice(0);for(let n=0,r=e.length;n<r;n++)e[n].call(this,t);t.target=null}}}const pn=[];for(let zw=0;zw<256;zw++)pn[zw]=(zw<16?"0":"")+zw.toString(16);let fn=1234567;const mn=Math.PI/180,gn=180/Math.PI;function vn(){const t=4294967295*Math.random()|0,e=4294967295*Math.random()|0,n=4294967295*Math.random()|0,r=4294967295*Math.random()|0,i=pn[255&t]+pn[t>>8&255]+pn[t>>16&255]+pn[t>>24&255]+"-"+pn[255&e]+pn[e>>8&255]+"-"+pn[e>>16&15|64]+pn[e>>24&255]+"-"+pn[63&n|128]+pn[n>>8&255]+"-"+pn[n>>16&255]+pn[n>>24&255]+pn[255&r]+pn[r>>8&255]+pn[r>>16&255]+pn[r>>24&255];return i.toUpperCase()}function yn(t,e,n){return Math.max(e,Math.min(n,t))}function xn(t,e){return(t%e+e)%e}function bn(t,e,n,r,i){return r+(t-e)*(i-r)/(n-e)}function wn(t,e,n){return t!==e?(n-t)/(e-t):0}function _n(t,e,n){return(1-n)*t+n*e}function Mn(t,e,n,r){return _n(t,e,1-Math.exp(-n*r))}function Sn(t,e=1){return e-Math.abs(xn(t,2*e)-e)}function Tn(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e),t*t*(3-2*t))}function En(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e),t*t*t*(t*(6*t-15)+10))}function An(t,e){return t+Math.floor(Math.random()*(e-t+1))}function Ln(t,e){return t+Math.random()*(e-t)}function Rn(t){return t*(.5-Math.random())}function Cn(t){return void 0!==t&&(fn=t%2147483647),fn=16807*fn%2147483647,(fn-1)/2147483646}function Pn(t){return t*mn}function In(t){return t*gn}function Nn(t){return 0===(t&t-1)&&0!==t}function On(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))}function Dn(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}function kn(t,e,n,r,i){const s=Math.cos,o=Math.sin,a=s(n/2),c=o(n/2),l=s((e+r)/2),u=o((e+r)/2),h=s((e-r)/2),d=o((e-r)/2),p=s((r-e)/2),f=o((r-e)/2);switch(i){case"XYX":t.set(a*u,c*h,c*d,a*l);break;case"YZY":t.set(c*d,a*u,c*h,a*l);break;case"ZXZ":t.set(c*h,c*d,a*u,a*l);break;case"XZX":t.set(a*u,c*f,c*p,a*l);break;case"YXY":t.set(c*p,a*u,c*f,a*l);break;case"ZYZ":t.set(c*f,c*p,a*u,a*l);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}var zn=Object.freeze({__proto__:null,DEG2RAD:mn,RAD2DEG:gn,generateUUID:vn,clamp:yn,euclideanModulo:xn,mapLinear:bn,inverseLerp:wn,lerp:_n,damp:Mn,pingpong:Sn,smoothstep:Tn,smootherstep:En,randInt:An,randFloat:Ln,randFloatSpread:Rn,seededRandom:Cn,degToRad:Pn,radToDeg:In,isPowerOfTwo:Nn,ceilPowerOfTwo:On,floorPowerOfTwo:Dn,setQuaternionFromProperEuler:kn});class Fn{constructor(t=0,e=0){this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t,e){return void 0!==e?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this)}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t,e){return void 0!==e?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this)}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){const e=this.x,n=this.y,r=t.elements;return this.x=r[0]*e+r[3]*n+r[6],this.y=r[1]*e+r[4]*n+r[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){const t=Math.atan2(-this.y,-this.x)+Math.PI;return t}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,n=this.y-t.y;return e*e+n*n}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e,n){return void 0!==n&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){const n=Math.cos(e),r=Math.sin(e),i=this.x-t.x,s=this.y-t.y;return this.x=i*n-s*r+t.x,this.y=i*r+s*n+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}Fn.prototype.isVector2=!0;class Un{constructor(){this.elements=[1,0,0,0,1,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}set(t,e,n,r,i,s,o,a,c){const l=this.elements;return l[0]=t,l[1]=r,l[2]=o,l[3]=e,l[4]=i,l[5]=a,l[6]=n,l[7]=s,l[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],this}extractBasis(t,e,n){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(t){const e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const n=t.elements,r=e.elements,i=this.elements,s=n[0],o=n[3],a=n[6],c=n[1],l=n[4],u=n[7],h=n[2],d=n[5],p=n[8],f=r[0],m=r[3],g=r[6],v=r[1],y=r[4],x=r[7],b=r[2],w=r[5],_=r[8];return i[0]=s*f+o*v+a*b,i[3]=s*m+o*y+a*w,i[6]=s*g+o*x+a*_,i[1]=c*f+l*v+u*b,i[4]=c*m+l*y+u*w,i[7]=c*g+l*x+u*_,i[2]=h*f+d*v+p*b,i[5]=h*m+d*y+p*w,i[8]=h*g+d*x+p*_,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){const t=this.elements,e=t[0],n=t[1],r=t[2],i=t[3],s=t[4],o=t[5],a=t[6],c=t[7],l=t[8];return e*s*l-e*o*c-n*i*l+n*o*a+r*i*c-r*s*a}invert(){const t=this.elements,e=t[0],n=t[1],r=t[2],i=t[3],s=t[4],o=t[5],a=t[6],c=t[7],l=t[8],u=l*s-o*c,h=o*a-l*i,d=c*i-s*a,p=e*u+n*h+r*d;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);const f=1/p;return t[0]=u*f,t[1]=(r*c-l*n)*f,t[2]=(o*n-r*s)*f,t[3]=h*f,t[4]=(l*e-r*a)*f,t[5]=(r*i-o*e)*f,t[6]=d*f,t[7]=(n*a-c*e)*f,t[8]=(s*e-n*i)*f,this}transpose(){let t;const e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){const e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}setUvTransform(t,e,n,r,i,s,o){const a=Math.cos(i),c=Math.sin(i);return this.set(n*a,n*c,-n*(a*s+c*o)+s+t,-r*c,r*a,-r*(-c*s+a*o)+o+e,0,0,1),this}scale(t,e){const n=this.elements;return n[0]*=t,n[3]*=t,n[6]*=t,n[1]*=e,n[4]*=e,n[7]*=e,this}rotate(t){const e=Math.cos(t),n=Math.sin(t),r=this.elements,i=r[0],s=r[3],o=r[6],a=r[1],c=r[4],l=r[7];return r[0]=e*i+n*a,r[3]=e*s+n*c,r[6]=e*o+n*l,r[1]=-n*i+e*a,r[4]=-n*s+e*c,r[7]=-n*o+e*l,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 r=0;r<9;r++)if(e[r]!==n[r])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 Bn(t){if(0===t.length)return-1/0;let e=t[0];for(let n=1,r=t.length;n<r;++n)t[n]>e&&(e=t[n]);return e}Un.prototype.isMatrix3=!0;const Hn={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:Uint8ClampedArray,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};function Gn(t,e){return new Hn[t](e)}function Vn(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}function Wn(t,e=0){let n=3735928559^e,r=1103547991^e;for(let i,s=0;s<t.length;s++)i=t.charCodeAt(s),n=Math.imul(n^i,2654435761),r=Math.imul(r^i,1597334677);return n=Math.imul(n^n>>>16,2246822507)^Math.imul(r^r>>>13,3266489909),r=Math.imul(r^r>>>16,2246822507)^Math.imul(n^n>>>13,3266489909),4294967296*(2097151&r)+(n>>>0)}let jn;class qn{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===jn&&(jn=Vn("canvas")),jn.width=t.width,jn.height=t.height;const n=jn.getContext("2d");t instanceof ImageData?n.putImageData(t,0,0):n.drawImage(t,0,0,t.width,t.height),e=jn}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")}}let Xn=0;class Yn extends dn{constructor(t=Yn.DEFAULT_IMAGE,e=Yn.DEFAULT_MAPPING,n=mt,r=mt,i=bt,s=_t,o=zt,a=Mt,c=1,l=Je){super(),Object.defineProperty(this,"id",{value:Xn++}),this.uuid=vn(),this.name="",this.image=t,this.mipmaps=[],this.mapping=e,this.wrapS=n,this.wrapT=r,this.magFilter=i,this.minFilter=s,this.anisotropy=c,this.format=o,this.internalFormat=null,this.type=a,this.offset=new Fn(0,0),this.repeat=new Fn(1,1),this.center=new Fn(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Un,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=l,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return(new this.constructor).copy(this)}copy(t){return this.name=t.name,this.image=t.image,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.encoding=t.encoding,this.userData=JSON.parse(JSON.stringify(t.userData)),this}toJSON(t){const e=void 0===t||"string"===typeof t;if(!e&&void 0!==t.textures[this.uuid])return t.textures[this.uuid];const n={metadata:{version:4.5,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,type:this.type,encoding:this.encoding,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};if(void 0!==this.image){const r=this.image;if(void 0===r.uuid&&(r.uuid=vn()),!e&&void 0===t.images[r.uuid]){let e;if(Array.isArray(r)){e=[];for(let t=0,n=r.length;t<n;t++)r[t].isDataTexture?e.push(Jn(r[t].image)):e.push(Jn(r[t]))}else e=Jn(r);t.images[r.uuid]={uuid:r.uuid,url:e}}n.image=r.uuid}return"{}"!==JSON.stringify(this.userData)&&(n.userData=this.userData),e||(t.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(this.mapping!==at)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case ft:t.x=t.x-Math.floor(t.x);break;case mt:t.x=t.x<0?0:1;break;case gt:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x);break}if(t.y<0||t.y>1)switch(this.wrapT){case ft:t.y=t.y-Math.floor(t.y);break;case mt:t.y=t.y<0?0:1;break;case gt:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y);break}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){!0===t&&this.version++}}function Jn(t){return"undefined"!==typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!==typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!==typeof ImageBitmap&&t instanceof ImageBitmap?qn.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."),{})}Yn.DEFAULT_IMAGE=void 0,Yn.DEFAULT_MAPPING=at,Yn.prototype.isTexture=!0;class Zn{constructor(t=0,e=0,n=0,r=1){this.x=t,this.y=e,this.z=n,this.w=r}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,e,n,r){return this.x=t,this.y=e,this.z=n,this.w=r,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this}add(t,e){return void 0!==e?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this)}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this}sub(t,e){return void 0!==e?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this)}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){const e=this.x,n=this.y,r=this.z,i=this.w,s=t.elements;return this.x=s[0]*e+s[4]*n+s[8]*r+s[12]*i,this.y=s[1]*e+s[5]*n+s[9]*r+s[13]*i,this.z=s[2]*e+s[6]*n+s[10]*r+s[14]*i,this.w=s[3]*e+s[7]*n+s[11]*r+s[15]*i,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);const e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this}setAxisAngleFromRotationMatrix(t){let e,n,r,i;const s=.01,o=.1,a=t.elements,c=a[0],l=a[4],u=a[8],h=a[1],d=a[5],p=a[9],f=a[2],m=a[6],g=a[10];if(Math.abs(l-h)<s&&Math.abs(u-f)<s&&Math.abs(p-m)<s){if(Math.abs(l+h)<o&&Math.abs(u+f)<o&&Math.abs(p+m)<o&&Math.abs(c+d+g-3)<o)return this.set(1,0,0,0),this;e=Math.PI;const t=(c+1)/2,a=(d+1)/2,v=(g+1)/2,y=(l+h)/4,x=(u+f)/4,b=(p+m)/4;return t>a&&t>v?t<s?(n=0,r=.707106781,i=.707106781):(n=Math.sqrt(t),r=y/n,i=x/n):a>v?a<s?(n=.707106781,r=0,i=.707106781):(r=Math.sqrt(a),n=y/r,i=b/r):v<s?(n=.707106781,r=.707106781,i=0):(i=Math.sqrt(v),n=x/i,r=b/i),this.set(n,r,i,e),this}let v=Math.sqrt((m-p)*(m-p)+(u-f)*(u-f)+(h-l)*(h-l));return Math.abs(v)<.001&&(v=1),this.x=(m-p)/v,this.y=(u-f)/v,this.z=(h-l)/v,this.w=Math.acos((c+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}}Zn.prototype.isVector4=!0;class Kn extends dn{constructor(t,e,n={}){super(),this.width=t,this.height=e,this.depth=1,this.scissor=new Zn(0,0,t,e),this.scissorTest=!1,this.viewport=new Zn(0,0,t,e),this.texture=new Yn(void 0,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.encoding),this.texture.isRenderTargetTexture=!0,this.texture.image={width:t,height:e,depth:1},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:bt,this.depthBuffer=void 0===n.depthBuffer||n.depthBuffer,this.stencilBuffer=void 0!==n.stencilBuffer&&n.stencilBuffer,this.depthTexture=void 0!==n.depthTexture?n.depthTexture:null}setTexture(t){t.image={width:this.width,height:this.height,depth:this.depth},this.texture=t}setSize(t,e,n=1){this.width===t&&this.height===e&&this.depth===n||(this.width=t,this.height=e,this.depth=n,this.texture.image.width=t,this.texture.image.height=e,this.texture.image.depth=n,this.dispose()),this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)}clone(){return(new this.constructor).copy(this)}copy(t){return this.width=t.width,this.height=t.height,this.depth=t.depth,this.viewport.copy(t.viewport),this.texture=t.texture.clone(),this.texture.image={...this.texture.image},this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.depthTexture=t.depthTexture,this}dispose(){this.dispatchEvent({type:"dispose"})}}Kn.prototype.isWebGLRenderTarget=!0;class $n extends Kn{constructor(t,e,n){super(t,e);const r=this.texture;this.texture=[];for(let i=0;i<n;i++)this.texture[i]=r.clone()}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 r=0,i=this.texture.length;r<i;r++)this.texture[r].image.width=t,this.texture[r].image.height=e,this.texture[r].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}}$n.prototype.isWebGLMultipleRenderTargets=!0;class Qn extends Kn{constructor(t,e,n={}){super(t,e,n),this.samples=4,this.ignoreDepthForMultisampleCopy=void 0===n.ignoreDepth||n.ignoreDepth,this.useRenderToTexture=void 0!==n.useRenderToTexture&&n.useRenderToTexture,this.useRenderbuffer=!1===this.useRenderToTexture}copy(t){return super.copy.call(this,t),this.samples=t.samples,this.useRenderToTexture=t.useRenderToTexture,this.useRenderbuffer=t.useRenderbuffer,this}}Qn.prototype.isWebGLMultisampleRenderTarget=!0;class tr{constructor(t=0,e=0,n=0,r=1){this._x=t,this._y=e,this._z=n,this._w=r}static slerp(t,e,n,r){return console.warn("THREE.Quaternion: Static .slerp() has been deprecated. Use qm.slerpQuaternions( qa, qb, t ) instead."),n.slerpQuaternions(t,e,r)}static slerpFlat(t,e,n,r,i,s,o){let a=n[r+0],c=n[r+1],l=n[r+2],u=n[r+3];const h=i[s+0],d=i[s+1],p=i[s+2],f=i[s+3];if(0===o)return t[e+0]=a,t[e+1]=c,t[e+2]=l,void(t[e+3]=u);if(1===o)return t[e+0]=h,t[e+1]=d,t[e+2]=p,void(t[e+3]=f);if(u!==f||a!==h||c!==d||l!==p){let t=1-o;const e=a*h+c*d+l*p+u*f,n=e>=0?1:-1,r=1-e*e;if(r>Number.EPSILON){const i=Math.sqrt(r),s=Math.atan2(i,e*n);t=Math.sin(t*s)/i,o=Math.sin(o*s)/i}const i=o*n;if(a=a*t+h*i,c=c*t+d*i,l=l*t+p*i,u=u*t+f*i,t===1-o){const t=1/Math.sqrt(a*a+c*c+l*l+u*u);a*=t,c*=t,l*=t,u*=t}}t[e]=a,t[e+1]=c,t[e+2]=l,t[e+3]=u}static multiplyQuaternionsFlat(t,e,n,r,i,s){const o=n[r],a=n[r+1],c=n[r+2],l=n[r+3],u=i[s],h=i[s+1],d=i[s+2],p=i[s+3];return t[e]=o*p+l*u+a*d-c*h,t[e+1]=a*p+l*h+c*u-o*d,t[e+2]=c*p+l*d+o*h-a*u,t[e+3]=l*p-o*u-a*h-c*d,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,n,r){return this._x=t,this._y=e,this._z=n,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e){if(!t||!t.isEuler)throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");const n=t._x,r=t._y,i=t._z,s=t._order,o=Math.cos,a=Math.sin,c=o(n/2),l=o(r/2),u=o(i/2),h=a(n/2),d=a(r/2),p=a(i/2);switch(s){case"XYZ":this._x=h*l*u+c*d*p,this._y=c*d*u-h*l*p,this._z=c*l*p+h*d*u,this._w=c*l*u-h*d*p;break;case"YXZ":this._x=h*l*u+c*d*p,this._y=c*d*u-h*l*p,this._z=c*l*p-h*d*u,this._w=c*l*u+h*d*p;break;case"ZXY":this._x=h*l*u-c*d*p,this._y=c*d*u+h*l*p,this._z=c*l*p+h*d*u,this._w=c*l*u-h*d*p;break;case"ZYX":this._x=h*l*u-c*d*p,this._y=c*d*u+h*l*p,this._z=c*l*p-h*d*u,this._w=c*l*u+h*d*p;break;case"YZX":this._x=h*l*u+c*d*p,this._y=c*d*u+h*l*p,this._z=c*l*p-h*d*u,this._w=c*l*u-h*d*p;break;case"XZY":this._x=h*l*u-c*d*p,this._y=c*d*u-h*l*p,this._z=c*l*p+h*d*u,this._w=c*l*u+h*d*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+s)}return!1!==e&&this._onChangeCallback(),this}setFromAxisAngle(t,e){const n=e/2,r=Math.sin(n);return this._x=t.x*r,this._y=t.y*r,this._z=t.z*r,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(t){const e=t.elements,n=e[0],r=e[4],i=e[8],s=e[1],o=e[5],a=e[9],c=e[2],l=e[6],u=e[10],h=n+o+u;if(h>0){const t=.5/Math.sqrt(h+1);this._w=.25/t,this._x=(l-a)*t,this._y=(i-c)*t,this._z=(s-r)*t}else if(n>o&&n>u){const t=2*Math.sqrt(1+n-o-u);this._w=(l-a)/t,this._x=.25*t,this._y=(r+s)/t,this._z=(i+c)/t}else if(o>u){const t=2*Math.sqrt(1+o-n-u);this._w=(i-c)/t,this._x=(r+s)/t,this._y=.25*t,this._z=(a+l)/t}else{const t=2*Math.sqrt(1+u-n-o);this._w=(s-r)/t,this._x=(i+c)/t,this._y=(a+l)/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(yn(this.dot(t),-1,1)))}rotateTowards(t,e){const n=this.angleTo(t);if(0===n)return this;const r=Math.min(1,e/n);return this.slerp(t,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t,e){return void 0!==e?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(t,e)):this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){const n=t._x,r=t._y,i=t._z,s=t._w,o=e._x,a=e._y,c=e._z,l=e._w;return this._x=n*l+s*o+r*c-i*a,this._y=r*l+s*a+i*o-n*c,this._z=i*l+s*c+n*a-r*o,this._w=s*l-n*o-r*a-i*c,this._onChangeCallback(),this}slerp(t,e){if(0===e)return this;if(1===e)return this.copy(t);const n=this._x,r=this._y,i=this._z,s=this._w;let o=s*t._w+n*t._x+r*t._y+i*t._z;if(o<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,o=-o):this.copy(t),o>=1)return this._w=s,this._x=n,this._y=r,this._z=i,this;const a=1-o*o;if(a<=Number.EPSILON){const t=1-e;return this._w=t*s+e*this._w,this._x=t*n+e*this._x,this._y=t*r+e*this._y,this._z=t*i+e*this._z,this.normalize(),this._onChangeCallback(),this}const c=Math.sqrt(a),l=Math.atan2(c,o),u=Math.sin((1-e)*l)/c,h=Math.sin(e*l)/c;return this._w=s*u+this._w*h,this._x=n*u+this._x*h,this._y=r*u+this._y*h,this._z=i*u+this._z*h,this._onChangeCallback(),this}slerpQuaternions(t,e,n){this.copy(t).slerp(e,n)}random(){const t=Math.random(),e=Math.sqrt(1-t),n=Math.sqrt(t),r=2*Math.PI*Math.random(),i=2*Math.PI*Math.random();return this.set(e*Math.cos(r),n*Math.sin(i),n*Math.cos(i),e*Math.sin(r))}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(){}}tr.prototype.isQuaternion=!0;class er{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(rr.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(rr.setFromAxisAngle(t,e))}applyMatrix3(t){const e=this.x,n=this.y,r=this.z,i=t.elements;return this.x=i[0]*e+i[3]*n+i[6]*r,this.y=i[1]*e+i[4]*n+i[7]*r,this.z=i[2]*e+i[5]*n+i[8]*r,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){const e=this.x,n=this.y,r=this.z,i=t.elements,s=1/(i[3]*e+i[7]*n+i[11]*r+i[15]);return this.x=(i[0]*e+i[4]*n+i[8]*r+i[12])*s,this.y=(i[1]*e+i[5]*n+i[9]*r+i[13])*s,this.z=(i[2]*e+i[6]*n+i[10]*r+i[14])*s,this}applyQuaternion(t){const e=this.x,n=this.y,r=this.z,i=t.x,s=t.y,o=t.z,a=t.w,c=a*e+s*r-o*n,l=a*n+o*e-i*r,u=a*r+i*n-s*e,h=-i*e-s*n-o*r;return this.x=c*a+h*-i+l*-o-u*-s,this.y=l*a+h*-s+u*-i-c*-o,this.z=u*a+h*-o+c*-s-l*-i,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){const e=this.x,n=this.y,r=this.z,i=t.elements;return this.x=i[0]*e+i[4]*n+i[8]*r,this.y=i[1]*e+i[5]*n+i[9]*r,this.z=i[2]*e+i[6]*n+i[10]*r,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this}cross(t,e){return void 0!==e?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(t,e)):this.crossVectors(this,t)}crossVectors(t,e){const n=t.x,r=t.y,i=t.z,s=e.x,o=e.y,a=e.z;return this.x=r*a-i*o,this.y=i*s-n*a,this.z=n*o-r*s,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 nr.copy(this).projectOnVector(t),this.sub(nr)}reflect(t){return this.sub(nr.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(yn(n,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,n=this.y-t.y,r=this.z-t.z;return e*e+n*n+r*r}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,n){const r=Math.sin(e)*t;return this.x=r*Math.sin(n),this.y=Math.cos(e)*t,this.z=r*Math.cos(n),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,n){return this.x=t*Math.sin(e),this.y=n,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){const e=this.setFromMatrixColumn(t,0).length(),n=this.setFromMatrixColumn(t,1).length(),r=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=n,this.z=r,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,4*e)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,3*e)}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e,n){return void 0!==n&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}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}}er.prototype.isVector3=!0;const nr=new er,rr=new tr;class ir{constructor(t=new er(1/0,1/0,1/0),e=new er(-1/0,-1/0,-1/0)){this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){let e=1/0,n=1/0,r=1/0,i=-1/0,s=-1/0,o=-1/0;for(let a=0,c=t.length;a<c;a+=3){const c=t[a],l=t[a+1],u=t[a+2];c<e&&(e=c),l<n&&(n=l),u<r&&(r=u),c>i&&(i=c),l>s&&(s=l),u>o&&(o=u)}return this.min.set(e,n,r),this.max.set(i,s,o),this}setFromBufferAttribute(t){let e=1/0,n=1/0,r=1/0,i=-1/0,s=-1/0,o=-1/0;for(let a=0,c=t.count;a<c;a++){const c=t.getX(a),l=t.getY(a),u=t.getZ(a);c<e&&(e=c),l<n&&(n=l),u<r&&(r=u),c>i&&(i=c),l>s&&(s=l),u>o&&(o=u)}return this.min.set(e,n,r),this.max.set(i,s,o),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=or.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(n),this.max.copy(t).add(n),this}setFromObject(t){return this.makeEmpty(),this.expandByObject(t)}clone(){return(new this.constructor).copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(t){return 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){t.updateWorldMatrix(!1,!1);const e=t.geometry;void 0!==e&&(null===e.boundingBox&&e.computeBoundingBox(),ar.copy(e.boundingBox),ar.applyMatrix4(t.matrixWorld),this.union(ar));const n=t.children;for(let r=0,i=n.length;r<i;r++)this.expandByObject(n[r]);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,or),or.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(fr),mr.subVectors(this.max,fr),cr.subVectors(t.a,fr),lr.subVectors(t.b,fr),ur.subVectors(t.c,fr),hr.subVectors(lr,cr),dr.subVectors(ur,lr),pr.subVectors(cr,ur);let e=[0,-hr.z,hr.y,0,-dr.z,dr.y,0,-pr.z,pr.y,hr.z,0,-hr.x,dr.z,0,-dr.x,pr.z,0,-pr.x,-hr.y,hr.x,0,-dr.y,dr.x,0,-pr.y,pr.x,0];return!!yr(e,cr,lr,ur,mr)&&(e=[1,0,0,0,1,0,0,0,1],!!yr(e,cr,lr,ur,mr)&&(gr.crossVectors(hr,dr),e=[gr.x,gr.y,gr.z],yr(e,cr,lr,ur,mr)))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){const e=or.copy(t).clamp(this.min,this.max);return e.sub(t).length()}getBoundingSphere(t){return this.getCenter(t.center),t.radius=.5*this.getSize(or).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()||(sr[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),sr[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),sr[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),sr[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),sr[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),sr[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),sr[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),sr[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(sr)),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)}}ir.prototype.isBox3=!0;const sr=[new er,new er,new er,new er,new er,new er,new er,new er],or=new er,ar=new ir,cr=new er,lr=new er,ur=new er,hr=new er,dr=new er,pr=new er,fr=new er,mr=new er,gr=new er,vr=new er;function yr(t,e,n,r,i){for(let s=0,o=t.length-3;s<=o;s+=3){vr.fromArray(t,s);const o=i.x*Math.abs(vr.x)+i.y*Math.abs(vr.y)+i.z*Math.abs(vr.z),a=e.dot(vr),c=n.dot(vr),l=r.dot(vr);if(Math.max(-Math.max(a,c,l),Math.min(a,c,l))>o)return!1}return!0}const xr=new ir,br=new er,wr=new er,_r=new er;class Mr{constructor(t=new er,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):xr.setFromPoints(t).getCenter(n);let r=0;for(let i=0,s=t.length;i<s;i++)r=Math.max(r,n.distanceToSquared(t[i]));return this.radius=Math.sqrt(r),this}copy(t){return this.center.copy(t.center),this.radius=t.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(t){return t.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(t){return t.distanceTo(this.center)-this.radius}intersectsSphere(t){const e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e}intersectsBox(t){return t.intersectsSphere(this)}intersectsPlane(t){return Math.abs(t.distanceToPoint(this.center))<=this.radius}clampPoint(t,e){const n=this.center.distanceToSquared(t);return 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){_r.subVectors(t,this.center);const e=_r.lengthSq();if(e>this.radius*this.radius){const t=Math.sqrt(e),n=.5*(t-this.radius);this.center.add(_r.multiplyScalar(n/t)),this.radius+=n}return this}union(t){return wr.subVectors(t.center,this.center).normalize().multiplyScalar(t.radius),this.expandByPoint(br.copy(t.center).add(wr)),this.expandByPoint(br.copy(t.center).sub(wr)),this}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return(new this.constructor).copy(this)}}const Sr=new er,Tr=new er,Er=new er,Ar=new er,Lr=new er,Rr=new er,Cr=new er;class Pr{constructor(t=new er,e=new er(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,Sr)),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=Sr.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(Sr.copy(this.direction).multiplyScalar(e).add(this.origin),Sr.distanceToSquared(t))}distanceSqToSegment(t,e,n,r){Tr.copy(t).add(e).multiplyScalar(.5),Er.copy(e).sub(t).normalize(),Ar.copy(this.origin).sub(Tr);const i=.5*t.distanceTo(e),s=-this.direction.dot(Er),o=Ar.dot(this.direction),a=-Ar.dot(Er),c=Ar.lengthSq(),l=Math.abs(1-s*s);let u,h,d,p;if(l>0)if(u=s*a-o,h=s*o-a,p=i*l,u>=0)if(h>=-p)if(h<=p){const t=1/l;u*=t,h*=t,d=u*(u+s*h+2*o)+h*(s*u+h+2*a)+c}else h=i,u=Math.max(0,-(s*h+o)),d=-u*u+h*(h+2*a)+c;else h=-i,u=Math.max(0,-(s*h+o)),d=-u*u+h*(h+2*a)+c;else h<=-p?(u=Math.max(0,-(-s*i+o)),h=u>0?-i:Math.min(Math.max(-i,-a),i),d=-u*u+h*(h+2*a)+c):h<=p?(u=0,h=Math.min(Math.max(-i,-a),i),d=h*(h+2*a)+c):(u=Math.max(0,-(s*i+o)),h=u>0?i:Math.min(Math.max(-i,-a),i),d=-u*u+h*(h+2*a)+c);else h=s>0?-i:i,u=Math.max(0,-(s*h+o)),d=-u*u+h*(h+2*a)+c;return n&&n.copy(this.direction).multiplyScalar(u).add(this.origin),r&&r.copy(Er).multiplyScalar(h).add(Tr),d}intersectSphere(t,e){Sr.subVectors(t.center,this.origin);const n=Sr.dot(this.direction),r=Sr.dot(Sr)-n*n,i=t.radius*t.radius;if(r>i)return null;const s=Math.sqrt(i-r),o=n-s,a=n+s;return o<0&&a<0?null:o<0?this.at(a,e):this.at(o,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);if(0===e)return!0;const n=t.normal.dot(this.direction);return n*e<0}intersectBox(t,e){let n,r,i,s,o,a;const c=1/this.direction.x,l=1/this.direction.y,u=1/this.direction.z,h=this.origin;return c>=0?(n=(t.min.x-h.x)*c,r=(t.max.x-h.x)*c):(n=(t.max.x-h.x)*c,r=(t.min.x-h.x)*c),l>=0?(i=(t.min.y-h.y)*l,s=(t.max.y-h.y)*l):(i=(t.max.y-h.y)*l,s=(t.min.y-h.y)*l),n>s||i>r?null:((i>n||n!==n)&&(n=i),(s<r||r!==r)&&(r=s),u>=0?(o=(t.min.z-h.z)*u,a=(t.max.z-h.z)*u):(o=(t.max.z-h.z)*u,a=(t.min.z-h.z)*u),n>a||o>r?null:((o>n||n!==n)&&(n=o),(a<r||r!==r)&&(r=a),r<0?null:this.at(n>=0?n:r,e)))}intersectsBox(t){return null!==this.intersectBox(t,Sr)}intersectTriangle(t,e,n,r,i){Lr.subVectors(e,t),Rr.subVectors(n,t),Cr.crossVectors(Lr,Rr);let s,o=this.direction.dot(Cr);if(o>0){if(r)return null;s=1}else{if(!(o<0))return null;s=-1,o=-o}Ar.subVectors(this.origin,t);const a=s*this.direction.dot(Rr.crossVectors(Ar,Rr));if(a<0)return null;const c=s*this.direction.dot(Lr.cross(Ar));if(c<0)return null;if(a+c>o)return null;const l=-s*Ar.dot(Cr);return l<0?null:this.at(l/o,i)}applyMatrix4(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this}equals(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}clone(){return(new this.constructor).copy(this)}}class Ir{constructor(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}set(t,e,n,r,i,s,o,a,c,l,u,h,d,p,f,m){const g=this.elements;return g[0]=t,g[4]=e,g[8]=n,g[12]=r,g[1]=i,g[5]=s,g[9]=o,g[13]=a,g[2]=c,g[6]=l,g[10]=u,g[14]=h,g[3]=d,g[7]=p,g[11]=f,g[15]=m,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return(new Ir).fromArray(this.elements)}copy(t){const e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],e[9]=n[9],e[10]=n[10],e[11]=n[11],e[12]=n[12],e[13]=n[13],e[14]=n[14],e[15]=n[15],this}copyPosition(t){const e=this.elements,n=t.elements;return e[12]=n[12],e[13]=n[13],e[14]=n[14],this}setFromMatrix3(t){const e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}extractBasis(t,e,n){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(t,e,n){return this.set(t.x,e.x,n.x,0,t.y,e.y,n.y,0,t.z,e.z,n.z,0,0,0,0,1),this}extractRotation(t){const e=this.elements,n=t.elements,r=1/Nr.setFromMatrixColumn(t,0).length(),i=1/Nr.setFromMatrixColumn(t,1).length(),s=1/Nr.setFromMatrixColumn(t,2).length();return e[0]=n[0]*r,e[1]=n[1]*r,e[2]=n[2]*r,e[3]=0,e[4]=n[4]*i,e[5]=n[5]*i,e[6]=n[6]*i,e[7]=0,e[8]=n[8]*s,e[9]=n[9]*s,e[10]=n[10]*s,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){t&&t.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");const e=this.elements,n=t.x,r=t.y,i=t.z,s=Math.cos(n),o=Math.sin(n),a=Math.cos(r),c=Math.sin(r),l=Math.cos(i),u=Math.sin(i);if("XYZ"===t.order){const t=s*l,n=s*u,r=o*l,i=o*u;e[0]=a*l,e[4]=-a*u,e[8]=c,e[1]=n+r*c,e[5]=t-i*c,e[9]=-o*a,e[2]=i-t*c,e[6]=r+n*c,e[10]=s*a}else if("YXZ"===t.order){const t=a*l,n=a*u,r=c*l,i=c*u;e[0]=t+i*o,e[4]=r*o-n,e[8]=s*c,e[1]=s*u,e[5]=s*l,e[9]=-o,e[2]=n*o-r,e[6]=i+t*o,e[10]=s*a}else if("ZXY"===t.order){const t=a*l,n=a*u,r=c*l,i=c*u;e[0]=t-i*o,e[4]=-s*u,e[8]=r+n*o,e[1]=n+r*o,e[5]=s*l,e[9]=i-t*o,e[2]=-s*c,e[6]=o,e[10]=s*a}else if("ZYX"===t.order){const t=s*l,n=s*u,r=o*l,i=o*u;e[0]=a*l,e[4]=r*c-n,e[8]=t*c+i,e[1]=a*u,e[5]=i*c+t,e[9]=n*c-r,e[2]=-c,e[6]=o*a,e[10]=s*a}else if("YZX"===t.order){const t=s*a,n=s*c,r=o*a,i=o*c;e[0]=a*l,e[4]=i-t*u,e[8]=r*u+n,e[1]=u,e[5]=s*l,e[9]=-o*l,e[2]=-c*l,e[6]=n*u+r,e[10]=t-i*u}else if("XZY"===t.order){const t=s*a,n=s*c,r=o*a,i=o*c;e[0]=a*l,e[4]=-u,e[8]=c*l,e[1]=t*u+i,e[5]=s*l,e[9]=n*u-r,e[2]=r*u-n,e[6]=o*l,e[10]=i*u+t}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose(Dr,t,kr)}lookAt(t,e,n){const r=this.elements;return Ur.subVectors(t,e),0===Ur.lengthSq()&&(Ur.z=1),Ur.normalize(),zr.crossVectors(n,Ur),0===zr.lengthSq()&&(1===Math.abs(n.z)?Ur.x+=1e-4:Ur.z+=1e-4,Ur.normalize(),zr.crossVectors(n,Ur)),zr.normalize(),Fr.crossVectors(Ur,zr),r[0]=zr.x,r[4]=Fr.x,r[8]=Ur.x,r[1]=zr.y,r[5]=Fr.y,r[9]=Ur.y,r[2]=zr.z,r[6]=Fr.z,r[10]=Ur.z,this}multiply(t,e){return void 0!==e?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(t,e)):this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const n=t.elements,r=e.elements,i=this.elements,s=n[0],o=n[4],a=n[8],c=n[12],l=n[1],u=n[5],h=n[9],d=n[13],p=n[2],f=n[6],m=n[10],g=n[14],v=n[3],y=n[7],x=n[11],b=n[15],w=r[0],_=r[4],M=r[8],S=r[12],T=r[1],E=r[5],A=r[9],L=r[13],R=r[2],C=r[6],P=r[10],I=r[14],N=r[3],O=r[7],D=r[11],k=r[15];return i[0]=s*w+o*T+a*R+c*N,i[4]=s*_+o*E+a*C+c*O,i[8]=s*M+o*A+a*P+c*D,i[12]=s*S+o*L+a*I+c*k,i[1]=l*w+u*T+h*R+d*N,i[5]=l*_+u*E+h*C+d*O,i[9]=l*M+u*A+h*P+d*D,i[13]=l*S+u*L+h*I+d*k,i[2]=p*w+f*T+m*R+g*N,i[6]=p*_+f*E+m*C+g*O,i[10]=p*M+f*A+m*P+g*D,i[14]=p*S+f*L+m*I+g*k,i[3]=v*w+y*T+x*R+b*N,i[7]=v*_+y*E+x*C+b*O,i[11]=v*M+y*A+x*P+b*D,i[15]=v*S+y*L+x*I+b*k,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}determinant(){const t=this.elements,e=t[0],n=t[4],r=t[8],i=t[12],s=t[1],o=t[5],a=t[9],c=t[13],l=t[2],u=t[6],h=t[10],d=t[14],p=t[3],f=t[7],m=t[11],g=t[15];return p*(+i*a*u-r*c*u-i*o*h+n*c*h+r*o*d-n*a*d)+f*(+e*a*d-e*c*h+i*s*h-r*s*d+r*c*l-i*a*l)+m*(+e*c*u-e*o*d-i*s*u+n*s*d+i*o*l-n*c*l)+g*(-r*o*l-e*a*u+e*o*h+r*s*u-n*s*h+n*a*l)}transpose(){const t=this.elements;let e;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(t,e,n){const r=this.elements;return t.isVector3?(r[12]=t.x,r[13]=t.y,r[14]=t.z):(r[12]=t,r[13]=e,r[14]=n),this}invert(){const t=this.elements,e=t[0],n=t[1],r=t[2],i=t[3],s=t[4],o=t[5],a=t[6],c=t[7],l=t[8],u=t[9],h=t[10],d=t[11],p=t[12],f=t[13],m=t[14],g=t[15],v=u*m*c-f*h*c+f*a*d-o*m*d-u*a*g+o*h*g,y=p*h*c-l*m*c-p*a*d+s*m*d+l*a*g-s*h*g,x=l*f*c-p*u*c+p*o*d-s*f*d-l*o*g+s*u*g,b=p*u*a-l*f*a-p*o*h+s*f*h+l*o*m-s*u*m,w=e*v+n*y+r*x+i*b;if(0===w)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const _=1/w;return t[0]=v*_,t[1]=(f*h*i-u*m*i-f*r*d+n*m*d+u*r*g-n*h*g)*_,t[2]=(o*m*i-f*a*i+f*r*c-n*m*c-o*r*g+n*a*g)*_,t[3]=(u*a*i-o*h*i-u*r*c+n*h*c+o*r*d-n*a*d)*_,t[4]=y*_,t[5]=(l*m*i-p*h*i+p*r*d-e*m*d-l*r*g+e*h*g)*_,t[6]=(p*a*i-s*m*i-p*r*c+e*m*c+s*r*g-e*a*g)*_,t[7]=(s*h*i-l*a*i+l*r*c-e*h*c-s*r*d+e*a*d)*_,t[8]=x*_,t[9]=(p*u*i-l*f*i-p*n*d+e*f*d+l*n*g-e*u*g)*_,t[10]=(s*f*i-p*o*i+p*n*c-e*f*c-s*n*g+e*o*g)*_,t[11]=(l*o*i-s*u*i-l*n*c+e*u*c+s*n*d-e*o*d)*_,t[12]=b*_,t[13]=(l*f*r-p*u*r+p*n*h-e*f*h-l*n*m+e*u*m)*_,t[14]=(p*o*r-s*f*r-p*n*a+e*f*a+s*n*m-e*o*m)*_,t[15]=(s*u*r-l*o*r+l*n*a-e*u*a-s*n*h+e*o*h)*_,this}scale(t){const e=this.elements,n=t.x,r=t.y,i=t.z;return e[0]*=n,e[4]*=r,e[8]*=i,e[1]*=n,e[5]*=r,e[9]*=i,e[2]*=n,e[6]*=r,e[10]*=i,e[3]*=n,e[7]*=r,e[11]*=i,this}getMaxScaleOnAxis(){const t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],n=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],r=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,n,r))}makeTranslation(t,e,n){return this.set(1,0,0,t,0,1,0,e,0,0,1,n,0,0,0,1),this}makeRotationX(t){const e=Math.cos(t),n=Math.sin(t);return this.set(1,0,0,0,0,e,-n,0,0,n,e,0,0,0,0,1),this}makeRotationY(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,0,n,0,0,1,0,0,-n,0,e,0,0,0,0,1),this}makeRotationZ(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,0,n,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){const n=Math.cos(e),r=Math.sin(e),i=1-n,s=t.x,o=t.y,a=t.z,c=i*s,l=i*o;return this.set(c*s+n,c*o-r*a,c*a+r*o,0,c*o+r*a,l*o+n,l*a-r*s,0,c*a-r*o,l*a+r*s,i*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,r,i,s){return this.set(1,n,i,0,t,1,s,0,e,r,1,0,0,0,0,1),this}compose(t,e,n){const r=this.elements,i=e._x,s=e._y,o=e._z,a=e._w,c=i+i,l=s+s,u=o+o,h=i*c,d=i*l,p=i*u,f=s*l,m=s*u,g=o*u,v=a*c,y=a*l,x=a*u,b=n.x,w=n.y,_=n.z;return r[0]=(1-(f+g))*b,r[1]=(d+x)*b,r[2]=(p-y)*b,r[3]=0,r[4]=(d-x)*w,r[5]=(1-(h+g))*w,r[6]=(m+v)*w,r[7]=0,r[8]=(p+y)*_,r[9]=(m-v)*_,r[10]=(1-(h+f))*_,r[11]=0,r[12]=t.x,r[13]=t.y,r[14]=t.z,r[15]=1,this}decompose(t,e,n){const r=this.elements;let i=Nr.set(r[0],r[1],r[2]).length();const s=Nr.set(r[4],r[5],r[6]).length(),o=Nr.set(r[8],r[9],r[10]).length(),a=this.determinant();a<0&&(i=-i),t.x=r[12],t.y=r[13],t.z=r[14],Or.copy(this);const c=1/i,l=1/s,u=1/o;return Or.elements[0]*=c,Or.elements[1]*=c,Or.elements[2]*=c,Or.elements[4]*=l,Or.elements[5]*=l,Or.elements[6]*=l,Or.elements[8]*=u,Or.elements[9]*=u,Or.elements[10]*=u,e.setFromRotationMatrix(Or),n.x=i,n.y=s,n.z=o,this}makePerspective(t,e,n,r,i,s){void 0===s&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");const o=this.elements,a=2*i/(e-t),c=2*i/(n-r),l=(e+t)/(e-t),u=(n+r)/(n-r),h=-(s+i)/(s-i),d=-2*s*i/(s-i);return o[0]=a,o[4]=0,o[8]=l,o[12]=0,o[1]=0,o[5]=c,o[9]=u,o[13]=0,o[2]=0,o[6]=0,o[10]=h,o[14]=d,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this}makeOrthographic(t,e,n,r,i,s){const o=this.elements,a=1/(e-t),c=1/(n-r),l=1/(s-i),u=(e+t)*a,h=(n+r)*c,d=(s+i)*l;return o[0]=2*a,o[4]=0,o[8]=0,o[12]=-u,o[1]=0,o[5]=2*c,o[9]=0,o[13]=-h,o[2]=0,o[6]=0,o[10]=-2*l,o[14]=-d,o[3]=0,o[7]=0,o[11]=0,o[15]=1,this}equals(t){const e=this.elements,n=t.elements;for(let r=0;r<16;r++)if(e[r]!==n[r])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}}Ir.prototype.isMatrix4=!0;const Nr=new er,Or=new Ir,Dr=new er(0,0,0),kr=new er(1,1,1),zr=new er,Fr=new er,Ur=new er,Br=new Ir,Hr=new tr;class Gr{constructor(t=0,e=0,n=0,r=Gr.DefaultOrder){this._x=t,this._y=e,this._z=n,this._order=r}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,e,n,r=this._order){return this._x=t,this._y=e,this._z=n,this._order=r,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 r=t.elements,i=r[0],s=r[4],o=r[8],a=r[1],c=r[5],l=r[9],u=r[2],h=r[6],d=r[10];switch(e){case"XYZ":this._y=Math.asin(yn(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-l,d),this._z=Math.atan2(-s,i)):(this._x=Math.atan2(h,c),this._z=0);break;case"YXZ":this._x=Math.asin(-yn(l,-1,1)),Math.abs(l)<.9999999?(this._y=Math.atan2(o,d),this._z=Math.atan2(a,c)):(this._y=Math.atan2(-u,i),this._z=0);break;case"ZXY":this._x=Math.asin(yn(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(-u,d),this._z=Math.atan2(-s,c)):(this._y=0,this._z=Math.atan2(a,i));break;case"ZYX":this._y=Math.asin(-yn(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(h,d),this._z=Math.atan2(a,i)):(this._x=0,this._z=Math.atan2(-s,c));break;case"YZX":this._z=Math.asin(yn(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-l,c),this._y=Math.atan2(-u,i)):(this._x=0,this._y=Math.atan2(o,d));break;case"XZY":this._z=Math.asin(-yn(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(h,c),this._y=Math.atan2(o,i)):(this._x=Math.atan2(-l,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 Br.makeRotationFromQuaternion(t),this.setFromRotationMatrix(Br,e,n)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return Hr.setFromEuler(this),this.setFromQuaternion(Hr,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],void 0!==t[3]&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t}toVector3(t){return t?t.set(this._x,this._y,this._z):new er(this._x,this._y,this._z)}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}}Gr.prototype.isEuler=!0,Gr.DefaultOrder="XYZ",Gr.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];class Vr{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 Wr=0;const jr=new er,qr=new tr,Xr=new Ir,Yr=new er,Jr=new er,Zr=new er,Kr=new tr,$r=new er(1,0,0),Qr=new er(0,1,0),ti=new er(0,0,1),ei={type:"added"},ni={type:"removed"};class ri extends dn{constructor(){super(),Object.defineProperty(this,"id",{value:Wr++}),this.uuid=vn(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=ri.DefaultUp.clone();const t=new er,e=new Gr,n=new tr,r=new er(1,1,1);function i(){n.setFromEuler(e,!1)}function s(){e.setFromQuaternion(n,void 0,!1)}e._onChange(i),n._onChange(s),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:e},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:r},modelViewMatrix:{value:new Ir},normalMatrix:{value:new Un}}),this.matrix=new Ir,this.matrixWorld=new Ir,this.matrixAutoUpdate=ri.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new Vr,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 qr.setFromAxisAngle(t,e),this.quaternion.multiply(qr),this}rotateOnWorldAxis(t,e){return qr.setFromAxisAngle(t,e),this.quaternion.premultiply(qr),this}rotateX(t){return this.rotateOnAxis($r,t)}rotateY(t){return this.rotateOnAxis(Qr,t)}rotateZ(t){return this.rotateOnAxis(ti,t)}translateOnAxis(t,e){return jr.copy(t).applyQuaternion(this.quaternion),this.position.add(jr.multiplyScalar(e)),this}translateX(t){return this.translateOnAxis($r,t)}translateY(t){return this.translateOnAxis(Qr,t)}translateZ(t){return this.translateOnAxis(ti,t)}localToWorld(t){return t.applyMatrix4(this.matrixWorld)}worldToLocal(t){return t.applyMatrix4(Xr.copy(this.matrixWorld).invert())}lookAt(t,e,n){t.isVector3?Yr.copy(t):Yr.set(t,e,n);const r=this.parent;this.updateWorldMatrix(!0,!1),Jr.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Xr.lookAt(Jr,Yr,this.up):Xr.lookAt(Yr,Jr,this.up),this.quaternion.setFromRotationMatrix(Xr),r&&(Xr.extractRotation(r.matrixWorld),qr.setFromRotationMatrix(Xr),this.quaternion.premultiply(qr.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(ei)):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(ni)),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(ni)}return this.children.length=0,this}attach(t){return this.updateWorldMatrix(!0,!1),Xr.copy(this.matrixWorld).invert(),null!==t.parent&&(t.parent.updateWorldMatrix(!0,!1),Xr.multiply(t.parent.matrixWorld)),t.applyMatrix4(Xr),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,r=this.children.length;n<r;n++){const r=this.children[n],i=r.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(Jr,t,Zr),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Jr,Kr,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,r=e.length;n<r;n++)e[n].traverse(t)}traverseVisible(t){if(!1===this.visible)return;t(this);const e=this.children;for(let n=0,r=e.length;n<r;n++)e[n].traverseVisible(t)}traverseAncestors(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,r=e.length;n<r;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:{}},n.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});const r={};function i(e,n){return void 0===e[n.uuid]&&(e[n.uuid]=n.toJSON(t)),n.uuid}if(r.uuid=this.uuid,r.type=this.type,""!==this.name&&(r.name=this.name),!0===this.castShadow&&(r.castShadow=!0),!0===this.receiveShadow&&(r.receiveShadow=!0),!1===this.visible&&(r.visible=!1),!1===this.frustumCulled&&(r.frustumCulled=!1),0!==this.renderOrder&&(r.renderOrder=this.renderOrder),"{}"!==JSON.stringify(this.userData)&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),!1===this.matrixAutoUpdate&&(r.matrixAutoUpdate=!1),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(r.instanceColor=this.instanceColor.toJSON())),this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&(r.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=i(t.geometries,this.geometry);const e=this.geometry.parameters;if(void 0!==e&&void 0!==e.shapes){const n=e.shapes;if(Array.isArray(n))for(let e=0,r=n.length;e<r;e++){const r=n[e];i(t.shapes,r)}else i(t.shapes,n)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton&&(i(t.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),void 0!==this.material)if(Array.isArray(this.material)){const e=[];for(let n=0,r=this.material.length;n<r;n++)e.push(i(t.materials,this.material[n]));r.material=e}else r.material=i(t.materials,this.material);if(this.children.length>0){r.children=[];for(let e=0;e<this.children.length;e++)r.children.push(this.children[e].toJSON(t).object)}if(this.animations.length>0){r.animations=[];for(let e=0;e<this.animations.length;e++){const n=this.animations[e];r.animations.push(i(t.animations,n))}}if(e){const e=s(t.geometries),r=s(t.materials),i=s(t.textures),o=s(t.images),a=s(t.shapes),c=s(t.skeletons),l=s(t.animations);e.length>0&&(n.geometries=e),r.length>0&&(n.materials=r),i.length>0&&(n.textures=i),o.length>0&&(n.images=o),a.length>0&&(n.shapes=a),c.length>0&&(n.skeletons=c),l.length>0&&(n.animations=l)}return n.object=r,n;function s(t){const e=[];for(const n in t){const r=t[n];delete r.metadata,e.push(r)}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 n=0;n<t.children.length;n++){const e=t.children[n];this.add(e.clone())}return this}}ri.DefaultUp=new er(0,1,0),ri.DefaultMatrixAutoUpdate=!0,ri.prototype.isObject3D=!0;const ii=new er,si=new er,oi=new er,ai=new er,ci=new er,li=new er,ui=new er,hi=new er,di=new er,pi=new er;class fi{constructor(t=new er,e=new er,n=new er){this.a=t,this.b=e,this.c=n}static getNormal(t,e,n,r){r.subVectors(n,e),ii.subVectors(t,e),r.cross(ii);const i=r.lengthSq();return i>0?r.multiplyScalar(1/Math.sqrt(i)):r.set(0,0,0)}static getBarycoord(t,e,n,r,i){ii.subVectors(r,e),si.subVectors(n,e),oi.subVectors(t,e);const s=ii.dot(ii),o=ii.dot(si),a=ii.dot(oi),c=si.dot(si),l=si.dot(oi),u=s*c-o*o;if(0===u)return i.set(-2,-1,-1);const h=1/u,d=(c*a-o*l)*h,p=(s*l-o*a)*h;return i.set(1-d-p,p,d)}static containsPoint(t,e,n,r){return this.getBarycoord(t,e,n,r,ai),ai.x>=0&&ai.y>=0&&ai.x+ai.y<=1}static getUV(t,e,n,r,i,s,o,a){return this.getBarycoord(t,e,n,r,ai),a.set(0,0),a.addScaledVector(i,ai.x),a.addScaledVector(s,ai.y),a.addScaledVector(o,ai.z),a}static isFrontFacing(t,e,n,r){return ii.subVectors(n,e),si.subVectors(t,e),ii.cross(si).dot(r)<0}set(t,e,n){return this.a.copy(t),this.b.copy(e),this.c.copy(n),this}setFromPointsAndIndices(t,e,n,r){return this.a.copy(t[e]),this.b.copy(t[n]),this.c.copy(t[r]),this}setFromAttributeAndIndices(t,e,n,r){return this.a.fromBufferAttribute(t,e),this.b.fromBufferAttribute(t,n),this.c.fromBufferAttribute(t,r),this}clone(){return(new this.constructor).copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return ii.subVectors(this.c,this.b),si.subVectors(this.a,this.b),.5*ii.cross(si).length()}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return fi.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return fi.getBarycoord(t,this.a,this.b,this.c,e)}getUV(t,e,n,r,i){return fi.getUV(t,this.a,this.b,this.c,e,n,r,i)}containsPoint(t){return fi.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return fi.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){const n=this.a,r=this.b,i=this.c;let s,o;ci.subVectors(r,n),li.subVectors(i,n),hi.subVectors(t,n);const a=ci.dot(hi),c=li.dot(hi);if(a<=0&&c<=0)return e.copy(n);di.subVectors(t,r);const l=ci.dot(di),u=li.dot(di);if(l>=0&&u<=l)return e.copy(r);const h=a*u-l*c;if(h<=0&&a>=0&&l<=0)return s=a/(a-l),e.copy(n).addScaledVector(ci,s);pi.subVectors(t,i);const d=ci.dot(pi),p=li.dot(pi);if(p>=0&&d<=p)return e.copy(i);const f=d*c-a*p;if(f<=0&&c>=0&&p<=0)return o=c/(c-p),e.copy(n).addScaledVector(li,o);const m=l*p-d*u;if(m<=0&&u-l>=0&&d-p>=0)return ui.subVectors(i,r),o=(u-l)/(u-l+(d-p)),e.copy(r).addScaledVector(ui,o);const g=1/(m+f+h);return s=f*g,o=h*g,e.copy(n).addScaledVector(ci,s).addScaledVector(li,o)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}let mi=0;class gi extends dn{constructor(){super(),Object.defineProperty(this,"id",{value:mi++}),this.uuid=vn(),this.name="",this.type="Material",this.fog=!0,this.blending=M,this.side=y,this.vertexColors=!1,this.opacity=1,this.format=zt,this.transparent=!1,this.blendSrc=z,this.blendDst=F,this.blendEquation=L,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=X,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=cn,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=an,this.stencilZFail=an,this.stencilZPass=an,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=n===w;continue}const r=this[e];void 0!==r?r&&r.isColor?r.set(n):r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[e]=n:console.warn("THREE."+this.type+": '"+e+"' is not a property of this material.")}}toJSON(t){const e=void 0===t||"string"===typeof t;e&&(t={textures:{},images:{}});const n={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};function r(t){const e=[];for(const n in t){const r=t[n];delete r.metadata,e.push(r)}return e}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),void 0!==this.roughness&&(n.roughness=this.roughness),void 0!==this.metalness&&(n.metalness=this.metalness),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),this.blending!==M&&(n.blending=this.blending),this.side!==y&&(n.side=this.side),this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.format!==zt&&(n.format=this.format),!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,this.rotation&&0!==this.rotation&&(n.rotation=this.rotation),!0===this.polygonOffset&&(n.polygonOffset=!0),0!==this.polygonOffsetFactor&&(n.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth&&1!==this.linewidth&&(n.linewidth=this.linewidth),void 0!==this.dashSize&&(n.dashSize=this.dashSize),void 0!==this.gapSize&&(n.gapSize=this.gapSize),void 0!==this.scale&&(n.scale=this.scale),!0===this.dithering&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),!0===this.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=r(t.textures),i=r(t.images);e.length>0&&(n.textures=e),i.length>0&&(n.images=i)}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.format=t.format,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;const e=t.clippingPlanes;let n=null;if(null!==e){const t=e.length;n=new Array(t);for(let r=0;r!==t;++r)n[r]=e[r].clone()}return this.clippingPlanes=n,this.clipIntersection=t.clipIntersection,this.clipShadows=t.clipShadows,this.shadowSide=t.shadowSide,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.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++}}gi.prototype.isMaterial=!0;const vi={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},yi={h:0,s:0,l:0},xi={h:0,s:0,l:0};function bi(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 wi(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function _i(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}class Mi{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=xn(t,1),e=yn(e,0,1),n=yn(n,0,1),0===e)this.r=this.g=this.b=n;else{const r=n<=.5?n*(1+e):n+e-n*e,i=2*n-r;this.r=bi(i,r,t+1/3),this.g=bi(i,r,t),this.b=bi(i,r,t-1/3)}return this}setStyle(t){function e(e){void 0!==e&&parseFloat(e)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}let n;if(n=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(t)){let t;const r=n[1],i=n[2];switch(r){case"rgb":case"rgba":if(t=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(i))return this.r=Math.min(255,parseInt(t[1],10))/255,this.g=Math.min(255,parseInt(t[2],10))/255,this.b=Math.min(255,parseInt(t[3],10))/255,e(t[4]),this;if(t=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(i))return this.r=Math.min(100,parseInt(t[1],10))/100,this.g=Math.min(100,parseInt(t[2],10))/100,this.b=Math.min(100,parseInt(t[3],10))/100,e(t[4]),this;break;case"hsl":case"hsla":if(t=/^\s*(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(i)){const n=parseFloat(t[1])/360,r=parseInt(t[2],10)/100,i=parseInt(t[3],10)/100;return e(t[4]),this.setHSL(n,r,i)}break}}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=vi[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}copyGammaToLinear(t,e=2){return this.r=Math.pow(t.r,e),this.g=Math.pow(t.g,e),this.b=Math.pow(t.b,e),this}copyLinearToGamma(t,e=2){const n=e>0?1/e:1;return this.r=Math.pow(t.r,n),this.g=Math.pow(t.g,n),this.b=Math.pow(t.b,n),this}convertGammaToLinear(t){return this.copyGammaToLinear(this,t),this}convertLinearToGamma(t){return this.copyLinearToGamma(this,t),this}copySRGBToLinear(t){return this.r=wi(t.r),this.g=wi(t.g),this.b=wi(t.b),this}copyLinearToSRGB(t){return this.r=_i(t.r),this.g=_i(t.g),this.b=_i(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0}getHexString(){return("000000"+this.getHex().toString(16)).slice(-6)}getHSL(t){const e=this.r,n=this.g,r=this.b,i=Math.max(e,n,r),s=Math.min(e,n,r);let o,a;const c=(s+i)/2;if(s===i)o=0,a=0;else{const t=i-s;switch(a=c<=.5?t/(i+s):t/(2-i-s),i){case e:o=(n-r)/t+(n<r?6:0);break;case n:o=(r-e)/t+2;break;case r:o=(e-n)/t+4;break}o/=6}return t.h=o,t.s=a,t.l=c,t}getStyle(){return"rgb("+(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"}offsetHSL(t,e,n){return this.getHSL(yi),yi.h+=t,yi.s+=e,yi.l+=n,this.setHSL(yi.h,yi.s,yi.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(yi),t.getHSL(xi);const n=_n(yi.h,xi.h,e),r=_n(yi.s,xi.s,e),i=_n(yi.l,xi.l,e);return this.setHSL(n,r,i),this}equals(t){return t.r===this.r&&t.g===this.g&&t.b===this.b}fromArray(t,e=0){return this.r=t[e],this.g=t[e+1],this.b=t[e+2],this}toArray(t=[],e=0){return t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t}fromBufferAttribute(t,e){return this.r=t.getX(e),this.g=t.getY(e),this.b=t.getZ(e),!0===t.normalized&&(this.r/=255,this.g/=255,this.b/=255),this}toJSON(){return this.getHex()}}Mi.NAMES=vi,Mi.prototype.isColor=!0,Mi.prototype.r=1,Mi.prototype.g=1,Mi.prototype.b=1;class Si extends gi{constructor(t){super(),this.type="MeshBasicMaterial",this.color=new Mi(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=$,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}}Si.prototype.isMeshBasicMaterial=!0;const Ti=new er,Ei=new Fn;class Ai{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=ln,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 r=0,i=this.itemSize;r<i;r++)this.array[t+r]=e.array[n+r];return this}copyArray(t){return this.array.set(t),this}copyColorsArray(t){const e=this.array;let n=0;for(let r=0,i=t.length;r<i;r++){let i=t[r];void 0===i&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",r),i=new Mi),e[n++]=i.r,e[n++]=i.g,e[n++]=i.b}return this}copyVector2sArray(t){const e=this.array;let n=0;for(let r=0,i=t.length;r<i;r++){let i=t[r];void 0===i&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",r),i=new Fn),e[n++]=i.x,e[n++]=i.y}return this}copyVector3sArray(t){const e=this.array;let n=0;for(let r=0,i=t.length;r<i;r++){let i=t[r];void 0===i&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",r),i=new er),e[n++]=i.x,e[n++]=i.y,e[n++]=i.z}return this}copyVector4sArray(t){const e=this.array;let n=0;for(let r=0,i=t.length;r<i;r++){let i=t[r];void 0===i&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",r),i=new Zn),e[n++]=i.x,e[n++]=i.y,e[n++]=i.z,e[n++]=i.w}return this}applyMatrix3(t){if(2===this.itemSize)for(let e=0,n=this.count;e<n;e++)Ei.fromBufferAttribute(this,e),Ei.applyMatrix3(t),this.setXY(e,Ei.x,Ei.y);else if(3===this.itemSize)for(let e=0,n=this.count;e<n;e++)Ti.fromBufferAttribute(this,e),Ti.applyMatrix3(t),this.setXYZ(e,Ti.x,Ti.y,Ti.z);return this}applyMatrix4(t){for(let e=0,n=this.count;e<n;e++)Ti.x=this.getX(e),Ti.y=this.getY(e),Ti.z=this.getZ(e),Ti.applyMatrix4(t),this.setXYZ(e,Ti.x,Ti.y,Ti.z);return this}applyNormalMatrix(t){for(let e=0,n=this.count;e<n;e++)Ti.x=this.getX(e),Ti.y=this.getY(e),Ti.z=this.getZ(e),Ti.applyNormalMatrix(t),this.setXYZ(e,Ti.x,Ti.y,Ti.z);return this}transformDirection(t){for(let e=0,n=this.count;e<n;e++)Ti.x=this.getX(e),Ti.y=this.getY(e),Ti.z=this.getZ(e),Ti.transformDirection(t),this.setXYZ(e,Ti.x,Ti.y,Ti.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,r){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=n,this.array[t+2]=r,this}setXYZW(t,e,n,r,i){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=n,this.array[t+2]=r,this.array[t+3]=i,this}onUpload(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!==ln&&(t.usage=this.usage),0===this.updateRange.offset&&-1===this.updateRange.count||(t.updateRange=this.updateRange),t}}Ai.prototype.isBufferAttribute=!0;class Li extends Ai{constructor(t,e,n){super(new Uint16Array(t),e,n)}}class Ri extends Ai{constructor(t,e,n){super(new Uint32Array(t),e,n)}}class Ci extends Ai{constructor(t,e,n){super(new Uint16Array(t),e,n)}}Ci.prototype.isFloat16BufferAttribute=!0;class Pi extends Ai{constructor(t,e,n){super(new Float32Array(t),e,n)}}let Ii=0;const Ni=new Ir,Oi=new ri,Di=new er,ki=new ir,zi=new ir,Fi=new er;class Ui extends dn{constructor(){super(),Object.defineProperty(this,"id",{value:Ii++}),this.uuid=vn(),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(Bn(t)>65535?Ri:Li)(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 Un).getNormalMatrix(t);n.applyNormalMatrix(e),n.needsUpdate=!0}const r=this.attributes.tangent;return void 0!==r&&(r.transformDirection(t),r.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}applyQuaternion(t){return Ni.makeRotationFromQuaternion(t),this.applyMatrix4(Ni),this}rotateX(t){return Ni.makeRotationX(t),this.applyMatrix4(Ni),this}rotateY(t){return Ni.makeRotationY(t),this.applyMatrix4(Ni),this}rotateZ(t){return Ni.makeRotationZ(t),this.applyMatrix4(Ni),this}translate(t,e,n){return Ni.makeTranslation(t,e,n),this.applyMatrix4(Ni),this}scale(t,e,n){return Ni.makeScale(t,e,n),this.applyMatrix4(Ni),this}lookAt(t){return Oi.lookAt(t),Oi.updateMatrix(),this.applyMatrix4(Oi.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Di).negate(),this.translate(Di.x,Di.y,Di.z),this}setFromPoints(t){const e=[];for(let n=0,r=t.length;n<r;n++){const r=t[n];e.push(r.x,r.y,r.z||0)}return this.setAttribute("position",new Pi(e,3)),this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new ir);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 er(-1/0,-1/0,-1/0),new er(1/0,1/0,1/0));if(void 0!==t){if(this.boundingBox.setFromBufferAttribute(t),e)for(let n=0,r=e.length;n<r;n++){const t=e[n];ki.setFromBufferAttribute(t),this.morphTargetsRelative?(Fi.addVectors(this.boundingBox.min,ki.min),this.boundingBox.expandByPoint(Fi),Fi.addVectors(this.boundingBox.max,ki.max),this.boundingBox.expandByPoint(Fi)):(this.boundingBox.expandByPoint(ki.min),this.boundingBox.expandByPoint(ki.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 Mr);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 er,1/0);if(t){const n=this.boundingSphere.center;if(ki.setFromBufferAttribute(t),e)for(let t=0,i=e.length;t<i;t++){const n=e[t];zi.setFromBufferAttribute(n),this.morphTargetsRelative?(Fi.addVectors(ki.min,zi.min),ki.expandByPoint(Fi),Fi.addVectors(ki.max,zi.max),ki.expandByPoint(Fi)):(ki.expandByPoint(zi.min),ki.expandByPoint(zi.max))}ki.getCenter(n);let r=0;for(let e=0,i=t.count;e<i;e++)Fi.fromBufferAttribute(t,e),r=Math.max(r,n.distanceToSquared(Fi));if(e)for(let i=0,s=e.length;i<s;i++){const s=e[i],o=this.morphTargetsRelative;for(let e=0,i=s.count;e<i;e++)Fi.fromBufferAttribute(s,e),o&&(Di.fromBufferAttribute(t,e),Fi.add(Di)),r=Math.max(r,n.distanceToSquared(Fi))}this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}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,r=e.position.array,i=e.normal.array,s=e.uv.array,o=r.length/3;void 0===e.tangent&&this.setAttribute("tangent",new Ai(new Float32Array(4*o),4));const a=e.tangent.array,c=[],l=[];for(let T=0;T<o;T++)c[T]=new er,l[T]=new er;const u=new er,h=new er,d=new er,p=new Fn,f=new Fn,m=new Fn,g=new er,v=new er;function y(t,e,n){u.fromArray(r,3*t),h.fromArray(r,3*e),d.fromArray(r,3*n),p.fromArray(s,2*t),f.fromArray(s,2*e),m.fromArray(s,2*n),h.sub(u),d.sub(u),f.sub(p),m.sub(p);const i=1/(f.x*m.y-m.x*f.y);isFinite(i)&&(g.copy(h).multiplyScalar(m.y).addScaledVector(d,-f.y).multiplyScalar(i),v.copy(d).multiplyScalar(f.x).addScaledVector(h,-m.x).multiplyScalar(i),c[t].add(g),c[e].add(g),c[n].add(g),l[t].add(v),l[e].add(v),l[n].add(v))}let x=this.groups;0===x.length&&(x=[{start:0,count:n.length}]);for(let T=0,E=x.length;T<E;++T){const t=x[T],e=t.start,r=t.count;for(let i=e,s=e+r;i<s;i+=3)y(n[i+0],n[i+1],n[i+2])}const b=new er,w=new er,_=new er,M=new er;function S(t){_.fromArray(i,3*t),M.copy(_);const e=c[t];b.copy(e),b.sub(_.multiplyScalar(_.dot(e))).normalize(),w.crossVectors(M,e);const n=w.dot(l[t]),r=n<0?-1:1;a[4*t]=b.x,a[4*t+1]=b.y,a[4*t+2]=b.z,a[4*t+3]=r}for(let T=0,E=x.length;T<E;++T){const t=x[T],e=t.start,r=t.count;for(let i=e,s=e+r;i<s;i+=3)S(n[i+0]),S(n[i+1]),S(n[i+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 Ai(new Float32Array(3*e.count),3),this.setAttribute("normal",n);else for(let t=0,e=n.count;t<e;t++)n.setXYZ(t,0,0,0);const r=new er,i=new er,s=new er,o=new er,a=new er,c=new er,l=new er,u=new er;if(t)for(let h=0,d=t.count;h<d;h+=3){const d=t.getX(h+0),p=t.getX(h+1),f=t.getX(h+2);r.fromBufferAttribute(e,d),i.fromBufferAttribute(e,p),s.fromBufferAttribute(e,f),l.subVectors(s,i),u.subVectors(r,i),l.cross(u),o.fromBufferAttribute(n,d),a.fromBufferAttribute(n,p),c.fromBufferAttribute(n,f),o.add(l),a.add(l),c.add(l),n.setXYZ(d,o.x,o.y,o.z),n.setXYZ(p,a.x,a.y,a.z),n.setXYZ(f,c.x,c.y,c.z)}else for(let t=0,h=e.count;t<h;t+=3)r.fromBufferAttribute(e,t+0),i.fromBufferAttribute(e,t+1),s.fromBufferAttribute(e,t+2),l.subVectors(s,i),u.subVectors(r,i),l.cross(u),n.setXYZ(t+0,l.x,l.y,l.z),n.setXYZ(t+1,l.x,l.y,l.z),n.setXYZ(t+2,l.x,l.y,l.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 r in n){if(void 0===t.attributes[r])continue;const i=n[r],s=i.array,o=t.attributes[r],a=o.array,c=o.itemSize*e,l=Math.min(a.length,s.length-c);for(let t=0,e=c;t<l;t++,e++)s[e]=a[t]}return this}normalizeNormals(){const t=this.attributes.normal;for(let e=0,n=t.count;e<n;e++)Fi.fromBufferAttribute(t,e),Fi.normalize(),t.setXYZ(e,Fi.x,Fi.y,Fi.z)}toNonIndexed(){function t(t,e){const n=t.array,r=t.itemSize,i=t.normalized,s=new n.constructor(e.length*r);let o=0,a=0;for(let c=0,l=e.length;c<l;c++){o=t.isInterleavedBufferAttribute?e[c]*t.data.stride+t.offset:e[c]*r;for(let t=0;t<r;t++)s[a++]=n[o++]}return new Ai(s,r,i)}if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const e=new Ui,n=this.index.array,r=this.attributes;for(const o in r){const i=r[o],s=t(i,n);e.setAttribute(o,s)}const i=this.morphAttributes;for(const o in i){const r=[],s=i[o];for(let e=0,i=s.length;e<i;e++){const i=s[e],o=t(i,n);r.push(o)}e.morphAttributes[o]=r}e.morphTargetsRelative=this.morphTargetsRelative;const s=this.groups;for(let o=0,a=s.length;o<a;o++){const t=s[o];e.addGroup(t.start,t.count,t.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 a in n){const e=n[a];t.data.attributes[a]=e.toJSON(t.data)}const r={};let i=!1;for(const a in this.morphAttributes){const e=this.morphAttributes[a],n=[];for(let r=0,i=e.length;r<i;r++){const i=e[r];n.push(i.toJSON(t.data))}n.length>0&&(r[a]=n,i=!0)}i&&(t.data.morphAttributes=r,t.data.morphTargetsRelative=this.morphTargetsRelative);const s=this.groups;s.length>0&&(t.data.groups=JSON.parse(JSON.stringify(s)));const o=this.boundingSphere;return null!==o&&(t.data.boundingSphere={center:o.center.toArray(),radius:o.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 r=t.attributes;for(const c in r){const t=r[c];this.setAttribute(c,t.clone(e))}const i=t.morphAttributes;for(const c in i){const t=[],n=i[c];for(let r=0,i=n.length;r<i;r++)t.push(n[r].clone(e));this.morphAttributes[c]=t}this.morphTargetsRelative=t.morphTargetsRelative;const s=t.groups;for(let c=0,l=s.length;c<l;c++){const t=s[c];this.addGroup(t.start,t.count,t.materialIndex)}const o=t.boundingBox;null!==o&&(this.boundingBox=o.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"})}}Ui.prototype.isBufferGeometry=!0;const Bi=new Ir,Hi=new Pr,Gi=new Mr,Vi=new er,Wi=new er,ji=new er,qi=new er,Xi=new er,Yi=new er,Ji=new er,Zi=new er,Ki=new er,$i=new Fn,Qi=new Fn,ts=new Fn,es=new er,ns=new er;class rs extends ri{constructor(t=new Ui,e=new Si){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,r=this.material,i=this.matrixWorld;if(void 0===r)return;if(null===n.boundingSphere&&n.computeBoundingSphere(),Gi.copy(n.boundingSphere),Gi.applyMatrix4(i),!1===t.ray.intersectsSphere(Gi))return;if(Bi.copy(i).invert(),Hi.copy(t.ray).applyMatrix4(Bi),null!==n.boundingBox&&!1===Hi.intersectsBox(n.boundingBox))return;let s;if(n.isBufferGeometry){const i=n.index,o=n.attributes.position,a=n.morphAttributes.position,c=n.morphTargetsRelative,l=n.attributes.uv,u=n.attributes.uv2,h=n.groups,d=n.drawRange;if(null!==i)if(Array.isArray(r))for(let n=0,p=h.length;n<p;n++){const p=h[n],f=r[p.materialIndex],m=Math.max(p.start,d.start),g=Math.min(i.count,Math.min(p.start+p.count,d.start+d.count));for(let n=m,r=g;n<r;n+=3){const r=i.getX(n),h=i.getX(n+1),d=i.getX(n+2);s=ss(this,f,t,Hi,o,a,c,l,u,r,h,d),s&&(s.faceIndex=Math.floor(n/3),s.face.materialIndex=p.materialIndex,e.push(s))}}else{const n=Math.max(0,d.start),h=Math.min(i.count,d.start+d.count);for(let d=n,p=h;d<p;d+=3){const n=i.getX(d),h=i.getX(d+1),p=i.getX(d+2);s=ss(this,r,t,Hi,o,a,c,l,u,n,h,p),s&&(s.faceIndex=Math.floor(d/3),e.push(s))}}else if(void 0!==o)if(Array.isArray(r))for(let n=0,p=h.length;n<p;n++){const i=h[n],p=r[i.materialIndex],f=Math.max(i.start,d.start),m=Math.min(o.count,Math.min(i.start+i.count,d.start+d.count));for(let n=f,r=m;n<r;n+=3){const r=n,h=n+1,d=n+2;s=ss(this,p,t,Hi,o,a,c,l,u,r,h,d),s&&(s.faceIndex=Math.floor(n/3),s.face.materialIndex=i.materialIndex,e.push(s))}}else{const n=Math.max(0,d.start),i=Math.min(o.count,d.start+d.count);for(let h=n,d=i;h<d;h+=3){const n=h,i=h+1,d=h+2;s=ss(this,r,t,Hi,o,a,c,l,u,n,i,d),s&&(s.faceIndex=Math.floor(h/3),e.push(s))}}}else n.isGeometry&&console.error("THREE.Mesh.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}}function is(t,e,n,r,i,s,o,a){let c;if(c=e.side===x?r.intersectTriangle(o,s,i,!0,a):r.intersectTriangle(i,s,o,e.side!==b,a),null===c)return null;ns.copy(a),ns.applyMatrix4(t.matrixWorld);const l=n.ray.origin.distanceTo(ns);return l<n.near||l>n.far?null:{distance:l,point:ns.clone(),object:t}}function ss(t,e,n,r,i,s,o,a,c,l,u,h){Vi.fromBufferAttribute(i,l),Wi.fromBufferAttribute(i,u),ji.fromBufferAttribute(i,h);const d=t.morphTargetInfluences;if(s&&d){Ji.set(0,0,0),Zi.set(0,0,0),Ki.set(0,0,0);for(let t=0,e=s.length;t<e;t++){const e=d[t],n=s[t];0!==e&&(qi.fromBufferAttribute(n,l),Xi.fromBufferAttribute(n,u),Yi.fromBufferAttribute(n,h),o?(Ji.addScaledVector(qi,e),Zi.addScaledVector(Xi,e),Ki.addScaledVector(Yi,e)):(Ji.addScaledVector(qi.sub(Vi),e),Zi.addScaledVector(Xi.sub(Wi),e),Ki.addScaledVector(Yi.sub(ji),e)))}Vi.add(Ji),Wi.add(Zi),ji.add(Ki)}t.isSkinnedMesh&&(t.boneTransform(l,Vi),t.boneTransform(u,Wi),t.boneTransform(h,ji));const p=is(t,e,n,r,Vi,Wi,ji,es);if(p){a&&($i.fromBufferAttribute(a,l),Qi.fromBufferAttribute(a,u),ts.fromBufferAttribute(a,h),p.uv=fi.getUV(es,Vi,Wi,ji,$i,Qi,ts,new Fn)),c&&($i.fromBufferAttribute(c,l),Qi.fromBufferAttribute(c,u),ts.fromBufferAttribute(c,h),p.uv2=fi.getUV(es,Vi,Wi,ji,$i,Qi,ts,new Fn));const t={a:l,b:u,c:h,normal:new er,materialIndex:0};fi.getNormal(Vi,Wi,ji,t.normal),p.face=t}return p}rs.prototype.isMesh=!0;class os extends Ui{constructor(t=1,e=1,n=1,r=1,i=1,s=1){super(),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:n,widthSegments:r,heightSegments:i,depthSegments:s};const o=this;r=Math.floor(r),i=Math.floor(i),s=Math.floor(s);const a=[],c=[],l=[],u=[];let h=0,d=0;function p(t,e,n,r,i,s,p,f,m,g,v){const y=s/m,x=p/g,b=s/2,w=p/2,_=f/2,M=m+1,S=g+1;let T=0,E=0;const A=new er;for(let o=0;o<S;o++){const s=o*x-w;for(let a=0;a<M;a++){const h=a*y-b;A[t]=h*r,A[e]=s*i,A[n]=_,c.push(A.x,A.y,A.z),A[t]=0,A[e]=0,A[n]=f>0?1:-1,l.push(A.x,A.y,A.z),u.push(a/m),u.push(1-o/g),T+=1}}for(let o=0;o<g;o++)for(let t=0;t<m;t++){const e=h+t+M*o,n=h+t+M*(o+1),r=h+(t+1)+M*(o+1),i=h+(t+1)+M*o;a.push(e,n,i),a.push(n,r,i),E+=6}o.addGroup(d,E,v),d+=E,h+=T}p("z","y","x",-1,-1,n,e,t,s,i,0),p("z","y","x",1,-1,n,e,-t,s,i,1),p("x","z","y",1,1,t,n,e,r,s,2),p("x","z","y",1,-1,t,n,-e,r,s,3),p("x","y","z",1,-1,t,e,n,r,i,4),p("x","y","z",-1,-1,t,e,-n,r,i,5),this.setIndex(a),this.setAttribute("position",new Pi(c,3)),this.setAttribute("normal",new Pi(l,3)),this.setAttribute("uv",new Pi(u,2))}static fromJSON(t){return new os(t.width,t.height,t.depth,t.widthSegments,t.heightSegments,t.depthSegments)}}function as(t){const e={};for(const n in t){e[n]={};for(const r in t[n]){const i=t[n][r];i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture||i.isQuaternion)?e[n][r]=i.clone():Array.isArray(i)?e[n][r]=i.slice():e[n][r]=i}}return e}function cs(t){const e={};for(let n=0;n<t.length;n++){const r=as(t[n]);for(const t in r)e[t]=r[t]}return e}const ls={clone:as,merge:cs};var us="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",hs="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}";class ds extends gi{constructor(t){super(),this.type="ShaderMaterial",this.defines={},this.uniforms={},this.vertexShader=us,this.fragmentShader=hs,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=as(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 r in this.uniforms){const n=this.uniforms[r],i=n.value;i&&i.isTexture?e.uniforms[r]={type:"t",value:i.toJSON(t).uuid}:i&&i.isColor?e.uniforms[r]={type:"c",value:i.getHex()}:i&&i.isVector2?e.uniforms[r]={type:"v2",value:i.toArray()}:i&&i.isVector3?e.uniforms[r]={type:"v3",value:i.toArray()}:i&&i.isVector4?e.uniforms[r]={type:"v4",value:i.toArray()}:i&&i.isMatrix3?e.uniforms[r]={type:"m3",value:i.toArray()}:i&&i.isMatrix4?e.uniforms[r]={type:"m4",value:i.toArray()}:e.uniforms[r]={value:i}}Object.keys(this.defines).length>0&&(e.defines=this.defines),e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader;const n={};for(const r in this.extensions)!0===this.extensions[r]&&(n[r]=!0);return Object.keys(n).length>0&&(e.extensions=n),e}}ds.prototype.isShaderMaterial=!0;class ps extends ri{constructor(){super(),this.type="Camera",this.matrixWorldInverse=new Ir,this.projectionMatrix=new Ir,this.projectionMatrixInverse=new Ir}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)}}ps.prototype.isCamera=!0;class fs extends ps{constructor(t=50,e=1,n=.1,r=2e3){super(),this.type="PerspectiveCamera",this.fov=t,this.zoom=1,this.near=n,this.far=r,this.focus=10,this.aspect=e,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}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*gn*Math.atan(e),this.updateProjectionMatrix()}getFocalLength(){const t=Math.tan(.5*mn*this.fov);return.5*this.getFilmHeight()/t}getEffectiveFOV(){return 2*gn*Math.atan(Math.tan(.5*mn*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,r,i,s){this.aspect=t/e,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=n,this.view.offsetY=r,this.view.width=i,this.view.height=s,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=this.near;let e=t*Math.tan(.5*mn*this.fov)/this.zoom,n=2*e,r=this.aspect*n,i=-.5*r;const s=this.view;if(null!==this.view&&this.view.enabled){const t=s.fullWidth,o=s.fullHeight;i+=s.offsetX*r/t,e-=s.offsetY*n/o,r*=s.width/t,n*=s.height/o}const o=this.filmOffset;0!==o&&(i+=t*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(i,i+r,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}}fs.prototype.isPerspectiveCamera=!0;const ms=90,gs=1;class vs extends ri{constructor(t,e,n){if(super(),this.type="CubeCamera",!0!==n.isWebGLCubeRenderTarget)return void console.error("THREE.CubeCamera: The constructor now expects an instance of WebGLCubeRenderTarget as third parameter.");this.renderTarget=n;const r=new fs(ms,gs,t,e);r.layers=this.layers,r.up.set(0,-1,0),r.lookAt(new er(1,0,0)),this.add(r);const i=new fs(ms,gs,t,e);i.layers=this.layers,i.up.set(0,-1,0),i.lookAt(new er(-1,0,0)),this.add(i);const s=new fs(ms,gs,t,e);s.layers=this.layers,s.up.set(0,0,1),s.lookAt(new er(0,1,0)),this.add(s);const o=new fs(ms,gs,t,e);o.layers=this.layers,o.up.set(0,0,-1),o.lookAt(new er(0,-1,0)),this.add(o);const a=new fs(ms,gs,t,e);a.layers=this.layers,a.up.set(0,-1,0),a.lookAt(new er(0,0,1)),this.add(a);const c=new fs(ms,gs,t,e);c.layers=this.layers,c.up.set(0,-1,0),c.lookAt(new er(0,0,-1)),this.add(c)}update(t,e){null===this.parent&&this.updateMatrixWorld();const n=this.renderTarget,[r,i,s,o,a,c]=this.children,l=t.xr.enabled,u=t.getRenderTarget();t.xr.enabled=!1;const h=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,t.setRenderTarget(n,0),t.render(e,r),t.setRenderTarget(n,1),t.render(e,i),t.setRenderTarget(n,2),t.render(e,s),t.setRenderTarget(n,3),t.render(e,o),t.setRenderTarget(n,4),t.render(e,a),n.texture.generateMipmaps=h,t.setRenderTarget(n,5),t.render(e,c),t.setRenderTarget(u),t.xr.enabled=l}}class ys extends Yn{constructor(t,e,n,r,i,s,o,a,c,l){t=void 0!==t?t:[],e=void 0!==e?e:ct,super(t,e,n,r,i,s,o,a,c,l),this.flipY=!1}get images(){return this.image}set images(t){this.image=t}}ys.prototype.isCubeTexture=!0;class xs extends Kn{constructor(t,e,n){Number.isInteger(e)&&(console.warn("THREE.WebGLCubeRenderTarget: constructor signature is now WebGLCubeRenderTarget( size, options )"),e=n),super(t,t,e),e=e||{},this.texture=new ys(void 0,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:bt,this.texture._needsFlipEnvMap=!1}fromEquirectangularTexture(t,e){this.texture.type=e.type,this.texture.format=zt,this.texture.encoding=e.encoding,this.texture.generateMipmaps=e.generateMipmaps,this.texture.minFilter=e.minFilter,this.texture.magFilter=e.magFilter;const n={uniforms:{tEquirect:{value:null}},vertexShader:"\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",fragmentShader:"\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"},r=new os(5,5,5),i=new ds({name:"CubemapFromEquirect",uniforms:as(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:x,blending:_});i.uniforms.tEquirect.value=e;const s=new rs(r,i),o=e.minFilter;e.minFilter===_t&&(e.minFilter=bt);const a=new vs(1,10,this);return a.update(t,s),e.minFilter=o,s.geometry.dispose(),s.material.dispose(),this}clear(t,e,n,r){const i=t.getRenderTarget();for(let s=0;s<6;s++)t.setRenderTarget(this,s),t.clear(e,n,r);t.setRenderTarget(i)}}xs.prototype.isWebGLCubeRenderTarget=!0;const bs=new er,ws=new er,_s=new Un;class Ms{constructor(t=new er(1,0,0),e=0){this.normal=t,this.constant=e}set(t,e){return this.normal.copy(t),this.constant=e,this}setComponents(t,e,n,r){return this.normal.set(t,e,n),this.constant=r,this}setFromNormalAndCoplanarPoint(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this}setFromCoplanarPoints(t,e,n){const r=bs.subVectors(n,e).cross(ws.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(r,t),this}copy(t){return this.normal.copy(t.normal),this.constant=t.constant,this}normalize(){const t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(t){return this.normal.dot(t)+this.constant}distanceToSphere(t){return this.distanceToPoint(t.center)-t.radius}projectPoint(t,e){return e.copy(this.normal).multiplyScalar(-this.distanceToPoint(t)).add(t)}intersectLine(t,e){const n=t.delta(bs),r=this.normal.dot(n);if(0===r)return 0===this.distanceToPoint(t.start)?e.copy(t.start):null;const i=-(t.start.dot(this.normal)+this.constant)/r;return i<0||i>1?null:e.copy(n).multiplyScalar(i).add(t.start)}intersectsLine(t){const e=this.distanceToPoint(t.start),n=this.distanceToPoint(t.end);return e<0&&n>0||n<0&&e>0}intersectsBox(t){return t.intersectsPlane(this)}intersectsSphere(t){return t.intersectsPlane(this)}coplanarPoint(t){return t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){const n=e||_s.getNormalMatrix(t),r=this.coplanarPoint(bs).applyMatrix4(t),i=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(i),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}clone(){return(new this.constructor).copy(this)}}Ms.prototype.isPlane=!0;const Ss=new Mr,Ts=new er;class Es{constructor(t=new Ms,e=new Ms,n=new Ms,r=new Ms,i=new Ms,s=new Ms){this.planes=[t,e,n,r,i,s]}set(t,e,n,r,i,s){const o=this.planes;return o[0].copy(t),o[1].copy(e),o[2].copy(n),o[3].copy(r),o[4].copy(i),o[5].copy(s),this}copy(t){const e=this.planes;for(let n=0;n<6;n++)e[n].copy(t.planes[n]);return this}setFromProjectionMatrix(t){const e=this.planes,n=t.elements,r=n[0],i=n[1],s=n[2],o=n[3],a=n[4],c=n[5],l=n[6],u=n[7],h=n[8],d=n[9],p=n[10],f=n[11],m=n[12],g=n[13],v=n[14],y=n[15];return e[0].setComponents(o-r,u-a,f-h,y-m).normalize(),e[1].setComponents(o+r,u+a,f+h,y+m).normalize(),e[2].setComponents(o+i,u+c,f+d,y+g).normalize(),e[3].setComponents(o-i,u-c,f-d,y-g).normalize(),e[4].setComponents(o-s,u-l,f-p,y-v).normalize(),e[5].setComponents(o+s,u+l,f+p,y+v).normalize(),this}intersectsObject(t){const e=t.geometry;return null===e.boundingSphere&&e.computeBoundingSphere(),Ss.copy(e.boundingSphere).applyMatrix4(t.matrixWorld),this.intersectsSphere(Ss)}intersectsSprite(t){return Ss.center.set(0,0,0),Ss.radius=.7071067811865476,Ss.applyMatrix4(t.matrixWorld),this.intersectsSphere(Ss)}intersectsSphere(t){const e=this.planes,n=t.center,r=-t.radius;for(let i=0;i<6;i++){const t=e[i].distanceToPoint(n);if(t<r)return!1}return!0}intersectsBox(t){const e=this.planes;for(let n=0;n<6;n++){const r=e[n];if(Ts.x=r.normal.x>0?t.max.x:t.min.x,Ts.y=r.normal.y>0?t.max.y:t.min.y,Ts.z=r.normal.z>0?t.max.z:t.min.z,r.distanceToPoint(Ts)<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 As(){let t=null,e=!1,n=null,r=null;function i(e,s){n(e,s),r=t.requestAnimationFrame(i)}return{start:function(){!0!==e&&null!==n&&(r=t.requestAnimationFrame(i),e=!0)},stop:function(){t.cancelAnimationFrame(r),e=!1},setAnimationLoop:function(t){n=t},setContext:function(e){t=e}}}function Ls(t,e){const n=e.isWebGL2,r=new WeakMap;function i(e,r){const i=e.array,s=e.usage,o=t.createBuffer();t.bindBuffer(r,o),t.bufferData(r,i,s),e.onUploadCallback();let a=5126;return i instanceof Float32Array?a=5126:i instanceof Float64Array?console.warn("THREE.WebGLAttributes: Unsupported data buffer format: Float64Array."):i instanceof Uint16Array?e.isFloat16BufferAttribute?n?a=5131:console.warn("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2."):a=5123:i instanceof Int16Array?a=5122:i instanceof Uint32Array?a=5125:i instanceof Int32Array?a=5124:i instanceof Int8Array?a=5120:(i instanceof Uint8Array||i instanceof Uint8ClampedArray)&&(a=5121),{buffer:o,type:a,bytesPerElement:i.BYTES_PER_ELEMENT,version:e.version}}function s(e,r,i){const s=r.array,o=r.updateRange;t.bindBuffer(i,e),-1===o.count?t.bufferSubData(i,0,s):(n?t.bufferSubData(i,o.offset*s.BYTES_PER_ELEMENT,s,o.offset,o.count):t.bufferSubData(i,o.offset*s.BYTES_PER_ELEMENT,s.subarray(o.offset,o.offset+o.count)),o.count=-1)}function o(t){return t.isInterleavedBufferAttribute&&(t=t.data),r.get(t)}function a(e){e.isInterleavedBufferAttribute&&(e=e.data);const n=r.get(e);n&&(t.deleteBuffer(n.buffer),r.delete(e))}function c(t,e){if(t.isGLBufferAttribute){const e=r.get(t);return void((!e||e.version<t.version)&&r.set(t,{buffer:t.buffer,type:t.type,bytesPerElement:t.elementSize,version:t.version}))}t.isInterleavedBufferAttribute&&(t=t.data);const n=r.get(t);void 0===n?r.set(t,i(t,e)):n.version<t.version&&(s(n.buffer,t,e),n.version=t.version)}return{get:o,remove:a,update:c}}class Rs extends Ui{constructor(t=1,e=1,n=1,r=1){super(),this.type="PlaneGeometry",this.parameters={width:t,height:e,widthSegments:n,heightSegments:r};const i=t/2,s=e/2,o=Math.floor(n),a=Math.floor(r),c=o+1,l=a+1,u=t/o,h=e/a,d=[],p=[],f=[],m=[];for(let g=0;g<l;g++){const t=g*h-s;for(let e=0;e<c;e++){const n=e*u-i;p.push(n,-t,0),f.push(0,0,1),m.push(e/o),m.push(1-g/a)}}for(let g=0;g<a;g++)for(let t=0;t<o;t++){const e=t+c*g,n=t+c*(g+1),r=t+1+c*(g+1),i=t+1+c*g;d.push(e,n,i),d.push(n,r,i)}this.setIndex(d),this.setAttribute("position",new Pi(p,3)),this.setAttribute("normal",new Pi(f,3)),this.setAttribute("uv",new Pi(m,2))}static fromJSON(t){return new Rs(t.width,t.height,t.widthSegments,t.heightSegments)}}var Cs="#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif",Ps="#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",Is="#ifdef USE_ALPHATEST\n\tif ( diffuseColor.a < alphaTest ) discard;\n#endif",Ns="#ifdef USE_ALPHATEST\n\tuniform float alphaTest;\n#endif",Os="#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",Ds="#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",ks="vec3 transformed = vec3( position );",zs="vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif",Fs="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",Us="#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",Bs="#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",Hs="#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",Gs="#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif",Vs="#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif",Ws="#if defined( USE_COLOR_ALPHA )\n\tdiffuseColor *= vColor;\n#elif defined( USE_COLOR )\n\tdiffuseColor.rgb *= vColor;\n#endif",js="#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR )\n\tvarying vec3 vColor;\n#endif",qs="#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvarying vec3 vColor;\n#endif",Xs="#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",Ys="#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}",Js="#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_maxMipLevel 8.0\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_maxTileSize 256.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\tfloat texelSize = 1.0 / ( 3.0 * cubeUV_maxTileSize );\n\t\tvec2 uv = getUV( direction, face ) * ( faceSize - 1.0 );\n\t\tvec2 f = fract( uv );\n\t\tuv += 0.5 - f;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tif ( mipInt < cubeUV_maxMipLevel ) {\n\t\t\tuv.y += 2.0 * cubeUV_maxTileSize;\n\t\t}\n\t\tuv.y += filterInt * 2.0 * cubeUV_minTileSize;\n\t\tuv.x += 3.0 * max( 0.0, cubeUV_maxTileSize - 2.0 * faceSize );\n\t\tuv *= texelSize;\n\t\tvec3 tl = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tuv.x += texelSize;\n\t\tvec3 tr = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tuv.y += texelSize;\n\t\tvec3 br = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tuv.x -= texelSize;\n\t\tvec3 bl = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tvec3 tm = mix( tl, tr, f.x );\n\t\tvec3 bm = mix( bl, br, f.x );\n\t\treturn mix( tm, bm, f.y );\n\t}\n\t#define r0 1.0\n\t#define v0 0.339\n\t#define m0 - 2.0\n\t#define r1 0.8\n\t#define v1 0.276\n\t#define m1 - 1.0\n\t#define r4 0.4\n\t#define v4 0.046\n\t#define m4 2.0\n\t#define r5 0.305\n\t#define v5 0.016\n\t#define m5 3.0\n\t#define r6 0.21\n\t#define v6 0.0038\n\t#define m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= r1 ) {\n\t\t\tmip = ( r0 - roughness ) * ( m1 - m0 ) / ( r0 - r1 ) + m0;\n\t\t} else if ( roughness >= r4 ) {\n\t\t\tmip = ( r1 - roughness ) * ( m4 - m1 ) / ( r1 - r4 ) + m1;\n\t\t} else if ( roughness >= r5 ) {\n\t\t\tmip = ( r4 - roughness ) * ( m5 - m4 ) / ( r4 - r5 ) + m4;\n\t\t} else if ( roughness >= r6 ) {\n\t\t\tmip = ( r5 - roughness ) * ( m6 - m5 ) / ( r5 - r6 ) + m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), m0, cubeUV_maxMipLevel );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif",Zs="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",Ks="#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",$s="#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias );\n#endif",Qs="#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",to="#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",eo="gl_FragColor = linearToOutputTexel( gl_FragColor );",no="\nvec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( gammaFactor ) ), value.a );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( 1.0 / gammaFactor ) ), value.a );\n}\nvec4 sRGBToLinear( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}\nvec4 RGBEToLinear( in vec4 value ) {\n\treturn vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 LinearToRGBE( in vec4 value ) {\n\tfloat maxComponent = max( max( value.r, value.g ), value.b );\n\tfloat fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\n\treturn vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\n}\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * value.a * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat M = clamp( maxRGB / maxRange, 0.0, 1.0 );\n\tM = ceil( M * 255.0 ) / 255.0;\n\treturn vec4( value.rgb / ( M * maxRange ), M );\n}\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat D = max( maxRange / maxRGB, 1.0 );\n\tD = clamp( floor( D ) / 255.0, 0.0, 1.0 );\n\treturn vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\n}",ro="#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\tenvColor = envMapTexelToLinear( envColor );\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",io="#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",so="#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",oo="#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",ao="#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",co="#ifdef USE_FOG\n\tvFogDepth = - mvPosition.z;\n#endif",lo="#ifdef USE_FOG\n\tvarying float vFogDepth;\n#endif",uo="#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",ho="#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",po="#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn texture2D( gradientMap, coord ).rgb;\n\t#else\n\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t#endif\n}",fo="#ifdef USE_LIGHTMAP\n\tvec4 lightMapTexel = texture2D( lightMap, vUv2 );\n\tvec3 lightMapIrradiance = lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tlightMapIrradiance *= PI;\n\t#endif\n\treflectedLight.indirectDiffuse += lightMapIrradiance;\n#endif",mo="#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",go="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",vo="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",yo="#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",xo="ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",bo="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)",wo="BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",_o="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)",Mo="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 *= specularColorMapTexelToLinear( 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 *= sheenColorMapTexelToLinear( 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",So="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 );\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\treflectedLight.directSpecular += 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\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}",To="\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",Eo="#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vUv2 );\n\t\tvec3 lightMapIrradiance = lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tlightMapIrradiance *= PI;\n\t\t#endif\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += 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",Ao="#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",Lo="#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",Ro="#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",Co="#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",Po="#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",Io="#ifdef USE_MAP\n\tvec4 texelColor = texture2D( map, vUv );\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\n#endif",No="#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",Oo="#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n#endif\n#ifdef USE_MAP\n\tvec4 mapTexel = texture2D( map, uv );\n\tdiffuseColor *= mapTexelToLinear( mapTexel );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",Do="#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",ko="float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",zo="#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",Fo="#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, 2 ) * 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",Uo="#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\tvec3 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset, const in int stride ) {\n\t\t\tfloat texelIndex = float( vertexIndex * 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 ).xyz;\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",Bo="#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t\t#ifndef USE_MORPHNORMALS\n\t\t\t\tif ( morphTargetInfluences[ i ] > 0.0 ) transformed += getMorph( gl_VertexID, i, 0, 1 ) * morphTargetInfluences[ i ];\n\t\t\t#else\n\t\t\t\tif ( morphTargetInfluences[ i ] > 0.0 ) transformed += getMorph( gl_VertexID, i, 0, 2 ) * morphTargetInfluences[ i ];\n\t\t\t#endif\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",Ho="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;",Go="#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",Vo="#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",Wo="#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",jo="#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",qo="#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",Xo="#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal = geometryNormal;\n#endif",Yo="#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",Jo="#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",Zo="#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 );",Ko="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}",$o="#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",Qo="vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",ta="#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",ea="#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",na="float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",ra="#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",ia="#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",sa="#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",oa="#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",aa="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}",ca="#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",la="#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",ua="#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",ha="#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",da="float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",pa="#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",fa="#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",ma="#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; }",ga="#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",va="#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( vec3 n, vec3 v, float thickness, float ior, 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( float roughness, float ior ) {\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\t}\n\tvec4 getTransmissionSample( vec2 fragCoord, float roughness, float ior ) {\n\t\tfloat framebufferLod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\t#ifdef TEXTURE_LOD_EXT\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( vec3 radiance, float transmissionDistance, vec3 attenuationColor, 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( vec3 n, vec3 v, float roughness, vec3 diffuseColor, vec3 specularColor, float specularF90,\n\t\tvec3 position, mat4 modelMatrix, mat4 viewMatrix, mat4 projMatrix, float ior, float thickness,\n\t\tvec3 attenuationColor, 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",ya="#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )\n\tvarying vec2 vUv;\n#endif",xa="#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",ba="#ifdef USE_UV\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n#endif",wa="#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",_a="#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n\tuniform mat3 uv2Transform;\n#endif",Ma="#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;\n#endif",Sa="#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";const Ta="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}",Ea="uniform sampler2D t2D;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",Aa="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}",La="#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}",Ra="#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}",Ca="#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}",Pa="#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}",Ia="#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}",Na="varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}",Oa="uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tvec4 texColor = texture2D( tEquirect, sampleUV );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",Da="uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include <color_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",ka="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}",za="#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#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}",Fa="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 += lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <envmap_fragment>\n\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}",Ua="#define LAMBERT\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <lights_lambert_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",Ba="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}",Ha="#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 <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}",Ga="#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\tmatcapColor = matcapTexelToLinear( matcapColor );\n\t#else\n\t\tvec4 matcapColor = vec4( 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}",Va="#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}",Wa="#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}",ja="#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 <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}",qa="#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}",Xa="#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 <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}",Ya="#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_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}",Ja="#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 <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}",Za="#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}",Ka="uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <color_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <fog_vertex>\n}",$a="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}",Qa="#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}",tc="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}",ec="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}",nc="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}",rc={alphamap_fragment:Cs,alphamap_pars_fragment:Ps,alphatest_fragment:Is,alphatest_pars_fragment:Ns,aomap_fragment:Os,aomap_pars_fragment:Ds,begin_vertex:ks,beginnormal_vertex:zs,bsdfs:Fs,bumpmap_pars_fragment:Us,clipping_planes_fragment:Bs,clipping_planes_pars_fragment:Hs,clipping_planes_pars_vertex:Gs,clipping_planes_vertex:Vs,color_fragment:Ws,color_pars_fragment:js,color_pars_vertex:qs,color_vertex:Xs,common:Ys,cube_uv_reflection_fragment:Js,defaultnormal_vertex:Zs,displacementmap_pars_vertex:Ks,displacementmap_vertex:$s,emissivemap_fragment:Qs,emissivemap_pars_fragment:to,encodings_fragment:eo,encodings_pars_fragment:no,envmap_fragment:ro,envmap_common_pars_fragment:io,envmap_pars_fragment:so,envmap_pars_vertex:oo,envmap_physical_pars_fragment:yo,envmap_vertex:ao,fog_vertex:co,fog_pars_vertex:lo,fog_fragment:uo,fog_pars_fragment:ho,gradientmap_pars_fragment:po,lightmap_fragment:fo,lightmap_pars_fragment:mo,lights_lambert_vertex:go,lights_pars_begin:vo,lights_toon_fragment:xo,lights_toon_pars_fragment:bo,lights_phong_fragment:wo,lights_phong_pars_fragment:_o,lights_physical_fragment:Mo,lights_physical_pars_fragment:So,lights_fragment_begin:To,lights_fragment_maps:Eo,lights_fragment_end:Ao,logdepthbuf_fragment:Lo,logdepthbuf_pars_fragment:Ro,logdepthbuf_pars_vertex:Co,logdepthbuf_vertex:Po,map_fragment:Io,map_pars_fragment:No,map_particle_fragment:Oo,map_particle_pars_fragment:Do,metalnessmap_fragment:ko,metalnessmap_pars_fragment:zo,morphnormal_vertex:Fo,morphtarget_pars_vertex:Uo,morphtarget_vertex:Bo,normal_fragment_begin:Ho,normal_fragment_maps:Go,normal_pars_fragment:Vo,normal_pars_vertex:Wo,normal_vertex:jo,normalmap_pars_fragment:qo,clearcoat_normal_fragment_begin:Xo,clearcoat_normal_fragment_maps:Yo,clearcoat_pars_fragment:Jo,output_fragment:Zo,packing:Ko,premultiplied_alpha_fragment:$o,project_vertex:Qo,dithering_fragment:ta,dithering_pars_fragment:ea,roughnessmap_fragment:na,roughnessmap_pars_fragment:ra,shadowmap_pars_fragment:ia,shadowmap_pars_vertex:sa,shadowmap_vertex:oa,shadowmask_pars_fragment:aa,skinbase_vertex:ca,skinning_pars_vertex:la,skinning_vertex:ua,skinnormal_vertex:ha,specularmap_fragment:da,specularmap_pars_fragment:pa,tonemapping_fragment:fa,tonemapping_pars_fragment:ma,transmission_fragment:ga,transmission_pars_fragment:va,uv_pars_fragment:ya,uv_pars_vertex:xa,uv_vertex:ba,uv2_pars_fragment:wa,uv2_pars_vertex:_a,uv2_vertex:Ma,worldpos_vertex:Sa,background_vert:Ta,background_frag:Ea,cube_vert:Aa,cube_frag:La,depth_vert:Ra,depth_frag:Ca,distanceRGBA_vert:Pa,distanceRGBA_frag:Ia,equirect_vert:Na,equirect_frag:Oa,linedashed_vert:Da,linedashed_frag:ka,meshbasic_vert:za,meshbasic_frag:Fa,meshlambert_vert:Ua,meshlambert_frag:Ba,meshmatcap_vert:Ha,meshmatcap_frag:Ga,meshnormal_vert:Va,meshnormal_frag:Wa,meshphong_vert:ja,meshphong_frag:qa,meshphysical_vert:Xa,meshphysical_frag:Ya,meshtoon_vert:Ja,meshtoon_frag:Za,points_vert:Ka,points_frag:$a,shadow_vert:Qa,shadow_frag:tc,sprite_vert:ec,sprite_frag:nc},ic={common:{diffuse:{value:new Mi(16777215)},opacity:{value:1},map:{value:null},uvTransform:{value:new Un},uv2Transform:{value:new Un},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 Fn(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 Mi(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 Mi(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new Un}},sprite:{diffuse:{value:new Mi(16777215)},opacity:{value:1},center:{value:new Fn(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new Un}}},sc={basic:{uniforms:cs([ic.common,ic.specularmap,ic.envmap,ic.aomap,ic.lightmap,ic.fog]),vertexShader:rc.meshbasic_vert,fragmentShader:rc.meshbasic_frag},lambert:{uniforms:cs([ic.common,ic.specularmap,ic.envmap,ic.aomap,ic.lightmap,ic.emissivemap,ic.fog,ic.lights,{emissive:{value:new Mi(0)}}]),vertexShader:rc.meshlambert_vert,fragmentShader:rc.meshlambert_frag},phong:{uniforms:cs([ic.common,ic.specularmap,ic.envmap,ic.aomap,ic.lightmap,ic.emissivemap,ic.bumpmap,ic.normalmap,ic.displacementmap,ic.fog,ic.lights,{emissive:{value:new Mi(0)},specular:{value:new Mi(1118481)},shininess:{value:30}}]),vertexShader:rc.meshphong_vert,fragmentShader:rc.meshphong_frag},standard:{uniforms:cs([ic.common,ic.envmap,ic.aomap,ic.lightmap,ic.emissivemap,ic.bumpmap,ic.normalmap,ic.displacementmap,ic.roughnessmap,ic.metalnessmap,ic.fog,ic.lights,{emissive:{value:new Mi(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:rc.meshphysical_vert,fragmentShader:rc.meshphysical_frag},toon:{uniforms:cs([ic.common,ic.aomap,ic.lightmap,ic.emissivemap,ic.bumpmap,ic.normalmap,ic.displacementmap,ic.gradientmap,ic.fog,ic.lights,{emissive:{value:new Mi(0)}}]),vertexShader:rc.meshtoon_vert,fragmentShader:rc.meshtoon_frag},matcap:{uniforms:cs([ic.common,ic.bumpmap,ic.normalmap,ic.displacementmap,ic.fog,{matcap:{value:null}}]),vertexShader:rc.meshmatcap_vert,fragmentShader:rc.meshmatcap_frag},points:{uniforms:cs([ic.points,ic.fog]),vertexShader:rc.points_vert,fragmentShader:rc.points_frag},dashed:{uniforms:cs([ic.common,ic.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:rc.linedashed_vert,fragmentShader:rc.linedashed_frag},depth:{uniforms:cs([ic.common,ic.displacementmap]),vertexShader:rc.depth_vert,fragmentShader:rc.depth_frag},normal:{uniforms:cs([ic.common,ic.bumpmap,ic.normalmap,ic.displacementmap,{opacity:{value:1}}]),vertexShader:rc.meshnormal_vert,fragmentShader:rc.meshnormal_frag},sprite:{uniforms:cs([ic.sprite,ic.fog]),vertexShader:rc.sprite_vert,fragmentShader:rc.sprite_frag},background:{uniforms:{uvTransform:{value:new Un},t2D:{value:null}},vertexShader:rc.background_vert,fragmentShader:rc.background_frag},cube:{uniforms:cs([ic.envmap,{opacity:{value:1}}]),vertexShader:rc.cube_vert,fragmentShader:rc.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:rc.equirect_vert,fragmentShader:rc.equirect_frag},distanceRGBA:{uniforms:cs([ic.common,ic.displacementmap,{referencePosition:{value:new er},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:rc.distanceRGBA_vert,fragmentShader:rc.distanceRGBA_frag},shadow:{uniforms:cs([ic.lights,ic.fog,{color:{value:new Mi(0)},opacity:{value:1}}]),vertexShader:rc.shadow_vert,fragmentShader:rc.shadow_frag}};function oc(t,e,n,r,i){const s=new Mi(0);let o,a,c=0,l=null,u=0,h=null;function d(n,i){let d=!1,f=!0===i.isScene?i.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),d=!0),(t.autoClear||d)&&t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil),f&&(f.isCubeTexture||f.mapping===dt)?(void 0===a&&(a=new rs(new os(1,1,1),new ds({name:"BackgroundCubeMaterial",uniforms:as(sc.cube.uniforms),vertexShader:sc.cube.vertexShader,fragmentShader:sc.cube.fragmentShader,side:x,depthTest:!1,depthWrite:!1,fog:!1})),a.geometry.deleteAttribute("normal"),a.geometry.deleteAttribute("uv"),a.onBeforeRender=function(t,e,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(a.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(a)),a.material.uniforms.envMap.value=f,a.material.uniforms.flipEnvMap.value=f.isCubeTexture&&!1===f.isRenderTargetTexture?-1:1,l===f&&u===f.version&&h===t.toneMapping||(a.material.needsUpdate=!0,l=f,u=f.version,h=t.toneMapping),n.unshift(a,a.geometry,a.material,0,0,null)):f&&f.isTexture&&(void 0===o&&(o=new rs(new Rs(2,2),new ds({name:"BackgroundMaterial",uniforms:as(sc.background.uniforms),vertexShader:sc.background.vertexShader,fragmentShader:sc.background.fragmentShader,side:y,depthTest:!1,depthWrite:!1,fog:!1})),o.geometry.deleteAttribute("normal"),Object.defineProperty(o.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(o)),o.material.uniforms.t2D.value=f,!0===f.matrixAutoUpdate&&f.updateMatrix(),o.material.uniforms.uvTransform.value.copy(f.matrix),l===f&&u===f.version&&h===t.toneMapping||(o.material.needsUpdate=!0,l=f,u=f.version,h=t.toneMapping),n.unshift(o,o.geometry,o.material,0,0,null))}function p(t,e){n.buffers.color.setClear(t.r,t.g,t.b,e,i)}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:d}}function ac(t,e,n,r){const i=t.getParameter(34921),s=r.isWebGL2?null:e.get("OES_vertex_array_object"),o=r.isWebGL2||null!==s,a={},c=m(null);let l=c;function u(e,r,i,s,a){let c=!1;if(o){const t=f(s,i,r);l!==t&&(l=t,d(l.object)),c=g(s,a),c&&v(s,a)}else{const t=!0===r.wireframe;l.geometry===s.id&&l.program===i.id&&l.wireframe===t||(l.geometry=s.id,l.program=i.id,l.wireframe=t,c=!0)}!0===e.isInstancedMesh&&(c=!0),null!==a&&n.update(a,34963),c&&(M(e,r,i,s),null!==a&&t.bindBuffer(34963,n.get(a).buffer))}function h(){return r.isWebGL2?t.createVertexArray():s.createVertexArrayOES()}function d(e){return r.isWebGL2?t.bindVertexArray(e):s.bindVertexArrayOES(e)}function p(e){return r.isWebGL2?t.deleteVertexArray(e):s.deleteVertexArrayOES(e)}function f(t,e,n){const r=!0===n.wireframe;let i=a[t.id];void 0===i&&(i={},a[t.id]=i);let s=i[e.id];void 0===s&&(s={},i[e.id]=s);let o=s[r];return void 0===o&&(o=m(h()),s[r]=o),o}function m(t){const e=[],n=[],r=[];for(let s=0;s<i;s++)e[s]=0,n[s]=0,r[s]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:e,enabledAttributes:n,attributeDivisors:r,object:t,attributes:{},index:null}}function g(t,e){const n=l.attributes,r=t.attributes;let i=0;for(const s in r){const t=n[s],e=r[s];if(void 0===t)return!0;if(t.attribute!==e)return!0;if(t.data!==e.data)return!0;i++}return l.attributesNum!==i||l.index!==e}function v(t,e){const n={},r=t.attributes;let i=0;for(const s in r){const t=r[s],e={};e.attribute=t,t.data&&(e.data=t.data),n[s]=e,i++}l.attributes=n,l.attributesNum=i,l.index=e}function y(){const t=l.newAttributes;for(let e=0,n=t.length;e<n;e++)t[e]=0}function x(t){b(t,0)}function b(n,i){const s=l.newAttributes,o=l.enabledAttributes,a=l.attributeDivisors;if(s[n]=1,0===o[n]&&(t.enableVertexAttribArray(n),o[n]=1),a[n]!==i){const s=r.isWebGL2?t:e.get("ANGLE_instanced_arrays");s[r.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](n,i),a[n]=i}}function w(){const e=l.newAttributes,n=l.enabledAttributes;for(let r=0,i=n.length;r<i;r++)n[r]!==e[r]&&(t.disableVertexAttribArray(r),n[r]=0)}function _(e,n,i,s,o,a){!0!==r.isWebGL2||5124!==i&&5125!==i?t.vertexAttribPointer(e,n,i,s,o,a):t.vertexAttribIPointer(e,n,i,o,a)}function M(i,s,o,a){if(!1===r.isWebGL2&&(i.isInstancedMesh||a.isInstancedBufferGeometry)&&null===e.get("ANGLE_instanced_arrays"))return;y();const c=a.attributes,l=o.getAttributes(),u=s.defaultAttributeValues;for(const e in l){const r=l[e];if(r.location>=0){let s=c[e];if(void 0===s&&("instanceMatrix"===e&&i.instanceMatrix&&(s=i.instanceMatrix),"instanceColor"===e&&i.instanceColor&&(s=i.instanceColor)),void 0!==s){const e=s.normalized,o=s.itemSize,c=n.get(s);if(void 0===c)continue;const l=c.buffer,u=c.type,h=c.bytesPerElement;if(s.isInterleavedBufferAttribute){const n=s.data,c=n.stride,d=s.offset;if(n&&n.isInstancedInterleavedBuffer){for(let t=0;t<r.locationSize;t++)b(r.location+t,n.meshPerAttribute);!0!==i.isInstancedMesh&&void 0===a._maxInstanceCount&&(a._maxInstanceCount=n.meshPerAttribute*n.count)}else for(let t=0;t<r.locationSize;t++)x(r.location+t);t.bindBuffer(34962,l);for(let t=0;t<r.locationSize;t++)_(r.location+t,o/r.locationSize,u,e,c*h,(d+o/r.locationSize*t)*h)}else{if(s.isInstancedBufferAttribute){for(let t=0;t<r.locationSize;t++)b(r.location+t,s.meshPerAttribute);!0!==i.isInstancedMesh&&void 0===a._maxInstanceCount&&(a._maxInstanceCount=s.meshPerAttribute*s.count)}else for(let t=0;t<r.locationSize;t++)x(r.location+t);t.bindBuffer(34962,l);for(let t=0;t<r.locationSize;t++)_(r.location+t,o/r.locationSize,u,e,o*h,o/r.locationSize*t*h)}}else if(void 0!==u){const n=u[e];if(void 0!==n)switch(n.length){case 2:t.vertexAttrib2fv(r.location,n);break;case 3:t.vertexAttrib3fv(r.location,n);break;case 4:t.vertexAttrib4fv(r.location,n);break;default:t.vertexAttrib1fv(r.location,n)}}}}w()}function S(){A();for(const t in a){const e=a[t];for(const t in e){const n=e[t];for(const t in n)p(n[t].object),delete n[t];delete e[t]}delete a[t]}}function T(t){if(void 0===a[t.id])return;const e=a[t.id];for(const n in e){const t=e[n];for(const e in t)p(t[e].object),delete t[e];delete e[n]}delete a[t.id]}function E(t){for(const e in a){const n=a[e];if(void 0===n[t.id])continue;const r=n[t.id];for(const t in r)p(r[t].object),delete r[t];delete n[t.id]}}function A(){L(),l!==c&&(l=c,d(l.object))}function L(){c.geometry=null,c.program=null,c.wireframe=!1}return{setup:u,reset:A,resetDefaultState:L,dispose:S,releaseStatesOfGeometry:T,releaseStatesOfProgram:E,initAttributes:y,enableAttribute:x,disableUnusedAttributes:w}}function cc(t,e,n,r){const i=r.isWebGL2;let s;function o(t){s=t}function a(e,r){t.drawArrays(s,e,r),n.update(r,s,1)}function c(r,o,a){if(0===a)return;let c,l;if(i)c=t,l="drawArraysInstanced";else if(c=e.get("ANGLE_instanced_arrays"),l="drawArraysInstancedANGLE",null===c)return void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");c[l](s,r,o,a),n.update(o,s,a)}this.setMode=o,this.render=a,this.renderInstances=c}function lc(t,e,n){let r;function i(){if(void 0!==r)return r;if(!0===e.has("EXT_texture_filter_anisotropic")){const n=e.get("EXT_texture_filter_anisotropic");r=t.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r}function s(e){if("highp"===e){if(t.getShaderPrecisionFormat(35633,36338).precision>0&&t.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";e="mediump"}return"mediump"===e&&t.getShaderPrecisionFormat(35633,36337).precision>0&&t.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}const o="undefined"!==typeof WebGL2RenderingContext&&t instanceof WebGL2RenderingContext||"undefined"!==typeof WebGL2ComputeRenderingContext&&t instanceof WebGL2ComputeRenderingContext;let a=void 0!==n.precision?n.precision:"highp";const c=s(a);c!==a&&(console.warn("THREE.WebGLRenderer:",a,"not supported, using",c,"instead."),a=c);const l=o||e.has("WEBGL_draw_buffers"),u=!0===n.logarithmicDepthBuffer,h=t.getParameter(34930),d=t.getParameter(35660),p=t.getParameter(3379),f=t.getParameter(34076),m=t.getParameter(34921),g=t.getParameter(36347),v=t.getParameter(36348),y=t.getParameter(36349),x=d>0,b=o||e.has("OES_texture_float"),w=x&&b,_=o?t.getParameter(36183):0;return{isWebGL2:o,drawBuffers:l,getMaxAnisotropy:i,getMaxPrecision:s,precision:a,logarithmicDepthBuffer:u,maxTextures:h,maxVertexTextures:d,maxTextureSize:p,maxCubemapSize:f,maxAttributes:m,maxVertexUniforms:g,maxVaryings:v,maxFragmentUniforms:y,vertexTextures:x,floatFragmentTextures:b,floatVertexTextures:w,maxSamples:_}}function uc(t){const e=this;let n=null,r=0,i=!1,s=!1;const o=new Ms,a=new Un,c={value:null,needsUpdate:!1};function l(){c.value!==n&&(c.value=n,c.needsUpdate=r>0),e.numPlanes=r,e.numIntersection=0}function u(t,n,r,i){const s=null!==t?t.length:0;let l=null;if(0!==s){if(l=c.value,!0!==i||null===l){const e=r+4*s,i=n.matrixWorldInverse;a.getNormalMatrix(i),(null===l||l.length<e)&&(l=new Float32Array(e));for(let n=0,c=r;n!==s;++n,c+=4)o.copy(t[n]).applyMatrix4(i,a),o.normal.toArray(l,c),l[c+3]=o.constant}c.value=l,c.needsUpdate=!0}return e.numPlanes=s,e.numIntersection=0,l}this.uniform=c,this.numPlanes=0,this.numIntersection=0,this.init=function(t,e,s){const o=0!==t.length||e||0!==r||i;return i=e,n=u(t,s,0),r=t.length,o},this.beginShadows=function(){s=!0,u(null)},this.endShadows=function(){s=!1,l()},this.setState=function(e,o,a){const h=e.clippingPlanes,d=e.clipIntersection,p=e.clipShadows,f=t.get(e);if(!i||null===h||0===h.length||s&&!p)s?u(null):l();else{const t=s?0:r,e=4*t;let i=f.clippingState||null;c.value=i,i=u(h,o,e,a);for(let r=0;r!==e;++r)i[r]=n[r];f.clippingState=i,this.numIntersection=d?this.numPlanes:0,this.numPlanes+=t}}}function hc(t){let e=new WeakMap;function n(t,e){return e===ut?t.mapping=ct:e===ht&&(t.mapping=lt),t}function r(r){if(r&&r.isTexture&&!1===r.isRenderTargetTexture){const s=r.mapping;if(s===ut||s===ht){if(e.has(r)){const t=e.get(r).texture;return n(t,r.mapping)}{const s=r.image;if(s&&s.height>0){const o=t.getRenderTarget(),a=new xs(s.height/2);return a.fromEquirectangularTexture(t,r),e.set(r,a),t.setRenderTarget(o),r.addEventListener("dispose",i),n(a.texture,r.mapping)}return null}}}return r}function i(t){const n=t.target;n.removeEventListener("dispose",i);const r=e.get(n);void 0!==r&&(e.delete(n),r.dispose())}function s(){e=new WeakMap}return{get:r,dispose:s}}sc.physical={uniforms:cs([sc.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new Fn(1,1)},clearcoatNormalMap:{value:null},sheen:{value:0},sheenColor:{value:new Mi(0)},sheenColorMap:{value:null},sheenRoughness:{value:0},sheenRoughnessMap:{value:null},transmission:{value:0},transmissionMap:{value:null},transmissionSamplerSize:{value:new Fn},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},attenuationDistance:{value:0},attenuationColor:{value:new Mi(0)},specularIntensity:{value:0},specularIntensityMap:{value:null},specularColor:{value:new Mi(1,1,1)},specularColorMap:{value:null}}]),vertexShader:rc.meshphysical_vert,fragmentShader:rc.meshphysical_frag};class dc extends ps{constructor(t=-1,e=1,n=1,r=-1,i=.1,s=2e3){super(),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=t,this.right=e,this.top=n,this.bottom=r,this.near=i,this.far=s,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.near=t.near,this.far=t.far,this.zoom=t.zoom,this.view=null===t.view?null:Object.assign({},t.view),this}setViewOffset(t,e,n,r,i,s){null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=n,this.view.offsetY=r,this.view.width=i,this.view.height=s,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,r=(this.top+this.bottom)/2;let i=n-t,s=n+t,o=r+e,a=r-e;if(null!==this.view&&this.view.enabled){const t=(this.right-this.left)/this.view.fullWidth/this.zoom,e=(this.top-this.bottom)/this.view.fullHeight/this.zoom;i+=t*this.view.offsetX,s=i+t*this.view.width,o-=e*this.view.offsetY,a=o-e*this.view.height}this.projectionMatrix.makeOrthographic(i,s,o,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}}dc.prototype.isOrthographicCamera=!0;class pc extends ds{constructor(t){super(t),this.type="RawShaderMaterial"}}pc.prototype.isRawShaderMaterial=!0;const fc=4,mc=8,gc=Math.pow(2,mc),vc=[.125,.215,.35,.446,.526,.582],yc=mc-fc+1+vc.length,xc=20,bc={[Je]:0,[Ze]:1,[$e]:2,[Qe]:3,[tn]:4,[en]:5,[Ke]:6},wc=new dc,{_lodPlanes:_c,_sizeLods:Mc,_sigmas:Sc}=Ic(),Tc=new Mi;let Ec=null;const Ac=(1+Math.sqrt(5))/2,Lc=1/Ac,Rc=[new er(1,1,1),new er(-1,1,1),new er(1,1,-1),new er(-1,1,-1),new er(0,Ac,Lc),new er(0,Ac,-Lc),new er(Lc,0,Ac),new er(-Lc,0,Ac),new er(Ac,Lc,0),new er(-Ac,Lc,0)];class Cc{constructor(t){this._renderer=t,this._pingPongRenderTarget=null,this._blurMaterial=Dc(xc),this._equirectShader=null,this._cubemapShader=null,this._compileMaterial(this._blurMaterial)}fromScene(t,e=0,n=.1,r=100){Ec=this._renderer.getRenderTarget();const i=this._allocateTargets();return this._sceneToCubeUV(t,n,r,i),e>0&&this._blur(i,0,0,e),this._applyPMREM(i),this._cleanup(i),i}fromEquirectangular(t){return this._fromTexture(t)}fromCubemap(t){return this._fromTexture(t)}compileCubemapShader(){null===this._cubemapShader&&(this._cubemapShader=zc(),this._compileMaterial(this._cubemapShader))}compileEquirectangularShader(){null===this._equirectShader&&(this._equirectShader=kc(),this._compileMaterial(this._equirectShader))}dispose(){this._blurMaterial.dispose(),null!==this._cubemapShader&&this._cubemapShader.dispose(),null!==this._equirectShader&&this._equirectShader.dispose();for(let t=0;t<_c.length;t++)_c[t].dispose()}_cleanup(t){this._pingPongRenderTarget.dispose(),this._renderer.setRenderTarget(Ec),t.scissorTest=!1,Oc(t,0,0,t.width,t.height)}_fromTexture(t){Ec=this._renderer.getRenderTarget();const e=this._allocateTargets(t);return this._textureToCubeUV(t,e),this._applyPMREM(e),this._cleanup(e),e}_allocateTargets(t){const e={magFilter:vt,minFilter:vt,generateMipmaps:!1,type:Mt,format:Bt,encoding:Pc(t)?t.encoding:$e,depthBuffer:!1},n=Nc(e);return n.depthBuffer=!t,this._pingPongRenderTarget=Nc(e),n}_compileMaterial(t){const e=new rs(_c[0],t);this._renderer.compile(e,wc)}_sceneToCubeUV(t,e,n,r){const i=90,s=1,o=new fs(i,s,e,n),a=[1,-1,1,1,1,1],c=[1,1,1,-1,-1,-1],l=this._renderer,u=l.autoClear,h=l.outputEncoding,d=l.toneMapping;l.getClearColor(Tc),l.toneMapping=et,l.outputEncoding=Je,l.autoClear=!1;const p=new Si({name:"PMREM.Background",side:x,depthWrite:!1,depthTest:!1}),f=new rs(new os,p);let m=!1;const g=t.background;g?g.isColor&&(p.color.copy(g),t.background=null,m=!0):(p.color.copy(Tc),m=!0);for(let v=0;v<6;v++){const e=v%3;0==e?(o.up.set(0,a[v],0),o.lookAt(c[v],0,0)):1==e?(o.up.set(0,0,a[v]),o.lookAt(0,c[v],0)):(o.up.set(0,a[v],0),o.lookAt(0,0,c[v])),Oc(r,e*gc,v>2?gc:0,gc,gc),l.setRenderTarget(r),m&&l.render(f,o),l.render(t,o)}f.geometry.dispose(),f.material.dispose(),l.toneMapping=d,l.outputEncoding=h,l.autoClear=u,t.background=g}_setEncoding(t,e){t.value=bc[e.encoding]}_textureToCubeUV(t,e){const n=this._renderer,r=t.mapping===ct||t.mapping===lt;r?null==this._cubemapShader&&(this._cubemapShader=zc()):null==this._equirectShader&&(this._equirectShader=kc());const i=r?this._cubemapShader:this._equirectShader,s=new rs(_c[0],i),o=i.uniforms;o["envMap"].value=t,r||o["texelSize"].value.set(1/t.image.width,1/t.image.height),this._setEncoding(o["inputEncoding"],t),this._setEncoding(o["outputEncoding"],e.texture),Oc(e,0,0,3*gc,2*gc),n.setRenderTarget(e),n.render(s,wc)}_applyPMREM(t){const e=this._renderer,n=e.autoClear;e.autoClear=!1;for(let r=1;r<yc;r++){const e=Math.sqrt(Sc[r]*Sc[r]-Sc[r-1]*Sc[r-1]),n=Rc[(r-1)%Rc.length];this._blur(t,r-1,r,e,n)}e.autoClear=n}_blur(t,e,n,r,i){const s=this._pingPongRenderTarget;this._halfBlur(t,s,e,n,r,"latitudinal",i),this._halfBlur(s,t,n,n,r,"longitudinal",i)}_halfBlur(t,e,n,r,i,s,o){const a=this._renderer,c=this._blurMaterial;"latitudinal"!==s&&"longitudinal"!==s&&console.error("blur direction must be either latitudinal or longitudinal!");const l=3,u=new rs(_c[r],c),h=c.uniforms,d=Mc[n]-1,p=isFinite(i)?Math.PI/(2*d):2*Math.PI/(2*xc-1),f=i/p,m=isFinite(i)?1+Math.floor(l*f):xc;m>xc&&console.warn(`sigmaRadians, ${i}, is too large and will clip, as it requested ${m} samples when the maximum is set to ${xc}`);const g=[];let v=0;for(let w=0;w<xc;++w){const t=w/f,e=Math.exp(-t*t/2);g.push(e),0==w?v+=e:w<m&&(v+=2*e)}for(let w=0;w<g.length;w++)g[w]=g[w]/v;h["envMap"].value=t.texture,h["samples"].value=m,h["weights"].value=g,h["latitudinal"].value="latitudinal"===s,o&&(h["poleAxis"].value=o),h["dTheta"].value=p,h["mipInt"].value=mc-n,this._setEncoding(h["inputEncoding"],t.texture),this._setEncoding(h["outputEncoding"],t.texture);const y=Mc[r],x=3*Math.max(0,gc-2*y),b=(0===r?0:2*gc)+2*y*(r>mc-fc?r-mc+fc:0);Oc(e,x,b,3*y,2*y),a.setRenderTarget(e),a.render(u,wc)}}function Pc(t){return void 0!==t&&t.type===Mt&&(t.encoding===Je||t.encoding===Ze||t.encoding===Ke)}function Ic(){const t=[],e=[],n=[];let r=mc;for(let i=0;i<yc;i++){const s=Math.pow(2,r);e.push(s);let o=1/s;i>mc-fc?o=vc[i-mc+fc-1]:0==i&&(o=0),n.push(o);const a=1/(s-1),c=-a/2,l=1+a/2,u=[c,c,l,c,l,l,c,c,l,l,c,l],h=6,d=6,p=3,f=2,m=1,g=new Float32Array(p*d*h),v=new Float32Array(f*d*h),y=new Float32Array(m*d*h);for(let t=0;t<h;t++){const e=t%3*2/3-1,n=t>2?0:-1,r=[e,n,0,e+2/3,n,0,e+2/3,n+1,0,e,n,0,e+2/3,n+1,0,e,n+1,0];g.set(r,p*d*t),v.set(u,f*d*t);const i=[t,t,t,t,t,t];y.set(i,m*d*t)}const x=new Ui;x.setAttribute("position",new Ai(g,p)),x.setAttribute("uv",new Ai(v,f)),x.setAttribute("faceIndex",new Ai(y,m)),t.push(x),r>fc&&r--}return{_lodPlanes:t,_sizeLods:e,_sigmas:n}}function Nc(t){const e=new Kn(3*gc,3*gc,t);return e.texture.mapping=dt,e.texture.name="PMREM.cubeUv",e.scissorTest=!0,e}function Oc(t,e,n,r,i){t.viewport.set(e,n,r,i),t.scissor.set(e,n,r,i)}function Dc(t){const e=new Float32Array(t),n=new er(0,1,0),r=new pc({name:"SphericalGaussianBlur",defines:{n:t},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:e},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:n},inputEncoding:{value:bc[Je]},outputEncoding:{value:bc[Je]}},vertexShader:Fc(),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${Uc()}\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include <cube_uv_reflection_fragment>\n\n\t\t\tvec3 getSample( float theta, vec3 axis ) {\n\n\t\t\t\tfloat cosTheta = cos( theta );\n\t\t\t\t// Rodrigues' axis-angle rotation\n\t\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t\t\t\t+ cross( axis, vOutputDirection ) * sin( theta )\n\t\t\t\t\t+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n\t\t\t\treturn bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n\t\t\t\tif ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n\t\t\t\t\taxis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n\t\t\t\t}\n\n\t\t\t\taxis = normalize( axis );\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n\t\t\t\tfor ( int i = 1; i < n; i++ ) {\n\n\t\t\t\t\tif ( i >= samples ) {\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfloat theta = dTheta * float( i );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n\t\t\t\t}\n\n\t\t\t\tgl_FragColor = linearToOutputTexel( gl_FragColor );\n\n\t\t\t}\n\t\t`,blending:_,depthTest:!1,depthWrite:!1});return r}function kc(){const t=new Fn(1,1),e=new pc({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null},texelSize:{value:t},inputEncoding:{value:bc[Je]},outputEncoding:{value:bc[Je]}},vertexShader:Fc(),fragmentShader:`\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform vec2 texelSize;\n\n\t\t\t${Uc()}\n\n\t\t\t#include <common>\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tvec2 f = fract( uv / texelSize - 0.5 );\n\t\t\t\tuv -= f * texelSize;\n\t\t\t\tvec3 tl = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\t\t\t\tuv.x += texelSize.x;\n\t\t\t\tvec3 tr = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\t\t\t\tuv.y += texelSize.y;\n\t\t\t\tvec3 br = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\t\t\t\tuv.x -= texelSize.x;\n\t\t\t\tvec3 bl = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\n\t\t\t\tvec3 tm = mix( tl, tr, f.x );\n\t\t\t\tvec3 bm = mix( bl, br, f.x );\n\t\t\t\tgl_FragColor.rgb = mix( tm, bm, f.y );\n\n\t\t\t\tgl_FragColor = linearToOutputTexel( gl_FragColor );\n\n\t\t\t}\n\t\t`,blending:_,depthTest:!1,depthWrite:!1});return e}function zc(){const t=new pc({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},inputEncoding:{value:bc[Je]},outputEncoding:{value:bc[Je]}},vertexShader:Fc(),fragmentShader:`\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform samplerCube envMap;\n\n\t\t\t${Uc()}\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb = envMapTexelToLinear( textureCube( envMap, vec3( - vOutputDirection.x, vOutputDirection.yz ) ) ).rgb;\n\t\t\t\tgl_FragColor = linearToOutputTexel( gl_FragColor );\n\n\t\t\t}\n\t\t`,blending:_,depthTest:!1,depthWrite:!1});return t}function Fc(){return"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute vec3 position;\n\t\tattribute vec2 uv;\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t"}function Uc(){return"\n\n\t\tuniform int inputEncoding;\n\t\tuniform int outputEncoding;\n\n\t\t#include <encodings_pars_fragment>\n\n\t\tvec4 inputTexelToLinear( vec4 value ) {\n\n\t\t\tif ( inputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( inputEncoding == 1 ) {\n\n\t\t\t\treturn sRGBToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 2 ) {\n\n\t\t\t\treturn RGBEToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 3 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 7.0 );\n\n\t\t\t} else if ( inputEncoding == 4 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 16.0 );\n\n\t\t\t} else if ( inputEncoding == 5 ) {\n\n\t\t\t\treturn RGBDToLinear( value, 256.0 );\n\n\t\t\t} else {\n\n\t\t\t\treturn GammaToLinear( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 linearToOutputTexel( vec4 value ) {\n\n\t\t\tif ( outputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( outputEncoding == 1 ) {\n\n\t\t\t\treturn LinearTosRGB( value );\n\n\t\t\t} else if ( outputEncoding == 2 ) {\n\n\t\t\t\treturn LinearToRGBE( value );\n\n\t\t\t} else if ( outputEncoding == 3 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 7.0 );\n\n\t\t\t} else if ( outputEncoding == 4 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 16.0 );\n\n\t\t\t} else if ( outputEncoding == 5 ) {\n\n\t\t\t\treturn LinearToRGBD( value, 256.0 );\n\n\t\t\t} else {\n\n\t\t\t\treturn LinearToGamma( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 envMapTexelToLinear( vec4 color ) {\n\n\t\t\treturn inputTexelToLinear( color );\n\n\t\t}\n\t"}function Bc(t){let e=new WeakMap,n=null;function r(r){if(r&&r.isTexture&&!1===r.isRenderTargetTexture){const o=r.mapping,a=o===ut||o===ht,c=o===ct||o===lt;if(a||c){if(e.has(r))return e.get(r).texture;{const o=r.image;if(a&&o&&o.height>0||c&&o&&i(o)){const i=t.getRenderTarget();null===n&&(n=new Cc(t));const o=a?n.fromEquirectangular(r):n.fromCubemap(r);return e.set(r,o),t.setRenderTarget(i),r.addEventListener("dispose",s),o.texture}return null}}}return r}function i(t){let e=0;const n=6;for(let r=0;r<n;r++)void 0!==t[r]&&e++;return e===n}function s(t){const n=t.target;n.removeEventListener("dispose",s);const r=e.get(n);void 0!==r&&(e.delete(n),r.dispose())}function o(){e=new WeakMap,null!==n&&(n.dispose(),n=null)}return{get:r,dispose:o}}function Hc(t){const e={};function n(n){if(void 0!==e[n])return e[n];let r;switch(n){case"WEBGL_depth_texture":r=t.getExtension("WEBGL_depth_texture")||t.getExtension("MOZ_WEBGL_depth_texture")||t.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":r=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":r=t.getExtension("WEBGL_compressed_texture_s3tc")||t.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":r=t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:r=t.getExtension(n)}return e[n]=r,r}return{has:function(t){return null!==n(t)},init:function(t){t.isWebGL2?n("EXT_color_buffer_float"):(n("WEBGL_depth_texture"),n("OES_texture_float"),n("OES_texture_half_float"),n("OES_texture_half_float_linear"),n("OES_standard_derivatives"),n("OES_element_index_uint"),n("OES_vertex_array_object"),n("ANGLE_instanced_arrays")),n("OES_texture_float_linear"),n("EXT_color_buffer_half_float"),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 Gc(t,e,n,r){const i={},s=new WeakMap;function o(t){const a=t.target;null!==a.index&&e.remove(a.index);for(const n in a.attributes)e.remove(a.attributes[n]);a.removeEventListener("dispose",o),delete i[a.id];const c=s.get(a);c&&(e.remove(c),s.delete(a)),r.releaseStatesOfGeometry(a),!0===a.isInstancedBufferGeometry&&delete a._maxInstanceCount,n.memory.geometries--}function a(t,e){return!0===i[e.id]||(e.addEventListener("dispose",o),i[e.id]=!0,n.memory.geometries++),e}function c(t){const n=t.attributes;for(const i in n)e.update(n[i],34962);const r=t.morphAttributes;for(const i in r){const t=r[i];for(let n=0,r=t.length;n<r;n++)e.update(t[n],34962)}}function l(t){const n=[],r=t.index,i=t.attributes.position;let o=0;if(null!==r){const t=r.array;o=r.version;for(let e=0,r=t.length;e<r;e+=3){const r=t[e+0],i=t[e+1],s=t[e+2];n.push(r,i,i,s,s,r)}}else{const t=i.array;o=i.version;for(let e=0,r=t.length/3-1;e<r;e+=3){const t=e+0,r=e+1,i=e+2;n.push(t,r,r,i,i,t)}}const a=new(Bn(n)>65535?Ri:Li)(n,1);a.version=o;const c=s.get(t);c&&e.remove(c),s.set(t,a)}function u(t){const e=s.get(t);if(e){const n=t.index;null!==n&&e.version<n.version&&l(t)}else l(t);return s.get(t)}return{get:a,update:c,getWireframeAttribute:u}}function Vc(t,e,n,r){const i=r.isWebGL2;let s,o,a;function c(t){s=t}function l(t){o=t.type,a=t.bytesPerElement}function u(e,r){t.drawElements(s,r,o,e*a),n.update(r,s,1)}function h(r,c,l){if(0===l)return;let u,h;if(i)u=t,h="drawElementsInstanced";else if(u=e.get("ANGLE_instanced_arrays"),h="drawElementsInstancedANGLE",null===u)return void console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");u[h](s,c,o,r*a,l),n.update(c,s,l)}this.setMode=c,this.setIndex=l,this.render=u,this.renderInstances=h}function Wc(t){const e={geometries:0,textures:0},n={frame:0,calls:0,triangles:0,points:0,lines:0};function r(t,e,r){switch(n.calls++,e){case 4:n.triangles+=r*(t/3);break;case 1:n.lines+=r*(t/2);break;case 3:n.lines+=r*(t-1);break;case 2:n.lines+=r*t;break;case 0:n.points+=r*t;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",e);break}}function i(){n.frame++,n.calls=0,n.triangles=0,n.points=0,n.lines=0}return{memory:e,render:n,programs:null,autoReset:!0,reset:i,update:r}}class jc extends Yn{constructor(t=null,e=1,n=1,r=1){super(null),this.image={data:t,width:e,height:n,depth:r},this.magFilter=vt,this.minFilter=vt,this.wrapR=mt,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.needsUpdate=!0}}function qc(t,e){return t[0]-e[0]}function Xc(t,e){return Math.abs(e[1])-Math.abs(t[1])}function Yc(t,e){let n=1;const r=e.isInterleavedBufferAttribute?e.data.array:e.array;r instanceof Int8Array?n=127:r instanceof Int16Array?n=32767:r instanceof Int32Array?n=2147483647:console.error("THREE.WebGLMorphtargets: Unsupported morph attribute data type: ",r),t.divideScalar(n)}function Jc(t,e,n){const r={},i=new Float32Array(8),s=new WeakMap,o=new er,a=[];for(let l=0;l<8;l++)a[l]=[l,0];function c(c,l,u,h){const d=c.morphTargetInfluences;if(!0===e.isWebGL2){const r=l.morphAttributes.position.length;let i=s.get(l);if(void 0===i||i.count!==r){void 0!==i&&i.texture.dispose();const t=void 0!==l.morphAttributes.normal,n=l.morphAttributes.position,a=l.morphAttributes.normal||[],c=l.attributes.position.count,u=!0===t?2:1;let h=c*u,d=1;h>e.maxTextureSize&&(d=Math.ceil(h/e.maxTextureSize),h=e.maxTextureSize);const p=new Float32Array(h*d*4*r),f=new jc(p,h,d,r);f.format=zt,f.type=Rt;const m=4*u;for(let e=0;e<r;e++){const r=n[e],i=a[e],s=h*d*4*e;for(let e=0;e<r.count;e++){o.fromBufferAttribute(r,e),!0===r.normalized&&Yc(o,r);const n=e*m;p[s+n+0]=o.x,p[s+n+1]=o.y,p[s+n+2]=o.z,p[s+n+3]=0,!0===t&&(o.fromBufferAttribute(i,e),!0===i.normalized&&Yc(o,i),p[s+n+4]=o.x,p[s+n+5]=o.y,p[s+n+6]=o.z,p[s+n+7]=0)}}i={count:r,texture:f,size:new Fn(h,d)},s.set(l,i)}let a=0;for(let t=0;t<d.length;t++)a+=d[t];const c=l.morphTargetsRelative?1:1-a;h.getUniforms().setValue(t,"morphTargetBaseInfluence",c),h.getUniforms().setValue(t,"morphTargetInfluences",d),h.getUniforms().setValue(t,"morphTargetsTexture",i.texture,n),h.getUniforms().setValue(t,"morphTargetsTextureSize",i.size)}else{const e=void 0===d?0:d.length;let n=r[l.id];if(void 0===n||n.length!==e){n=[];for(let t=0;t<e;t++)n[t]=[t,0];r[l.id]=n}for(let t=0;t<e;t++){const e=n[t];e[0]=t,e[1]=d[t]}n.sort(Xc);for(let t=0;t<8;t++)t<e&&n[t][1]?(a[t][0]=n[t][0],a[t][1]=n[t][1]):(a[t][0]=Number.MAX_SAFE_INTEGER,a[t][1]=0);a.sort(qc);const s=l.morphAttributes.position,o=l.morphAttributes.normal;let c=0;for(let t=0;t<8;t++){const e=a[t],n=e[0],r=e[1];n!==Number.MAX_SAFE_INTEGER&&r?(s&&l.getAttribute("morphTarget"+t)!==s[n]&&l.setAttribute("morphTarget"+t,s[n]),o&&l.getAttribute("morphNormal"+t)!==o[n]&&l.setAttribute("morphNormal"+t,o[n]),i[t]=r,c+=r):(s&&!0===l.hasAttribute("morphTarget"+t)&&l.deleteAttribute("morphTarget"+t),o&&!0===l.hasAttribute("morphNormal"+t)&&l.deleteAttribute("morphNormal"+t),i[t]=0)}const u=l.morphTargetsRelative?1:1-c;h.getUniforms().setValue(t,"morphTargetBaseInfluence",u),h.getUniforms().setValue(t,"morphTargetInfluences",i)}}return{update:c}}function Zc(t,e,n,r){let i=new WeakMap;function s(t){const s=r.render.frame,o=t.geometry,c=e.get(t,o);return i.get(c)!==s&&(e.update(c),i.set(c,s)),t.isInstancedMesh&&(!1===t.hasEventListener("dispose",a)&&t.addEventListener("dispose",a),n.update(t.instanceMatrix,34962),null!==t.instanceColor&&n.update(t.instanceColor,34962)),c}function o(){i=new WeakMap}function a(t){const e=t.target;e.removeEventListener("dispose",a),n.remove(e.instanceMatrix),null!==e.instanceColor&&n.remove(e.instanceColor)}return{update:s,dispose:o}}jc.prototype.isDataTexture2DArray=!0;class Kc extends Yn{constructor(t=null,e=1,n=1,r=1){super(null),this.image={data:t,width:e,height:n,depth:r},this.magFilter=vt,this.minFilter=vt,this.wrapR=mt,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.needsUpdate=!0}}Kc.prototype.isDataTexture3D=!0;const $c=new Yn,Qc=new jc,tl=new Kc,el=new ys,nl=[],rl=[],il=new Float32Array(16),sl=new Float32Array(9),ol=new Float32Array(4);function al(t,e,n){const r=t[0];if(r<=0||r>0)return t;const i=e*n;let s=nl[i];if(void 0===s&&(s=new Float32Array(i),nl[i]=s),0!==e){r.toArray(s,0);for(let r=1,i=0;r!==e;++r)i+=n,t[r].toArray(s,i)}return s}function cl(t,e){if(t.length!==e.length)return!1;for(let n=0,r=t.length;n<r;n++)if(t[n]!==e[n])return!1;return!0}function ll(t,e){for(let n=0,r=e.length;n<r;n++)t[n]=e[n]}function ul(t,e){let n=rl[e];void 0===n&&(n=new Int32Array(e),rl[e]=n);for(let r=0;r!==e;++r)n[r]=t.allocateTextureUnit();return n}function hl(t,e){const n=this.cache;n[0]!==e&&(t.uniform1f(this.addr,e),n[0]=e)}function dl(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(cl(n,e))return;t.uniform2fv(this.addr,e),ll(n,e)}}function pl(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(cl(n,e))return;t.uniform3fv(this.addr,e),ll(n,e)}}function fl(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(cl(n,e))return;t.uniform4fv(this.addr,e),ll(n,e)}}function ml(t,e){const n=this.cache,r=e.elements;if(void 0===r){if(cl(n,e))return;t.uniformMatrix2fv(this.addr,!1,e),ll(n,e)}else{if(cl(n,r))return;ol.set(r),t.uniformMatrix2fv(this.addr,!1,ol),ll(n,r)}}function gl(t,e){const n=this.cache,r=e.elements;if(void 0===r){if(cl(n,e))return;t.uniformMatrix3fv(this.addr,!1,e),ll(n,e)}else{if(cl(n,r))return;sl.set(r),t.uniformMatrix3fv(this.addr,!1,sl),ll(n,r)}}function vl(t,e){const n=this.cache,r=e.elements;if(void 0===r){if(cl(n,e))return;t.uniformMatrix4fv(this.addr,!1,e),ll(n,e)}else{if(cl(n,r))return;il.set(r),t.uniformMatrix4fv(this.addr,!1,il),ll(n,r)}}function yl(t,e){const n=this.cache;n[0]!==e&&(t.uniform1i(this.addr,e),n[0]=e)}function xl(t,e){const n=this.cache;cl(n,e)||(t.uniform2iv(this.addr,e),ll(n,e))}function bl(t,e){const n=this.cache;cl(n,e)||(t.uniform3iv(this.addr,e),ll(n,e))}function wl(t,e){const n=this.cache;cl(n,e)||(t.uniform4iv(this.addr,e),ll(n,e))}function _l(t,e){const n=this.cache;n[0]!==e&&(t.uniform1ui(this.addr,e),n[0]=e)}function Ml(t,e){const n=this.cache;cl(n,e)||(t.uniform2uiv(this.addr,e),ll(n,e))}function Sl(t,e){const n=this.cache;cl(n,e)||(t.uniform3uiv(this.addr,e),ll(n,e))}function Tl(t,e){const n=this.cache;cl(n,e)||(t.uniform4uiv(this.addr,e),ll(n,e))}function El(t,e,n){const r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(t.uniform1i(this.addr,i),r[0]=i),n.safeSetTexture2D(e||$c,i)}function Al(t,e,n){const r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(t.uniform1i(this.addr,i),r[0]=i),n.setTexture3D(e||tl,i)}function Ll(t,e,n){const r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(t.uniform1i(this.addr,i),r[0]=i),n.safeSetTextureCube(e||el,i)}function Rl(t,e,n){const r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(t.uniform1i(this.addr,i),r[0]=i),n.setTexture2DArray(e||Qc,i)}function Cl(t){switch(t){case 5126:return hl;case 35664:return dl;case 35665:return pl;case 35666:return fl;case 35674:return ml;case 35675:return gl;case 35676:return vl;case 5124:case 35670:return yl;case 35667:case 35671:return xl;case 35668:case 35672:return bl;case 35669:case 35673:return wl;case 5125:return _l;case 36294:return Ml;case 36295:return Sl;case 36296:return Tl;case 35678:case 36198:case 36298:case 36306:case 35682:return El;case 35679:case 36299:case 36307:return Al;case 35680:case 36300:case 36308:case 36293:return Ll;case 36289:case 36303:case 36311:case 36292:return Rl}}function Pl(t,e){t.uniform1fv(this.addr,e)}function Il(t,e){const n=al(e,this.size,2);t.uniform2fv(this.addr,n)}function Nl(t,e){const n=al(e,this.size,3);t.uniform3fv(this.addr,n)}function Ol(t,e){const n=al(e,this.size,4);t.uniform4fv(this.addr,n)}function Dl(t,e){const n=al(e,this.size,4);t.uniformMatrix2fv(this.addr,!1,n)}function kl(t,e){const n=al(e,this.size,9);t.uniformMatrix3fv(this.addr,!1,n)}function zl(t,e){const n=al(e,this.size,16);t.uniformMatrix4fv(this.addr,!1,n)}function Fl(t,e){t.uniform1iv(this.addr,e)}function Ul(t,e){t.uniform2iv(this.addr,e)}function Bl(t,e){t.uniform3iv(this.addr,e)}function Hl(t,e){t.uniform4iv(this.addr,e)}function Gl(t,e){t.uniform1uiv(this.addr,e)}function Vl(t,e){t.uniform2uiv(this.addr,e)}function Wl(t,e){t.uniform3uiv(this.addr,e)}function jl(t,e){t.uniform4uiv(this.addr,e)}function ql(t,e,n){const r=e.length,i=ul(n,r);t.uniform1iv(this.addr,i);for(let s=0;s!==r;++s)n.safeSetTexture2D(e[s]||$c,i[s])}function Xl(t,e,n){const r=e.length,i=ul(n,r);t.uniform1iv(this.addr,i);for(let s=0;s!==r;++s)n.setTexture3D(e[s]||tl,i[s])}function Yl(t,e,n){const r=e.length,i=ul(n,r);t.uniform1iv(this.addr,i);for(let s=0;s!==r;++s)n.safeSetTextureCube(e[s]||el,i[s])}function Jl(t,e,n){const r=e.length,i=ul(n,r);t.uniform1iv(this.addr,i);for(let s=0;s!==r;++s)n.setTexture2DArray(e[s]||Qc,i[s])}function Zl(t){switch(t){case 5126:return Pl;case 35664:return Il;case 35665:return Nl;case 35666:return Ol;case 35674:return Dl;case 35675:return kl;case 35676:return zl;case 5124:case 35670:return Fl;case 35667:case 35671:return Ul;case 35668:case 35672:return Bl;case 35669:case 35673:return Hl;case 5125:return Gl;case 36294:return Vl;case 36295:return Wl;case 36296:return jl;case 35678:case 36198:case 36298:case 36306:case 35682:return ql;case 35679:case 36299:case 36307:return Xl;case 35680:case 36300:case 36308:case 36293:return Yl;case 36289:case 36303:case 36311:case 36292:return Jl}}function Kl(t,e,n){this.id=t,this.addr=n,this.cache=[],this.setValue=Cl(e.type)}function $l(t,e,n){this.id=t,this.addr=n,this.cache=[],this.size=e.size,this.setValue=Zl(e.type)}function Ql(t){this.id=t,this.seq=[],this.map={}}$l.prototype.updateCache=function(t){const e=this.cache;t instanceof Float32Array&&e.length!==t.length&&(this.cache=new Float32Array(t.length)),ll(e,t)},Ql.prototype.setValue=function(t,e,n){const r=this.seq;for(let i=0,s=r.length;i!==s;++i){const s=r[i];s.setValue(t,e[s.id],n)}};const tu=/(\w+)(\])?(\[|\.)?/g;function eu(t,e){t.seq.push(e),t.map[e.id]=e}function nu(t,e,n){const r=t.name,i=r.length;tu.lastIndex=0;while(1){const s=tu.exec(r),o=tu.lastIndex;let a=s[1];const c="]"===s[2],l=s[3];if(c&&(a|=0),void 0===l||"["===l&&o+2===i){eu(n,void 0===l?new Kl(a,t,e):new $l(a,t,e));break}{const t=n.map;let e=t[a];void 0===e&&(e=new Ql(a),eu(n,e)),n=e}}}function ru(t,e){this.seq=[],this.map={};const n=t.getProgramParameter(e,35718);for(let r=0;r<n;++r){const n=t.getActiveUniform(e,r),i=t.getUniformLocation(e,n.name);nu(n,i,this)}}function iu(t,e,n){const r=t.createShader(e);return t.shaderSource(r,n),t.compileShader(r),r}ru.prototype.setValue=function(t,e,n,r){const i=this.map[e];void 0!==i&&i.setValue(t,n,r)},ru.prototype.setOptional=function(t,e,n){const r=e[n];void 0!==r&&this.setValue(t,n,r)},ru.upload=function(t,e,n,r){for(let i=0,s=e.length;i!==s;++i){const s=e[i],o=n[s.id];!1!==o.needsUpdate&&s.setValue(t,o.value,r)}},ru.seqWithValue=function(t,e){const n=[];for(let r=0,i=t.length;r!==i;++r){const i=t[r];i.id in e&&n.push(i)}return n};let su=0;function ou(t){const e=t.split("\n");for(let n=0;n<e.length;n++)e[n]=n+1+": "+e[n];return e.join("\n")}function au(t){switch(t){case Je:return["Linear","( value )"];case Ze:return["sRGB","( value )"];case $e:return["RGBE","( value )"];case Qe:return["RGBM","( value, 7.0 )"];case tn:return["RGBM","( value, 16.0 )"];case en:return["RGBD","( value, 256.0 )"];case Ke:return["Gamma","( value, float( GAMMA_FACTOR ) )"];default:return console.warn("THREE.WebGLProgram: Unsupported encoding:",t),["Linear","( value )"]}}function cu(t,e,n){const r=t.getShaderParameter(e,35713),i=t.getShaderInfoLog(e).trim();return r&&""===i?"":n.toUpperCase()+"\n\n"+i+"\n\n"+ou(t.getShaderSource(e))}function lu(t,e){const n=au(e);return"vec4 "+t+"( vec4 value ) { return "+n[0]+"ToLinear"+n[1]+"; }"}function uu(t,e){const n=au(e);return"vec4 "+t+"( vec4 value ) { return LinearTo"+n[0]+n[1]+"; }"}function hu(t,e){let n;switch(e){case nt:n="Linear";break;case rt:n="Reinhard";break;case it:n="OptimizedCineon";break;case st:n="ACESFilmic";break;case ot:n="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),n="Linear"}return"vec3 "+t+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}function du(t){const e=[t.extensionDerivatives||t.envMapCubeUV||t.bumpMap||t.tangentSpaceNormalMap||t.clearcoatNormalMap||t.flatShading||"physical"===t.shaderID?"#extension GL_OES_standard_derivatives : enable":"",(t.extensionFragDepth||t.logarithmicDepthBuffer)&&t.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",t.extensionDrawBuffers&&t.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(t.extensionShaderTextureLOD||t.envMap||t.transmission)&&t.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""];return e.filter(mu).join("\n")}function pu(t){const e=[];for(const n in t){const r=t[n];!1!==r&&e.push("#define "+n+" "+r)}return e.join("\n")}function fu(t,e){const n={},r=t.getProgramParameter(e,35721);for(let i=0;i<r;i++){const r=t.getActiveAttrib(e,i),s=r.name;let o=1;35674===r.type&&(o=2),35675===r.type&&(o=3),35676===r.type&&(o=4),n[s]={type:r.type,location:t.getAttribLocation(e,s),locationSize:o}}return n}function mu(t){return""!==t}function gu(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 vu(t,e){return t.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const yu=/^[ \t]*#include +<([\w\d./]+)>/gm;function xu(t){return t.replace(yu,bu)}function bu(t,e){const n=rc[e];if(void 0===n)throw new Error("Can not resolve #include <"+e+">");return xu(n)}const wu=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,_u=/#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 Mu(t){return t.replace(_u,Tu).replace(wu,Su)}function Su(t,e,n,r){return console.warn("WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead."),Tu(t,e,n,r)}function Tu(t,e,n,r){let i="";for(let s=parseInt(e);s<parseInt(n);s++)i+=r.replace(/\[\s*i\s*\]/g,"[ "+s+" ]").replace(/UNROLLED_LOOP_INDEX/g,s);return i}function Eu(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 Au(t){let e="SHADOWMAP_TYPE_BASIC";return t.shadowMapType===m?e="SHADOWMAP_TYPE_PCF":t.shadowMapType===g?e="SHADOWMAP_TYPE_PCF_SOFT":t.shadowMapType===v&&(e="SHADOWMAP_TYPE_VSM"),e}function Lu(t){let e="ENVMAP_TYPE_CUBE";if(t.envMap)switch(t.envMapMode){case ct:case lt:e="ENVMAP_TYPE_CUBE";break;case dt:case pt:e="ENVMAP_TYPE_CUBE_UV";break}return e}function Ru(t){let e="ENVMAP_MODE_REFLECTION";if(t.envMap)switch(t.envMapMode){case lt:case pt:e="ENVMAP_MODE_REFRACTION";break}return e}function Cu(t){let e="ENVMAP_BLENDING_NONE";if(t.envMap)switch(t.combine){case $:e="ENVMAP_BLENDING_MULTIPLY";break;case Q:e="ENVMAP_BLENDING_MIX";break;case tt:e="ENVMAP_BLENDING_ADD";break}return e}function Pu(t,e,n,r){const i=t.getContext(),s=n.defines;let o=n.vertexShader,a=n.fragmentShader;const c=Au(n),l=Lu(n),u=Ru(n),h=Cu(n),d=t.gammaFactor>0?t.gammaFactor:1,p=n.isWebGL2?"":du(n),f=pu(s),m=i.createProgram();let g,v,y=n.glslVersion?"#version "+n.glslVersion+"\n":"";n.isRawShaderMaterial?(g=[f].filter(mu).join("\n"),g.length>0&&(g+="\n"),v=[p,f].filter(mu).join("\n"),v.length>0&&(v+="\n")):(g=[Eu(n),"#define SHADER_NAME "+n.shaderName,f,n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+d,"#define MAX_BONES "+n.maxBones,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+u:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMap&&n.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",n.normalMap&&n.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.displacementMap&&n.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.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.morphTargets&&n.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",n.morphTargets&&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 "+c:"",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(mu).join("\n"),v=[p,Eu(n),"#define SHADER_NAME "+n.shaderName,f,"#define GAMMA_FACTOR "+d,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 "+l:"",n.envMap?"#define "+u:"",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.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.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 "+c:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"",(n.extensionShaderTextureLOD||n.envMap)&&n.rendererExtensionShaderTextureLod?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",n.toneMapping!==et?"#define TONE_MAPPING":"",n.toneMapping!==et?rc["tonemapping_pars_fragment"]:"",n.toneMapping!==et?hu("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.format===kt?"#define OPAQUE":"",rc["encodings_pars_fragment"],n.map?lu("mapTexelToLinear",n.mapEncoding):"",n.matcap?lu("matcapTexelToLinear",n.matcapEncoding):"",n.envMap?lu("envMapTexelToLinear",n.envMapEncoding):"",n.emissiveMap?lu("emissiveMapTexelToLinear",n.emissiveMapEncoding):"",n.specularColorMap?lu("specularColorMapTexelToLinear",n.specularColorMapEncoding):"",n.sheenColorMap?lu("sheenColorMapTexelToLinear",n.sheenColorMapEncoding):"",n.lightMap?lu("lightMapTexelToLinear",n.lightMapEncoding):"",uu("linearToOutputTexel",n.outputEncoding),n.depthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(mu).join("\n")),o=xu(o),o=gu(o,n),o=vu(o,n),a=xu(a),a=gu(a,n),a=vu(a,n),o=Mu(o),a=Mu(a),n.isWebGL2&&!0!==n.isRawShaderMaterial&&(y="#version 300 es\n",g=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+g,v=["#define varying in",n.glslVersion===hn?"":"out highp vec4 pc_fragColor;",n.glslVersion===hn?"":"#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"+v);const x=y+g+o,b=y+v+a,w=iu(i,35633,x),_=iu(i,35632,b);if(i.attachShader(m,w),i.attachShader(m,_),void 0!==n.index0AttributeName?i.bindAttribLocation(m,0,n.index0AttributeName):!0===n.morphTargets&&i.bindAttribLocation(m,0,"position"),i.linkProgram(m),t.debug.checkShaderErrors){const t=i.getProgramInfoLog(m).trim(),e=i.getShaderInfoLog(w).trim(),n=i.getShaderInfoLog(_).trim();let r=!0,s=!0;if(!1===i.getProgramParameter(m,35714)){r=!1;const e=cu(i,w,"vertex"),n=cu(i,_,"fragment");console.error("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(m,35715)+"\n\nProgram Info Log: "+t+"\n"+e+"\n"+n)}else""!==t?console.warn("THREE.WebGLProgram: Program Info Log:",t):""!==e&&""!==n||(s=!1);s&&(this.diagnostics={runnable:r,programLog:t,vertexShader:{log:e,prefix:g},fragmentShader:{log:n,prefix:v}})}let M,S;return i.deleteShader(w),i.deleteShader(_),this.getUniforms=function(){return void 0===M&&(M=new ru(i,m)),M},this.getAttributes=function(){return void 0===S&&(S=fu(i,m)),S},this.destroy=function(){r.releaseStatesOfProgram(this),i.deleteProgram(m),this.program=void 0},this.name=n.shaderName,this.id=su++,this.cacheKey=e,this.usedTimes=1,this.program=m,this.vertexShader=w,this.fragmentShader=_,this}function Iu(t,e,n,r,i,s,o){const a=[],c=i.isWebGL2,l=i.logarithmicDepthBuffer,u=i.floatVertexTextures,h=i.maxVertexUniforms,d=i.vertexTextures;let p=i.precision;const f={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"},m=["precision","isWebGL2","supportsVertexTextures","outputEncoding","instancing","instancingColor","map","mapEncoding","matcap","matcapEncoding","envMap","envMapMode","envMapEncoding","envMapCubeUV","lightMap","lightMapEncoding","aoMap","emissiveMap","emissiveMapEncoding","bumpMap","normalMap","objectSpaceNormalMap","tangentSpaceNormalMap","clearcoat","clearcoatMap","clearcoatRoughnessMap","clearcoatNormalMap","displacementMap","specularMap",,"roughnessMap","metalnessMap","gradientMap","alphaMap","alphaTest","combine","vertexColors","vertexAlphas","vertexTangents","vertexUvs","uvsVertexOnly","fog","useFog","fogExp2","flatShading","sizeAttenuation","logarithmicDepthBuffer","skinning","maxBones","useVertexTexture","morphTargets","morphNormals","morphTargetsCount","premultipliedAlpha","numDirLights","numPointLights","numSpotLights","numHemiLights","numRectAreaLights","numDirLightShadows","numPointLightShadows","numSpotLightShadows","shadowMapEnabled","shadowMapType","toneMapping","physicallyCorrectLights","doubleSided","flipSided","numClippingPlanes","numClipIntersection","depthPacking","dithering","format","specularIntensityMap","specularColorMap","specularColorMapEncoding","transmission","transmissionMap","thicknessMap","sheen","sheenColorMap","sheenColorMapEncoding","sheenRoughnessMap"];function g(t){const e=t.skeleton,n=e.bones;if(u)return 1024;{const t=h,e=Math.floor((t-20)/4),r=Math.min(e,n.length);return r<n.length?(console.warn("THREE.WebGLRenderer: Skeleton has "+n.length+" bones. This GPU supports "+r+"."),0):r}}function v(t){let e;return t&&t.isTexture?e=t.encoding:t&&t.isWebGLRenderTarget?(console.warn("THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead."),e=t.texture.encoding):e=Je,e}function y(s,a,h,m,y){const w=m.fog,_=s.isMeshStandardMaterial?m.environment:null,M=(s.isMeshStandardMaterial?n:e).get(s.envMap||_),S=f[s.type],T=y.isSkinnedMesh?g(y):0;let E,A;if(null!==s.precision&&(p=i.getMaxPrecision(s.precision),p!==s.precision&&console.warn("THREE.WebGLProgram.getParameters:",s.precision,"not supported, using",p,"instead.")),S){const t=sc[S];E=t.vertexShader,A=t.fragmentShader}else E=s.vertexShader,A=s.fragmentShader;const L=t.getRenderTarget(),R=s.alphaTest>0,C=s.clearcoat>0,P={isWebGL2:c,shaderID:S,shaderName:s.type,vertexShader:E,fragmentShader:A,defines:s.defines,isRawShaderMaterial:!0===s.isRawShaderMaterial,glslVersion:s.glslVersion,precision:p,instancing:!0===y.isInstancedMesh,instancingColor:!0===y.isInstancedMesh&&null!==y.instanceColor,supportsVertexTextures:d,outputEncoding:null!==L?v(L.texture):t.outputEncoding,map:!!s.map,mapEncoding:v(s.map),matcap:!!s.matcap,matcapEncoding:v(s.matcap),envMap:!!M,envMapMode:M&&M.mapping,envMapEncoding:v(M),envMapCubeUV:!!M&&(M.mapping===dt||M.mapping===pt),lightMap:!!s.lightMap,lightMapEncoding:v(s.lightMap),aoMap:!!s.aoMap,emissiveMap:!!s.emissiveMap,emissiveMapEncoding:v(s.emissiveMap),bumpMap:!!s.bumpMap,normalMap:!!s.normalMap,objectSpaceNormalMap:s.normalMapType===on,tangentSpaceNormalMap:s.normalMapType===sn,clearcoat:C,clearcoatMap:C&&!!s.clearcoatMap,clearcoatRoughnessMap:C&&!!s.clearcoatRoughnessMap,clearcoatNormalMap:C&&!!s.clearcoatNormalMap,displacementMap:!!s.displacementMap,roughnessMap:!!s.roughnessMap,metalnessMap:!!s.metalnessMap,specularMap:!!s.specularMap,specularIntensityMap:!!s.specularIntensityMap,specularColorMap:!!s.specularColorMap,specularColorMapEncoding:v(s.specularColorMap),alphaMap:!!s.alphaMap,alphaTest:R,gradientMap:!!s.gradientMap,sheen:s.sheen>0,sheenColorMap:!!s.sheenColorMap,sheenColorMapEncoding:v(s.sheenColorMap),sheenRoughnessMap:!!s.sheenRoughnessMap,transmission:s.transmission>0,transmissionMap:!!s.transmissionMap,thicknessMap:!!s.thicknessMap,combine:s.combine,vertexTangents:!!s.normalMap&&!!y.geometry&&!!y.geometry.attributes.tangent,vertexColors:s.vertexColors,vertexAlphas:!0===s.vertexColors&&!!y.geometry&&!!y.geometry.attributes.color&&4===y.geometry.attributes.color.itemSize,vertexUvs:!!s.map||!!s.bumpMap||!!s.normalMap||!!s.specularMap||!!s.alphaMap||!!s.emissiveMap||!!s.roughnessMap||!!s.metalnessMap||!!s.clearcoatMap||!!s.clearcoatRoughnessMap||!!s.clearcoatNormalMap||!!s.displacementMap||!!s.transmissionMap||!!s.thicknessMap||!!s.specularIntensityMap||!!s.specularColorMap||!!s.sheenColorMap||s.sheenRoughnessMap,uvsVertexOnly:!(s.map||s.bumpMap||s.normalMap||s.specularMap||s.alphaMap||s.emissiveMap||s.roughnessMap||s.metalnessMap||s.clearcoatNormalMap||s.transmission>0||s.transmissionMap||s.thicknessMap||s.specularIntensityMap||s.specularColorMap||s.sheen>0||s.sheenColorMap||s.sheenRoughnessMap)&&!!s.displacementMap,fog:!!w,useFog:s.fog,fogExp2:w&&w.isFogExp2,flatShading:!!s.flatShading,sizeAttenuation:s.sizeAttenuation,logarithmicDepthBuffer:l,skinning:!0===y.isSkinnedMesh&&T>0,maxBones:T,useVertexTexture:u,morphTargets:!!y.geometry&&!!y.geometry.morphAttributes.position,morphNormals:!!y.geometry&&!!y.geometry.morphAttributes.normal,morphTargetsCount:y.geometry&&y.geometry.morphAttributes.position?y.geometry.morphAttributes.position.length:0,numDirLights:a.directional.length,numPointLights:a.point.length,numSpotLights:a.spot.length,numRectAreaLights:a.rectArea.length,numHemiLights:a.hemi.length,numDirLightShadows:a.directionalShadowMap.length,numPointLightShadows:a.pointShadowMap.length,numSpotLightShadows:a.spotShadowMap.length,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,format:s.format,dithering:s.dithering,shadowMapEnabled:t.shadowMap.enabled&&h.length>0,shadowMapType:t.shadowMap.type,toneMapping:s.toneMapped?t.toneMapping:et,physicallyCorrectLights:t.physicallyCorrectLights,premultipliedAlpha:s.premultipliedAlpha,doubleSided:s.side===b,flipSided:s.side===x,depthPacking:void 0!==s.depthPacking&&s.depthPacking,index0AttributeName:s.index0AttributeName,extensionDerivatives:s.extensions&&s.extensions.derivatives,extensionFragDepth:s.extensions&&s.extensions.fragDepth,extensionDrawBuffers:s.extensions&&s.extensions.drawBuffers,extensionShaderTextureLOD:s.extensions&&s.extensions.shaderTextureLOD,rendererExtensionFragDepth:c||r.has("EXT_frag_depth"),rendererExtensionDrawBuffers:c||r.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:c||r.has("EXT_shader_texture_lod"),customProgramCacheKey:s.customProgramCacheKey()};return P}function w(e){const n=[];if(e.shaderID?n.push(e.shaderID):(n.push(Wn(e.fragmentShader)),n.push(Wn(e.vertexShader))),void 0!==e.defines)for(const t in e.defines)n.push(t),n.push(e.defines[t]);if(!1===e.isRawShaderMaterial){for(let t=0;t<m.length;t++)n.push(e[m[t]]);n.push(t.outputEncoding),n.push(t.gammaFactor)}return n.push(e.customProgramCacheKey),n.join()}function _(t){const e=f[t.type];let n;if(e){const t=sc[e];n=ls.clone(t.uniforms)}else n=t.uniforms;return n}function M(e,n){let r;for(let t=0,i=a.length;t<i;t++){const e=a[t];if(e.cacheKey===n){r=e,++r.usedTimes;break}}return void 0===r&&(r=new Pu(t,n,e,s),a.push(r)),r}function S(t){if(0===--t.usedTimes){const e=a.indexOf(t);a[e]=a[a.length-1],a.pop(),t.destroy()}}return{getParameters:y,getProgramCacheKey:w,getUniforms:_,acquireProgram:M,releaseProgram:S,programs:a}}function Nu(){let t=new WeakMap;function e(e){let n=t.get(e);return void 0===n&&(n={},t.set(e,n)),n}function n(e){t.delete(e)}function r(e,n,r){t.get(e)[n]=r}function i(){t=new WeakMap}return{get:e,remove:n,update:r,dispose:i}}function Ou(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.program!==e.program?t.program.id-e.program.id:t.material.id!==e.material.id?t.material.id-e.material.id:t.z!==e.z?t.z-e.z:t.id-e.id}function Du(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 ku(t){const e=[];let n=0;const r=[],i=[],s=[],o={id:-1};function a(){n=0,r.length=0,i.length=0,s.length=0}function c(r,i,s,a,c,l){let u=e[n];const h=t.get(s);return void 0===u?(u={id:r.id,object:r,geometry:i,material:s,program:h.program||o,groupOrder:a,renderOrder:r.renderOrder,z:c,group:l},e[n]=u):(u.id=r.id,u.object=r,u.geometry=i,u.material=s,u.program=h.program||o,u.groupOrder=a,u.renderOrder=r.renderOrder,u.z=c,u.group=l),n++,u}function l(t,e,n,o,a,l){const u=c(t,e,n,o,a,l);n.transmission>0?i.push(u):!0===n.transparent?s.push(u):r.push(u)}function u(t,e,n,o,a,l){const u=c(t,e,n,o,a,l);n.transmission>0?i.unshift(u):!0===n.transparent?s.unshift(u):r.unshift(u)}function h(t,e){r.length>1&&r.sort(t||Ou),i.length>1&&i.sort(e||Du),s.length>1&&s.sort(e||Du)}function d(){for(let t=n,r=e.length;t<r;t++){const n=e[t];if(null===n.id)break;n.id=null,n.object=null,n.geometry=null,n.material=null,n.program=null,n.group=null}}return{opaque:r,transmissive:i,transparent:s,init:a,push:l,unshift:u,finish:d,sort:h}}function zu(t){let e=new WeakMap;function n(n,r){let i;return!1===e.has(n)?(i=new ku(t),e.set(n,[i])):r>=e.get(n).length?(i=new ku(t),e.get(n).push(i)):i=e.get(n)[r],i}function r(){e=new WeakMap}return{get:n,dispose:r}}function Fu(){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 er,color:new Mi};break;case"SpotLight":n={position:new er,direction:new er,color:new Mi,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new er,color:new Mi,distance:0,decay:0};break;case"HemisphereLight":n={direction:new er,skyColor:new Mi,groundColor:new Mi};break;case"RectAreaLight":n={color:new Mi,position:new er,halfWidth:new er,halfHeight:new er};break}return t[e.id]=n,n}}}function Uu(){const t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];let n;switch(e.type){case"DirectionalLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Fn};break;case"SpotLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Fn};break;case"PointLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Fn,shadowCameraNear:1,shadowCameraFar:1e3};break}return t[e.id]=n,n}}}let Bu=0;function Hu(t,e){return(e.castShadow?1:0)-(t.castShadow?1:0)}function Gu(t,e){const n=new Fu,r=Uu(),i={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadow:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[]};for(let u=0;u<9;u++)i.probe.push(new er);const s=new er,o=new Ir,a=new Ir;function c(s,o){let a=0,c=0,l=0;for(let t=0;t<9;t++)i.probe[t].set(0,0,0);let u=0,h=0,d=0,p=0,f=0,m=0,g=0,v=0;s.sort(Hu);const y=!0!==o?Math.PI:1;for(let t=0,e=s.length;t<e;t++){const e=s[t],o=e.color,x=e.intensity,b=e.distance,w=e.shadow&&e.shadow.map?e.shadow.map.texture:null;if(e.isAmbientLight)a+=o.r*x*y,c+=o.g*x*y,l+=o.b*x*y;else if(e.isLightProbe)for(let t=0;t<9;t++)i.probe[t].addScaledVector(e.sh.coefficients[t],x);else if(e.isDirectionalLight){const t=n.get(e);if(t.color.copy(e.color).multiplyScalar(e.intensity*y),e.castShadow){const t=e.shadow,n=r.get(e);n.shadowBias=t.bias,n.shadowNormalBias=t.normalBias,n.shadowRadius=t.radius,n.shadowMapSize=t.mapSize,i.directionalShadow[u]=n,i.directionalShadowMap[u]=w,i.directionalShadowMatrix[u]=e.shadow.matrix,m++}i.directional[u]=t,u++}else if(e.isSpotLight){const t=n.get(e);if(t.position.setFromMatrixPosition(e.matrixWorld),t.color.copy(o).multiplyScalar(x*y),t.distance=b,t.coneCos=Math.cos(e.angle),t.penumbraCos=Math.cos(e.angle*(1-e.penumbra)),t.decay=e.decay,e.castShadow){const t=e.shadow,n=r.get(e);n.shadowBias=t.bias,n.shadowNormalBias=t.normalBias,n.shadowRadius=t.radius,n.shadowMapSize=t.mapSize,i.spotShadow[d]=n,i.spotShadowMap[d]=w,i.spotShadowMatrix[d]=e.shadow.matrix,v++}i.spot[d]=t,d++}else if(e.isRectAreaLight){const t=n.get(e);t.color.copy(o).multiplyScalar(x),t.halfWidth.set(.5*e.width,0,0),t.halfHeight.set(0,.5*e.height,0),i.rectArea[p]=t,p++}else if(e.isPointLight){const t=n.get(e);if(t.color.copy(e.color).multiplyScalar(e.intensity*y),t.distance=e.distance,t.decay=e.decay,e.castShadow){const t=e.shadow,n=r.get(e);n.shadowBias=t.bias,n.shadowNormalBias=t.normalBias,n.shadowRadius=t.radius,n.shadowMapSize=t.mapSize,n.shadowCameraNear=t.camera.near,n.shadowCameraFar=t.camera.far,i.pointShadow[h]=n,i.pointShadowMap[h]=w,i.pointShadowMatrix[h]=e.shadow.matrix,g++}i.point[h]=t,h++}else if(e.isHemisphereLight){const t=n.get(e);t.skyColor.copy(e.color).multiplyScalar(x*y),t.groundColor.copy(e.groundColor).multiplyScalar(x*y),i.hemi[f]=t,f++}}p>0&&(e.isWebGL2||!0===t.has("OES_texture_float_linear")?(i.rectAreaLTC1=ic.LTC_FLOAT_1,i.rectAreaLTC2=ic.LTC_FLOAT_2):!0===t.has("OES_texture_half_float_linear")?(i.rectAreaLTC1=ic.LTC_HALF_1,i.rectAreaLTC2=ic.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),i.ambient[0]=a,i.ambient[1]=c,i.ambient[2]=l;const x=i.hash;x.directionalLength===u&&x.pointLength===h&&x.spotLength===d&&x.rectAreaLength===p&&x.hemiLength===f&&x.numDirectionalShadows===m&&x.numPointShadows===g&&x.numSpotShadows===v||(i.directional.length=u,i.spot.length=d,i.rectArea.length=p,i.point.length=h,i.hemi.length=f,i.directionalShadow.length=m,i.directionalShadowMap.length=m,i.pointShadow.length=g,i.pointShadowMap.length=g,i.spotShadow.length=v,i.spotShadowMap.length=v,i.directionalShadowMatrix.length=m,i.pointShadowMatrix.length=g,i.spotShadowMatrix.length=v,x.directionalLength=u,x.pointLength=h,x.spotLength=d,x.rectAreaLength=p,x.hemiLength=f,x.numDirectionalShadows=m,x.numPointShadows=g,x.numSpotShadows=v,i.version=Bu++)}function l(t,e){let n=0,r=0,c=0,l=0,u=0;const h=e.matrixWorldInverse;for(let d=0,p=t.length;d<p;d++){const e=t[d];if(e.isDirectionalLight){const t=i.directional[n];t.direction.setFromMatrixPosition(e.matrixWorld),s.setFromMatrixPosition(e.target.matrixWorld),t.direction.sub(s),t.direction.transformDirection(h),n++}else if(e.isSpotLight){const t=i.spot[c];t.position.setFromMatrixPosition(e.matrixWorld),t.position.applyMatrix4(h),t.direction.setFromMatrixPosition(e.matrixWorld),s.setFromMatrixPosition(e.target.matrixWorld),t.direction.sub(s),t.direction.transformDirection(h),c++}else if(e.isRectAreaLight){const t=i.rectArea[l];t.position.setFromMatrixPosition(e.matrixWorld),t.position.applyMatrix4(h),a.identity(),o.copy(e.matrixWorld),o.premultiply(h),a.extractRotation(o),t.halfWidth.set(.5*e.width,0,0),t.halfHeight.set(0,.5*e.height,0),t.halfWidth.applyMatrix4(a),t.halfHeight.applyMatrix4(a),l++}else if(e.isPointLight){const t=i.point[r];t.position.setFromMatrixPosition(e.matrixWorld),t.position.applyMatrix4(h),r++}else if(e.isHemisphereLight){const t=i.hemi[u];t.direction.setFromMatrixPosition(e.matrixWorld),t.direction.transformDirection(h),t.direction.normalize(),u++}}}return{setup:c,setupView:l,state:i}}function Vu(t,e){const n=new Gu(t,e),r=[],i=[];function s(){r.length=0,i.length=0}function o(t){r.push(t)}function a(t){i.push(t)}function c(t){n.setup(r,t)}function l(t){n.setupView(r,t)}const u={lightsArray:r,shadowsArray:i,lights:n};return{init:s,state:u,setupLights:c,setupLightsView:l,pushLight:o,pushShadow:a}}function Wu(t,e){let n=new WeakMap;function r(r,i=0){let s;return!1===n.has(r)?(s=new Vu(t,e),n.set(r,[s])):i>=n.get(r).length?(s=new Vu(t,e),n.get(r).push(s)):s=n.get(r)[i],s}function i(){n=new WeakMap}return{get:r,dispose:i}}class ju extends gi{constructor(t){super(),this.type="MeshDepthMaterial",this.depthPacking=nn,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}}ju.prototype.isMeshDepthMaterial=!0;class qu extends gi{constructor(t){super(),this.type="MeshDistanceMaterial",this.referencePosition=new er,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}}qu.prototype.isMeshDistanceMaterial=!0;const Xu="void main() {\n\tgl_Position = vec4( position, 1.0 );\n}",Yu="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}";function Ju(t,e,n){let r=new Es;const i=new Fn,s=new Fn,o=new Zn,a=new ju({depthPacking:rn}),c=new qu,l={},u=n.maxTextureSize,h={0:x,1:y,2:b},d=new ds({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Fn},radius:{value:4}},vertexShader:Xu,fragmentShader:Yu}),p=d.clone();p.defines.HORIZONTAL_PASS=1;const f=new Ui;f.setAttribute("position",new Ai(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const g=new rs(f,d),w=this;function M(n,r){const i=e.update(g);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(r,null,i,d,g,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(r,null,i,p,g,null)}function S(e,n,r,i,s,o,u){let d=null;const p=!0===i.isPointLight?e.customDistanceMaterial:e.customDepthMaterial;if(d=void 0!==p?p:!0===i.isPointLight?c:a,t.localClippingEnabled&&!0===r.clipShadows&&0!==r.clippingPlanes.length||r.displacementMap&&0!==r.displacementScale||r.alphaMap&&r.alphaTest>0){const t=d.uuid,e=r.uuid;let n=l[t];void 0===n&&(n={},l[t]=n);let i=n[e];void 0===i&&(i=d.clone(),n[e]=i),d=i}return d.visible=r.visible,d.wireframe=r.wireframe,d.side=u===v?null!==r.shadowSide?r.shadowSide:r.side:null!==r.shadowSide?r.shadowSide:h[r.side],d.alphaMap=r.alphaMap,d.alphaTest=r.alphaTest,d.clipShadows=r.clipShadows,d.clippingPlanes=r.clippingPlanes,d.clipIntersection=r.clipIntersection,d.displacementMap=r.displacementMap,d.displacementScale=r.displacementScale,d.displacementBias=r.displacementBias,d.wireframeLinewidth=r.wireframeLinewidth,d.linewidth=r.linewidth,!0===i.isPointLight&&!0===d.isMeshDistanceMaterial&&(d.referencePosition.setFromMatrixPosition(i.matrixWorld),d.nearDistance=s,d.farDistance=o),d}function T(n,i,s,o,a){if(!1===n.visible)return;const c=n.layers.test(i.layers);if(c&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&a===v)&&(!n.frustumCulled||r.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(s.matrixWorldInverse,n.matrixWorld);const r=e.update(n),i=n.material;if(Array.isArray(i)){const e=r.groups;for(let c=0,l=e.length;c<l;c++){const l=e[c],u=i[l.materialIndex];if(u&&u.visible){const e=S(n,r,u,o,s.near,s.far,a);t.renderBufferDirect(s,null,r,e,n,l)}}}else if(i.visible){const e=S(n,r,i,o,s.near,s.far,a);t.renderBufferDirect(s,null,r,e,n,null)}}const l=n.children;for(let t=0,e=l.length;t<e;t++)T(l[t],i,s,o,a)}this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=m,this.render=function(e,n,a){if(!1===w.enabled)return;if(!1===w.autoUpdate&&!1===w.needsUpdate)return;if(0===e.length)return;const c=t.getRenderTarget(),l=t.getActiveCubeFace(),h=t.getActiveMipmapLevel(),d=t.state;d.setBlending(_),d.buffers.color.setClear(1,1,1,1),d.buffers.depth.setTest(!0),d.setScissorTest(!1);for(let p=0,f=e.length;p<f;p++){const c=e[p],l=c.shadow;if(void 0===l){console.warn("THREE.WebGLShadowMap:",c,"has no shadow.");continue}if(!1===l.autoUpdate&&!1===l.needsUpdate)continue;i.copy(l.mapSize);const h=l.getFrameExtents();if(i.multiply(h),s.copy(l.mapSize),(i.x>u||i.y>u)&&(i.x>u&&(s.x=Math.floor(u/h.x),i.x=s.x*h.x,l.mapSize.x=s.x),i.y>u&&(s.y=Math.floor(u/h.y),i.y=s.y*h.y,l.mapSize.y=s.y)),null===l.map&&!l.isPointLightShadow&&this.type===v){const t={minFilter:bt,magFilter:bt,format:zt};l.map=new Kn(i.x,i.y,t),l.map.texture.name=c.name+".shadowMap",l.mapPass=new Kn(i.x,i.y,t),l.camera.updateProjectionMatrix()}if(null===l.map){const t={minFilter:vt,magFilter:vt,format:zt};l.map=new Kn(i.x,i.y,t),l.map.texture.name=c.name+".shadowMap",l.camera.updateProjectionMatrix()}t.setRenderTarget(l.map),t.clear();const f=l.getViewportCount();for(let t=0;t<f;t++){const e=l.getViewport(t);o.set(s.x*e.x,s.y*e.y,s.x*e.z,s.y*e.w),d.viewport(o),l.updateMatrices(c,t),r=l.getFrustum(),T(n,a,l.camera,c,this.type)}l.isPointLightShadow||this.type!==v||M(l,a),l.needsUpdate=!1}w.needsUpdate=!1,t.setRenderTarget(c,l,h)}}function Zu(t,e,n){const r=n.isWebGL2;function i(){let e=!1;const n=new Zn;let r=null;const i=new Zn(0,0,0,0);return{setMask:function(n){r===n||e||(t.colorMask(n,n,n,n),r=n)},setLocked:function(t){e=t},setClear:function(e,r,s,o,a){!0===a&&(e*=o,r*=o,s*=o),n.set(e,r,s,o),!1===i.equals(n)&&(t.clearColor(e,r,s,o),i.copy(n))},reset:function(){e=!1,r=null,i.set(-1,0,0,0)}}}function s(){let e=!1,n=null,r=null,i=null;return{setTest:function(t){t?bt(2929):wt(2929)},setMask:function(r){n===r||e||(t.depthMask(r),n=r)},setFunc:function(e){if(r!==e){if(e)switch(e){case W:t.depthFunc(512);break;case j:t.depthFunc(519);break;case q:t.depthFunc(513);break;case X:t.depthFunc(515);break;case Y:t.depthFunc(514);break;case J:t.depthFunc(518);break;case Z:t.depthFunc(516);break;case K:t.depthFunc(517);break;default:t.depthFunc(515)}else t.depthFunc(515);r=e}},setLocked:function(t){e=t},setClear:function(e){i!==e&&(t.clearDepth(e),i=e)},reset:function(){e=!1,n=null,r=null,i=null}}}function o(){let e=!1,n=null,r=null,i=null,s=null,o=null,a=null,c=null,l=null;return{setTest:function(t){e||(t?bt(2960):wt(2960))},setMask:function(r){n===r||e||(t.stencilMask(r),n=r)},setFunc:function(e,n,o){r===e&&i===n&&s===o||(t.stencilFunc(e,n,o),r=e,i=n,s=o)},setOp:function(e,n,r){o===e&&a===n&&c===r||(t.stencilOp(e,n,r),o=e,a=n,c=r)},setLocked:function(t){e=t},setClear:function(e){l!==e&&(t.clearStencil(e),l=e)},reset:function(){e=!1,n=null,r=null,i=null,s=null,o=null,a=null,c=null,l=null}}}const a=new i,c=new s,l=new o;let u={},h={},m=null,g=!1,v=null,y=null,w=null,$=null,Q=null,tt=null,et=null,nt=!1,rt=null,it=null,st=null,ot=null,at=null;const ct=t.getParameter(35661);let lt=!1,ut=0;const ht=t.getParameter(7938);-1!==ht.indexOf("WebGL")?(ut=parseFloat(/^WebGL (\d)/.exec(ht)[1]),lt=ut>=1):-1!==ht.indexOf("OpenGL ES")&&(ut=parseFloat(/^OpenGL ES (\d)/.exec(ht)[1]),lt=ut>=2);let dt=null,pt={};const ft=t.getParameter(3088),mt=t.getParameter(2978),gt=(new Zn).fromArray(ft),vt=(new Zn).fromArray(mt);function yt(e,n,r){const i=new Uint8Array(4),s=t.createTexture();t.bindTexture(e,s),t.texParameteri(e,10241,9728),t.texParameteri(e,10240,9728);for(let o=0;o<r;o++)t.texImage2D(n+o,0,6408,1,1,0,6408,5121,i);return s}const xt={};function bt(e){!0!==u[e]&&(t.enable(e),u[e]=!0)}function wt(e){!1!==u[e]&&(t.disable(e),u[e]=!1)}function _t(e,n){return h[e]!==n&&(t.bindFramebuffer(e,n),h[e]=n,r&&(36009===e&&(h[36160]=n),36160===e&&(h[36009]=n)),!0)}function Mt(e){return m!==e&&(t.useProgram(e),m=e,!0)}xt[3553]=yt(3553,3553,1),xt[34067]=yt(34067,34069,6),a.setClear(0,0,0,1),c.setClear(1),l.setClear(0),bt(2929),c.setFunc(X),Lt(!1),Rt(p),bt(2884),Et(_);const St={[L]:32774,[R]:32778,[C]:32779};if(r)St[P]=32775,St[I]=32776;else{const t=e.get("EXT_blend_minmax");null!==t&&(St[P]=t.MIN_EXT,St[I]=t.MAX_EXT)}const Tt={[N]:0,[O]:1,[D]:768,[z]:770,[V]:776,[H]:774,[U]:772,[k]:769,[F]:771,[G]:775,[B]:773};function Et(e,n,r,i,s,o,a,c){if(e!==_){if(!1===g&&(bt(3042),g=!0),e===A)s=s||n,o=o||r,a=a||i,n===y&&s===Q||(t.blendEquationSeparate(St[n],St[s]),y=n,Q=s),r===w&&i===$&&o===tt&&a===et||(t.blendFuncSeparate(Tt[r],Tt[i],Tt[o],Tt[a]),w=r,$=i,tt=o,et=a),v=e,nt=null;else if(e!==v||c!==nt){if(y===L&&Q===L||(t.blendEquation(32774),y=L,Q=L),c)switch(e){case M:t.blendFuncSeparate(1,771,1,771);break;case S:t.blendFunc(1,1);break;case T:t.blendFuncSeparate(0,0,769,771);break;case E:t.blendFuncSeparate(0,768,0,770);break;default:console.error("THREE.WebGLState: Invalid blending: ",e);break}else switch(e){case M:t.blendFuncSeparate(770,771,1,771);break;case S:t.blendFunc(770,1);break;case T:t.blendFunc(0,769);break;case E:t.blendFunc(0,768);break;default:console.error("THREE.WebGLState: Invalid blending: ",e);break}w=null,$=null,tt=null,et=null,v=e,nt=c}}else!0===g&&(wt(3042),g=!1)}function At(t,e){t.side===b?wt(2884):bt(2884);let n=t.side===x;e&&(n=!n),Lt(n),t.blending===M&&!1===t.transparent?Et(_):Et(t.blending,t.blendEquation,t.blendSrc,t.blendDst,t.blendEquationAlpha,t.blendSrcAlpha,t.blendDstAlpha,t.premultipliedAlpha),c.setFunc(t.depthFunc),c.setTest(t.depthTest),c.setMask(t.depthWrite),a.setMask(t.colorWrite);const r=t.stencilWrite;l.setTest(r),r&&(l.setMask(t.stencilWriteMask),l.setFunc(t.stencilFunc,t.stencilRef,t.stencilFuncMask),l.setOp(t.stencilFail,t.stencilZFail,t.stencilZPass)),Pt(t.polygonOffset,t.polygonOffsetFactor,t.polygonOffsetUnits),!0===t.alphaToCoverage?bt(32926):wt(32926)}function Lt(e){rt!==e&&(e?t.frontFace(2304):t.frontFace(2305),rt=e)}function Rt(e){e!==d?(bt(2884),e!==it&&(e===p?t.cullFace(1029):e===f?t.cullFace(1028):t.cullFace(1032))):wt(2884),it=e}function Ct(e){e!==st&&(lt&&t.lineWidth(e),st=e)}function Pt(e,n,r){e?(bt(32823),ot===n&&at===r||(t.polygonOffset(n,r),ot=n,at=r)):wt(32823)}function It(t){t?bt(3089):wt(3089)}function Nt(e){void 0===e&&(e=33984+ct-1),dt!==e&&(t.activeTexture(e),dt=e)}function Ot(e,n){null===dt&&Nt();let r=pt[dt];void 0===r&&(r={type:void 0,texture:void 0},pt[dt]=r),r.type===e&&r.texture===n||(t.bindTexture(e,n||xt[e]),r.type=e,r.texture=n)}function Dt(){const e=pt[dt];void 0!==e&&void 0!==e.type&&(t.bindTexture(e.type,null),e.type=void 0,e.texture=void 0)}function kt(){try{t.compressedTexImage2D.apply(t,arguments)}catch(e){console.error("THREE.WebGLState:",e)}}function zt(){try{t.texSubImage2D.apply(t,arguments)}catch(e){console.error("THREE.WebGLState:",e)}}function Ft(){try{t.texStorage2D.apply(t,arguments)}catch(e){console.error("THREE.WebGLState:",e)}}function Ut(){try{t.texImage2D.apply(t,arguments)}catch(e){console.error("THREE.WebGLState:",e)}}function Bt(){try{t.texImage3D.apply(t,arguments)}catch(e){console.error("THREE.WebGLState:",e)}}function Ht(e){!1===gt.equals(e)&&(t.scissor(e.x,e.y,e.z,e.w),gt.copy(e))}function Gt(e){!1===vt.equals(e)&&(t.viewport(e.x,e.y,e.z,e.w),vt.copy(e))}function Vt(){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===r&&(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),u={},dt=null,pt={},h={},m=null,g=!1,v=null,y=null,w=null,$=null,Q=null,tt=null,et=null,nt=!1,rt=null,it=null,st=null,ot=null,at=null,gt.set(0,0,t.canvas.width,t.canvas.height),vt.set(0,0,t.canvas.width,t.canvas.height),a.reset(),c.reset(),l.reset()}return{buffers:{color:a,depth:c,stencil:l},enable:bt,disable:wt,bindFramebuffer:_t,useProgram:Mt,setBlending:Et,setMaterial:At,setFlipSided:Lt,setCullFace:Rt,setLineWidth:Ct,setPolygonOffset:Pt,setScissorTest:It,activeTexture:Nt,bindTexture:Ot,unbindTexture:Dt,compressedTexImage2D:kt,texImage2D:Ut,texImage3D:Bt,texStorage2D:Ft,texSubImage2D:zt,scissor:Ht,viewport:Gt,reset:Vt}}function Ku(t,e,n,r,i,s,o){const a=i.isWebGL2,c=i.maxTextures,l=i.maxCubemapSize,u=i.maxTextureSize,h=i.maxSamples,d=e.has("WEBGL_multisampled_render_to_texture"),p=d?e.get("WEBGL_multisampled_render_to_texture"):void 0,f=new WeakMap;let m,g=!1;try{g="undefined"!==typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(rt){}function v(t,e){return g?new OffscreenCanvas(t,e):Vn("canvas")}function y(t,e,n,r){let i=1;if((t.width>r||t.height>r)&&(i=r/Math.max(t.width,t.height)),i<1||!0===e){if("undefined"!==typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!==typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!==typeof ImageBitmap&&t instanceof ImageBitmap){const r=e?Dn:Math.floor,s=r(i*t.width),o=r(i*t.height);void 0===m&&(m=v(s,o));const a=n?v(s,o):m;a.width=s,a.height=o;const c=a.getContext("2d");return c.drawImage(t,0,0,s,o),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+t.width+"x"+t.height+") to ("+s+"x"+o+")."),a}return"data"in t&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+t.width+"x"+t.height+")."),t}return t}function x(t){return Nn(t.width)&&Nn(t.height)}function b(t){return!a&&(t.wrapS!==mt||t.wrapT!==mt||t.minFilter!==vt&&t.minFilter!==bt)}function w(t,e){return t.generateMipmaps&&e&&t.minFilter!==vt&&t.minFilter!==bt}function _(e){t.generateMipmap(e)}function M(n,r,i){if(!1===a)return r;if(null!==n){if(void 0!==t[n])return t[n];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+n+"'")}let s=r;return 6403===r&&(5126===i&&(s=33326),5131===i&&(s=33325),5121===i&&(s=33321)),6407===r&&(5126===i&&(s=34837),5131===i&&(s=34843),5121===i&&(s=32849)),6408===r&&(5126===i&&(s=34836),5131===i&&(s=34842),5121===i&&(s=32856)),33325!==s&&33326!==s&&34842!==s&&34836!==s||e.get("EXT_color_buffer_float"),s}function S(t,e,n){return!0===w(t,n)?Math.log2(Math.max(e.width,e.height))+1:t.mipmaps.length>0?t.mipmaps.length:1}function T(t){return t===vt||t===yt||t===xt?9728:9729}function E(t){const e=t.target;e.removeEventListener("dispose",E),L(e),e.isVideoTexture&&f.delete(e),o.memory.textures--}function A(t){const e=t.target;e.removeEventListener("dispose",A),R(e)}function L(e){const n=r.get(e);void 0!==n.__webglInit&&(t.deleteTexture(n.__webglTexture),r.remove(e))}function R(e){const n=e.texture,i=r.get(e),s=r.get(n);if(e){if(void 0!==s.__webglTexture&&(t.deleteTexture(s.__webglTexture),o.memory.textures--),e.depthTexture&&e.depthTexture.dispose(),e.isWebGLCubeRenderTarget)for(let e=0;e<6;e++)t.deleteFramebuffer(i.__webglFramebuffer[e]),i.__webglDepthbuffer&&t.deleteRenderbuffer(i.__webglDepthbuffer[e]);else t.deleteFramebuffer(i.__webglFramebuffer),i.__webglDepthbuffer&&t.deleteRenderbuffer(i.__webglDepthbuffer),i.__webglMultisampledFramebuffer&&t.deleteFramebuffer(i.__webglMultisampledFramebuffer),i.__webglColorRenderbuffer&&t.deleteRenderbuffer(i.__webglColorRenderbuffer),i.__webglDepthRenderbuffer&&t.deleteRenderbuffer(i.__webglDepthRenderbuffer);if(e.isWebGLMultipleRenderTargets)for(let e=0,i=n.length;e<i;e++){const i=r.get(n[e]);i.__webglTexture&&(t.deleteTexture(i.__webglTexture),o.memory.textures--),r.remove(n[e])}r.remove(n),r.remove(e)}}let C=0;function P(){C=0}function I(){const t=C;return t>=c&&console.warn("THREE.WebGLTextures: Trying to use "+t+" texture units while this GPU supports only "+c),C+=1,t}function N(t,e){const i=r.get(t);if(t.isVideoTexture&&$(t),t.version>0&&i.__version!==t.version){const n=t.image;if(void 0===n)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined");else{if(!1!==n.complete)return void H(i,t,e);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}n.activeTexture(33984+e),n.bindTexture(3553,i.__webglTexture)}function O(t,e){const i=r.get(t);t.version>0&&i.__version!==t.version?H(i,t,e):(n.activeTexture(33984+e),n.bindTexture(35866,i.__webglTexture))}function D(t,e){const i=r.get(t);t.version>0&&i.__version!==t.version?H(i,t,e):(n.activeTexture(33984+e),n.bindTexture(32879,i.__webglTexture))}function k(t,e){const i=r.get(t);t.version>0&&i.__version!==t.version?G(i,t,e):(n.activeTexture(33984+e),n.bindTexture(34067,i.__webglTexture))}const z={[ft]:10497,[mt]:33071,[gt]:33648},F={[vt]:9728,[yt]:9984,[xt]:9986,[bt]:9729,[wt]:9985,[_t]:9987};function U(n,s,o){if(o?(t.texParameteri(n,10242,z[s.wrapS]),t.texParameteri(n,10243,z[s.wrapT]),32879!==n&&35866!==n||t.texParameteri(n,32882,z[s.wrapR]),t.texParameteri(n,10240,F[s.magFilter]),t.texParameteri(n,10241,F[s.minFilter])):(t.texParameteri(n,10242,33071),t.texParameteri(n,10243,33071),32879!==n&&35866!==n||t.texParameteri(n,32882,33071),s.wrapS===mt&&s.wrapT===mt||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,T(s.magFilter)),t.texParameteri(n,10241,T(s.minFilter)),s.minFilter!==vt&&s.minFilter!==bt&&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 o=e.get("EXT_texture_filter_anisotropic");if(s.type===Rt&&!1===e.has("OES_texture_float_linear"))return;if(!1===a&&s.type===Ct&&!1===e.has("OES_texture_half_float_linear"))return;(s.anisotropy>1||r.get(s).__currentAnisotropy)&&(t.texParameterf(n,o.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(s.anisotropy,i.getMaxAnisotropy())),r.get(s).__currentAnisotropy=s.anisotropy)}}function B(e,n){void 0===e.__webglInit&&(e.__webglInit=!0,n.addEventListener("dispose",E),e.__webglTexture=t.createTexture(),o.memory.textures++)}function H(e,r,i){let o=3553;r.isDataTexture2DArray&&(o=35866),r.isDataTexture3D&&(o=32879),B(e,r),n.activeTexture(33984+i),n.bindTexture(o,e.__webglTexture),t.pixelStorei(37440,r.flipY),t.pixelStorei(37441,r.premultiplyAlpha),t.pixelStorei(3317,r.unpackAlignment),t.pixelStorei(37443,0);const c=b(r)&&!1===x(r.image),l=y(r.image,c,!1,u),h=x(l)||a,d=s.convert(r.format);let p,f=s.convert(r.type),m=M(r.internalFormat,d,f,r.encoding);U(o,r,h);const g=r.mipmaps;if(r.isDepthTexture)m=6402,a?m=r.type===Rt?36012:r.type===Lt?33190:r.type===Ot?35056:33189:r.type===Rt&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),r.format===Ht&&6402===m&&r.type!==Et&&r.type!==Lt&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),r.type=Et,f=s.convert(r.type)),r.format===Gt&&6402===m&&(m=34041,r.type!==Ot&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),r.type=Ot,f=s.convert(r.type))),n.texImage2D(3553,0,m,l.width,l.height,0,d,f,null);else if(r.isDataTexture)if(g.length>0&&h){for(let t=0,e=g.length;t<e;t++)p=g[t],n.texImage2D(3553,t,m,p.width,p.height,0,d,f,p.data);r.generateMipmaps=!1}else n.texImage2D(3553,0,m,l.width,l.height,0,d,f,l.data);else if(r.isCompressedTexture)for(let t=0,s=g.length;t<s;t++)p=g[t],r.format!==zt&&r.format!==kt?null!==d?n.compressedTexImage2D(3553,t,m,p.width,p.height,0,p.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):n.texImage2D(3553,t,m,p.width,p.height,0,d,f,p.data);else if(r.isDataTexture2DArray)n.texImage3D(35866,0,m,l.width,l.height,l.depth,0,d,f,l.data);else if(r.isDataTexture3D)n.texImage3D(32879,0,m,l.width,l.height,l.depth,0,d,f,l.data);else{const t=S(r,l,h),i=a&&!0!==r.isVideoTexture,s=void 0===e.__version;if(g.length>0&&h){i&&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?n.texSubImage2D(3553,t,0,0,d,f,p):n.texImage2D(3553,t,m,d,f,p);r.generateMipmaps=!1}else i?(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)}w(r,h)&&_(o),e.__version=r.version,r.onUpdate&&r.onUpdate(r)}function G(e,r,i){if(6!==r.image.length)return;B(e,r),n.activeTexture(33984+i),n.bindTexture(34067,e.__webglTexture),t.pixelStorei(37440,r.flipY),t.pixelStorei(37441,r.premultiplyAlpha),t.pixelStorei(3317,r.unpackAlignment),t.pixelStorei(37443,0);const o=r&&(r.isCompressedTexture||r.image[0].isCompressedTexture),c=r.image[0]&&r.image[0].isDataTexture,u=[];for(let t=0;t<6;t++)u[t]=o||c?c?r.image[t].image:r.image[t]:y(r.image[t],!1,!0,l);const h=u[0],d=x(h)||a,p=s.convert(r.format),f=s.convert(r.type),m=M(r.internalFormat,p,f,r.encoding);let g;if(U(34067,r,d),o)for(let t=0;t<6;t++){g=u[t].mipmaps;for(let e=0;e<g.length;e++){const i=g[e];r.format!==zt&&r.format!==kt?null!==p?n.compressedTexImage2D(34069+t,e,m,i.width,i.height,0,i.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):n.texImage2D(34069+t,e,m,i.width,i.height,0,p,f,i.data)}}else{g=r.mipmaps;for(let t=0;t<6;t++)if(c){n.texImage2D(34069+t,0,m,u[t].width,u[t].height,0,p,f,u[t].data);for(let e=0;e<g.length;e++){const r=g[e],i=r.image[t].image;n.texImage2D(34069+t,e+1,m,i.width,i.height,0,p,f,i.data)}}else{n.texImage2D(34069+t,0,m,p,f,u[t]);for(let e=0;e<g.length;e++){const r=g[e];n.texImage2D(34069+t,e+1,m,p,f,r.image[t])}}}w(r,d)&&_(34067),e.__version=r.version,r.onUpdate&&r.onUpdate(r)}function V(e,i,o,a,c){const l=s.convert(o.format),u=s.convert(o.type),h=M(o.internalFormat,l,u,o.encoding),d=r.get(i);d.__hasExternalTextures||(32879===c||35866===c?n.texImage3D(c,0,h,i.width,i.height,i.depth,0,l,u,null):n.texImage2D(c,0,h,i.width,i.height,0,l,u,null)),n.bindFramebuffer(36160,e),i.useRenderToTexture?p.framebufferTexture2DMultisampleEXT(36160,a,c,r.get(o).__webglTexture,0,K(i)):t.framebufferTexture2D(36160,a,c,r.get(o).__webglTexture,0),n.bindFramebuffer(36160,null)}function W(e,n,r){if(t.bindRenderbuffer(36161,e),n.depthBuffer&&!n.stencilBuffer){let i=33189;if(r||n.useRenderToTexture){const e=n.depthTexture;e&&e.isDepthTexture&&(e.type===Rt?i=36012:e.type===Lt&&(i=33190));const r=K(n);n.useRenderToTexture?p.renderbufferStorageMultisampleEXT(36161,r,i,n.width,n.height):t.renderbufferStorageMultisample(36161,r,i,n.width,n.height)}else t.renderbufferStorage(36161,i,n.width,n.height);t.framebufferRenderbuffer(36160,36096,36161,e)}else if(n.depthBuffer&&n.stencilBuffer){const i=K(n);r&&n.useRenderbuffer?t.renderbufferStorageMultisample(36161,i,35056,n.width,n.height):n.useRenderToTexture?p.renderbufferStorageMultisampleEXT(36161,i,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,i=s.convert(e.format),o=s.convert(e.type),a=M(e.internalFormat,i,o,e.encoding),c=K(n);r&&n.useRenderbuffer?t.renderbufferStorageMultisample(36161,c,a,n.width,n.height):n.useRenderToTexture?p.renderbufferStorageMultisampleEXT(36161,c,a,n.width,n.height):t.renderbufferStorage(36161,a,n.width,n.height)}t.bindRenderbuffer(36161,null)}function j(e,i){const s=i&&i.isWebGLCubeRenderTarget;if(s)throw new Error("Depth Texture with cube render targets is not supported");if(n.bindFramebuffer(36160,e),!i.depthTexture||!i.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");r.get(i.depthTexture).__webglTexture&&i.depthTexture.image.width===i.width&&i.depthTexture.image.height===i.height||(i.depthTexture.image.width=i.width,i.depthTexture.image.height=i.height,i.depthTexture.needsUpdate=!0),N(i.depthTexture,0);const o=r.get(i.depthTexture).__webglTexture,a=K(i);if(i.depthTexture.format===Ht)i.useRenderToTexture?p.framebufferTexture2DMultisampleEXT(36160,36096,3553,o,0,a):t.framebufferTexture2D(36160,36096,3553,o,0);else{if(i.depthTexture.format!==Gt)throw new Error("Unknown depthTexture format");i.useRenderToTexture?p.framebufferTexture2DMultisampleEXT(36160,33306,3553,o,0,a):t.framebufferTexture2D(36160,33306,3553,o,0)}}function q(e){const i=r.get(e),s=!0===e.isWebGLCubeRenderTarget;if(e.depthTexture&&!i.__autoAllocateDepthBuffer){if(s)throw new Error("target.depthTexture not supported in Cube render targets");j(i.__webglFramebuffer,e)}else if(s){i.__webglDepthbuffer=[];for(let r=0;r<6;r++)n.bindFramebuffer(36160,i.__webglFramebuffer[r]),i.__webglDepthbuffer[r]=t.createRenderbuffer(),W(i.__webglDepthbuffer[r],e,!1)}else n.bindFramebuffer(36160,i.__webglFramebuffer),i.__webglDepthbuffer=t.createRenderbuffer(),W(i.__webglDepthbuffer,e,!1);n.bindFramebuffer(36160,null)}function X(t,e,n){const i=r.get(t);void 0!==e&&V(i.__webglFramebuffer,t,t.texture,36064,3553),void 0!==n&&q(t)}function Y(e){const c=e.texture,l=r.get(e),u=r.get(c);e.addEventListener("dispose",A),!0!==e.isWebGLMultipleRenderTargets&&(void 0===u.__webglTexture&&(u.__webglTexture=t.createTexture()),u.__version=c.version,o.memory.textures++);const h=!0===e.isWebGLCubeRenderTarget,d=!0===e.isWebGLMultipleRenderTargets,p=c.isDataTexture3D||c.isDataTexture2DArray,f=x(e)||a;if(!a||c.format!==kt||c.type!==Rt&&c.type!==Ct||(c.format=zt,console.warn("THREE.WebGLRenderer: Rendering to textures with RGB format is not supported. Using RGBA format instead.")),h){l.__webglFramebuffer=[];for(let e=0;e<6;e++)l.__webglFramebuffer[e]=t.createFramebuffer()}else if(l.__webglFramebuffer=t.createFramebuffer(),d)if(i.drawBuffers){const n=e.texture;for(let e=0,i=n.length;e<i;e++){const i=r.get(n[e]);void 0===i.__webglTexture&&(i.__webglTexture=t.createTexture(),o.memory.textures++)}}else console.warn("THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.");else if(e.useRenderbuffer)if(a){l.__webglMultisampledFramebuffer=t.createFramebuffer(),l.__webglColorRenderbuffer=t.createRenderbuffer(),t.bindRenderbuffer(36161,l.__webglColorRenderbuffer);const r=s.convert(c.format),i=s.convert(c.type),o=M(c.internalFormat,r,i,c.encoding),a=K(e);t.renderbufferStorageMultisample(36161,a,o,e.width,e.height),n.bindFramebuffer(36160,l.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(36160,36064,36161,l.__webglColorRenderbuffer),t.bindRenderbuffer(36161,null),e.depthBuffer&&(l.__webglDepthRenderbuffer=t.createRenderbuffer(),W(l.__webglDepthRenderbuffer,e,!0)),n.bindFramebuffer(36160,null)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.");if(h){n.bindTexture(34067,u.__webglTexture),U(34067,c,f);for(let t=0;t<6;t++)V(l.__webglFramebuffer[t],e,c,36064,34069+t);w(c,f)&&_(34067),n.unbindTexture()}else if(d){const t=e.texture;for(let i=0,s=t.length;i<s;i++){const s=t[i],o=r.get(s);n.bindTexture(3553,o.__webglTexture),U(3553,s,f),V(l.__webglFramebuffer,e,s,36064+i,3553),w(s,f)&&_(3553)}n.unbindTexture()}else{let t=3553;if(p)if(a){const e=c.isDataTexture3D;t=e?32879:35866}else console.warn("THREE.DataTexture3D and THREE.DataTexture2DArray only supported with WebGL2.");n.bindTexture(t,u.__webglTexture),U(t,c,f),V(l.__webglFramebuffer,e,c,36064,t),w(c,f)&&_(t),n.unbindTexture()}e.depthBuffer&&q(e)}function J(t){const e=x(t)||a,i=!0===t.isWebGLMultipleRenderTargets?t.texture:[t.texture];for(let s=0,o=i.length;s<o;s++){const o=i[s];if(w(o,e)){const e=t.isWebGLCubeRenderTarget?34067:3553,i=r.get(o).__webglTexture;n.bindTexture(e,i),_(e),n.unbindTexture()}}}function Z(e){if(e.useRenderbuffer)if(a){const i=e.width,s=e.height;let o=16384;const a=[36064],c=e.stencilBuffer?33306:36096;e.depthBuffer&&a.push(c),e.ignoreDepthForMultisampleCopy||(e.depthBuffer&&(o|=256),e.stencilBuffer&&(o|=1024));const l=r.get(e);n.bindFramebuffer(36008,l.__webglMultisampledFramebuffer),n.bindFramebuffer(36009,l.__webglFramebuffer),e.ignoreDepthForMultisampleCopy&&(t.invalidateFramebuffer(36008,[c]),t.invalidateFramebuffer(36009,[c])),t.blitFramebuffer(0,0,i,s,0,0,i,s,o,9728),t.invalidateFramebuffer(36008,a),n.bindFramebuffer(36008,null),n.bindFramebuffer(36009,l.__webglMultisampledFramebuffer)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.")}function K(t){return a&&(t.useRenderbuffer||t.useRenderToTexture)?Math.min(h,t.samples):0}function $(t){const e=o.render.frame;f.get(t)!==e&&(f.set(t,e),t.update())}let Q=!1,tt=!1;function et(t,e){t&&t.isWebGLRenderTarget&&(!1===Q&&(console.warn("THREE.WebGLTextures.safeSetTexture2D: don't use render targets as textures. Use their .texture property instead."),Q=!0),t=t.texture),N(t,e)}function nt(t,e){t&&t.isWebGLCubeRenderTarget&&(!1===tt&&(console.warn("THREE.WebGLTextures.safeSetTextureCube: don't use cube render targets as textures. Use their .texture property instead."),tt=!0),t=t.texture),k(t,e)}this.allocateTextureUnit=I,this.resetTextureUnits=P,this.setTexture2D=N,this.setTexture2DArray=O,this.setTexture3D=D,this.setTextureCube=k,this.rebindTextures=X,this.setupRenderTarget=Y,this.updateRenderTargetMipmap=J,this.updateMultisampleRenderTarget=Z,this.setupDepthRenderbuffer=q,this.setupFrameBufferTexture=V,this.safeSetTexture2D=et,this.safeSetTextureCube=nt}function $u(t,e,n){const r=n.isWebGL2;function i(t){let n;if(t===Mt)return 5121;if(t===Pt)return 32819;if(t===It)return 32820;if(t===Nt)return 33635;if(t===St)return 5120;if(t===Tt)return 5122;if(t===Et)return 5123;if(t===At)return 5124;if(t===Lt)return 5125;if(t===Rt)return 5126;if(t===Ct)return r?5131:(n=e.get("OES_texture_half_float"),null!==n?n.HALF_FLOAT_OES:null);if(t===Dt)return 6406;if(t===kt)return 6407;if(t===zt)return 6408;if(t===Ft)return 6409;if(t===Ut)return 6410;if(t===Ht)return 6402;if(t===Gt)return 34041;if(t===Vt)return 6403;if(t===Wt)return 36244;if(t===jt)return 33319;if(t===qt)return 33320;if(t===Xt)return 36248;if(t===Yt)return 36249;if(t===Jt||t===Zt||t===Kt||t===$t){if(n=e.get("WEBGL_compressed_texture_s3tc"),null===n)return null;if(t===Jt)return n.COMPRESSED_RGB_S3TC_DXT1_EXT;if(t===Zt)return n.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(t===Kt)return n.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(t===$t)return n.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(t===Qt||t===te||t===ee||t===ne){if(n=e.get("WEBGL_compressed_texture_pvrtc"),null===n)return null;if(t===Qt)return n.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(t===te)return n.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(t===ee)return n.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(t===ne)return n.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(t===re)return n=e.get("WEBGL_compressed_texture_etc1"),null!==n?n.COMPRESSED_RGB_ETC1_WEBGL:null;if((t===ie||t===se)&&(n=e.get("WEBGL_compressed_texture_etc"),null!==n)){if(t===ie)return n.COMPRESSED_RGB8_ETC2;if(t===se)return n.COMPRESSED_RGBA8_ETC2_EAC}return t===oe||t===ae||t===ce||t===le||t===ue||t===he||t===de||t===pe||t===fe||t===me||t===ge||t===ve||t===ye||t===xe||t===we||t===_e||t===Me||t===Se||t===Te||t===Ee||t===Ae||t===Le||t===Re||t===Ce||t===Pe||t===Ie||t===Ne||t===Oe?(n=e.get("WEBGL_compressed_texture_astc"),null!==n?t:null):t===be?(n=e.get("EXT_texture_compression_bptc"),null!==n?t:null):t===Ot?r?34042:(n=e.get("WEBGL_depth_texture"),null!==n?n.UNSIGNED_INT_24_8_WEBGL:null):void 0}return{convert:i}}class Qu extends fs{constructor(t=[]){super(),this.cameras=t}}Qu.prototype.isArrayCamera=!0;class th extends ri{constructor(){super(),this.type="Group"}}th.prototype.isGroup=!0;const eh={type:"move"};class nh{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return null===this._hand&&(this._hand=new th,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 th,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new er,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new er),this._targetRay}getGripSpace(){return null===this._grip&&(this._grip=new th,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new er,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new er),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 r=null,i=null,s=null;const o=this._targetRay,a=this._grip,c=this._hand;if(t&&"visible-blurred"!==e.session.visibilityState)if(null!==o&&(r=e.getPose(t.targetRaySpace,n),null!==r&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),r.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(r.linearVelocity)):o.hasLinearVelocity=!1,r.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(r.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(eh))),c&&t.hand){s=!0;for(const s of t.hand.values()){const t=e.getJointPose(s,n);if(void 0===c.joints[s.jointName]){const t=new th;t.matrixAutoUpdate=!1,t.visible=!1,c.joints[s.jointName]=t,c.add(t)}const r=c.joints[s.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 r=c.joints["index-finger-tip"],i=c.joints["thumb-tip"],o=r.position.distanceTo(i.position),a=.02,l=.005;c.inputState.pinching&&o>a+l?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!c.inputState.pinching&&o<=a-l&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else null!==a&&t.gripSpace&&(i=e.getPose(t.gripSpace,n),null!==i&&(a.matrix.fromArray(i.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),i.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(i.linearVelocity)):a.hasLinearVelocity=!1,i.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(i.angularVelocity)):a.hasAngularVelocity=!1));return null!==o&&(o.visible=null!==r),null!==a&&(a.visible=null!==i),null!==c&&(c.visible=null!==s),this}}class rh extends Yn{constructor(t,e,n,r,i,s,o,a,c,l){if(l=void 0!==l?l:Ht,l!==Ht&&l!==Gt)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===n&&l===Ht&&(n=Et),void 0===n&&l===Gt&&(n=Ot),super(null,r,i,s,o,a,l,n,c),this.image={width:t,height:e},this.magFilter=void 0!==o?o:vt,this.minFilter=void 0!==a?a:vt,this.flipY=!1,this.generateMipmaps=!1}}rh.prototype.isDepthTexture=!0;class ih extends dn{constructor(t,e){super();const n=this;let r=null,i=1,s=null,o="local-floor";const a=t.extensions.has("WEBGL_multisampled_render_to_texture");let c=null,l=null,u=null,h=null,d=!1,p=null;const f=e.getContextAttributes();let m=null,g=null;const v=[],y=new Map,x=new fs;x.layers.enable(1),x.viewport=new Zn;const b=new fs;b.layers.enable(2),b.viewport=new Zn;const w=[x,b],_=new Qu;_.layers.enable(1),_.layers.enable(2);let M=null,S=null;function T(t){const e=y.get(t.inputSource);e&&e.dispatchEvent({type:t.type,data:t.inputSource})}function E(){y.forEach((function(t,e){t.disconnect(e)})),y.clear(),M=null,S=null,t.setRenderTarget(m),h=null,u=null,l=null,r=null,g=null,O.stop(),n.isPresenting=!1,n.dispatchEvent({type:"sessionend"})}function A(t){const e=r.inputSources;for(let n=0;n<v.length;n++)y.set(e[n],v[n]);for(let n=0;n<t.removed.length;n++){const e=t.removed[n],r=y.get(e);r&&(r.dispatchEvent({type:"disconnected",data:e}),y.delete(e))}for(let n=0;n<t.added.length;n++){const e=t.added[n],r=y.get(e);r&&r.dispatchEvent({type:"connected",data:e})}}this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(t){let e=v[t];return void 0===e&&(e=new nh,v[t]=e),e.getTargetRaySpace()},this.getControllerGrip=function(t){let e=v[t];return void 0===e&&(e=new nh,v[t]=e),e.getGripSpace()},this.getHand=function(t){let e=v[t];return void 0===e&&(e=new nh,v[t]=e),e.getHandSpace()},this.setFramebufferScaleFactor=function(t){i=t,!0===n.isPresenting&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(t){o=t,!0===n.isPresenting&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return s},this.getBaseLayer=function(){return null!==u?u:h},this.getBinding=function(){return l},this.getFrame=function(){return p},this.getSession=function(){return r},this.setSession=async function(c){if(r=c,null!==r){if(m=t.getRenderTarget(),r.addEventListener("select",T),r.addEventListener("selectstart",T),r.addEventListener("selectend",T),r.addEventListener("squeeze",T),r.addEventListener("squeezestart",T),r.addEventListener("squeezeend",T),r.addEventListener("end",E),r.addEventListener("inputsourceschange",A),!0!==f.xrCompatible&&await e.makeXRCompatible(),void 0===r.renderState.layers||!1===t.capabilities.isWebGL2){const t={antialias:void 0!==r.renderState.layers||f.antialias,alpha:f.alpha,depth:f.depth,stencil:f.stencil,framebufferScaleFactor:i};h=new XRWebGLLayer(r,e,t),r.updateRenderState({baseLayer:h}),g=new Kn(h.framebufferWidth,h.framebufferHeight)}else{d=f.antialias;let t=null,n=null,s=null;f.depth&&(s=f.stencil?35056:33189,t=f.stencil?Gt:Ht,n=f.stencil?Ot:Et);const o={colorFormat:f.alpha||d?32856:32849,depthFormat:s,scaleFactor:i};l=new XRWebGLBinding(r,e),u=l.createProjectionLayer(o),r.updateRenderState({layers:[u]}),g=d?new Qn(u.textureWidth,u.textureHeight,{format:zt,type:Mt,depthTexture:new rh(u.textureWidth,u.textureHeight,n,void 0,void 0,void 0,void 0,void 0,void 0,t),stencilBuffer:f.stencil,ignoreDepth:u.ignoreDepthValues,useRenderToTexture:a}):new Kn(u.textureWidth,u.textureHeight,{format:f.alpha?zt:kt,type:Mt,depthTexture:new rh(u.textureWidth,u.textureHeight,n,void 0,void 0,void 0,void 0,void 0,void 0,t),stencilBuffer:f.stencil,ignoreDepth:u.ignoreDepthValues})}this.setFoveation(0),s=await r.requestReferenceSpace(o),O.setContext(r),O.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}};const L=new er,R=new er;function C(t,e,n){L.setFromMatrixPosition(e.matrixWorld),R.setFromMatrixPosition(n.matrixWorld);const r=L.distanceTo(R),i=e.projectionMatrix.elements,s=n.projectionMatrix.elements,o=i[14]/(i[10]-1),a=i[14]/(i[10]+1),c=(i[9]+1)/i[5],l=(i[9]-1)/i[5],u=(i[8]-1)/i[0],h=(s[8]+1)/s[0],d=o*u,p=o*h,f=r/(-u+h),m=f*-u;e.matrixWorld.decompose(t.position,t.quaternion,t.scale),t.translateX(m),t.translateZ(f),t.matrixWorld.compose(t.position,t.quaternion,t.scale),t.matrixWorldInverse.copy(t.matrixWorld).invert();const g=o+f,v=a+f,y=d-m,x=p+(r-m),b=c*a/v*g,w=l*a/v*g;t.projectionMatrix.makePerspective(y,x,b,w,g,v)}function P(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===r)return;_.near=b.near=x.near=t.near,_.far=b.far=x.far=t.far,M===_.near&&S===_.far||(r.updateRenderState({depthNear:_.near,depthFar:_.far}),M=_.near,S=_.far);const e=t.parent,n=_.cameras;P(_,e);for(let r=0;r<n.length;r++)P(n[r],e);_.matrixWorld.decompose(_.position,_.quaternion,_.scale),t.position.copy(_.position),t.quaternion.copy(_.quaternion),t.scale.copy(_.scale),t.matrix.copy(_.matrix),t.matrixWorld.copy(_.matrixWorld);const i=t.children;for(let r=0,s=i.length;r<s;r++)i[r].updateMatrixWorld(!0);2===n.length?C(_,x,b):_.projectionMatrix.copy(x.projectionMatrix)},this.getCamera=function(){return _},this.getFoveation=function(){return null!==u?u.fixedFoveation:null!==h?h.fixedFoveation:void 0},this.setFoveation=function(t){null!==u&&(u.fixedFoveation=t),null!==h&&void 0!==h.fixedFoveation&&(h.fixedFoveation=t)};let I=null;function N(e,n){if(c=n.getViewerPose(s),p=n,null!==c){const e=c.views;null!==h&&(t.setRenderTargetFramebuffer(g,h.framebuffer),t.setRenderTarget(g));let n=!1;e.length!==_.cameras.length&&(_.cameras.length=0,n=!0);for(let r=0;r<e.length;r++){const i=e[r];let s=null;if(null!==h)s=h.getViewport(i);else{const e=l.getViewSubImage(u,i);s=e.viewport,0===r&&(t.setRenderTargetTextures(g,e.colorTexture,u.ignoreDepthValues?void 0:e.depthStencilTexture),t.setRenderTarget(g))}const o=w[r];o.matrix.fromArray(i.transform.matrix),o.projectionMatrix.fromArray(i.projectionMatrix),o.viewport.set(s.x,s.y,s.width,s.height),0===r&&_.matrix.copy(o.matrix),!0===n&&_.cameras.push(o)}}const i=r.inputSources;for(let t=0;t<v.length;t++){const e=v[t],r=i[t];e.update(r,n,s)}I&&I(e,n),p=null}const O=new As;O.setAnimationLoop(N),this.setAnimationLoop=function(t){I=t},this.dispose=function(){}}}function sh(t){function e(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)}function n(t,e,n,v,y){e.isMeshBasicMaterial?r(t,e):e.isMeshLambertMaterial?(r(t,e),c(t,e)):e.isMeshToonMaterial?(r(t,e),u(t,e)):e.isMeshPhongMaterial?(r(t,e),l(t,e)):e.isMeshStandardMaterial?(r(t,e),e.isMeshPhysicalMaterial?d(t,e,y):h(t,e)):e.isMeshMatcapMaterial?(r(t,e),p(t,e)):e.isMeshDepthMaterial?(r(t,e),f(t,e)):e.isMeshDistanceMaterial?(r(t,e),m(t,e)):e.isMeshNormalMaterial?(r(t,e),g(t,e)):e.isLineBasicMaterial?(i(t,e),e.isLineDashedMaterial&&s(t,e)):e.isPointsMaterial?o(t,e,n,v):e.isSpriteMaterial?a(t,e):e.isShadowMaterial?(t.color.value.copy(e.color),t.opacity.value=e.opacity):e.isShaderMaterial&&(e.uniformsNeedUpdate=!1)}function r(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 r=t.get(n).envMap;let i,s;r&&(e.envMap.value=r,e.flipEnvMap.value=r.isCubeTexture&&!1===r.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?i=n.map:n.specularMap?i=n.specularMap:n.displacementMap?i=n.displacementMap:n.normalMap?i=n.normalMap:n.bumpMap?i=n.bumpMap:n.roughnessMap?i=n.roughnessMap:n.metalnessMap?i=n.metalnessMap:n.alphaMap?i=n.alphaMap:n.emissiveMap?i=n.emissiveMap:n.clearcoatMap?i=n.clearcoatMap:n.clearcoatNormalMap?i=n.clearcoatNormalMap:n.clearcoatRoughnessMap?i=n.clearcoatRoughnessMap:n.specularIntensityMap?i=n.specularIntensityMap:n.specularColorMap?i=n.specularColorMap:n.transmissionMap?i=n.transmissionMap:n.thicknessMap?i=n.thicknessMap:n.sheenColorMap?i=n.sheenColorMap:n.sheenRoughnessMap&&(i=n.sheenRoughnessMap),void 0!==i&&(i.isWebGLRenderTarget&&(i=i.texture),!0===i.matrixAutoUpdate&&i.updateMatrix(),e.uvTransform.value.copy(i.matrix)),n.aoMap?s=n.aoMap:n.lightMap&&(s=n.lightMap),void 0!==s&&(s.isWebGLRenderTarget&&(s=s.texture),!0===s.matrixAutoUpdate&&s.updateMatrix(),e.uv2Transform.value.copy(s.matrix))}function i(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity}function s(t,e){t.dashSize.value=e.dashSize,t.totalSize.value=e.dashSize+e.gapSize,t.scale.value=e.scale}function o(t,e,n,r){let i;t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.size.value=e.size*n,t.scale.value=.5*r,e.map&&(t.map.value=e.map),e.alphaMap&&(t.alphaMap.value=e.alphaMap),e.alphaTest>0&&(t.alphaTest.value=e.alphaTest),e.map?i=e.map:e.alphaMap&&(i=e.alphaMap),void 0!==i&&(!0===i.matrixAutoUpdate&&i.updateMatrix(),t.uvTransform.value.copy(i.matrix))}function a(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))}function c(t,e){e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap)}function l(t,e){t.specular.value.copy(e.specular),t.shininess.value=Math.max(e.shininess,1e-4),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap),e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,e.side===x&&(t.bumpScale.value*=-1)),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),e.side===x&&t.normalScale.value.negate()),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}function u(t,e){e.gradientMap&&(t.gradientMap.value=e.gradientMap),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap),e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,e.side===x&&(t.bumpScale.value*=-1)),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),e.side===x&&t.normalScale.value.negate()),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}function h(e,n){e.roughness.value=n.roughness,e.metalness.value=n.metalness,n.roughnessMap&&(e.roughnessMap.value=n.roughnessMap),n.metalnessMap&&(e.metalnessMap.value=n.metalnessMap),n.emissiveMap&&(e.emissiveMap.value=n.emissiveMap),n.bumpMap&&(e.bumpMap.value=n.bumpMap,e.bumpScale.value=n.bumpScale,n.side===x&&(e.bumpScale.value*=-1)),n.normalMap&&(e.normalMap.value=n.normalMap,e.normalScale.value.copy(n.normalScale),n.side===x&&e.normalScale.value.negate()),n.displacementMap&&(e.displacementMap.value=n.displacementMap,e.displacementScale.value=n.displacementScale,e.displacementBias.value=n.displacementBias);const r=t.get(n).envMap;r&&(e.envMapIntensity.value=n.envMapIntensity)}function d(t,e,n){h(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,e.side===x&&t.clearcoatNormalScale.value.negate())),e.transmission>0&&(t.transmission.value=e.transmission,t.transmissionSamplerMap.value=n.texture,t.transmissionSamplerSize.value.set(n.width,n.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)}function p(t,e){e.matcap&&(t.matcap.value=e.matcap),e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,e.side===x&&(t.bumpScale.value*=-1)),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),e.side===x&&t.normalScale.value.negate()),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}function f(t,e){e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}function m(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}function g(t,e){e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,e.side===x&&(t.bumpScale.value*=-1)),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),e.side===x&&t.normalScale.value.negate()),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}return{refreshFogUniforms:e,refreshMaterialUniforms:n}}function oh(){const t=Vn("canvas");return t.style.display="block",t}function ah(t={}){const e=void 0!==t.canvas?t.canvas:oh(),n=void 0!==t.context?t.context:null,r=void 0!==t.alpha&&t.alpha,i=void 0===t.depth||t.depth,s=void 0===t.stencil||t.stencil,o=void 0!==t.antialias&&t.antialias,a=void 0===t.premultipliedAlpha||t.premultipliedAlpha,c=void 0!==t.preserveDrawingBuffer&&t.preserveDrawingBuffer,u=void 0!==t.powerPreference?t.powerPreference:"default",h=void 0!==t.failIfMajorPerformanceCaveat&&t.failIfMajorPerformanceCaveat;let d=null,p=null;const f=[],m=[];this.domElement=e,this.debug={checkShaderErrors:!0},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.gammaFactor=2,this.outputEncoding=Je,this.physicallyCorrectLights=!1,this.toneMapping=et,this.toneMappingExposure=1;const g=this;let v=!1,w=0,_=0,M=null,S=-1,T=null;const E=new Zn,A=new Zn;let L=null,R=e.width,C=e.height,P=1,I=null,N=null;const O=new Zn(0,0,R,C),D=new Zn(0,0,R,C);let k=!1;const z=[],F=new Es;let U=!1,B=!1,H=null;const G=new Ir,V=new er,W={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function j(){return null===M?P:1}let q,X,Y,J,Z,K,$,Q,tt,nt,rt,it,st,ot,at,ct,lt,ut,ht,dt,pt,ft,gt,yt=n;function xt(t,n){for(let r=0;r<t.length;r++){const i=t[r],s=e.getContext(i,n);if(null!==s)return s}return null}try{const t={alpha:r,depth:i,stencil:s,antialias:o,premultipliedAlpha:a,preserveDrawingBuffer:c,powerPreference:u,failIfMajorPerformanceCaveat:h};if("setAttribute"in e&&e.setAttribute("data-engine","three.js r"+l),e.addEventListener("webglcontextlost",St,!1),e.addEventListener("webglcontextrestored",Tt,!1),null===yt){const e=["webgl2","webgl","experimental-webgl"];if(!0===g.isWebGL1Renderer&&e.shift(),yt=xt(e,t),null===yt)throw xt(e)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}void 0===yt.getShaderPrecisionFormat&&(yt.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(Xt){throw console.error("THREE.WebGLRenderer: "+Xt.message),Xt}function bt(){q=new Hc(yt),X=new lc(yt,q,t),q.init(X),ft=new $u(yt,q,X),Y=new Zu(yt,q,X),z[0]=1029,J=new Wc(yt),Z=new Nu,K=new Ku(yt,q,Y,Z,X,ft,J),$=new hc(g),Q=new Bc(g),tt=new Ls(yt,X),gt=new ac(yt,q,tt,X),nt=new Gc(yt,tt,J,gt),rt=new Zc(yt,nt,tt,J),ht=new Jc(yt,X,K),ct=new uc(Z),it=new Iu(g,$,Q,q,X,gt,ct),st=new sh(Z),ot=new zu(Z),at=new Wu(q,X),ut=new oc(g,$,Y,rt,a),lt=new Ju(g,rt,X),dt=new cc(yt,q,J,X),pt=new Vc(yt,q,J,X),J.programs=it.programs,g.capabilities=X,g.extensions=q,g.properties=Z,g.renderLists=ot,g.shadowMap=lt,g.state=Y,g.info=J}bt();const wt=new ih(g,yt);function St(t){t.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),v=!0}function Tt(){console.log("THREE.WebGLRenderer: Context Restored."),v=!1;const t=J.autoReset,e=lt.enabled,n=lt.autoUpdate,r=lt.needsUpdate,i=lt.type;bt(),J.autoReset=t,lt.enabled=e,lt.autoUpdate=n,lt.needsUpdate=r,lt.type=i}function Et(t){const e=t.target;e.removeEventListener("dispose",Et),At(e)}function At(t){Lt(t),Z.remove(t)}function Lt(t){const e=Z.get(t).programs;void 0!==e&&e.forEach((function(t){it.releaseProgram(t)}))}this.xr=wt,this.getContext=function(){return yt},this.getContextAttributes=function(){return yt.getContextAttributes()},this.forceContextLoss=function(){const t=q.get("WEBGL_lose_context");t&&t.loseContext()},this.forceContextRestore=function(){const t=q.get("WEBGL_lose_context");t&&t.restoreContext()},this.getPixelRatio=function(){return P},this.setPixelRatio=function(t){void 0!==t&&(P=t,this.setSize(R,C,!1))},this.getSize=function(t){return t.set(R,C)},this.setSize=function(t,n,r){wt.isPresenting?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(R=t,C=n,e.width=Math.floor(t*P),e.height=Math.floor(n*P),!1!==r&&(e.style.width=t+"px",e.style.height=n+"px"),this.setViewport(0,0,t,n))},this.getDrawingBufferSize=function(t){return t.set(R*P,C*P).floor()},this.setDrawingBufferSize=function(t,n,r){R=t,C=n,P=r,e.width=Math.floor(t*r),e.height=Math.floor(n*r),this.setViewport(0,0,t,n)},this.getCurrentViewport=function(t){return t.copy(E)},this.getViewport=function(t){return t.copy(O)},this.setViewport=function(t,e,n,r){t.isVector4?O.set(t.x,t.y,t.z,t.w):O.set(t,e,n,r),Y.viewport(E.copy(O).multiplyScalar(P).floor())},this.getScissor=function(t){return t.copy(D)},this.setScissor=function(t,e,n,r){t.isVector4?D.set(t.x,t.y,t.z,t.w):D.set(t,e,n,r),Y.scissor(A.copy(D).multiplyScalar(P).floor())},this.getScissorTest=function(){return k},this.setScissorTest=function(t){Y.setScissorTest(k=t)},this.setOpaqueSort=function(t){I=t},this.setTransparentSort=function(t){N=t},this.getClearColor=function(t){return t.copy(ut.getClearColor())},this.setClearColor=function(){ut.setClearColor.apply(ut,arguments)},this.getClearAlpha=function(){return ut.getClearAlpha()},this.setClearAlpha=function(){ut.setClearAlpha.apply(ut,arguments)},this.clear=function(t,e,n){let r=0;(void 0===t||t)&&(r|=16384),(void 0===e||e)&&(r|=256),(void 0===n||n)&&(r|=1024),yt.clear(r)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){e.removeEventListener("webglcontextlost",St,!1),e.removeEventListener("webglcontextrestored",Tt,!1),ot.dispose(),at.dispose(),Z.dispose(),$.dispose(),Q.dispose(),rt.dispose(),gt.dispose(),wt.dispose(),wt.removeEventListener("sessionstart",Nt),wt.removeEventListener("sessionend",Ot),H&&(H.dispose(),H=null),Dt.stop()},this.renderBufferDirect=function(t,e,n,r,i,s){null===e&&(e=W);const o=i.isMesh&&i.matrixWorld.determinant()<0,a=Wt(t,e,n,r,i);Y.setMaterial(r,o);let c=n.index;const l=n.attributes.position;if(null===c){if(void 0===l||0===l.count)return}else if(0===c.count)return;let u,h=1;!0===r.wireframe&&(c=nt.getWireframeAttribute(n),h=2),gt.setup(i,r,a,n,c);let d=dt;null!==c&&(u=tt.get(c),d=pt,d.setIndex(u));const p=null!==c?c.count:l.count,f=n.drawRange.start*h,m=n.drawRange.count*h,g=null!==s?s.start*h:0,v=null!==s?s.count*h:1/0,y=Math.max(f,g),x=Math.min(p,f+m,g+v)-1,b=Math.max(0,x-y+1);if(0!==b){if(i.isMesh)!0===r.wireframe?(Y.setLineWidth(r.wireframeLinewidth*j()),d.setMode(1)):d.setMode(4);else if(i.isLine){let t=r.linewidth;void 0===t&&(t=1),Y.setLineWidth(t*j()),i.isLineSegments?d.setMode(1):i.isLineLoop?d.setMode(2):d.setMode(3)}else i.isPoints?d.setMode(0):i.isSprite&&d.setMode(4);if(i.isInstancedMesh)d.renderInstances(y,b,i.count);else if(n.isInstancedBufferGeometry){const t=Math.min(n.instanceCount,n._maxInstanceCount);d.renderInstances(y,b,t)}else d.render(y,b)}},this.compile=function(t,e){p=at.get(t),p.init(),m.push(p),t.traverseVisible((function(t){t.isLight&&t.layers.test(e.layers)&&(p.pushLight(t),t.castShadow&&p.pushShadow(t))})),p.setupLights(g.physicallyCorrectLights),t.traverse((function(e){const n=e.material;if(n)if(Array.isArray(n))for(let r=0;r<n.length;r++){const i=n[r];Gt(i,t,e)}else Gt(n,t,e)})),m.pop(),p=null};let Pt=null;function It(t){Pt&&Pt(t)}function Nt(){Dt.stop()}function Ot(){Dt.start()}const Dt=new As;function kt(t,e,n,r){if(!1===t.visible)return;const i=t.layers.test(e.layers);if(i)if(t.isGroup)n=t.renderOrder;else if(t.isLOD)!0===t.autoUpdate&&t.update(e);else if(t.isLight)p.pushLight(t),t.castShadow&&p.pushShadow(t);else if(t.isSprite){if(!t.frustumCulled||F.intersectsSprite(t)){r&&V.setFromMatrixPosition(t.matrixWorld).applyMatrix4(G);const e=rt.update(t),i=t.material;i.visible&&d.push(t,e,i,n,V.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||F.intersectsObject(t))){r&&V.setFromMatrixPosition(t.matrixWorld).applyMatrix4(G);const e=rt.update(t),i=t.material;if(Array.isArray(i)){const r=e.groups;for(let s=0,o=r.length;s<o;s++){const o=r[s],a=i[o.materialIndex];a&&a.visible&&d.push(t,e,a,n,V.z,o)}}else i.visible&&d.push(t,e,i,n,V.z,null)}const s=t.children;for(let o=0,a=s.length;o<a;o++)kt(s[o],e,n,r)}function Ft(t,e,n,r){const i=t.opaque,s=t.transmissive,o=t.transparent;p.setupLightsView(n),s.length>0&&Ut(i,e,n),r&&Y.viewport(E.copy(r)),i.length>0&&Bt(i,e,n),s.length>0&&Bt(s,e,n),o.length>0&&Bt(o,e,n)}function Ut(t,e,n){if(null===H){const t=!0===o&&!0===X.isWebGL2,e=t?Qn:Kn;H=new e(1024,1024,{generateMipmaps:!0,type:null!==ft.convert(Ct)?Ct:Mt,minFilter:_t,magFilter:vt,wrapS:mt,wrapT:mt,useRenderToTexture:q.has("WEBGL_multisampled_render_to_texture")})}const r=g.getRenderTarget();g.setRenderTarget(H),g.clear();const i=g.toneMapping;g.toneMapping=et,Bt(t,e,n),g.toneMapping=i,K.updateMultisampleRenderTarget(H),K.updateRenderTargetMipmap(H),g.setRenderTarget(r)}function Bt(t,e,n){const r=!0===e.isScene?e.overrideMaterial:null;for(let i=0,s=t.length;i<s;i++){const s=t[i],o=s.object,a=s.geometry,c=null===r?s.material:r,l=s.group;o.layers.test(n.layers)&&Ht(o,e,n,a,c,l)}}function Ht(t,e,n,r,i,s){t.onBeforeRender(g,e,n,r,i,s),t.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,t.matrixWorld),t.normalMatrix.getNormalMatrix(t.modelViewMatrix),i.onBeforeRender(g,e,n,r,t,s),!0===i.transparent&&i.side===b?(i.side=x,i.needsUpdate=!0,g.renderBufferDirect(n,e,r,i,t,s),i.side=y,i.needsUpdate=!0,g.renderBufferDirect(n,e,r,i,t,s),i.side=b):g.renderBufferDirect(n,e,r,i,t,s),t.onAfterRender(g,e,n,r,i,s)}function Gt(t,e,n){!0!==e.isScene&&(e=W);const r=Z.get(t),i=p.state.lights,s=p.state.shadowsArray,o=i.state.version,a=it.getParameters(t,i.state,s,e,n),c=it.getProgramCacheKey(a);let l=r.programs;r.environment=t.isMeshStandardMaterial?e.environment:null,r.fog=e.fog,r.envMap=(t.isMeshStandardMaterial?Q:$).get(t.envMap||r.environment),void 0===l&&(t.addEventListener("dispose",Et),l=new Map,r.programs=l);let u=l.get(c);if(void 0!==u){if(r.currentProgram===u&&r.lightsStateVersion===o)return Vt(t,a),u}else a.uniforms=it.getUniforms(t),t.onBuild(n,a,g),t.onBeforeCompile(a,g),u=it.acquireProgram(a,c),l.set(c,u),r.uniforms=a.uniforms;const h=r.uniforms;(t.isShaderMaterial||t.isRawShaderMaterial)&&!0!==t.clipping||(h.clippingPlanes=ct.uniform),Vt(t,a),r.needsLights=qt(t),r.lightsStateVersion=o,r.needsLights&&(h.ambientLightColor.value=i.state.ambient,h.lightProbe.value=i.state.probe,h.directionalLights.value=i.state.directional,h.directionalLightShadows.value=i.state.directionalShadow,h.spotLights.value=i.state.spot,h.spotLightShadows.value=i.state.spotShadow,h.rectAreaLights.value=i.state.rectArea,h.ltc_1.value=i.state.rectAreaLTC1,h.ltc_2.value=i.state.rectAreaLTC2,h.pointLights.value=i.state.point,h.pointLightShadows.value=i.state.pointShadow,h.hemisphereLights.value=i.state.hemi,h.directionalShadowMap.value=i.state.directionalShadowMap,h.directionalShadowMatrix.value=i.state.directionalShadowMatrix,h.spotShadowMap.value=i.state.spotShadowMap,h.spotShadowMatrix.value=i.state.spotShadowMatrix,h.pointShadowMap.value=i.state.pointShadowMap,h.pointShadowMatrix.value=i.state.pointShadowMatrix);const d=u.getUniforms(),f=ru.seqWithValue(d.seq,h);return r.currentProgram=u,r.uniformsList=f,u}function Vt(t,e){const n=Z.get(t);n.outputEncoding=e.outputEncoding,n.instancing=e.instancing,n.skinning=e.skinning,n.morphTargets=e.morphTargets,n.morphNormals=e.morphNormals,n.morphTargetsCount=e.morphTargetsCount,n.numClippingPlanes=e.numClippingPlanes,n.numIntersection=e.numClipIntersection,n.vertexAlphas=e.vertexAlphas,n.vertexTangents=e.vertexTangents}function Wt(t,e,n,r,i){!0!==e.isScene&&(e=W),K.resetTextureUnits();const s=e.fog,o=r.isMeshStandardMaterial?e.environment:null,a=null===M?g.outputEncoding:M.texture.encoding,c=(r.isMeshStandardMaterial?Q:$).get(r.envMap||o),l=!0===r.vertexColors&&!!n.attributes.color&&4===n.attributes.color.itemSize,u=!!r.normalMap&&!!n.attributes.tangent,h=!!n.morphAttributes.position,d=!!n.morphAttributes.normal,f=n.morphAttributes.position?n.morphAttributes.position.length:0,m=Z.get(r),v=p.state.lights;if(!0===U&&(!0===B||t!==T)){const e=t===T&&r.id===S;ct.setState(r,t,e)}let y=!1;r.version===m.__version?m.needsLights&&m.lightsStateVersion!==v.state.version||m.outputEncoding!==a||i.isInstancedMesh&&!1===m.instancing?y=!0:i.isInstancedMesh||!0!==m.instancing?i.isSkinnedMesh&&!1===m.skinning?y=!0:i.isSkinnedMesh||!0!==m.skinning?m.envMap!==c||r.fog&&m.fog!==s?y=!0:void 0===m.numClippingPlanes||m.numClippingPlanes===ct.numPlanes&&m.numIntersection===ct.numIntersection?(m.vertexAlphas!==l||m.vertexTangents!==u||m.morphTargets!==h||m.morphNormals!==d||!0===X.isWebGL2&&m.morphTargetsCount!==f)&&(y=!0):y=!0:y=!0:y=!0:(y=!0,m.__version=r.version);let x=m.currentProgram;!0===y&&(x=Gt(r,e,i));let b=!1,w=!1,_=!1;const E=x.getUniforms(),A=m.uniforms;if(Y.useProgram(x.program)&&(b=!0,w=!0,_=!0),r.id!==S&&(S=r.id,w=!0),b||T!==t){if(E.setValue(yt,"projectionMatrix",t.projectionMatrix),X.logarithmicDepthBuffer&&E.setValue(yt,"logDepthBufFC",2/(Math.log(t.far+1)/Math.LN2)),T!==t&&(T=t,w=!0,_=!0),r.isShaderMaterial||r.isMeshPhongMaterial||r.isMeshToonMaterial||r.isMeshStandardMaterial||r.envMap){const e=E.map.cameraPosition;void 0!==e&&e.setValue(yt,V.setFromMatrixPosition(t.matrixWorld))}(r.isMeshPhongMaterial||r.isMeshToonMaterial||r.isMeshLambertMaterial||r.isMeshBasicMaterial||r.isMeshStandardMaterial||r.isShaderMaterial)&&E.setValue(yt,"isOrthographic",!0===t.isOrthographicCamera),(r.isMeshPhongMaterial||r.isMeshToonMaterial||r.isMeshLambertMaterial||r.isMeshBasicMaterial||r.isMeshStandardMaterial||r.isShaderMaterial||r.isShadowMaterial||i.isSkinnedMesh)&&E.setValue(yt,"viewMatrix",t.matrixWorldInverse)}if(i.isSkinnedMesh){E.setOptional(yt,i,"bindMatrix"),E.setOptional(yt,i,"bindMatrixInverse");const t=i.skeleton;t&&(X.floatVertexTextures?(null===t.boneTexture&&t.computeBoneTexture(),E.setValue(yt,"boneTexture",t.boneTexture,K),E.setValue(yt,"boneTextureSize",t.boneTextureSize)):E.setOptional(yt,t,"boneMatrices"))}return!n||void 0===n.morphAttributes.position&&void 0===n.morphAttributes.normal||ht.update(i,n,r,x),(w||m.receiveShadow!==i.receiveShadow)&&(m.receiveShadow=i.receiveShadow,E.setValue(yt,"receiveShadow",i.receiveShadow)),w&&(E.setValue(yt,"toneMappingExposure",g.toneMappingExposure),m.needsLights&&jt(A,_),s&&r.fog&&st.refreshFogUniforms(A,s),st.refreshMaterialUniforms(A,r,P,C,H),ru.upload(yt,m.uniformsList,A,K)),r.isShaderMaterial&&!0===r.uniformsNeedUpdate&&(ru.upload(yt,m.uniformsList,A,K),r.uniformsNeedUpdate=!1),r.isSpriteMaterial&&E.setValue(yt,"center",i.center),E.setValue(yt,"modelViewMatrix",i.modelViewMatrix),E.setValue(yt,"normalMatrix",i.normalMatrix),E.setValue(yt,"modelMatrix",i.matrixWorld),x}function jt(t,e){t.ambientLightColor.needsUpdate=e,t.lightProbe.needsUpdate=e,t.directionalLights.needsUpdate=e,t.directionalLightShadows.needsUpdate=e,t.pointLights.needsUpdate=e,t.pointLightShadows.needsUpdate=e,t.spotLights.needsUpdate=e,t.spotLightShadows.needsUpdate=e,t.rectAreaLights.needsUpdate=e,t.hemisphereLights.needsUpdate=e}function qt(t){return t.isMeshLambertMaterial||t.isMeshToonMaterial||t.isMeshPhongMaterial||t.isMeshStandardMaterial||t.isShadowMaterial||t.isShaderMaterial&&!0===t.lights}Dt.setAnimationLoop(It),"undefined"!==typeof window&&Dt.setContext(window),this.setAnimationLoop=function(t){Pt=t,wt.setAnimationLoop(t),null===t?Dt.stop():Dt.start()},wt.addEventListener("sessionstart",Nt),wt.addEventListener("sessionend",Ot),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===v)return;!0===t.autoUpdate&&t.updateMatrixWorld(),null===e.parent&&e.updateMatrixWorld(),!0===wt.enabled&&!0===wt.isPresenting&&(!0===wt.cameraAutoUpdate&&wt.updateCamera(e),e=wt.getCamera()),!0===t.isScene&&t.onBeforeRender(g,t,e,M),p=at.get(t,m.length),p.init(),m.push(p),G.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),F.setFromProjectionMatrix(G),B=this.localClippingEnabled,U=ct.init(this.clippingPlanes,B,e),d=ot.get(t,f.length),d.init(),f.push(d),kt(t,e,0,g.sortObjects),d.finish(),!0===g.sortObjects&&d.sort(I,N),!0===U&&ct.beginShadows();const n=p.state.shadowsArray;if(lt.render(n,t,e),!0===U&&ct.endShadows(),!0===this.info.autoReset&&this.info.reset(),ut.render(d,t),p.setupLights(g.physicallyCorrectLights),e.isArrayCamera){const n=e.cameras;for(let e=0,r=n.length;e<r;e++){const r=n[e];Ft(d,t,r,r.viewport)}}else Ft(d,t,e);null!==M&&(K.updateMultisampleRenderTarget(M),K.updateRenderTargetMipmap(M)),!0===t.isScene&&t.onAfterRender(g,t,e),Y.buffers.depth.setTest(!0),Y.buffers.depth.setMask(!0),Y.buffers.color.setMask(!0),Y.setPolygonOffset(!1),gt.resetDefaultState(),S=-1,T=null,m.pop(),p=m.length>0?m[m.length-1]:null,f.pop(),d=f.length>0?f[f.length-1]:null},this.getActiveCubeFace=function(){return w},this.getActiveMipmapLevel=function(){return _},this.getRenderTarget=function(){return M},this.setRenderTargetTextures=function(t,e,n){Z.get(t.texture).__webglTexture=e,Z.get(t.depthTexture).__webglTexture=n;const r=Z.get(t);r.__hasExternalTextures=!0,r.__hasExternalTextures&&(r.__autoAllocateDepthBuffer=void 0===n,r.__autoAllocateDepthBuffer||t.useRenderToTexture&&(console.warn("render-to-texture extension was disabled because an external texture was provided"),t.useRenderToTexture=!1,t.useRenderbuffer=!0))},this.setRenderTargetFramebuffer=function(t,e){const n=Z.get(t);n.__webglFramebuffer=e,n.__useDefaultFramebuffer=void 0===e},this.setRenderTarget=function(t,e=0,n=0){M=t,w=e,_=n;let r=!0;if(t){const e=Z.get(t);void 0!==e.__useDefaultFramebuffer?(Y.bindFramebuffer(36160,null),r=!1):void 0===e.__webglFramebuffer?K.setupRenderTarget(t):e.__hasExternalTextures&&K.rebindTextures(t,Z.get(t.texture).__webglTexture,Z.get(t.depthTexture).__webglTexture)}let i=null,s=!1,o=!1;if(t){const n=t.texture;(n.isDataTexture3D||n.isDataTexture2DArray)&&(o=!0);const r=Z.get(t).__webglFramebuffer;t.isWebGLCubeRenderTarget?(i=r[e],s=!0):i=t.useRenderbuffer?Z.get(t).__webglMultisampledFramebuffer:r,E.copy(t.viewport),A.copy(t.scissor),L=t.scissorTest}else E.copy(O).multiplyScalar(P).floor(),A.copy(D).multiplyScalar(P).floor(),L=k;const a=Y.bindFramebuffer(36160,i);if(a&&X.drawBuffers&&r){let e=!1;if(t)if(t.isWebGLMultipleRenderTargets){const n=t.texture;if(z.length!==n.length||36064!==z[0]){for(let t=0,e=n.length;t<e;t++)z[t]=36064+t;z.length=n.length,e=!0}}else 1===z.length&&36064===z[0]||(z[0]=36064,z.length=1,e=!0);else 1===z.length&&1029===z[0]||(z[0]=1029,z.length=1,e=!0);e&&(X.isWebGL2?yt.drawBuffers(z):q.get("WEBGL_draw_buffers").drawBuffersWEBGL(z))}if(Y.viewport(E),Y.scissor(A),Y.setScissorTest(L),s){const r=Z.get(t.texture);yt.framebufferTexture2D(36160,36064,34069+e,r.__webglTexture,n)}else if(o){const r=Z.get(t.texture),i=e||0;yt.framebufferTextureLayer(36160,36064,r.__webglTexture,n||0,i)}S=-1},this.readRenderTargetPixels=function(t,e,n,r,i,s,o){if(!t||!t.isWebGLRenderTarget)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let a=Z.get(t).__webglFramebuffer;if(t.isWebGLCubeRenderTarget&&void 0!==o&&(a=a[o]),a){Y.bindFramebuffer(36160,a);try{const o=t.texture,a=o.format,c=o.type;if(a!==zt&&ft.convert(a)!==yt.getParameter(35739))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");const l=c===Ct&&(q.has("EXT_color_buffer_half_float")||X.isWebGL2&&q.has("EXT_color_buffer_float"));if(c!==Mt&&ft.convert(c)!==yt.getParameter(35738)&&(c!==Rt||!(X.isWebGL2||q.has("OES_texture_float")||q.has("WEBGL_color_buffer_float")))&&!l)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");36053===yt.checkFramebufferStatus(36160)?e>=0&&e<=t.width-r&&n>=0&&n<=t.height-i&&yt.readPixels(e,n,r,i,ft.convert(a),ft.convert(c),s):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{const t=null!==M?Z.get(M).__webglFramebuffer:null;Y.bindFramebuffer(36160,t)}}},this.copyFramebufferToTexture=function(t,e,n=0){const r=Math.pow(2,-n),i=Math.floor(e.image.width*r),s=Math.floor(e.image.height*r);let o=ft.convert(e.format);X.isWebGL2&&(6407===o&&(o=32849),6408===o&&(o=32856)),K.setTexture2D(e,0),yt.copyTexImage2D(3553,n,o,t.x,t.y,i,s,0),Y.unbindTexture()},this.copyTextureToTexture=function(t,e,n,r=0){const i=e.image.width,s=e.image.height,o=ft.convert(n.format),a=ft.convert(n.type);K.setTexture2D(n,0),yt.pixelStorei(37440,n.flipY),yt.pixelStorei(37441,n.premultiplyAlpha),yt.pixelStorei(3317,n.unpackAlignment),e.isDataTexture?yt.texSubImage2D(3553,r,t.x,t.y,i,s,o,a,e.image.data):e.isCompressedTexture?yt.compressedTexSubImage2D(3553,r,t.x,t.y,e.mipmaps[0].width,e.mipmaps[0].height,o,e.mipmaps[0].data):yt.texSubImage2D(3553,r,t.x,t.y,o,a,e.image),0===r&&n.generateMipmaps&&yt.generateMipmap(3553),Y.unbindTexture()},this.copyTextureToTexture3D=function(t,e,n,r,i=0){if(g.isWebGL1Renderer)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");const s=t.max.x-t.min.x+1,o=t.max.y-t.min.y+1,a=t.max.z-t.min.z+1,c=ft.convert(r.format),l=ft.convert(r.type);let u;if(r.isDataTexture3D)K.setTexture3D(r,0),u=32879;else{if(!r.isDataTexture2DArray)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");K.setTexture2DArray(r,0),u=35866}yt.pixelStorei(37440,r.flipY),yt.pixelStorei(37441,r.premultiplyAlpha),yt.pixelStorei(3317,r.unpackAlignment);const h=yt.getParameter(3314),d=yt.getParameter(32878),p=yt.getParameter(3316),f=yt.getParameter(3315),m=yt.getParameter(32877),v=n.isCompressedTexture?n.mipmaps[0]:n.image;yt.pixelStorei(3314,v.width),yt.pixelStorei(32878,v.height),yt.pixelStorei(3316,t.min.x),yt.pixelStorei(3315,t.min.y),yt.pixelStorei(32877,t.min.z),n.isDataTexture||n.isDataTexture3D?yt.texSubImage3D(u,i,e.x,e.y,e.z,s,o,a,c,l,v.data):n.isCompressedTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),yt.compressedTexSubImage3D(u,i,e.x,e.y,e.z,s,o,a,c,v.data)):yt.texSubImage3D(u,i,e.x,e.y,e.z,s,o,a,c,l,v),yt.pixelStorei(3314,h),yt.pixelStorei(32878,d),yt.pixelStorei(3316,p),yt.pixelStorei(3315,f),yt.pixelStorei(32877,m),0===i&&r.generateMipmaps&&yt.generateMipmap(u),Y.unbindTexture()},this.initTexture=function(t){K.setTexture2D(t,0),Y.unbindTexture()},this.resetState=function(){w=0,_=0,M=null,Y.reset(),gt.reset()},"undefined"!==typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}ah.prototype.isWebGLRenderer=!0;class ch extends ah{}ch.prototype.isWebGL1Renderer=!0;class lh{constructor(t,e=25e-5){this.name="",this.color=new Mi(t),this.density=e}clone(){return new lh(this.color,this.density)}toJSON(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}}lh.prototype.isFogExp2=!0;class uh{constructor(t,e=1,n=1e3){this.name="",this.color=new Mi(t),this.near=e,this.far=n}clone(){return new uh(this.color,this.near,this.far)}toJSON(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}uh.prototype.isFog=!0;class hh extends ri{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}}hh.prototype.isScene=!0;class dh{constructor(t,e){this.array=t,this.stride=e,this.count=void 0!==t?t.length/e:0,this.usage=ln,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=vn()}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 r=0,i=this.stride;r<i;r++)this.array[t+r]=e.array[n+r];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=vn()),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=vn()),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}}}dh.prototype.isInterleavedBuffer=!0;const ph=new er;class fh{constructor(t,e,n,r=!1){this.name="",this.data=t,this.itemSize=e,this.offset=n,this.normalized=!0===r}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++)ph.x=this.getX(e),ph.y=this.getY(e),ph.z=this.getZ(e),ph.applyMatrix4(t),this.setXYZ(e,ph.x,ph.y,ph.z);return this}applyNormalMatrix(t){for(let e=0,n=this.count;e<n;e++)ph.x=this.getX(e),ph.y=this.getY(e),ph.z=this.getZ(e),ph.applyNormalMatrix(t),this.setXYZ(e,ph.x,ph.y,ph.z);return this}transformDirection(t){for(let e=0,n=this.count;e<n;e++)ph.x=this.getX(e),ph.y=this.getY(e),ph.z=this.getZ(e),ph.transformDirection(t),this.setXYZ(e,ph.x,ph.y,ph.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,r){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=n,this.data.array[t+2]=r,this}setXYZW(t,e,n,r,i){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=n,this.data.array[t+2]=r,this.data.array[t+3]=i,this}clone(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 Ai(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 fh(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}}}fh.prototype.isInterleavedBufferAttribute=!0;class mh extends gi{constructor(t){super(),this.type="SpriteMaterial",this.color=new Mi(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 gh;mh.prototype.isSpriteMaterial=!0;const vh=new er,yh=new er,xh=new er,bh=new Fn,wh=new Fn,_h=new Ir,Mh=new er,Sh=new er,Th=new er,Eh=new Fn,Ah=new Fn,Lh=new Fn;class Rh extends ri{constructor(t){if(super(),this.type="Sprite",void 0===gh){gh=new Ui;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 dh(t,5);gh.setIndex([0,1,2,0,2,3]),gh.setAttribute("position",new fh(e,3,0,!1)),gh.setAttribute("uv",new fh(e,2,3,!1))}this.geometry=gh,this.material=void 0!==t?t:new mh,this.center=new Fn(.5,.5)}raycast(t,e){null===t.camera&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),yh.setFromMatrixScale(this.matrixWorld),_h.copy(t.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(t.camera.matrixWorldInverse,this.matrixWorld),xh.setFromMatrixPosition(this.modelViewMatrix),t.camera.isPerspectiveCamera&&!1===this.material.sizeAttenuation&&yh.multiplyScalar(-xh.z);const n=this.material.rotation;let r,i;0!==n&&(i=Math.cos(n),r=Math.sin(n));const s=this.center;Ch(Mh.set(-.5,-.5,0),xh,s,yh,r,i),Ch(Sh.set(.5,-.5,0),xh,s,yh,r,i),Ch(Th.set(.5,.5,0),xh,s,yh,r,i),Eh.set(0,0),Ah.set(1,0),Lh.set(1,1);let o=t.ray.intersectTriangle(Mh,Sh,Th,!1,vh);if(null===o&&(Ch(Sh.set(-.5,.5,0),xh,s,yh,r,i),Ah.set(0,1),o=t.ray.intersectTriangle(Mh,Th,Sh,!1,vh),null===o))return;const a=t.ray.origin.distanceTo(vh);a<t.near||a>t.far||e.push({distance:a,point:vh.clone(),uv:fi.getUV(vh,Mh,Sh,Th,Eh,Ah,Lh,new Fn),face:null,object:this})}copy(t){return super.copy(t),void 0!==t.center&&this.center.copy(t.center),this.material=t.material,this}}function Ch(t,e,n,r,i,s){bh.subVectors(t,n).addScalar(.5).multiply(r),void 0!==i?(wh.x=s*bh.x-i*bh.y,wh.y=i*bh.x+s*bh.y):wh.copy(bh),t.copy(e),t.x+=wh.x,t.y+=wh.y,t.applyMatrix4(_h)}Rh.prototype.isSprite=!0;const Ph=new er,Ih=new er;class Nh extends ri{constructor(){super(),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),this.autoUpdate=!0}copy(t){super.copy(t,!1);const e=t.levels;for(let n=0,r=e.length;n<r;n++){const t=e[n];this.addLevel(t.object.clone(),t.distance)}return this.autoUpdate=t.autoUpdate,this}addLevel(t,e=0){e=Math.abs(e);const n=this.levels;let r;for(r=0;r<n.length;r++)if(e<n[r].distance)break;return n.splice(r,0,{distance:e,object:t}),this.add(t),this}getCurrentLevel(){return this._currentLevel}getObjectForDistance(t){const e=this.levels;if(e.length>0){let n,r;for(n=1,r=e.length;n<r;n++)if(t<e[n].distance)break;return e[n-1].object}return null}raycast(t,e){const n=this.levels;if(n.length>0){Ph.setFromMatrixPosition(this.matrixWorld);const n=t.ray.origin.distanceTo(Ph);this.getObjectForDistance(n).raycast(t,e)}}update(t){const e=this.levels;if(e.length>1){Ph.setFromMatrixPosition(t.matrixWorld),Ih.setFromMatrixPosition(this.matrixWorld);const n=Ph.distanceTo(Ih)/t.zoom;let r,i;for(e[0].object.visible=!0,r=1,i=e.length;r<i;r++){if(!(n>=e[r].distance))break;e[r-1].object.visible=!1,e[r].object.visible=!0}for(this._currentLevel=r-1;r<i;r++)e[r].object.visible=!1}}toJSON(t){const e=super.toJSON(t);!1===this.autoUpdate&&(e.object.autoUpdate=!1),e.object.levels=[];const n=this.levels;for(let r=0,i=n.length;r<i;r++){const t=n[r];e.object.levels.push({object:t.object.uuid,distance:t.distance})}return e}}const Oh=new er,Dh=new Zn,kh=new Zn,zh=new er,Fh=new Ir;class Uh extends rs{constructor(t,e){super(t,e),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new Ir,this.bindMatrixInverse=new Ir}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 Zn,e=this.geometry.attributes.skinWeight;for(let n=0,r=e.count;n<r;n++){t.x=e.getX(n),t.y=e.getY(n),t.z=e.getZ(n),t.w=e.getW(n);const r=1/t.manhattanLength();r!==1/0?t.multiplyScalar(r):t.set(1,0,0,0),e.setXYZW(n,t.x,t.y,t.z,t.w)}}updateMatrixWorld(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,r=this.geometry;Dh.fromBufferAttribute(r.attributes.skinIndex,t),kh.fromBufferAttribute(r.attributes.skinWeight,t),Oh.copy(e).applyMatrix4(this.bindMatrix),e.set(0,0,0);for(let i=0;i<4;i++){const t=kh.getComponent(i);if(0!==t){const r=Dh.getComponent(i);Fh.multiplyMatrices(n.bones[r].matrixWorld,n.boneInverses[r]),e.addScaledVector(zh.copy(Oh).applyMatrix4(Fh),t)}}return e.applyMatrix4(this.bindMatrixInverse)}}Uh.prototype.isSkinnedMesh=!0;class Bh extends ri{constructor(){super(),this.type="Bone"}}Bh.prototype.isBone=!0;class Hh extends Yn{constructor(t=null,e=1,n=1,r,i,s,o,a,c=vt,l=vt,u,h){super(null,s,o,a,c,l,r,i,u,h),this.image={data:t,width:e,height:n},this.magFilter=c,this.minFilter=l,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.needsUpdate=!0}}Hh.prototype.isDataTexture=!0;const Gh=new Ir,Vh=new Ir;class Wh{constructor(t=[],e=[]){this.uuid=vn(),this.bones=t.slice(0),this.boneInverses=e,this.boneMatrices=null,this.boneTexture=null,this.boneTextureSize=0,this.frame=-1,this.init()}init(){const t=this.bones,e=this.boneInverses;if(this.boneMatrices=new Float32Array(16*t.length),0===e.length)this.calculateInverses();else if(t.length!==e.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let t=0,e=this.bones.length;t<e;t++)this.boneInverses.push(new Ir)}}calculateInverses(){this.boneInverses.length=0;for(let t=0,e=this.bones.length;t<e;t++){const e=new Ir;this.bones[t]&&e.copy(this.bones[t].matrixWorld).invert(),this.boneInverses.push(e)}}pose(){for(let t=0,e=this.bones.length;t<e;t++){const e=this.bones[t];e&&e.matrixWorld.copy(this.boneInverses[t]).invert()}for(let t=0,e=this.bones.length;t<e;t++){const e=this.bones[t];e&&(e.parent&&e.parent.isBone?(e.matrix.copy(e.parent.matrixWorld).invert(),e.matrix.multiply(e.matrixWorld)):e.matrix.copy(e.matrixWorld),e.matrix.decompose(e.position,e.quaternion,e.scale))}}update(){const t=this.bones,e=this.boneInverses,n=this.boneMatrices,r=this.boneTexture;for(let i=0,s=t.length;i<s;i++){const r=t[i]?t[i].matrixWorld:Vh;Gh.multiplyMatrices(r,e[i]),Gh.toArray(n,16*i)}null!==r&&(r.needsUpdate=!0)}clone(){return new Wh(this.bones,this.boneInverses)}computeBoneTexture(){let t=Math.sqrt(4*this.bones.length);t=On(t),t=Math.max(t,4);const e=new Float32Array(t*t*4);e.set(this.boneMatrices);const n=new Hh(e,t,t,zt,Rt);return this.boneMatrices=e,this.boneTexture=n,this.boneTextureSize=t,this}getBoneByName(t){for(let e=0,n=this.bones.length;e<n;e++){const n=this.bones[e];if(n.name===t)return n}}dispose(){null!==this.boneTexture&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(t,e){this.uuid=t.uuid;for(let n=0,r=t.bones.length;n<r;n++){const r=t.bones[n];let i=e[r];void 0===i&&(console.warn("THREE.Skeleton: No bone found with UUID:",r),i=new Bh),this.bones.push(i),this.boneInverses.push((new Ir).fromArray(t.boneInverses[n]))}return this.init(),this}toJSON(){const t={metadata:{version:4.5,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};t.uuid=this.uuid;const e=this.bones,n=this.boneInverses;for(let r=0,i=e.length;r<i;r++){const i=e[r];t.bones.push(i.uuid);const s=n[r];t.boneInverses.push(s.toArray())}return t}}class jh extends Ai{constructor(t,e,n,r=1){"number"===typeof n&&(r=n,n=!1,console.error("THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument.")),super(t,e,n),this.meshPerAttribute=r}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}}jh.prototype.isInstancedBufferAttribute=!0;const qh=new Ir,Xh=new Ir,Yh=[],Jh=new rs;class Zh extends rs{constructor(t,e,n){super(t,e),this.instanceMatrix=new jh(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,r=this.count;if(Jh.geometry=this.geometry,Jh.material=this.material,void 0!==Jh.material)for(let i=0;i<r;i++){this.getMatrixAt(i,qh),Xh.multiplyMatrices(n,qh),Jh.matrixWorld=Xh,Jh.raycast(t,Yh);for(let t=0,n=Yh.length;t<n;t++){const n=Yh[t];n.instanceId=i,n.object=this,e.push(n)}Yh.length=0}}setColorAt(t,e){null===this.instanceColor&&(this.instanceColor=new jh(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"})}}Zh.prototype.isInstancedMesh=!0;class Kh extends gi{constructor(t){super(),this.type="LineBasicMaterial",this.color=new Mi(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}}Kh.prototype.isLineBasicMaterial=!0;const $h=new er,Qh=new er,td=new Ir,ed=new Pr,nd=new Mr;class rd extends ri{constructor(t=new Ui,e=new Kh){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,r=e.count;t<r;t++)$h.fromBufferAttribute(e,t-1),Qh.fromBufferAttribute(e,t),n[t]=n[t-1],n[t]+=$h.distanceTo(Qh);t.setAttribute("lineDistance",new Pi(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,r=this.matrixWorld,i=t.params.Line.threshold,s=n.drawRange;if(null===n.boundingSphere&&n.computeBoundingSphere(),nd.copy(n.boundingSphere),nd.applyMatrix4(r),nd.radius+=i,!1===t.ray.intersectsSphere(nd))return;td.copy(r).invert(),ed.copy(t.ray).applyMatrix4(td);const o=i/((this.scale.x+this.scale.y+this.scale.z)/3),a=o*o,c=new er,l=new er,u=new er,h=new er,d=this.isLineSegments?2:1;if(n.isBufferGeometry){const r=n.index,i=n.attributes,o=i.position;if(null!==r){const n=Math.max(0,s.start),i=Math.min(r.count,s.start+s.count);for(let s=n,p=i-1;s<p;s+=d){const n=r.getX(s),i=r.getX(s+1);c.fromBufferAttribute(o,n),l.fromBufferAttribute(o,i);const d=ed.distanceSqToSegment(c,l,h,u);if(d>a)continue;h.applyMatrix4(this.matrixWorld);const p=t.ray.origin.distanceTo(h);p<t.near||p>t.far||e.push({distance:p,point:u.clone().applyMatrix4(this.matrixWorld),index:s,face:null,faceIndex:null,object:this})}}else{const n=Math.max(0,s.start),r=Math.min(o.count,s.start+s.count);for(let i=n,s=r-1;i<s;i+=d){c.fromBufferAttribute(o,i),l.fromBufferAttribute(o,i+1);const n=ed.distanceSqToSegment(c,l,h,u);if(n>a)continue;h.applyMatrix4(this.matrixWorld);const r=t.ray.origin.distanceTo(h);r<t.near||r>t.far||e.push({distance:r,point:u.clone().applyMatrix4(this.matrixWorld),index:i,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.")}}}rd.prototype.isLine=!0;const id=new er,sd=new er;class od extends rd{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,r=e.count;t<r;t+=2)id.fromBufferAttribute(e,t),sd.fromBufferAttribute(e,t+1),n[t]=0===t?0:n[t-1],n[t+1]=n[t]+id.distanceTo(sd);t.setAttribute("lineDistance",new Pi(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}}od.prototype.isLineSegments=!0;class ad extends rd{constructor(t,e){super(t,e),this.type="LineLoop"}}ad.prototype.isLineLoop=!0;class cd extends gi{constructor(t){super(),this.type="PointsMaterial",this.color=new Mi(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}}cd.prototype.isPointsMaterial=!0;const ld=new Ir,ud=new Pr,hd=new Mr,dd=new er;class pd extends ri{constructor(t=new Ui,e=new cd){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,r=this.matrixWorld,i=t.params.Points.threshold,s=n.drawRange;if(null===n.boundingSphere&&n.computeBoundingSphere(),hd.copy(n.boundingSphere),hd.applyMatrix4(r),hd.radius+=i,!1===t.ray.intersectsSphere(hd))return;ld.copy(r).invert(),ud.copy(t.ray).applyMatrix4(ld);const o=i/((this.scale.x+this.scale.y+this.scale.z)/3),a=o*o;if(n.isBufferGeometry){const i=n.index,o=n.attributes,c=o.position;if(null!==i){const n=Math.max(0,s.start),o=Math.min(i.count,s.start+s.count);for(let s=n,l=o;s<l;s++){const n=i.getX(s);dd.fromBufferAttribute(c,n),fd(dd,n,a,r,t,e,this)}}else{const n=Math.max(0,s.start),i=Math.min(c.count,s.start+s.count);for(let s=n,o=i;s<o;s++)dd.fromBufferAttribute(c,s),fd(dd,s,a,r,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.")}}}function fd(t,e,n,r,i,s,o){const a=ud.distanceSqToPoint(t);if(a<n){const n=new er;ud.closestPointToPoint(t,n),n.applyMatrix4(r);const c=i.ray.origin.distanceTo(n);if(c<i.near||c>i.far)return;s.push({distance:c,distanceToRay:Math.sqrt(a),point:n,index:e,face:null,object:o})}}pd.prototype.isPoints=!0;class md extends Yn{constructor(t,e,n,r,i,s,o,a,c){super(t,e,n,r,i,s,o,a,c),this.format=void 0!==o?o:kt,this.minFilter=void 0!==s?s:bt,this.magFilter=void 0!==i?i:bt,this.generateMipmaps=!1;const l=this;function u(){l.needsUpdate=!0,t.requestVideoFrameCallback(u)}"requestVideoFrameCallback"in t&&t.requestVideoFrameCallback(u)}clone(){return new this.constructor(this.image).copy(this)}update(){const t=this.image,e="requestVideoFrameCallback"in t;!1===e&&t.readyState>=t.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}md.prototype.isVideoTexture=!0;class gd extends Yn{constructor(t,e,n,r,i,s,o,a,c,l,u,h){super(null,s,o,a,c,l,r,i,u,h),this.image={width:e,height:n},this.mipmaps=t,this.flipY=!1,this.generateMipmaps=!1}}gd.prototype.isCompressedTexture=!0;class vd extends Yn{constructor(t,e,n,r,i,s,o,a,c){super(t,e,n,r,i,s,o,a,c),this.needsUpdate=!0}}vd.prototype.isCanvasTexture=!0;class yd extends Ui{constructor(t=1,e=8,n=0,r=2*Math.PI){super(),this.type="CircleGeometry",this.parameters={radius:t,segments:e,thetaStart:n,thetaLength:r},e=Math.max(3,e);const i=[],s=[],o=[],a=[],c=new er,l=new Fn;s.push(0,0,0),o.push(0,0,1),a.push(.5,.5);for(let u=0,h=3;u<=e;u++,h+=3){const i=n+u/e*r;c.x=t*Math.cos(i),c.y=t*Math.sin(i),s.push(c.x,c.y,c.z),o.push(0,0,1),l.x=(s[h]/t+1)/2,l.y=(s[h+1]/t+1)/2,a.push(l.x,l.y)}for(let u=1;u<=e;u++)i.push(u,u+1,0);this.setIndex(i),this.setAttribute("position",new Pi(s,3)),this.setAttribute("normal",new Pi(o,3)),this.setAttribute("uv",new Pi(a,2))}static fromJSON(t){return new yd(t.radius,t.segments,t.thetaStart,t.thetaLength)}}class xd extends Ui{constructor(t=1,e=1,n=1,r=8,i=1,s=!1,o=0,a=2*Math.PI){super(),this.type="CylinderGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:n,radialSegments:r,heightSegments:i,openEnded:s,thetaStart:o,thetaLength:a};const c=this;r=Math.floor(r),i=Math.floor(i);const l=[],u=[],h=[],d=[];let p=0;const f=[],m=n/2;let g=0;function v(){const s=new er,v=new er;let y=0;const x=(e-t)/n;for(let c=0;c<=i;c++){const l=[],g=c/i,y=g*(e-t)+t;for(let t=0;t<=r;t++){const e=t/r,i=e*a+o,c=Math.sin(i),f=Math.cos(i);v.x=y*c,v.y=-g*n+m,v.z=y*f,u.push(v.x,v.y,v.z),s.set(c,x,f).normalize(),h.push(s.x,s.y,s.z),d.push(e,1-g),l.push(p++)}f.push(l)}for(let t=0;t<r;t++)for(let e=0;e<i;e++){const n=f[e][t],r=f[e+1][t],i=f[e+1][t+1],s=f[e][t+1];l.push(n,r,s),l.push(r,i,s),y+=6}c.addGroup(g,y,0),g+=y}function y(n){const i=p,s=new Fn,f=new er;let v=0;const y=!0===n?t:e,x=!0===n?1:-1;for(let t=1;t<=r;t++)u.push(0,m*x,0),h.push(0,x,0),d.push(.5,.5),p++;const b=p;for(let t=0;t<=r;t++){const e=t/r,n=e*a+o,i=Math.cos(n),c=Math.sin(n);f.x=y*c,f.y=m*x,f.z=y*i,u.push(f.x,f.y,f.z),h.push(0,x,0),s.x=.5*i+.5,s.y=.5*c*x+.5,d.push(s.x,s.y),p++}for(let t=0;t<r;t++){const e=i+t,r=b+t;!0===n?l.push(r,r+1,e):l.push(r+1,r,e),v+=3}c.addGroup(g,v,!0===n?1:2),g+=v}v(),!1===s&&(t>0&&y(!0),e>0&&y(!1)),this.setIndex(l),this.setAttribute("position",new Pi(u,3)),this.setAttribute("normal",new Pi(h,3)),this.setAttribute("uv",new Pi(d,2))}static fromJSON(t){return new xd(t.radiusTop,t.radiusBottom,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}}class bd extends xd{constructor(t=1,e=1,n=8,r=1,i=!1,s=0,o=2*Math.PI){super(0,t,e,n,r,i,s,o),this.type="ConeGeometry",this.parameters={radius:t,height:e,radialSegments:n,heightSegments:r,openEnded:i,thetaStart:s,thetaLength:o}}static fromJSON(t){return new bd(t.radius,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}}class wd extends Ui{constructor(t=[],e=[],n=1,r=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:t,indices:e,radius:n,detail:r};const i=[],s=[];function o(t){const n=new er,r=new er,i=new er;for(let s=0;s<e.length;s+=3)d(e[s+0],n),d(e[s+1],r),d(e[s+2],i),a(n,r,i,t)}function a(t,e,n,r){const i=r+1,s=[];for(let o=0;o<=i;o++){s[o]=[];const r=t.clone().lerp(n,o/i),a=e.clone().lerp(n,o/i),c=i-o;for(let t=0;t<=c;t++)s[o][t]=0===t&&o===i?r:r.clone().lerp(a,t/c)}for(let o=0;o<i;o++)for(let t=0;t<2*(i-o)-1;t++){const e=Math.floor(t/2);t%2===0?(h(s[o][e+1]),h(s[o+1][e]),h(s[o][e])):(h(s[o][e+1]),h(s[o+1][e+1]),h(s[o+1][e]))}}function c(t){const e=new er;for(let n=0;n<i.length;n+=3)e.x=i[n+0],e.y=i[n+1],e.z=i[n+2],e.normalize().multiplyScalar(t),i[n+0]=e.x,i[n+1]=e.y,i[n+2]=e.z}function l(){const t=new er;for(let e=0;e<i.length;e+=3){t.x=i[e+0],t.y=i[e+1],t.z=i[e+2];const n=m(t)/2/Math.PI+.5,r=g(t)/Math.PI+.5;s.push(n,1-r)}p(),u()}function u(){for(let t=0;t<s.length;t+=6){const e=s[t+0],n=s[t+2],r=s[t+4],i=Math.max(e,n,r),o=Math.min(e,n,r);i>.9&&o<.1&&(e<.2&&(s[t+0]+=1),n<.2&&(s[t+2]+=1),r<.2&&(s[t+4]+=1))}}function h(t){i.push(t.x,t.y,t.z)}function d(e,n){const r=3*e;n.x=t[r+0],n.y=t[r+1],n.z=t[r+2]}function p(){const t=new er,e=new er,n=new er,r=new er,o=new Fn,a=new Fn,c=new Fn;for(let l=0,u=0;l<i.length;l+=9,u+=6){t.set(i[l+0],i[l+1],i[l+2]),e.set(i[l+3],i[l+4],i[l+5]),n.set(i[l+6],i[l+7],i[l+8]),o.set(s[u+0],s[u+1]),a.set(s[u+2],s[u+3]),c.set(s[u+4],s[u+5]),r.copy(t).add(e).add(n).divideScalar(3);const h=m(r);f(o,u+0,t,h),f(a,u+2,e,h),f(c,u+4,n,h)}}function f(t,e,n,r){r<0&&1===t.x&&(s[e]=t.x-1),0===n.x&&0===n.z&&(s[e]=r/2/Math.PI+.5)}function m(t){return Math.atan2(t.z,-t.x)}function g(t){return Math.atan2(-t.y,Math.sqrt(t.x*t.x+t.z*t.z))}o(r),c(n),l(),this.setAttribute("position",new Pi(i,3)),this.setAttribute("normal",new Pi(i.slice(),3)),this.setAttribute("uv",new Pi(s,2)),0===r?this.computeVertexNormals():this.normalizeNormals()}static fromJSON(t){return new wd(t.vertices,t.indices,t.radius,t.details)}}class _d extends wd{constructor(t=1,e=0){const n=(1+Math.sqrt(5))/2,r=1/n,i=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-r,-n,0,-r,n,0,r,-n,0,r,n,-r,-n,0,-r,n,0,r,-n,0,r,n,0,-n,0,-r,n,0,-r,-n,0,r,n,0,r],s=[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9];super(i,s,t,e),this.type="DodecahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new _d(t.radius,t.detail)}}const Md=new er,Sd=new er,Td=new er,Ed=new fi;class Ad extends Ui{constructor(t=null,e=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:t,thresholdAngle:e},null!==t){const n=4,r=Math.pow(10,n),i=Math.cos(mn*e),s=t.getIndex(),o=t.getAttribute("position"),a=s?s.count:o.count,c=[0,0,0],l=["a","b","c"],u=new Array(3),h={},d=[];for(let t=0;t<a;t+=3){s?(c[0]=s.getX(t),c[1]=s.getX(t+1),c[2]=s.getX(t+2)):(c[0]=t,c[1]=t+1,c[2]=t+2);const{a:e,b:n,c:a}=Ed;if(e.fromBufferAttribute(o,c[0]),n.fromBufferAttribute(o,c[1]),a.fromBufferAttribute(o,c[2]),Ed.getNormal(Td),u[0]=`${Math.round(e.x*r)},${Math.round(e.y*r)},${Math.round(e.z*r)}`,u[1]=`${Math.round(n.x*r)},${Math.round(n.y*r)},${Math.round(n.z*r)}`,u[2]=`${Math.round(a.x*r)},${Math.round(a.y*r)},${Math.round(a.z*r)}`,u[0]!==u[1]&&u[1]!==u[2]&&u[2]!==u[0])for(let t=0;t<3;t++){const e=(t+1)%3,n=u[t],r=u[e],s=Ed[l[t]],o=Ed[l[e]],a=`${n}_${r}`,p=`${r}_${n}`;p in h&&h[p]?(Td.dot(h[p].normal)<=i&&(d.push(s.x,s.y,s.z),d.push(o.x,o.y,o.z)),h[p]=null):a in h||(h[a]={index0:c[t],index1:c[e],normal:Td.clone()})}}for(const t in h)if(h[t]){const{index0:e,index1:n}=h[t];Md.fromBufferAttribute(o,e),Sd.fromBufferAttribute(o,n),d.push(Md.x,Md.y,Md.z),d.push(Sd.x,Sd.y,Sd.z)}this.setAttribute("position",new Pi(d,3))}}}class Ld{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,r=this.getPoint(0),i=0;e.push(0);for(let s=1;s<=t;s++)n=this.getPoint(s/t),i+=n.distanceTo(r),e.push(i),r=n;return this.cacheArcLengths=e,e}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(t,e){const n=this.getLengths();let r=0;const i=n.length;let s;s=e||t*n[i-1];let o,a=0,c=i-1;while(a<=c)if(r=Math.floor(a+(c-a)/2),o=n[r]-s,o<0)a=r+1;else{if(!(o>0)){c=r;break}c=r-1}if(r=c,n[r]===s)return r/(i-1);const l=n[r],u=n[r+1],h=u-l,d=(s-l)/h,p=(r+d)/(i-1);return p}getTangent(t,e){const n=1e-4;let r=t-n,i=t+n;r<0&&(r=0),i>1&&(i=1);const s=this.getPoint(r),o=this.getPoint(i),a=e||(s.isVector2?new Fn:new er);return a.copy(o).sub(s).normalize(),a}getTangentAt(t,e){const n=this.getUtoTmapping(t);return this.getTangent(n,e)}computeFrenetFrames(t,e){const n=new er,r=[],i=[],s=[],o=new er,a=new Ir;for(let d=0;d<=t;d++){const e=d/t;r[d]=this.getTangentAt(e,new er)}i[0]=new er,s[0]=new er;let c=Number.MAX_VALUE;const l=Math.abs(r[0].x),u=Math.abs(r[0].y),h=Math.abs(r[0].z);l<=c&&(c=l,n.set(1,0,0)),u<=c&&(c=u,n.set(0,1,0)),h<=c&&n.set(0,0,1),o.crossVectors(r[0],n).normalize(),i[0].crossVectors(r[0],o),s[0].crossVectors(r[0],i[0]);for(let d=1;d<=t;d++){if(i[d]=i[d-1].clone(),s[d]=s[d-1].clone(),o.crossVectors(r[d-1],r[d]),o.length()>Number.EPSILON){o.normalize();const t=Math.acos(yn(r[d-1].dot(r[d]),-1,1));i[d].applyMatrix4(a.makeRotationAxis(o,t))}s[d].crossVectors(r[d],i[d])}if(!0===e){let e=Math.acos(yn(i[0].dot(i[t]),-1,1));e/=t,r[0].dot(o.crossVectors(i[0],i[t]))>0&&(e=-e);for(let n=1;n<=t;n++)i[n].applyMatrix4(a.makeRotationAxis(r[n],e*n)),s[n].crossVectors(r[n],i[n])}return{tangents:r,normals:i,binormals:s}}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 Rd extends Ld{constructor(t=0,e=0,n=1,r=1,i=0,s=2*Math.PI,o=!1,a=0){super(),this.type="EllipseCurve",this.aX=t,this.aY=e,this.xRadius=n,this.yRadius=r,this.aStartAngle=i,this.aEndAngle=s,this.aClockwise=o,this.aRotation=a}getPoint(t,e){const n=e||new Fn,r=2*Math.PI;let i=this.aEndAngle-this.aStartAngle;const s=Math.abs(i)<Number.EPSILON;while(i<0)i+=r;while(i>r)i-=r;i<Number.EPSILON&&(i=s?0:r),!0!==this.aClockwise||s||(i===r?i=-r:i-=r);const o=this.aStartAngle+t*i;let a=this.aX+this.xRadius*Math.cos(o),c=this.aY+this.yRadius*Math.sin(o);if(0!==this.aRotation){const t=Math.cos(this.aRotation),e=Math.sin(this.aRotation),n=a-this.aX,r=c-this.aY;a=n*t-r*e+this.aX,c=n*e+r*t+this.aY}return n.set(a,c)}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}}Rd.prototype.isEllipseCurve=!0;class Cd extends Rd{constructor(t,e,n,r,i,s){super(t,e,n,n,r,i,s),this.type="ArcCurve"}}function Pd(){let t=0,e=0,n=0,r=0;function i(i,s,o,a){t=i,e=o,n=-3*i+3*s-2*o-a,r=2*i-2*s+o+a}return{initCatmullRom:function(t,e,n,r,s){i(e,n,s*(n-t),s*(r-e))},initNonuniformCatmullRom:function(t,e,n,r,s,o,a){let c=(e-t)/s-(n-t)/(s+o)+(n-e)/o,l=(n-e)/o-(r-e)/(o+a)+(r-n)/a;c*=o,l*=o,i(e,n,c,l)},calc:function(i){const s=i*i,o=s*i;return t+e*i+n*s+r*o}}}Cd.prototype.isArcCurve=!0;const Id=new er,Nd=new Pd,Od=new Pd,Dd=new Pd;class kd extends Ld{constructor(t=[],e=!1,n="centripetal",r=.5){super(),this.type="CatmullRomCurve3",this.points=t,this.closed=e,this.curveType=n,this.tension=r}getPoint(t,e=new er){const n=e,r=this.points,i=r.length,s=(i-(this.closed?0:1))*t;let o,a,c=Math.floor(s),l=s-c;this.closed?c+=c>0?0:(Math.floor(Math.abs(c)/i)+1)*i:0===l&&c===i-1&&(c=i-2,l=1),this.closed||c>0?o=r[(c-1)%i]:(Id.subVectors(r[0],r[1]).add(r[0]),o=Id);const u=r[c%i],h=r[(c+1)%i];if(this.closed||c+2<i?a=r[(c+2)%i]:(Id.subVectors(r[i-1],r[i-2]).add(r[i-1]),a=Id),"centripetal"===this.curveType||"chordal"===this.curveType){const t="chordal"===this.curveType?.5:.25;let e=Math.pow(o.distanceToSquared(u),t),n=Math.pow(u.distanceToSquared(h),t),r=Math.pow(h.distanceToSquared(a),t);n<1e-4&&(n=1),e<1e-4&&(e=n),r<1e-4&&(r=n),Nd.initNonuniformCatmullRom(o.x,u.x,h.x,a.x,e,n,r),Od.initNonuniformCatmullRom(o.y,u.y,h.y,a.y,e,n,r),Dd.initNonuniformCatmullRom(o.z,u.z,h.z,a.z,e,n,r)}else"catmullrom"===this.curveType&&(Nd.initCatmullRom(o.x,u.x,h.x,a.x,this.tension),Od.initCatmullRom(o.y,u.y,h.y,a.y,this.tension),Dd.initCatmullRom(o.z,u.z,h.z,a.z,this.tension));return n.set(Nd.calc(l),Od.calc(l),Dd.calc(l)),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 er).fromArray(n))}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}}function zd(t,e,n,r,i){const s=.5*(r-e),o=.5*(i-n),a=t*t,c=t*a;return(2*n-2*r+s+o)*c+(-3*n+3*r-2*s-o)*a+s*t+n}function Fd(t,e){const n=1-t;return n*n*e}function Ud(t,e){return 2*(1-t)*t*e}function Bd(t,e){return t*t*e}function Hd(t,e,n,r){return Fd(t,e)+Ud(t,n)+Bd(t,r)}function Gd(t,e){const n=1-t;return n*n*n*e}function Vd(t,e){const n=1-t;return 3*n*n*t*e}function Wd(t,e){return 3*(1-t)*t*t*e}function jd(t,e){return t*t*t*e}function qd(t,e,n,r,i){return Gd(t,e)+Vd(t,n)+Wd(t,r)+jd(t,i)}kd.prototype.isCatmullRomCurve3=!0;class Xd extends Ld{constructor(t=new Fn,e=new Fn,n=new Fn,r=new Fn){super(),this.type="CubicBezierCurve",this.v0=t,this.v1=e,this.v2=n,this.v3=r}getPoint(t,e=new Fn){const n=e,r=this.v0,i=this.v1,s=this.v2,o=this.v3;return n.set(qd(t,r.x,i.x,s.x,o.x),qd(t,r.y,i.y,s.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.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}}Xd.prototype.isCubicBezierCurve=!0;class Yd extends Ld{constructor(t=new er,e=new er,n=new er,r=new er){super(),this.type="CubicBezierCurve3",this.v0=t,this.v1=e,this.v2=n,this.v3=r}getPoint(t,e=new er){const n=e,r=this.v0,i=this.v1,s=this.v2,o=this.v3;return n.set(qd(t,r.x,i.x,s.x,o.x),qd(t,r.y,i.y,s.y,o.y),qd(t,r.z,i.z,s.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.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}}Yd.prototype.isCubicBezierCurve3=!0;class Jd extends Ld{constructor(t=new Fn,e=new Fn){super(),this.type="LineCurve",this.v1=t,this.v2=e}getPoint(t,e=new Fn){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 Fn;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}}Jd.prototype.isLineCurve=!0;class Zd extends Ld{constructor(t=new er,e=new er){super(),this.type="LineCurve3",this.isLineCurve3=!0,this.v1=t,this.v2=e}getPoint(t,e=new er){const n=e;return 1===t?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(t).add(this.v1)),n}getPointAt(t,e){return this.getPoint(t,e)}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}class Kd extends Ld{constructor(t=new Fn,e=new Fn,n=new Fn){super(),this.type="QuadraticBezierCurve",this.v0=t,this.v1=e,this.v2=n}getPoint(t,e=new Fn){const n=e,r=this.v0,i=this.v1,s=this.v2;return n.set(Hd(t,r.x,i.x,s.x),Hd(t,r.y,i.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}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 $d extends Ld{constructor(t=new er,e=new er,n=new er){super(),this.type="QuadraticBezierCurve3",this.v0=t,this.v1=e,this.v2=n}getPoint(t,e=new er){const n=e,r=this.v0,i=this.v1,s=this.v2;return n.set(Hd(t,r.x,i.x,s.x),Hd(t,r.y,i.y,s.y),Hd(t,r.z,i.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}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}}$d.prototype.isQuadraticBezierCurve3=!0;class Qd extends Ld{constructor(t=[]){super(),this.type="SplineCurve",this.points=t}getPoint(t,e=new Fn){const n=e,r=this.points,i=(r.length-1)*t,s=Math.floor(i),o=i-s,a=r[0===s?s:s-1],c=r[s],l=r[s>r.length-2?r.length-1:s+1],u=r[s>r.length-3?r.length-1:s+2];return n.set(zd(o,a.x,c.x,l.x,u.x),zd(o,a.y,c.y,l.y,u.y)),n}copy(t){super.copy(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){const n=t.points[e];this.points.push(n.clone())}return this}toJSON(){const t=super.toJSON();t.points=[];for(let e=0,n=this.points.length;e<n;e++){const n=this.points[e];t.points.push(n.toArray())}return t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){const n=t.points[e];this.points.push((new Fn).fromArray(n))}return this}}Qd.prototype.isSplineCurve=!0;var tp=Object.freeze({__proto__:null,ArcCurve:Cd,CatmullRomCurve3:kd,CubicBezierCurve:Xd,CubicBezierCurve3:Yd,EllipseCurve:Rd,LineCurve:Jd,LineCurve3:Zd,QuadraticBezierCurve:Kd,QuadraticBezierCurve3:$d,SplineCurve:Qd});class ep extends Ld{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 Jd(e,t))}getPoint(t,e){const n=t*this.getLength(),r=this.getCurveLengths();let i=0;while(i<r.length){if(r[i]>=n){const t=r[i]-n,s=this.curves[i],o=s.getLength(),a=0===o?0:1-t/o;return s.getPointAt(a,e)}i++}return null}getLength(){const t=this.getCurveLengths();return t[t.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const t=[];let e=0;for(let n=0,r=this.curves.length;n<r;n++)e+=this.curves[n].getLength(),t.push(e);return this.cacheLengths=t,t}getSpacedPoints(t=40){const e=[];for(let n=0;n<=t;n++)e.push(this.getPoint(n/t));return this.autoClose&&e.push(e[0]),e}getPoints(t=12){const e=[];let n;for(let r=0,i=this.curves;r<i.length;r++){const s=i[r],o=s&&s.isEllipseCurve?2*t:s&&(s.isLineCurve||s.isLineCurve3)?1:s&&s.isSplineCurve?t*s.points.length:t,a=s.getPoints(o);for(let t=0;t<a.length;t++){const r=a[t];n&&n.equals(r)||(e.push(r),n=r)}}return this.autoClose&&e.length>1&&!e[e.length-1].equals(e[0])&&e.push(e[0]),e}copy(t){super.copy(t),this.curves=[];for(let e=0,n=t.curves.length;e<n;e++){const n=t.curves[e];this.curves.push(n.clone())}return this.autoClose=t.autoClose,this}toJSON(){const t=super.toJSON();t.autoClose=this.autoClose,t.curves=[];for(let e=0,n=this.curves.length;e<n;e++){const n=this.curves[e];t.curves.push(n.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.autoClose=t.autoClose,this.curves=[];for(let e=0,n=t.curves.length;e<n;e++){const n=t.curves[e];this.curves.push((new tp[n.type]).fromJSON(n))}return this}}class np extends ep{constructor(t){super(),this.type="Path",this.currentPoint=new Fn,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 Jd(this.currentPoint.clone(),new Fn(t,e));return this.curves.push(n),this.currentPoint.set(t,e),this}quadraticCurveTo(t,e,n,r){const i=new Kd(this.currentPoint.clone(),new Fn(t,e),new Fn(n,r));return this.curves.push(i),this.currentPoint.set(n,r),this}bezierCurveTo(t,e,n,r,i,s){const o=new Xd(this.currentPoint.clone(),new Fn(t,e),new Fn(n,r),new Fn(i,s));return this.curves.push(o),this.currentPoint.set(i,s),this}splineThru(t){const e=[this.currentPoint.clone()].concat(t),n=new Qd(e);return this.curves.push(n),this.currentPoint.copy(t[t.length-1]),this}arc(t,e,n,r,i,s){const o=this.currentPoint.x,a=this.currentPoint.y;return this.absarc(t+o,e+a,n,r,i,s),this}absarc(t,e,n,r,i,s){return this.absellipse(t,e,n,n,r,i,s),this}ellipse(t,e,n,r,i,s,o,a){const c=this.currentPoint.x,l=this.currentPoint.y;return this.absellipse(t+c,e+l,n,r,i,s,o,a),this}absellipse(t,e,n,r,i,s,o,a){const c=new Rd(t,e,n,r,i,s,o,a);if(this.curves.length>0){const t=c.getPoint(0);t.equals(this.currentPoint)||this.lineTo(t.x,t.y)}this.curves.push(c);const l=c.getPoint(1);return this.currentPoint.copy(l),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 rp extends np{constructor(t){super(t),this.uuid=vn(),this.type="Shape",this.holes=[]}getPointsHoles(t){const e=[];for(let n=0,r=this.holes.length;n<r;n++)e[n]=this.holes[n].getPoints(t);return e}extractPoints(t){return{shape:this.getPoints(t),holes:this.getPointsHoles(t)}}copy(t){super.copy(t),this.holes=[];for(let e=0,n=t.holes.length;e<n;e++){const n=t.holes[e];this.holes.push(n.clone())}return this}toJSON(){const t=super.toJSON();t.uuid=this.uuid,t.holes=[];for(let e=0,n=this.holes.length;e<n;e++){const n=this.holes[e];t.holes.push(n.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.uuid=t.uuid,this.holes=[];for(let e=0,n=t.holes.length;e<n;e++){const n=t.holes[e];this.holes.push((new np).fromJSON(n))}return this}}const ip={triangulate:function(t,e,n=2){const r=e&&e.length,i=r?e[0]*n:t.length;let s=sp(t,0,i,n,!0);const o=[];if(!s||s.next===s.prev)return o;let a,c,l,u,h,d,p;if(r&&(s=dp(t,e,s,n)),t.length>80*n){a=l=t[0],c=u=t[1];for(let e=n;e<i;e+=n)h=t[e],d=t[e+1],h<a&&(a=h),d<c&&(c=d),h>l&&(l=h),d>u&&(u=d);p=Math.max(l-a,u-c),p=0!==p?1/p:0}return ap(s,o,n,a,c,p),o}};function sp(t,e,n,r,i){let s,o;if(i===Dp(t,e,n,r)>0)for(s=e;s<n;s+=r)o=Ip(s,t[s],t[s+1],o);else for(s=n-r;s>=e;s-=r)o=Ip(s,t[s],t[s+1],o);return o&&Sp(o,o.next)&&(Np(o),o=o.next),o}function op(t,e){if(!t)return t;e||(e=t);let n,r=t;do{if(n=!1,r.steiner||!Sp(r,r.next)&&0!==Mp(r.prev,r,r.next))r=r.next;else{if(Np(r),r=e=r.prev,r===r.next)break;n=!0}}while(n||r!==e);return e}function ap(t,e,n,r,i,s,o){if(!t)return;!o&&s&&vp(t,r,i,s);let a,c,l=t;while(t.prev!==t.next)if(a=t.prev,c=t.next,s?lp(t,r,i,s):cp(t))e.push(a.i/n),e.push(t.i/n),e.push(c.i/n),Np(t),t=c.next,l=c.next;else if(t=c,t===l){o?1===o?(t=up(op(t),e,n),ap(t,e,n,r,i,s,2)):2===o&&hp(t,e,n,r,i,s):ap(op(t),e,n,r,i,s,1);break}}function cp(t){const e=t.prev,n=t,r=t.next;if(Mp(e,n,r)>=0)return!1;let i=t.next.next;while(i!==t.prev){if(wp(e.x,e.y,n.x,n.y,r.x,r.y,i.x,i.y)&&Mp(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function lp(t,e,n,r){const i=t.prev,s=t,o=t.next;if(Mp(i,s,o)>=0)return!1;const a=i.x<s.x?i.x<o.x?i.x:o.x:s.x<o.x?s.x:o.x,c=i.y<s.y?i.y<o.y?i.y:o.y:s.y<o.y?s.y:o.y,l=i.x>s.x?i.x>o.x?i.x:o.x:s.x>o.x?s.x:o.x,u=i.y>s.y?i.y>o.y?i.y:o.y:s.y>o.y?s.y:o.y,h=xp(a,c,e,n,r),d=xp(l,u,e,n,r);let p=t.prevZ,f=t.nextZ;while(p&&p.z>=h&&f&&f.z<=d){if(p!==t.prev&&p!==t.next&&wp(i.x,i.y,s.x,s.y,o.x,o.y,p.x,p.y)&&Mp(p.prev,p,p.next)>=0)return!1;if(p=p.prevZ,f!==t.prev&&f!==t.next&&wp(i.x,i.y,s.x,s.y,o.x,o.y,f.x,f.y)&&Mp(f.prev,f,f.next)>=0)return!1;f=f.nextZ}while(p&&p.z>=h){if(p!==t.prev&&p!==t.next&&wp(i.x,i.y,s.x,s.y,o.x,o.y,p.x,p.y)&&Mp(p.prev,p,p.next)>=0)return!1;p=p.prevZ}while(f&&f.z<=d){if(f!==t.prev&&f!==t.next&&wp(i.x,i.y,s.x,s.y,o.x,o.y,f.x,f.y)&&Mp(f.prev,f,f.next)>=0)return!1;f=f.nextZ}return!0}function up(t,e,n){let r=t;do{const i=r.prev,s=r.next.next;!Sp(i,s)&&Tp(i,r,r.next,s)&&Rp(i,s)&&Rp(s,i)&&(e.push(i.i/n),e.push(r.i/n),e.push(s.i/n),Np(r),Np(r.next),r=t=s),r=r.next}while(r!==t);return op(r)}function hp(t,e,n,r,i,s){let o=t;do{let t=o.next.next;while(t!==o.prev){if(o.i!==t.i&&_p(o,t)){let a=Pp(o,t);return o=op(o,o.next),a=op(a,a.next),ap(o,e,n,r,i,s),void ap(a,e,n,r,i,s)}t=t.next}o=o.next}while(o!==t)}function dp(t,e,n,r){const i=[];let s,o,a,c,l;for(s=0,o=e.length;s<o;s++)a=e[s]*r,c=s<o-1?e[s+1]*r:t.length,l=sp(t,a,c,r,!1),l===l.next&&(l.steiner=!0),i.push(bp(l));for(i.sort(pp),s=0;s<i.length;s++)fp(i[s],n),n=op(n,n.next);return n}function pp(t,e){return t.x-e.x}function fp(t,e){if(e=mp(t,e),e){const n=Pp(e,t);op(e,e.next),op(n,n.next)}}function mp(t,e){let n=e;const r=t.x,i=t.y;let s,o=-1/0;do{if(i<=n.y&&i>=n.next.y&&n.next.y!==n.y){const t=n.x+(i-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(t<=r&&t>o){if(o=t,t===r){if(i===n.y)return n;if(i===n.next.y)return n.next}s=n.x<n.next.x?n:n.next}}n=n.next}while(n!==e);if(!s)return null;if(r===o)return s;const a=s,c=s.x,l=s.y;let u,h=1/0;n=s;do{r>=n.x&&n.x>=c&&r!==n.x&&wp(i<l?r:o,i,c,l,i<l?o:r,i,n.x,n.y)&&(u=Math.abs(i-n.y)/(r-n.x),Rp(n,t)&&(u<h||u===h&&(n.x>s.x||n.x===s.x&&gp(s,n)))&&(s=n,h=u)),n=n.next}while(n!==a);return s}function gp(t,e){return Mp(t.prev,t,e.prev)<0&&Mp(e.next,t,t.next)<0}function vp(t,e,n,r){let i=t;do{null===i.z&&(i.z=xp(i.x,i.y,e,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,yp(i)}function yp(t){let e,n,r,i,s,o,a,c,l=1;do{n=t,t=null,s=null,o=0;while(n){for(o++,r=n,a=0,e=0;e<l;e++)if(a++,r=r.nextZ,!r)break;c=l;while(a>0||c>0&&r)0!==a&&(0===c||!r||n.z<=r.z)?(i=n,n=n.nextZ,a--):(i=r,r=r.nextZ,c--),s?s.nextZ=i:t=i,i.prevZ=s,s=i;n=r}s.nextZ=null,l*=2}while(o>1);return t}function xp(t,e,n,r,i){return t=32767*(t-n)*i,e=32767*(e-r)*i,t=16711935&(t|t<<8),t=252645135&(t|t<<4),t=858993459&(t|t<<2),t=1431655765&(t|t<<1),e=16711935&(e|e<<8),e=252645135&(e|e<<4),e=858993459&(e|e<<2),e=1431655765&(e|e<<1),t|e<<1}function bp(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 wp(t,e,n,r,i,s,o,a){return(i-o)*(e-a)-(t-o)*(s-a)>=0&&(t-o)*(r-a)-(n-o)*(e-a)>=0&&(n-o)*(s-a)-(i-o)*(r-a)>=0}function _p(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!Lp(t,e)&&(Rp(t,e)&&Rp(e,t)&&Cp(t,e)&&(Mp(t.prev,t,e.prev)||Mp(t,e.prev,e))||Sp(t,e)&&Mp(t.prev,t,t.next)>0&&Mp(e.prev,e,e.next)>0)}function Mp(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function Sp(t,e){return t.x===e.x&&t.y===e.y}function Tp(t,e,n,r){const i=Ap(Mp(t,e,n)),s=Ap(Mp(t,e,r)),o=Ap(Mp(n,r,t)),a=Ap(Mp(n,r,e));return i!==s&&o!==a||(!(0!==i||!Ep(t,n,e))||(!(0!==s||!Ep(t,r,e))||(!(0!==o||!Ep(n,t,r))||!(0!==a||!Ep(n,e,r)))))}function Ep(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 Ap(t){return t>0?1:t<0?-1:0}function Lp(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&&Tp(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}function Rp(t,e){return Mp(t.prev,t,t.next)<0?Mp(t,e,t.next)>=0&&Mp(t,t.prev,e)>=0:Mp(t,e,t.prev)<0||Mp(t,t.next,e)<0}function Cp(t,e){let n=t,r=!1;const i=(t.x+e.x)/2,s=(t.y+e.y)/2;do{n.y>s!==n.next.y>s&&n.next.y!==n.y&&i<(n.next.x-n.x)*(s-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next}while(n!==t);return r}function Pp(t,e){const n=new Op(t.i,t.x,t.y),r=new Op(e.i,e.x,e.y),i=t.next,s=e.prev;return t.next=e,e.prev=t,n.next=i,i.prev=n,r.next=n,n.prev=r,s.next=r,r.prev=s,r}function Ip(t,e,n,r){const i=new Op(t,e,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function Np(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 Op(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}function Dp(t,e,n,r){let i=0;for(let s=e,o=n-r;s<n;s+=r)i+=(t[o]-t[s])*(t[s+1]+t[o+1]),o=s;return i}class kp{static area(t){const e=t.length;let n=0;for(let r=e-1,i=0;i<e;r=i++)n+=t[r].x*t[i].y-t[i].x*t[r].y;return.5*n}static isClockWise(t){return kp.area(t)<0}static triangulateShape(t,e){const n=[],r=[],i=[];zp(t),Fp(n,t);let s=t.length;e.forEach(zp);for(let a=0;a<e.length;a++)r.push(s),s+=e[a].length,Fp(n,e[a]);const o=ip.triangulate(n,r);for(let a=0;a<o.length;a+=3)i.push(o.slice(a,a+3));return i}}function zp(t){const e=t.length;e>2&&t[e-1].equals(t[0])&&t.pop()}function Fp(t,e){for(let n=0;n<e.length;n++)t.push(e[n].x),t.push(e[n].y)}class Up extends Ui{constructor(t=new rp([new Fn(.5,.5),new Fn(-.5,.5),new Fn(-.5,-.5),new Fn(.5,-.5)]),e={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:t,options:e},t=Array.isArray(t)?t:[t];const n=this,r=[],i=[];for(let o=0,a=t.length;o<a;o++){const e=t[o];s(e)}function s(t){const s=[],o=void 0!==e.curveSegments?e.curveSegments:12,a=void 0!==e.steps?e.steps:1;let c=void 0!==e.depth?e.depth:1,l=void 0===e.bevelEnabled||e.bevelEnabled,u=void 0!==e.bevelThickness?e.bevelThickness:.2,h=void 0!==e.bevelSize?e.bevelSize:u-.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:Bp;void 0!==e.amount&&(console.warn("THREE.ExtrudeBufferGeometry: amount has been renamed to depth."),c=e.amount);let g,v,y,x,b,w=!1;f&&(g=f.getSpacedPoints(a),w=!0,l=!1,v=f.computeFrenetFrames(a,!1),y=new er,x=new er,b=new er),l||(p=0,u=0,h=0,d=0);const _=t.extractPoints(o);let M=_.shape;const S=_.holes,T=!kp.isClockWise(M);if(T){M=M.reverse();for(let t=0,e=S.length;t<e;t++){const e=S[t];kp.isClockWise(e)&&(S[t]=e.reverse())}}const E=kp.triangulateShape(M,S),A=M;for(let e=0,n=S.length;e<n;e++){const t=S[e];M=M.concat(t)}function L(t,e,n){return e||console.error("THREE.ExtrudeGeometry: vec does not exist"),e.clone().multiplyScalar(n).add(t)}const R=M.length,C=E.length;function P(t,e,n){let r,i,s;const o=t.x-e.x,a=t.y-e.y,c=n.x-t.x,l=n.y-t.y,u=o*o+a*a,h=o*l-a*c;if(Math.abs(h)>Number.EPSILON){const h=Math.sqrt(u),d=Math.sqrt(c*c+l*l),p=e.x-a/h,f=e.y+o/h,m=n.x-l/d,g=n.y+c/d,v=((m-p)*l-(g-f)*c)/(o*l-a*c);r=p+o*v-t.x,i=f+a*v-t.y;const y=r*r+i*i;if(y<=2)return new Fn(r,i);s=Math.sqrt(y/2)}else{let t=!1;o>Number.EPSILON?c>Number.EPSILON&&(t=!0):o<-Number.EPSILON?c<-Number.EPSILON&&(t=!0):Math.sign(a)===Math.sign(l)&&(t=!0),t?(r=-a,i=o,s=Math.sqrt(u)):(r=o,i=a,s=Math.sqrt(u/2))}return new Fn(r/s,i/s)}const I=[];for(let e=0,n=A.length,r=n-1,i=e+1;e<n;e++,r++,i++)r===n&&(r=0),i===n&&(i=0),I[e]=P(A[e],A[r],A[i]);const N=[];let O,D=I.concat();for(let e=0,n=S.length;e<n;e++){const t=S[e];O=[];for(let e=0,n=t.length,r=n-1,i=e+1;e<n;e++,r++,i++)r===n&&(r=0),i===n&&(i=0),O[e]=P(t[e],t[r],t[i]);N.push(O),D=D.concat(O)}for(let e=0;e<p;e++){const t=e/p,n=u*Math.cos(t*Math.PI/2),r=h*Math.sin(t*Math.PI/2)+d;for(let e=0,i=A.length;e<i;e++){const t=L(A[e],I[e],r);B(t.x,t.y,-n)}for(let e=0,i=S.length;e<i;e++){const t=S[e];O=N[e];for(let e=0,i=t.length;e<i;e++){const i=L(t[e],O[e],r);B(i.x,i.y,-n)}}}const k=h+d;for(let e=0;e<R;e++){const t=l?L(M[e],D[e],k):M[e];w?(x.copy(v.normals[0]).multiplyScalar(t.x),y.copy(v.binormals[0]).multiplyScalar(t.y),b.copy(g[0]).add(x).add(y),B(b.x,b.y,b.z)):B(t.x,t.y,0)}for(let e=1;e<=a;e++)for(let t=0;t<R;t++){const n=l?L(M[t],D[t],k):M[t];w?(x.copy(v.normals[e]).multiplyScalar(n.x),y.copy(v.binormals[e]).multiplyScalar(n.y),b.copy(g[e]).add(x).add(y),B(b.x,b.y,b.z)):B(n.x,n.y,c/a*e)}for(let e=p-1;e>=0;e--){const t=e/p,n=u*Math.cos(t*Math.PI/2),r=h*Math.sin(t*Math.PI/2)+d;for(let e=0,i=A.length;e<i;e++){const t=L(A[e],I[e],r);B(t.x,t.y,c+n)}for(let e=0,i=S.length;e<i;e++){const t=S[e];O=N[e];for(let e=0,i=t.length;e<i;e++){const i=L(t[e],O[e],r);w?B(i.x,i.y+g[a-1].y,g[a-1].x+n):B(i.x,i.y,c+n)}}}function z(){const t=r.length/3;if(l){let t=0,e=R*t;for(let n=0;n<C;n++){const t=E[n];H(t[2]+e,t[1]+e,t[0]+e)}t=a+2*p,e=R*t;for(let n=0;n<C;n++){const t=E[n];H(t[0]+e,t[1]+e,t[2]+e)}}else{for(let t=0;t<C;t++){const e=E[t];H(e[2],e[1],e[0])}for(let t=0;t<C;t++){const e=E[t];H(e[0]+R*a,e[1]+R*a,e[2]+R*a)}}n.addGroup(t,r.length/3-t,0)}function F(){const t=r.length/3;let e=0;U(A,e),e+=A.length;for(let n=0,r=S.length;n<r;n++){const t=S[n];U(t,e),e+=t.length}n.addGroup(t,r.length/3-t,1)}function U(t,e){let n=t.length;while(--n>=0){const r=n;let i=n-1;i<0&&(i=t.length-1);for(let t=0,n=a+2*p;t<n;t++){const n=R*t,s=R*(t+1),o=e+r+n,a=e+i+n,c=e+i+s,l=e+r+s;G(o,a,c,l)}}}function B(t,e,n){s.push(t),s.push(e),s.push(n)}function H(t,e,i){V(t),V(e),V(i);const s=r.length/3,o=m.generateTopUV(n,r,s-3,s-2,s-1);W(o[0]),W(o[1]),W(o[2])}function G(t,e,i,s){V(t),V(e),V(s),V(e),V(i),V(s);const o=r.length/3,a=m.generateSideWallUV(n,r,o-6,o-3,o-2,o-1);W(a[0]),W(a[1]),W(a[3]),W(a[1]),W(a[2]),W(a[3])}function V(t){r.push(s[3*t+0]),r.push(s[3*t+1]),r.push(s[3*t+2])}function W(t){i.push(t.x),i.push(t.y)}z(),F()}this.setAttribute("position",new Pi(r,3)),this.setAttribute("uv",new Pi(i,2)),this.computeVertexNormals()}toJSON(){const t=super.toJSON(),e=this.parameters.shapes,n=this.parameters.options;return Hp(e,n,t)}static fromJSON(t,e){const n=[];for(let i=0,s=t.shapes.length;i<s;i++){const r=e[t.shapes[i]];n.push(r)}const r=t.options.extrudePath;return void 0!==r&&(t.options.extrudePath=(new tp[r.type]).fromJSON(r)),new Up(n,t.options)}}const Bp={generateTopUV:function(t,e,n,r,i){const s=e[3*n],o=e[3*n+1],a=e[3*r],c=e[3*r+1],l=e[3*i],u=e[3*i+1];return[new Fn(s,o),new Fn(a,c),new Fn(l,u)]},generateSideWallUV:function(t,e,n,r,i,s){const o=e[3*n],a=e[3*n+1],c=e[3*n+2],l=e[3*r],u=e[3*r+1],h=e[3*r+2],d=e[3*i],p=e[3*i+1],f=e[3*i+2],m=e[3*s],g=e[3*s+1],v=e[3*s+2];return Math.abs(a-u)<Math.abs(o-l)?[new Fn(o,1-c),new Fn(l,1-h),new Fn(d,1-f),new Fn(m,1-v)]:[new Fn(a,1-c),new Fn(u,1-h),new Fn(p,1-f),new Fn(g,1-v)]}};function Hp(t,e,n){if(n.shapes=[],Array.isArray(t))for(let r=0,i=t.length;r<i;r++){const e=t[r];n.shapes.push(e.uuid)}else n.shapes.push(t.uuid);return void 0!==e.extrudePath&&(n.options.extrudePath=e.extrudePath.toJSON()),n}class Gp extends wd{constructor(t=1,e=0){const n=(1+Math.sqrt(5))/2,r=[-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,0,1],i=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1];super(r,i,t,e),this.type="IcosahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new Gp(t.radius,t.detail)}}class Vp extends Ui{constructor(t=[new Fn(0,.5),new Fn(.5,0),new Fn(0,-.5)],e=12,n=0,r=2*Math.PI){super(),this.type="LatheGeometry",this.parameters={points:t,segments:e,phiStart:n,phiLength:r},e=Math.floor(e),r=yn(r,0,2*Math.PI);const i=[],s=[],o=[],a=1/e,c=new er,l=new Fn;for(let u=0;u<=e;u++){const i=n+u*a*r,h=Math.sin(i),d=Math.cos(i);for(let n=0;n<=t.length-1;n++)c.x=t[n].x*h,c.y=t[n].y,c.z=t[n].x*d,s.push(c.x,c.y,c.z),l.x=u/e,l.y=n/(t.length-1),o.push(l.x,l.y)}for(let u=0;u<e;u++)for(let e=0;e<t.length-1;e++){const n=e+u*t.length,r=n,s=n+t.length,o=n+t.length+1,a=n+1;i.push(r,s,a),i.push(s,o,a)}if(this.setIndex(i),this.setAttribute("position",new Pi(s,3)),this.setAttribute("uv",new Pi(o,2)),this.computeVertexNormals(),r===2*Math.PI){const n=this.attributes.normal.array,r=new er,i=new er,s=new er,o=e*t.length*3;for(let e=0,a=0;e<t.length;e++,a+=3)r.x=n[a+0],r.y=n[a+1],r.z=n[a+2],i.x=n[o+a+0],i.y=n[o+a+1],i.z=n[o+a+2],s.addVectors(r,i).normalize(),n[a+0]=n[o+a+0]=s.x,n[a+1]=n[o+a+1]=s.y,n[a+2]=n[o+a+2]=s.z}}static fromJSON(t){return new Vp(t.points,t.segments,t.phiStart,t.phiLength)}}class Wp extends wd{constructor(t=1,e=0){const n=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],r=[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2];super(n,r,t,e),this.type="OctahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new Wp(t.radius,t.detail)}}class jp extends Ui{constructor(t=.5,e=1,n=8,r=1,i=0,s=2*Math.PI){super(),this.type="RingGeometry",this.parameters={innerRadius:t,outerRadius:e,thetaSegments:n,phiSegments:r,thetaStart:i,thetaLength:s},n=Math.max(3,n),r=Math.max(1,r);const o=[],a=[],c=[],l=[];let u=t;const h=(e-t)/r,d=new er,p=new Fn;for(let f=0;f<=r;f++){for(let t=0;t<=n;t++){const r=i+t/n*s;d.x=u*Math.cos(r),d.y=u*Math.sin(r),a.push(d.x,d.y,d.z),c.push(0,0,1),p.x=(d.x/e+1)/2,p.y=(d.y/e+1)/2,l.push(p.x,p.y)}u+=h}for(let f=0;f<r;f++){const t=f*(n+1);for(let e=0;e<n;e++){const r=e+t,i=r,s=r+n+1,a=r+n+2,c=r+1;o.push(i,s,c),o.push(s,a,c)}}this.setIndex(o),this.setAttribute("position",new Pi(a,3)),this.setAttribute("normal",new Pi(c,3)),this.setAttribute("uv",new Pi(l,2))}static fromJSON(t){return new jp(t.innerRadius,t.outerRadius,t.thetaSegments,t.phiSegments,t.thetaStart,t.thetaLength)}}class qp extends Ui{constructor(t=new rp([new Fn(0,.5),new Fn(-.5,-.5),new Fn(.5,-.5)]),e=12){super(),this.type="ShapeGeometry",this.parameters={shapes:t,curveSegments:e};const n=[],r=[],i=[],s=[];let o=0,a=0;if(!1===Array.isArray(t))c(t);else for(let l=0;l<t.length;l++)c(t[l]),this.addGroup(o,a,l),o+=a,a=0;function c(t){const o=r.length/3,c=t.extractPoints(e);let l=c.shape;const u=c.holes;!1===kp.isClockWise(l)&&(l=l.reverse());for(let e=0,n=u.length;e<n;e++){const t=u[e];!0===kp.isClockWise(t)&&(u[e]=t.reverse())}const h=kp.triangulateShape(l,u);for(let e=0,n=u.length;e<n;e++){const t=u[e];l=l.concat(t)}for(let e=0,n=l.length;e<n;e++){const t=l[e];r.push(t.x,t.y,0),i.push(0,0,1),s.push(t.x,t.y)}for(let e=0,r=h.length;e<r;e++){const t=h[e],r=t[0]+o,i=t[1]+o,s=t[2]+o;n.push(r,i,s),a+=3}}this.setIndex(n),this.setAttribute("position",new Pi(r,3)),this.setAttribute("normal",new Pi(i,3)),this.setAttribute("uv",new Pi(s,2))}toJSON(){const t=super.toJSON(),e=this.parameters.shapes;return Xp(e,t)}static fromJSON(t,e){const n=[];for(let r=0,i=t.shapes.length;r<i;r++){const i=e[t.shapes[r]];n.push(i)}return new qp(n,t.curveSegments)}}function Xp(t,e){if(e.shapes=[],Array.isArray(t))for(let n=0,r=t.length;n<r;n++){const r=t[n];e.shapes.push(r.uuid)}else e.shapes.push(t.uuid);return e}class Yp extends Ui{constructor(t=1,e=32,n=16,r=0,i=2*Math.PI,s=0,o=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:n,phiStart:r,phiLength:i,thetaStart:s,thetaLength:o},e=Math.max(3,Math.floor(e)),n=Math.max(2,Math.floor(n));const a=Math.min(s+o,Math.PI);let c=0;const l=[],u=new er,h=new er,d=[],p=[],f=[],m=[];for(let g=0;g<=n;g++){const d=[],v=g/n;let y=0;0==g&&0==s?y=.5/e:g==n&&a==Math.PI&&(y=-.5/e);for(let n=0;n<=e;n++){const a=n/e;u.x=-t*Math.cos(r+a*i)*Math.sin(s+v*o),u.y=t*Math.cos(s+v*o),u.z=t*Math.sin(r+a*i)*Math.sin(s+v*o),p.push(u.x,u.y,u.z),h.copy(u).normalize(),f.push(h.x,h.y,h.z),m.push(a+y,1-v),d.push(c++)}l.push(d)}for(let g=0;g<n;g++)for(let t=0;t<e;t++){const e=l[g][t+1],r=l[g][t],i=l[g+1][t],o=l[g+1][t+1];(0!==g||s>0)&&d.push(e,r,o),(g!==n-1||a<Math.PI)&&d.push(r,i,o)}this.setIndex(d),this.setAttribute("position",new Pi(p,3)),this.setAttribute("normal",new Pi(f,3)),this.setAttribute("uv",new Pi(m,2))}static fromJSON(t){return new Yp(t.radius,t.widthSegments,t.heightSegments,t.phiStart,t.phiLength,t.thetaStart,t.thetaLength)}}class Jp extends wd{constructor(t=1,e=0){const n=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],r=[2,1,0,0,3,2,1,3,0,2,3,1];super(n,r,t,e),this.type="TetrahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new Jp(t.radius,t.detail)}}class Zp extends Ui{constructor(t=1,e=.4,n=8,r=6,i=2*Math.PI){super(),this.type="TorusGeometry",this.parameters={radius:t,tube:e,radialSegments:n,tubularSegments:r,arc:i},n=Math.floor(n),r=Math.floor(r);const s=[],o=[],a=[],c=[],l=new er,u=new er,h=new er;for(let d=0;d<=n;d++)for(let s=0;s<=r;s++){const p=s/r*i,f=d/n*Math.PI*2;u.x=(t+e*Math.cos(f))*Math.cos(p),u.y=(t+e*Math.cos(f))*Math.sin(p),u.z=e*Math.sin(f),o.push(u.x,u.y,u.z),l.x=t*Math.cos(p),l.y=t*Math.sin(p),h.subVectors(u,l).normalize(),a.push(h.x,h.y,h.z),c.push(s/r),c.push(d/n)}for(let d=1;d<=n;d++)for(let t=1;t<=r;t++){const e=(r+1)*d+t-1,n=(r+1)*(d-1)+t-1,i=(r+1)*(d-1)+t,o=(r+1)*d+t;s.push(e,n,o),s.push(n,i,o)}this.setIndex(s),this.setAttribute("position",new Pi(o,3)),this.setAttribute("normal",new Pi(a,3)),this.setAttribute("uv",new Pi(c,2))}static fromJSON(t){return new Zp(t.radius,t.tube,t.radialSegments,t.tubularSegments,t.arc)}}class Kp extends Ui{constructor(t=1,e=.4,n=64,r=8,i=2,s=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:t,tube:e,tubularSegments:n,radialSegments:r,p:i,q:s},n=Math.floor(n),r=Math.floor(r);const o=[],a=[],c=[],l=[],u=new er,h=new er,d=new er,p=new er,f=new er,m=new er,g=new er;for(let y=0;y<=n;++y){const o=y/n*i*Math.PI*2;v(o,i,s,t,d),v(o+.01,i,s,t,p),m.subVectors(p,d),g.addVectors(p,d),f.crossVectors(m,g),g.crossVectors(f,m),f.normalize(),g.normalize();for(let t=0;t<=r;++t){const i=t/r*Math.PI*2,s=-e*Math.cos(i),o=e*Math.sin(i);u.x=d.x+(s*g.x+o*f.x),u.y=d.y+(s*g.y+o*f.y),u.z=d.z+(s*g.z+o*f.z),a.push(u.x,u.y,u.z),h.subVectors(u,d).normalize(),c.push(h.x,h.y,h.z),l.push(y/n),l.push(t/r)}}for(let y=1;y<=n;y++)for(let t=1;t<=r;t++){const e=(r+1)*(y-1)+(t-1),n=(r+1)*y+(t-1),i=(r+1)*y+t,s=(r+1)*(y-1)+t;o.push(e,n,s),o.push(n,i,s)}function v(t,e,n,r,i){const s=Math.cos(t),o=Math.sin(t),a=n/e*t,c=Math.cos(a);i.x=r*(2+c)*.5*s,i.y=r*(2+c)*o*.5,i.z=r*Math.sin(a)*.5}this.setIndex(o),this.setAttribute("position",new Pi(a,3)),this.setAttribute("normal",new Pi(c,3)),this.setAttribute("uv",new Pi(l,2))}static fromJSON(t){return new Kp(t.radius,t.tube,t.tubularSegments,t.radialSegments,t.p,t.q)}}class $p extends Ui{constructor(t=new $d(new er(-1,-1,0),new er(-1,1,0),new er(1,1,0)),e=64,n=1,r=8,i=!1){super(),this.type="TubeGeometry",this.parameters={path:t,tubularSegments:e,radius:n,radialSegments:r,closed:i};const s=t.computeFrenetFrames(e,i);this.tangents=s.tangents,this.normals=s.normals,this.binormals=s.binormals;const o=new er,a=new er,c=new Fn;let l=new er;const u=[],h=[],d=[],p=[];function f(){for(let t=0;t<e;t++)m(t);m(!1===i?e:0),v(),g()}function m(i){l=t.getPointAt(i/e,l);const c=s.normals[i],d=s.binormals[i];for(let t=0;t<=r;t++){const e=t/r*Math.PI*2,i=Math.sin(e),s=-Math.cos(e);a.x=s*c.x+i*d.x,a.y=s*c.y+i*d.y,a.z=s*c.z+i*d.z,a.normalize(),h.push(a.x,a.y,a.z),o.x=l.x+n*a.x,o.y=l.y+n*a.y,o.z=l.z+n*a.z,u.push(o.x,o.y,o.z)}}function g(){for(let t=1;t<=e;t++)for(let e=1;e<=r;e++){const n=(r+1)*(t-1)+(e-1),i=(r+1)*t+(e-1),s=(r+1)*t+e,o=(r+1)*(t-1)+e;p.push(n,i,o),p.push(i,s,o)}}function v(){for(let t=0;t<=e;t++)for(let n=0;n<=r;n++)c.x=t/e,c.y=n/r,d.push(c.x,c.y)}f(),this.setIndex(p),this.setAttribute("position",new Pi(u,3)),this.setAttribute("normal",new Pi(h,3)),this.setAttribute("uv",new Pi(d,2))}toJSON(){const t=super.toJSON();return t.path=this.parameters.path.toJSON(),t}static fromJSON(t){return new $p((new tp[t.path.type]).fromJSON(t.path),t.tubularSegments,t.radius,t.radialSegments,t.closed)}}class Qp extends Ui{constructor(t=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:t},null!==t){const e=[],n=new Set,r=new er,i=new er;if(null!==t.index){const s=t.attributes.position,o=t.index;let a=t.groups;0===a.length&&(a=[{start:0,count:o.count,materialIndex:0}]);for(let t=0,c=a.length;t<c;++t){const c=a[t],l=c.start,u=c.count;for(let t=l,a=l+u;t<a;t+=3)for(let c=0;c<3;c++){const a=o.getX(t+c),l=o.getX(t+(c+1)%3);r.fromBufferAttribute(s,a),i.fromBufferAttribute(s,l),!0===tf(r,i,n)&&(e.push(r.x,r.y,r.z),e.push(i.x,i.y,i.z))}}}else{const s=t.attributes.position;for(let t=0,o=s.count/3;t<o;t++)for(let a=0;a<3;a++){const o=3*t+a,c=3*t+(a+1)%3;r.fromBufferAttribute(s,o),i.fromBufferAttribute(s,c),!0===tf(r,i,n)&&(e.push(r.x,r.y,r.z),e.push(i.x,i.y,i.z))}}this.setAttribute("position",new Pi(e,3))}}}function tf(t,e,n){const r=`${t.x},${t.y},${t.z}-${e.x},${e.y},${e.z}`,i=`${e.x},${e.y},${e.z}-${t.x},${t.y},${t.z}`;return!0!==n.has(r)&&!0!==n.has(i)&&(n.add(r,i),!0)}var ef=Object.freeze({__proto__:null,BoxGeometry:os,BoxBufferGeometry:os,CircleGeometry:yd,CircleBufferGeometry:yd,ConeGeometry:bd,ConeBufferGeometry:bd,CylinderGeometry:xd,CylinderBufferGeometry:xd,DodecahedronGeometry:_d,DodecahedronBufferGeometry:_d,EdgesGeometry:Ad,ExtrudeGeometry:Up,ExtrudeBufferGeometry:Up,IcosahedronGeometry:Gp,IcosahedronBufferGeometry:Gp,LatheGeometry:Vp,LatheBufferGeometry:Vp,OctahedronGeometry:Wp,OctahedronBufferGeometry:Wp,PlaneGeometry:Rs,PlaneBufferGeometry:Rs,PolyhedronGeometry:wd,PolyhedronBufferGeometry:wd,RingGeometry:jp,RingBufferGeometry:jp,ShapeGeometry:qp,ShapeBufferGeometry:qp,SphereGeometry:Yp,SphereBufferGeometry:Yp,TetrahedronGeometry:Jp,TetrahedronBufferGeometry:Jp,TorusGeometry:Zp,TorusBufferGeometry:Zp,TorusKnotGeometry:Kp,TorusKnotBufferGeometry:Kp,TubeGeometry:$p,TubeBufferGeometry:$p,WireframeGeometry:Qp});class nf extends gi{constructor(t){super(),this.type="ShadowMaterial",this.color=new Mi(0),this.transparent=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this}}nf.prototype.isShadowMaterial=!0;class rf extends gi{constructor(t){super(),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new Mi(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 Mi(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=sn,this.normalScale=new Fn(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}}rf.prototype.isMeshStandardMaterial=!0;class sf extends rf{constructor(t){super(),this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new Fn(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return yn(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.sheenColor=new Mi(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 Mi(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new Mi(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}}sf.prototype.isMeshPhysicalMaterial=!0;class of extends gi{constructor(t){super(),this.type="MeshPhongMaterial",this.color=new Mi(16777215),this.specular=new Mi(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Mi(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=sn,this.normalScale=new Fn(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=$,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}}of.prototype.isMeshPhongMaterial=!0;class af extends gi{constructor(t){super(),this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new Mi(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Mi(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=sn,this.normalScale=new Fn(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}}af.prototype.isMeshToonMaterial=!0;class cf extends gi{constructor(t){super(),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=sn,this.normalScale=new Fn(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}}cf.prototype.isMeshNormalMaterial=!0;class lf extends gi{constructor(t){super(),this.type="MeshLambertMaterial",this.color=new Mi(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Mi(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=$,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}}lf.prototype.isMeshLambertMaterial=!0;class uf extends gi{constructor(t){super(),this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Mi(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=sn,this.normalScale=new Fn(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}}uf.prototype.isMeshMatcapMaterial=!0;class hf extends Kh{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}}hf.prototype.isLineDashedMaterial=!0;var df=Object.freeze({__proto__:null,ShadowMaterial:nf,SpriteMaterial:mh,RawShaderMaterial:pc,ShaderMaterial:ds,PointsMaterial:cd,MeshPhysicalMaterial:sf,MeshStandardMaterial:rf,MeshPhongMaterial:of,MeshToonMaterial:af,MeshNormalMaterial:cf,MeshLambertMaterial:lf,MeshDepthMaterial:ju,MeshDistanceMaterial:qu,MeshBasicMaterial:Si,MeshMatcapMaterial:uf,LineDashedMaterial:hf,LineBasicMaterial:Kh,Material:gi});const pf={arraySlice:function(t,e,n){return pf.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){function e(e,n){return t[e]-t[n]}const n=t.length,r=new Array(n);for(let i=0;i!==n;++i)r[i]=i;return r.sort(e),r},sortedArray:function(t,e,n){const r=t.length,i=new t.constructor(r);for(let s=0,o=0;o!==r;++s){const r=n[s]*e;for(let n=0;n!==e;++n)i[o++]=t[r+n]}return i},flattenJSON:function(t,e,n,r){let i=1,s=t[0];while(void 0!==s&&void 0===s[r])s=t[i++];if(void 0===s)return;let o=s[r];if(void 0!==o)if(Array.isArray(o))do{o=s[r],void 0!==o&&(e.push(s.time),n.push.apply(n,o)),s=t[i++]}while(void 0!==s);else if(void 0!==o.toArray)do{o=s[r],void 0!==o&&(e.push(s.time),o.toArray(n,n.length)),s=t[i++]}while(void 0!==s);else do{o=s[r],void 0!==o&&(e.push(s.time),n.push(o)),s=t[i++]}while(void 0!==s)},subclip:function(t,e,n,r,i=30){const s=t.clone();s.name=e;const o=[];for(let c=0;c<s.tracks.length;++c){const t=s.tracks[c],e=t.getValueSize(),a=[],l=[];for(let s=0;s<t.times.length;++s){const o=t.times[s]*i;if(!(o<n||o>=r)){a.push(t.times[s]);for(let n=0;n<e;++n)l.push(t.values[s*e+n])}}0!==a.length&&(t.times=pf.convertArray(a,t.times.constructor),t.values=pf.convertArray(l,t.values.constructor),o.push(t))}s.tracks=o;let a=1/0;for(let c=0;c<s.tracks.length;++c)a>s.tracks[c].times[0]&&(a=s.tracks[c].times[0]);for(let c=0;c<s.tracks.length;++c)s.tracks[c].shift(-1*a);return s.resetDuration(),s},makeClipAdditive:function(t,e=0,n=t,r=30){r<=0&&(r=30);const i=n.tracks.length,s=e/r;for(let o=0;o<i;++o){const e=n.tracks[o],r=e.ValueTypeName;if("bool"===r||"string"===r)continue;const i=t.tracks.find((function(t){return t.name===e.name&&t.ValueTypeName===r}));if(void 0===i)continue;let a=0;const c=e.getValueSize();e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(a=c/3);let l=0;const u=i.getValueSize();i.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(l=u/3);const h=e.times.length-1;let d;if(s<=e.times[0]){const t=a,n=c-a;d=pf.arraySlice(e.values,t,n)}else if(s>=e.times[h]){const t=h*c+a,n=t+c-a;d=pf.arraySlice(e.values,t,n)}else{const t=e.createInterpolant(),n=a,r=c-a;t.evaluate(s),d=pf.arraySlice(t.resultBuffer,n,r)}if("quaternion"===r){const t=(new tr).fromArray(d).normalize().conjugate();t.toArray(d)}const p=i.times.length;for(let t=0;t<p;++t){const e=t*u+l;if("quaternion"===r)tr.multiplyQuaternionsFlat(i.values,e,d,0,i.values,e);else{const t=u-2*l;for(let n=0;n<t;++n)i.values[e+n]-=d[n]}}}return t.blendMode=je,t}};class ff{constructor(t,e,n,r){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=void 0!==r?r:new e.constructor(n),this.sampleValues=e,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(t){const e=this.parameterPositions;let n=this._cachedIndex,r=e[n],i=e[n-1];t:{e:{let s;n:{r:if(!(t<r)){for(let s=n+2;;){if(void 0===r){if(t<i)break r;return n=e.length,this._cachedIndex=n,this.afterEnd_(n-1,t,i)}if(n===s)break;if(i=r,r=e[++n],t<r)break e}s=e.length;break n}if(t>=i)break t;{const o=e[1];t<o&&(n=2,i=o);for(let s=n-2;;){if(void 0===i)return this._cachedIndex=0,this.beforeStart_(0,t,r);if(n===s)break;if(r=i,i=e[--n-1],t>=i)break e}s=n,n=0}}while(n<s){const r=n+s>>>1;t<e[r]?s=r:n=r+1}if(r=e[n],i=e[n-1],void 0===i)return this._cachedIndex=0,this.beforeStart_(0,t,r);if(void 0===r)return n=e.length,this._cachedIndex=n,this.afterEnd_(n-1,i,t)}this._cachedIndex=n,this.intervalChanged_(n,i,r)}return this.interpolate_(n,i,t,r)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(t){const e=this.resultBuffer,n=this.sampleValues,r=this.valueSize,i=t*r;for(let s=0;s!==r;++s)e[s]=n[i+s];return e}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}ff.prototype.beforeStart_=ff.prototype.copySampleValue_,ff.prototype.afterEnd_=ff.prototype.copySampleValue_;class mf extends ff{constructor(t,e,n,r){super(t,e,n,r),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:He,endingEnd:He}}intervalChanged_(t,e,n){const r=this.parameterPositions;let i=t-2,s=t+1,o=r[i],a=r[s];if(void 0===o)switch(this.getSettings_().endingStart){case Ge:i=t,o=2*e-n;break;case Ve:i=r.length-2,o=e+r[i]-r[i+1];break;default:i=t,o=n}if(void 0===a)switch(this.getSettings_().endingEnd){case Ge:s=t,a=2*n-e;break;case Ve:s=1,a=n+r[1]-r[0];break;default:s=t-1,a=e}const c=.5*(n-e),l=this.valueSize;this._weightPrev=c/(e-o),this._weightNext=c/(a-n),this._offsetPrev=i*l,this._offsetNext=s*l}interpolate_(t,e,n,r){const i=this.resultBuffer,s=this.sampleValues,o=this.valueSize,a=t*o,c=a-o,l=this._offsetPrev,u=this._offsetNext,h=this._weightPrev,d=this._weightNext,p=(n-e)/(r-e),f=p*p,m=f*p,g=-h*m+2*h*f-h*p,v=(1+h)*m+(-1.5-2*h)*f+(-.5+h)*p+1,y=(-1-d)*m+(1.5+d)*f+.5*p,x=d*m-d*f;for(let b=0;b!==o;++b)i[b]=g*s[l+b]+v*s[c+b]+y*s[a+b]+x*s[u+b];return i}}class gf extends ff{constructor(t,e,n,r){super(t,e,n,r)}interpolate_(t,e,n,r){const i=this.resultBuffer,s=this.sampleValues,o=this.valueSize,a=t*o,c=a-o,l=(n-e)/(r-e),u=1-l;for(let h=0;h!==o;++h)i[h]=s[c+h]*u+s[a+h]*l;return i}}class vf extends ff{constructor(t,e,n,r){super(t,e,n,r)}interpolate_(t){return this.copySampleValue_(t-1)}}class yf{constructor(t,e,n,r){if(void 0===t)throw new Error("THREE.KeyframeTrack: track name is undefined");if(void 0===e||0===e.length)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+t);this.name=t,this.times=pf.convertArray(e,this.TimeBufferType),this.values=pf.convertArray(n,this.ValueBufferType),this.setInterpolation(r||this.DefaultInterpolation)}static toJSON(t){const e=t.constructor;let n;if(e.toJSON!==this.toJSON)n=e.toJSON(t);else{n={name:t.name,times:pf.convertArray(t.times,Array),values:pf.convertArray(t.values,Array)};const e=t.getInterpolation();e!==t.DefaultInterpolation&&(n.interpolation=e)}return n.type=t.ValueTypeName,n}InterpolantFactoryMethodDiscrete(t){return new vf(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodLinear(t){return new gf(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodSmooth(t){return new mf(this.times,this.values,this.getValueSize(),t)}setInterpolation(t){let e;switch(t){case Fe:e=this.InterpolantFactoryMethodDiscrete;break;case Ue:e=this.InterpolantFactoryMethodLinear;break;case Be:e=this.InterpolantFactoryMethodSmooth;break}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 Fe;case this.InterpolantFactoryMethodLinear:return Ue;case this.InterpolantFactoryMethodSmooth:return Be}}getValueSize(){return this.values.length/this.times.length}shift(t){if(0!==t){const e=this.times;for(let n=0,r=e.length;n!==r;++n)e[n]+=t}return this}scale(t){if(1!==t){const e=this.times;for(let n=0,r=e.length;n!==r;++n)e[n]*=t}return this}trim(t,e){const n=this.times,r=n.length;let i=0,s=r-1;while(i!==r&&n[i]<t)++i;while(-1!==s&&n[s]>e)--s;if(++s,0!==i||s!==r){i>=s&&(s=Math.max(s,1),i=s-1);const t=this.getValueSize();this.times=pf.arraySlice(n,i,s),this.values=pf.arraySlice(this.values,i*t,s*t)}return this}validate(){let t=!0;const e=this.getValueSize();e-Math.floor(e)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),t=!1);const n=this.times,r=this.values,i=n.length;0===i&&(console.error("THREE.KeyframeTrack: Track is empty.",this),t=!1);let s=null;for(let o=0;o!==i;o++){const e=n[o];if("number"===typeof e&&isNaN(e)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,o,e),t=!1;break}if(null!==s&&s>e){console.error("THREE.KeyframeTrack: Out of order keys.",this,o,e,s),t=!1;break}s=e}if(void 0!==r&&pf.isTypedArray(r))for(let o=0,a=r.length;o!==a;++o){const e=r[o];if(isNaN(e)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,o,e),t=!1;break}}return t}optimize(){const t=pf.arraySlice(this.times),e=pf.arraySlice(this.values),n=this.getValueSize(),r=this.getInterpolation()===Be,i=t.length-1;let s=1;for(let o=1;o<i;++o){let i=!1;const a=t[o],c=t[o+1];if(a!==c&&(1!==o||a!==t[0]))if(r)i=!0;else{const t=o*n,r=t-n,s=t+n;for(let o=0;o!==n;++o){const n=e[t+o];if(n!==e[r+o]||n!==e[s+o]){i=!0;break}}}if(i){if(o!==s){t[s]=t[o];const r=o*n,i=s*n;for(let t=0;t!==n;++t)e[i+t]=e[r+t]}++s}}if(i>0){t[s]=t[i];for(let t=i*n,r=s*n,o=0;o!==n;++o)e[r+o]=e[t+o];++s}return s!==t.length?(this.times=pf.arraySlice(t,0,s),this.values=pf.arraySlice(e,0,s*n)):(this.times=t,this.values=e),this}clone(){const t=pf.arraySlice(this.times,0),e=pf.arraySlice(this.values,0),n=this.constructor,r=new n(this.name,t,e);return r.createInterpolant=this.createInterpolant,r}}yf.prototype.TimeBufferType=Float32Array,yf.prototype.ValueBufferType=Float32Array,yf.prototype.DefaultInterpolation=Ue;class xf extends yf{}xf.prototype.ValueTypeName="bool",xf.prototype.ValueBufferType=Array,xf.prototype.DefaultInterpolation=Fe,xf.prototype.InterpolantFactoryMethodLinear=void 0,xf.prototype.InterpolantFactoryMethodSmooth=void 0;class bf extends yf{}bf.prototype.ValueTypeName="color";class wf extends yf{}wf.prototype.ValueTypeName="number";class _f extends ff{constructor(t,e,n,r){super(t,e,n,r)}interpolate_(t,e,n,r){const i=this.resultBuffer,s=this.sampleValues,o=this.valueSize,a=(n-e)/(r-e);let c=t*o;for(let l=c+o;c!==l;c+=4)tr.slerpFlat(i,0,s,c-o,s,c,a);return i}}class Mf extends yf{InterpolantFactoryMethodLinear(t){return new _f(this.times,this.values,this.getValueSize(),t)}}Mf.prototype.ValueTypeName="quaternion",Mf.prototype.DefaultInterpolation=Ue,Mf.prototype.InterpolantFactoryMethodSmooth=void 0;class Sf extends yf{}Sf.prototype.ValueTypeName="string",Sf.prototype.ValueBufferType=Array,Sf.prototype.DefaultInterpolation=Fe,Sf.prototype.InterpolantFactoryMethodLinear=void 0,Sf.prototype.InterpolantFactoryMethodSmooth=void 0;class Tf extends yf{}Tf.prototype.ValueTypeName="vector";class Ef{constructor(t,e=-1,n,r=We){this.name=t,this.tracks=n,this.duration=e,this.blendMode=r,this.uuid=vn(),this.duration<0&&this.resetDuration()}static parse(t){const e=[],n=t.tracks,r=1/(t.fps||1);for(let s=0,o=n.length;s!==o;++s)e.push(Lf(n[s]).scale(r));const i=new this(t.name,t.duration,e,t.blendMode);return i.uuid=t.uuid,i}static toJSON(t){const e=[],n=t.tracks,r={name:t.name,duration:t.duration,tracks:e,uuid:t.uuid,blendMode:t.blendMode};for(let i=0,s=n.length;i!==s;++i)e.push(yf.toJSON(n[i]));return r}static CreateFromMorphTargetSequence(t,e,n,r){const i=e.length,s=[];for(let o=0;o<i;o++){let t=[],a=[];t.push((o+i-1)%i,o,(o+1)%i),a.push(0,1,0);const c=pf.getKeyframeOrder(t);t=pf.sortedArray(t,1,c),a=pf.sortedArray(a,1,c),r||0!==t[0]||(t.push(i),a.push(a[0])),s.push(new wf(".morphTargetInfluences["+e[o].name+"]",t,a).scale(1/n))}return new this(t,-1,s)}static findByName(t,e){let n=t;if(!Array.isArray(t)){const e=t;n=e.geometry&&e.geometry.animations||e.animations}for(let r=0;r<n.length;r++)if(n[r].name===e)return n[r];return null}static CreateClipsFromMorphTargetSequences(t,e,n){const r={},i=/^([\w-]*?)([\d]+)$/;for(let o=0,a=t.length;o<a;o++){const e=t[o],n=e.name.match(i);if(n&&n.length>1){const t=n[1];let i=r[t];i||(r[t]=i=[]),i.push(e)}}const s=[];for(const o in r)s.push(this.CreateFromMorphTargetSequence(o,r[o],e,n));return s}static parseAnimation(t,e){if(!t)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const n=function(t,e,n,r,i){if(0!==n.length){const s=[],o=[];pf.flattenJSON(n,s,o,r),0!==s.length&&i.push(new t(e,s,o))}},r=[],i=t.name||"default",s=t.fps||30,o=t.blendMode;let a=t.length||-1;const c=t.hierarchy||[];for(let u=0;u<c.length;u++){const t=c[u].keys;if(t&&0!==t.length)if(t[0].morphTargets){const e={};let n;for(n=0;n<t.length;n++)if(t[n].morphTargets)for(let r=0;r<t[n].morphTargets.length;r++)e[t[n].morphTargets[r]]=-1;for(const i in e){const e=[],s=[];for(let r=0;r!==t[n].morphTargets.length;++r){const r=t[n];e.push(r.time),s.push(r.morphTarget===i?1:0)}r.push(new wf(".morphTargetInfluence["+i+"]",e,s))}a=e.length*(s||1)}else{const i=".bones["+e[u].name+"]";n(Tf,i+".position",t,"pos",r),n(Mf,i+".quaternion",t,"rot",r),n(Tf,i+".scale",t,"scl",r)}}if(0===r.length)return null;const l=new this(i,a,r,o);return l}resetDuration(){const t=this.tracks;let e=0;for(let n=0,r=t.length;n!==r;++n){const t=this.tracks[n];e=Math.max(e,t.times[t.times.length-1])}return this.duration=e,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 Af(t){switch(t.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return wf;case"vector":case"vector2":case"vector3":case"vector4":return Tf;case"color":return bf;case"quaternion":return Mf;case"bool":case"boolean":return xf;case"string":return Sf}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+t)}function Lf(t){if(void 0===t.type)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=Af(t.type);if(void 0===t.times){const e=[],n=[];pf.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 Rf={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={}}};class Cf{constructor(t,e,n){const r=this;let i=!1,s=0,o=0,a=void 0;const c=[];this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=n,this.itemStart=function(t){o++,!1===i&&void 0!==r.onStart&&r.onStart(t,s,o),i=!0},this.itemEnd=function(t){s++,void 0!==r.onProgress&&r.onProgress(t,s,o),s===o&&(i=!1,void 0!==r.onLoad&&r.onLoad())},this.itemError=function(t){void 0!==r.onError&&r.onError(t)},this.resolveURL=function(t){return a?a(t):t},this.setURLModifier=function(t){return a=t,this},this.addHandler=function(t,e){return c.push(t,e),this},this.removeHandler=function(t){const e=c.indexOf(t);return-1!==e&&c.splice(e,2),this},this.getHandler=function(t){for(let e=0,n=c.length;e<n;e+=2){const n=c[e],r=c[e+1];if(n.global&&(n.lastIndex=0),n.test(t))return r}return null}}}const Pf=new Cf;class If{constructor(t){this.manager=void 0!==t?t:Pf,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(t,e){const n=this;return new Promise((function(r,i){n.load(t,r,e,i)}))}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 Nf={};class Of extends If{constructor(t){super(t)}load(t,e,n,r){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const i=Rf.get(t);if(void 0!==i)return this.manager.itemStart(t),setTimeout(()=>{e&&e(i),this.manager.itemEnd(t)},0),i;if(void 0!==Nf[t])return void Nf[t].push({onLoad:e,onProgress:n,onError:r});Nf[t]=[],Nf[t].push({onLoad:e,onProgress:n,onError:r});const s=new Request(t,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"});fetch(s).then(e=>{if(200===e.status||0===e.status){0===e.status&&console.warn("THREE.FileLoader: HTTP Status 0 received.");const n=Nf[t],r=e.body.getReader(),i=e.headers.get("Content-Length"),s=i?parseInt(i):0,o=0!==s;let a=0;return new ReadableStream({start(t){function e(){r.read().then(({done:r,value:i})=>{if(r)t.close();else{a+=i.byteLength;const r=new ProgressEvent("progress",{lengthComputable:o,loaded:a,total:s});for(let t=0,e=n.length;t<e;t++){const e=n[t];e.onProgress&&e.onProgress(r)}t.enqueue(i),e()}})}e()}})}throw Error(`fetch for "${e.url}" responded with ${e.status}: ${e.statusText}`)}).then(t=>{const e=new Response(t);switch(this.responseType){case"arraybuffer":return e.arrayBuffer();case"blob":return e.blob();case"document":return e.text().then(t=>{const e=new DOMParser;return e.parseFromString(t,this.mimeType)});case"json":return e.json();default:return e.text()}}).then(e=>{Rf.add(t,e);const n=Nf[t];delete Nf[t];for(let t=0,r=n.length;t<r;t++){const r=n[t];r.onLoad&&r.onLoad(e)}this.manager.itemEnd(t)}).catch(e=>{const n=Nf[t];delete Nf[t];for(let t=0,r=n.length;t<r;t++){const r=n[t];r.onError&&r.onError(e)}this.manager.itemError(t),this.manager.itemEnd(t)}),this.manager.itemStart(t)}setResponseType(t){return this.responseType=t,this}setMimeType(t){return this.mimeType=t,this}}class Df extends If{constructor(t){super(t)}load(t,e,n,r){const i=this,s=[],o=new gd,a=new Of(this.manager);a.setPath(this.path),a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setWithCredentials(i.withCredentials);let c=0;function l(l){a.load(t[l],(function(t){const n=i.parse(t,!0);s[l]={width:n.width,height:n.height,format:n.format,mipmaps:n.mipmaps},c+=1,6===c&&(1===n.mipmapCount&&(o.minFilter=bt),o.image=s,o.format=n.format,o.needsUpdate=!0,e&&e(o))}),n,r)}if(Array.isArray(t))for(let u=0,h=t.length;u<h;++u)l(u);else a.load(t,(function(t){const n=i.parse(t,!0);if(n.isCubemap){const t=n.mipmaps.length/n.mipmapCount;for(let e=0;e<t;e++){s[e]={mipmaps:[]};for(let t=0;t<n.mipmapCount;t++)s[e].mipmaps.push(n.mipmaps[e*n.mipmapCount+t]),s[e].format=n.format,s[e].width=n.width,s[e].height=n.height}o.image=s}else o.image.width=n.width,o.image.height=n.height,o.mipmaps=n.mipmaps;1===n.mipmapCount&&(o.minFilter=bt),o.format=n.format,o.needsUpdate=!0,e&&e(o)}),n,r);return o}}class kf extends If{constructor(t){super(t)}load(t,e,n,r){void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const i=this,s=Rf.get(t);if(void 0!==s)return i.manager.itemStart(t),setTimeout((function(){e&&e(s),i.manager.itemEnd(t)}),0),s;const o=Vn("img");function a(){l(),Rf.add(t,this),e&&e(this),i.manager.itemEnd(t)}function c(e){l(),r&&r(e),i.manager.itemError(t),i.manager.itemEnd(t)}function l(){o.removeEventListener("load",a,!1),o.removeEventListener("error",c,!1)}return o.addEventListener("load",a,!1),o.addEventListener("error",c,!1),"data:"!==t.substr(0,5)&&void 0!==this.crossOrigin&&(o.crossOrigin=this.crossOrigin),i.manager.itemStart(t),o.src=t,o}}class zf extends If{constructor(t){super(t)}load(t,e,n,r){const i=new ys,s=new kf(this.manager);s.setCrossOrigin(this.crossOrigin),s.setPath(this.path);let o=0;function a(n){s.load(t[n],(function(t){i.images[n]=t,o++,6===o&&(i.needsUpdate=!0,e&&e(i))}),void 0,r)}for(let c=0;c<t.length;++c)a(c);return i}}class Ff extends If{constructor(t){super(t)}load(t,e,n,r){const i=this,s=new Hh,o=new Of(this.manager);return o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setPath(this.path),o.setWithCredentials(i.withCredentials),o.load(t,(function(t){const n=i.parse(t);n&&(void 0!==n.image?s.image=n.image:void 0!==n.data&&(s.image.width=n.width,s.image.height=n.height,s.image.data=n.data),s.wrapS=void 0!==n.wrapS?n.wrapS:mt,s.wrapT=void 0!==n.wrapT?n.wrapT:mt,s.magFilter=void 0!==n.magFilter?n.magFilter:bt,s.minFilter=void 0!==n.minFilter?n.minFilter:bt,s.anisotropy=void 0!==n.anisotropy?n.anisotropy:1,void 0!==n.encoding&&(s.encoding=n.encoding),void 0!==n.flipY&&(s.flipY=n.flipY),void 0!==n.format&&(s.format=n.format),void 0!==n.type&&(s.type=n.type),void 0!==n.mipmaps&&(s.mipmaps=n.mipmaps,s.minFilter=_t),1===n.mipmapCount&&(s.minFilter=bt),void 0!==n.generateMipmaps&&(s.generateMipmaps=n.generateMipmaps),s.needsUpdate=!0,e&&e(s,n))}),n,r),s}}class Uf extends If{constructor(t){super(t)}load(t,e,n,r){const i=new Yn,s=new kf(this.manager);return s.setCrossOrigin(this.crossOrigin),s.setPath(this.path),s.load(t,(function(t){i.image=t,i.needsUpdate=!0,void 0!==e&&e(i)}),n,r),i}}class Bf extends ri{constructor(t,e=1){super(),this.type="Light",this.color=new Mi(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}}Bf.prototype.isLight=!0;class Hf extends Bf{constructor(t,e,n){super(t,n),this.type="HemisphereLight",this.position.copy(ri.DefaultUp),this.updateMatrix(),this.groundColor=new Mi(e)}copy(t){return Bf.prototype.copy.call(this,t),this.groundColor.copy(t.groundColor),this}}Hf.prototype.isHemisphereLight=!0;const Gf=new Ir,Vf=new er,Wf=new er;class jf{constructor(t){this.camera=t,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Fn(512,512),this.map=null,this.mapPass=null,this.matrix=new Ir,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Es,this._frameExtents=new Fn(1,1),this._viewportCount=1,this._viewports=[new Zn(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(t){const e=this.camera,n=this.matrix;Vf.setFromMatrixPosition(t.matrixWorld),e.position.copy(Vf),Wf.setFromMatrixPosition(t.target.matrixWorld),e.lookAt(Wf),e.updateMatrixWorld(),Gf.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Gf),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 qf extends jf{constructor(){super(new fs(50,1,.5,500)),this.focus=1}updateMatrices(t){const e=this.camera,n=2*gn*t.angle*this.focus,r=this.mapSize.width/this.mapSize.height,i=t.distance||e.far;n===e.fov&&r===e.aspect&&i===e.far||(e.fov=n,e.aspect=r,e.far=i,e.updateProjectionMatrix()),super.updateMatrices(t)}copy(t){return super.copy(t),this.focus=t.focus,this}}qf.prototype.isSpotLightShadow=!0;class Xf extends Bf{constructor(t,e,n=0,r=Math.PI/3,i=0,s=1){super(t,e),this.type="SpotLight",this.position.copy(ri.DefaultUp),this.updateMatrix(),this.target=new ri,this.distance=n,this.angle=r,this.penumbra=i,this.decay=s,this.shadow=new qf}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}}Xf.prototype.isSpotLight=!0;const Yf=new Ir,Jf=new er,Zf=new er;class Kf extends jf{constructor(){super(new fs(90,1,.5,500)),this._frameExtents=new Fn(4,2),this._viewportCount=6,this._viewports=[new Zn(2,1,1,1),new Zn(0,1,1,1),new Zn(3,1,1,1),new Zn(1,1,1,1),new Zn(3,0,1,1),new Zn(1,0,1,1)],this._cubeDirections=[new er(1,0,0),new er(-1,0,0),new er(0,0,1),new er(0,0,-1),new er(0,1,0),new er(0,-1,0)],this._cubeUps=[new er(0,1,0),new er(0,1,0),new er(0,1,0),new er(0,1,0),new er(0,0,1),new er(0,0,-1)]}updateMatrices(t,e=0){const n=this.camera,r=this.matrix,i=t.distance||n.far;i!==n.far&&(n.far=i,n.updateProjectionMatrix()),Jf.setFromMatrixPosition(t.matrixWorld),n.position.copy(Jf),Zf.copy(n.position),Zf.add(this._cubeDirections[e]),n.up.copy(this._cubeUps[e]),n.lookAt(Zf),n.updateMatrixWorld(),r.makeTranslation(-Jf.x,-Jf.y,-Jf.z),Yf.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Yf)}}Kf.prototype.isPointLightShadow=!0;class $f extends Bf{constructor(t,e,n=0,r=1){super(t,e),this.type="PointLight",this.distance=n,this.decay=r,this.shadow=new Kf}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}}$f.prototype.isPointLight=!0;class Qf extends jf{constructor(){super(new dc(-5,5,5,-5,.5,500))}}Qf.prototype.isDirectionalLightShadow=!0;class tm extends Bf{constructor(t,e){super(t,e),this.type="DirectionalLight",this.position.copy(ri.DefaultUp),this.updateMatrix(),this.target=new ri,this.shadow=new Qf}dispose(){this.shadow.dispose()}copy(t){return super.copy(t),this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}tm.prototype.isDirectionalLight=!0;class em extends Bf{constructor(t,e){super(t,e),this.type="AmbientLight"}}em.prototype.isAmbientLight=!0;class nm extends Bf{constructor(t,e,n=10,r=10){super(t,e),this.type="RectAreaLight",this.width=n,this.height=r}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}}nm.prototype.isRectAreaLight=!0;class rm{constructor(){this.coefficients=[];for(let t=0;t<9;t++)this.coefficients.push(new er)}set(t){for(let e=0;e<9;e++)this.coefficients[e].copy(t[e]);return this}zero(){for(let t=0;t<9;t++)this.coefficients[t].set(0,0,0);return this}getAt(t,e){const n=t.x,r=t.y,i=t.z,s=this.coefficients;return e.copy(s[0]).multiplyScalar(.282095),e.addScaledVector(s[1],.488603*r),e.addScaledVector(s[2],.488603*i),e.addScaledVector(s[3],.488603*n),e.addScaledVector(s[4],n*r*1.092548),e.addScaledVector(s[5],r*i*1.092548),e.addScaledVector(s[6],.315392*(3*i*i-1)),e.addScaledVector(s[7],n*i*1.092548),e.addScaledVector(s[8],.546274*(n*n-r*r)),e}getIrradianceAt(t,e){const n=t.x,r=t.y,i=t.z,s=this.coefficients;return e.copy(s[0]).multiplyScalar(.886227),e.addScaledVector(s[1],1.023328*r),e.addScaledVector(s[2],1.023328*i),e.addScaledVector(s[3],1.023328*n),e.addScaledVector(s[4],.858086*n*r),e.addScaledVector(s[5],.858086*r*i),e.addScaledVector(s[6],.743125*i*i-.247708),e.addScaledVector(s[7],.858086*n*i),e.addScaledVector(s[8],.429043*(n*n-r*r)),e}add(t){for(let e=0;e<9;e++)this.coefficients[e].add(t.coefficients[e]);return this}addScaledSH(t,e){for(let n=0;n<9;n++)this.coefficients[n].addScaledVector(t.coefficients[n],e);return this}scale(t){for(let e=0;e<9;e++)this.coefficients[e].multiplyScalar(t);return this}lerp(t,e){for(let n=0;n<9;n++)this.coefficients[n].lerp(t.coefficients[n],e);return this}equals(t){for(let e=0;e<9;e++)if(!this.coefficients[e].equals(t.coefficients[e]))return!1;return!0}copy(t){return this.set(t.coefficients)}clone(){return(new this.constructor).copy(this)}fromArray(t,e=0){const n=this.coefficients;for(let r=0;r<9;r++)n[r].fromArray(t,e+3*r);return this}toArray(t=[],e=0){const n=this.coefficients;for(let r=0;r<9;r++)n[r].toArray(t,e+3*r);return t}static getBasisAt(t,e){const n=t.x,r=t.y,i=t.z;e[0]=.282095,e[1]=.488603*r,e[2]=.488603*i,e[3]=.488603*n,e[4]=1.092548*n*r,e[5]=1.092548*r*i,e[6]=.315392*(3*i*i-1),e[7]=1.092548*n*i,e[8]=.546274*(n*n-r*r)}}rm.prototype.isSphericalHarmonics3=!0;class im extends Bf{constructor(t=new rm,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}}im.prototype.isLightProbe=!0;class sm extends If{constructor(t){super(t),this.textures={}}load(t,e,n,r){const i=this,s=new Of(i.manager);s.setPath(i.path),s.setRequestHeader(i.requestHeader),s.setWithCredentials(i.withCredentials),s.load(t,(function(n){try{e(i.parse(JSON.parse(n)))}catch(s){r?r(s):console.error(s),i.manager.itemError(t)}}),n,r)}parse(t){const e=this.textures;function n(t){return void 0===e[t]&&console.warn("THREE.MaterialLoader: Undefined texture",t),e[t]}const r=new df[t.type];if(void 0!==t.uuid&&(r.uuid=t.uuid),void 0!==t.name&&(r.name=t.name),void 0!==t.color&&void 0!==r.color&&r.color.setHex(t.color),void 0!==t.roughness&&(r.roughness=t.roughness),void 0!==t.metalness&&(r.metalness=t.metalness),void 0!==t.sheen&&(r.sheen=t.sheen),void 0!==t.sheenColor&&(r.sheenColor=(new Mi).setHex(t.sheenColor)),void 0!==t.sheenRoughness&&(r.sheenRoughness=t.sheenRoughness),void 0!==t.emissive&&void 0!==r.emissive&&r.emissive.setHex(t.emissive),void 0!==t.specular&&void 0!==r.specular&&r.specular.setHex(t.specular),void 0!==t.specularIntensity&&(r.specularIntensity=t.specularIntensity),void 0!==t.specularColor&&void 0!==r.specularColor&&r.specularColor.setHex(t.specularColor),void 0!==t.shininess&&(r.shininess=t.shininess),void 0!==t.clearcoat&&(r.clearcoat=t.clearcoat),void 0!==t.clearcoatRoughness&&(r.clearcoatRoughness=t.clearcoatRoughness),void 0!==t.transmission&&(r.transmission=t.transmission),void 0!==t.thickness&&(r.thickness=t.thickness),void 0!==t.attenuationDistance&&(r.attenuationDistance=t.attenuationDistance),void 0!==t.attenuationColor&&void 0!==r.attenuationColor&&r.attenuationColor.setHex(t.attenuationColor),void 0!==t.fog&&(r.fog=t.fog),void 0!==t.flatShading&&(r.flatShading=t.flatShading),void 0!==t.blending&&(r.blending=t.blending),void 0!==t.combine&&(r.combine=t.combine),void 0!==t.side&&(r.side=t.side),void 0!==t.shadowSide&&(r.shadowSide=t.shadowSide),void 0!==t.opacity&&(r.opacity=t.opacity),void 0!==t.format&&(r.format=t.format),void 0!==t.transparent&&(r.transparent=t.transparent),void 0!==t.alphaTest&&(r.alphaTest=t.alphaTest),void 0!==t.depthTest&&(r.depthTest=t.depthTest),void 0!==t.depthWrite&&(r.depthWrite=t.depthWrite),void 0!==t.colorWrite&&(r.colorWrite=t.colorWrite),void 0!==t.stencilWrite&&(r.stencilWrite=t.stencilWrite),void 0!==t.stencilWriteMask&&(r.stencilWriteMask=t.stencilWriteMask),void 0!==t.stencilFunc&&(r.stencilFunc=t.stencilFunc),void 0!==t.stencilRef&&(r.stencilRef=t.stencilRef),void 0!==t.stencilFuncMask&&(r.stencilFuncMask=t.stencilFuncMask),void 0!==t.stencilFail&&(r.stencilFail=t.stencilFail),void 0!==t.stencilZFail&&(r.stencilZFail=t.stencilZFail),void 0!==t.stencilZPass&&(r.stencilZPass=t.stencilZPass),void 0!==t.wireframe&&(r.wireframe=t.wireframe),void 0!==t.wireframeLinewidth&&(r.wireframeLinewidth=t.wireframeLinewidth),void 0!==t.wireframeLinecap&&(r.wireframeLinecap=t.wireframeLinecap),void 0!==t.wireframeLinejoin&&(r.wireframeLinejoin=t.wireframeLinejoin),void 0!==t.rotation&&(r.rotation=t.rotation),1!==t.linewidth&&(r.linewidth=t.linewidth),void 0!==t.dashSize&&(r.dashSize=t.dashSize),void 0!==t.gapSize&&(r.gapSize=t.gapSize),void 0!==t.scale&&(r.scale=t.scale),void 0!==t.polygonOffset&&(r.polygonOffset=t.polygonOffset),void 0!==t.polygonOffsetFactor&&(r.polygonOffsetFactor=t.polygonOffsetFactor),void 0!==t.polygonOffsetUnits&&(r.polygonOffsetUnits=t.polygonOffsetUnits),void 0!==t.dithering&&(r.dithering=t.dithering),void 0!==t.alphaToCoverage&&(r.alphaToCoverage=t.alphaToCoverage),void 0!==t.premultipliedAlpha&&(r.premultipliedAlpha=t.premultipliedAlpha),void 0!==t.visible&&(r.visible=t.visible),void 0!==t.toneMapped&&(r.toneMapped=t.toneMapped),void 0!==t.userData&&(r.userData=t.userData),void 0!==t.vertexColors&&("number"===typeof t.vertexColors?r.vertexColors=t.vertexColors>0:r.vertexColors=t.vertexColors),void 0!==t.uniforms)for(const i in t.uniforms){const e=t.uniforms[i];switch(r.uniforms[i]={},e.type){case"t":r.uniforms[i].value=n(e.value);break;case"c":r.uniforms[i].value=(new Mi).setHex(e.value);break;case"v2":r.uniforms[i].value=(new Fn).fromArray(e.value);break;case"v3":r.uniforms[i].value=(new er).fromArray(e.value);break;case"v4":r.uniforms[i].value=(new Zn).fromArray(e.value);break;case"m3":r.uniforms[i].value=(new Un).fromArray(e.value);break;case"m4":r.uniforms[i].value=(new Ir).fromArray(e.value);break;default:r.uniforms[i].value=e.value}}if(void 0!==t.defines&&(r.defines=t.defines),void 0!==t.vertexShader&&(r.vertexShader=t.vertexShader),void 0!==t.fragmentShader&&(r.fragmentShader=t.fragmentShader),void 0!==t.extensions)for(const i in t.extensions)r.extensions[i]=t.extensions[i];if(void 0!==t.shading&&(r.flatShading=1===t.shading),void 0!==t.size&&(r.size=t.size),void 0!==t.sizeAttenuation&&(r.sizeAttenuation=t.sizeAttenuation),void 0!==t.map&&(r.map=n(t.map)),void 0!==t.matcap&&(r.matcap=n(t.matcap)),void 0!==t.alphaMap&&(r.alphaMap=n(t.alphaMap)),void 0!==t.bumpMap&&(r.bumpMap=n(t.bumpMap)),void 0!==t.bumpScale&&(r.bumpScale=t.bumpScale),void 0!==t.normalMap&&(r.normalMap=n(t.normalMap)),void 0!==t.normalMapType&&(r.normalMapType=t.normalMapType),void 0!==t.normalScale){let e=t.normalScale;!1===Array.isArray(e)&&(e=[e,e]),r.normalScale=(new Fn).fromArray(e)}return void 0!==t.displacementMap&&(r.displacementMap=n(t.displacementMap)),void 0!==t.displacementScale&&(r.displacementScale=t.displacementScale),void 0!==t.displacementBias&&(r.displacementBias=t.displacementBias),void 0!==t.roughnessMap&&(r.roughnessMap=n(t.roughnessMap)),void 0!==t.metalnessMap&&(r.metalnessMap=n(t.metalnessMap)),void 0!==t.emissiveMap&&(r.emissiveMap=n(t.emissiveMap)),void 0!==t.emissiveIntensity&&(r.emissiveIntensity=t.emissiveIntensity),void 0!==t.specularMap&&(r.specularMap=n(t.specularMap)),void 0!==t.specularIntensityMap&&(r.specularIntensityMap=n(t.specularIntensityMap)),void 0!==t.specularColorMap&&(r.specularColorMap=n(t.specularColorMap)),void 0!==t.envMap&&(r.envMap=n(t.envMap)),void 0!==t.envMapIntensity&&(r.envMapIntensity=t.envMapIntensity),void 0!==t.reflectivity&&(r.reflectivity=t.reflectivity),void 0!==t.refractionRatio&&(r.refractionRatio=t.refractionRatio),void 0!==t.lightMap&&(r.lightMap=n(t.lightMap)),void 0!==t.lightMapIntensity&&(r.lightMapIntensity=t.lightMapIntensity),void 0!==t.aoMap&&(r.aoMap=n(t.aoMap)),void 0!==t.aoMapIntensity&&(r.aoMapIntensity=t.aoMapIntensity),void 0!==t.gradientMap&&(r.gradientMap=n(t.gradientMap)),void 0!==t.clearcoatMap&&(r.clearcoatMap=n(t.clearcoatMap)),void 0!==t.clearcoatRoughnessMap&&(r.clearcoatRoughnessMap=n(t.clearcoatRoughnessMap)),void 0!==t.clearcoatNormalMap&&(r.clearcoatNormalMap=n(t.clearcoatNormalMap)),void 0!==t.clearcoatNormalScale&&(r.clearcoatNormalScale=(new Fn).fromArray(t.clearcoatNormalScale)),void 0!==t.transmissionMap&&(r.transmissionMap=n(t.transmissionMap)),void 0!==t.thicknessMap&&(r.thicknessMap=n(t.thicknessMap)),void 0!==t.sheenColorMap&&(r.sheenColorMap=n(t.sheenColorMap)),void 0!==t.sheenRoughnessMap&&(r.sheenRoughnessMap=n(t.sheenRoughnessMap)),r}setTextures(t){return this.textures=t,this}}class om{static decodeText(t){if("undefined"!==typeof TextDecoder)return(new TextDecoder).decode(t);let e="";for(let r=0,i=t.length;r<i;r++)e+=String.fromCharCode(t[r]);try{return decodeURIComponent(escape(e))}catch(n){return e}}static extractUrlBase(t){const e=t.lastIndexOf("/");return-1===e?"./":t.substr(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)}}class am extends Ui{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}}am.prototype.isInstancedBufferGeometry=!0;class cm extends If{constructor(t){super(t)}load(t,e,n,r){const i=this,s=new Of(i.manager);s.setPath(i.path),s.setRequestHeader(i.requestHeader),s.setWithCredentials(i.withCredentials),s.load(t,(function(n){try{e(i.parse(JSON.parse(n)))}catch(s){r?r(s):console.error(s),i.manager.itemError(t)}}),n,r)}parse(t){const e={},n={};function r(t,n){if(void 0!==e[n])return e[n];const r=t.interleavedBuffers,s=r[n],o=i(t,s.buffer),a=Gn(s.type,o),c=new dh(a,s.stride);return c.uuid=s.uuid,e[n]=c,c}function i(t,e){if(void 0!==n[e])return n[e];const r=t.arrayBuffers,i=r[e],s=new Uint32Array(i).buffer;return n[e]=s,s}const s=t.isInstancedBufferGeometry?new am:new Ui,o=t.data.index;if(void 0!==o){const t=Gn(o.type,o.array);s.setIndex(new Ai(t,1))}const a=t.data.attributes;for(const d in a){const e=a[d];let n;if(e.isInterleavedBufferAttribute){const i=r(t.data,e.data);n=new fh(i,e.itemSize,e.offset,e.normalized)}else{const t=Gn(e.type,e.array),r=e.isInstancedBufferAttribute?jh:Ai;n=new r(t,e.itemSize,e.normalized)}void 0!==e.name&&(n.name=e.name),void 0!==e.usage&&n.setUsage(e.usage),void 0!==e.updateRange&&(n.updateRange.offset=e.updateRange.offset,n.updateRange.count=e.updateRange.count),s.setAttribute(d,n)}const c=t.data.morphAttributes;if(c)for(const d in c){const e=c[d],n=[];for(let i=0,s=e.length;i<s;i++){const s=e[i];let o;if(s.isInterleavedBufferAttribute){const e=r(t.data,s.data);o=new fh(e,s.itemSize,s.offset,s.normalized)}else{const t=Gn(s.type,s.array);o=new Ai(t,s.itemSize,s.normalized)}void 0!==s.name&&(o.name=s.name),n.push(o)}s.morphAttributes[d]=n}const l=t.data.morphTargetsRelative;l&&(s.morphTargetsRelative=!0);const u=t.data.groups||t.data.drawcalls||t.data.offsets;if(void 0!==u)for(let d=0,p=u.length;d!==p;++d){const t=u[d];s.addGroup(t.start,t.count,t.materialIndex)}const h=t.data.boundingSphere;if(void 0!==h){const t=new er;void 0!==h.center&&t.fromArray(h.center),s.boundingSphere=new Mr(t,h.radius)}return t.name&&(s.name=t.name),t.userData&&(s.userData=t.userData),s}}class lm extends If{constructor(t){super(t)}load(t,e,n,r){const i=this,s=""===this.path?om.extractUrlBase(t):this.path;this.resourcePath=this.resourcePath||s;const o=new Of(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(t,(function(n){let s=null;try{s=JSON.parse(n)}catch(a){return void 0!==r&&r(a),void console.error("THREE:ObjectLoader: Can't parse "+t+".",a.message)}const o=s.metadata;void 0!==o&&void 0!==o.type&&"geometry"!==o.type.toLowerCase()?i.parse(s,e):console.error("THREE.ObjectLoader: Can't load "+t)}),n,r)}async loadAsync(t,e){const n=this,r=""===this.path?om.extractUrlBase(t):this.path;this.resourcePath=this.resourcePath||r;const i=new Of(this.manager);i.setPath(this.path),i.setRequestHeader(this.requestHeader),i.setWithCredentials(this.withCredentials);const s=await i.loadAsync(t,e),o=JSON.parse(s),a=o.metadata;if(void 0===a||void 0===a.type||"geometry"===a.type.toLowerCase())throw new Error("THREE.ObjectLoader: Can't load "+t);return await n.parseAsync(o)}parse(t,e){const n=this.parseAnimations(t.animations),r=this.parseShapes(t.shapes),i=this.parseGeometries(t.geometries,r),s=this.parseImages(t.images,(function(){void 0!==e&&e(c)})),o=this.parseTextures(t.textures,s),a=this.parseMaterials(t.materials,o),c=this.parseObject(t.object,i,a,o,n),l=this.parseSkeletons(t.skeletons,c);if(this.bindSkeletons(c,l),void 0!==e){let t=!1;for(const e in s)if(s[e]instanceof HTMLImageElement){t=!0;break}!1===t&&e(c)}return c}async parseAsync(t){const e=this.parseAnimations(t.animations),n=this.parseShapes(t.shapes),r=this.parseGeometries(t.geometries,n),i=await this.parseImagesAsync(t.images),s=this.parseTextures(t.textures,i),o=this.parseMaterials(t.materials,s),a=this.parseObject(t.object,r,o,s,e),c=this.parseSkeletons(t.skeletons,a);return this.bindSkeletons(a,c),a}parseShapes(t){const e={};if(void 0!==t)for(let n=0,r=t.length;n<r;n++){const r=(new rp).fromJSON(t[n]);e[r.uuid]=r}return e}parseSkeletons(t,e){const n={},r={};if(e.traverse((function(t){t.isBone&&(r[t.uuid]=t)})),void 0!==t)for(let i=0,s=t.length;i<s;i++){const e=(new Wh).fromJSON(t[i],r);n[e.uuid]=e}return n}parseGeometries(t,e){const n={};if(void 0!==t){const r=new cm;for(let i=0,s=t.length;i<s;i++){let s;const o=t[i];switch(o.type){case"BufferGeometry":case"InstancedBufferGeometry":s=r.parse(o);break;case"Geometry":console.error("THREE.ObjectLoader: The legacy Geometry type is no longer supported.");break;default:o.type in ef?s=ef[o.type].fromJSON(o,e):console.warn(`THREE.ObjectLoader: Unsupported geometry type "${o.type}"`)}s.uuid=o.uuid,void 0!==o.name&&(s.name=o.name),!0===s.isBufferGeometry&&void 0!==o.userData&&(s.userData=o.userData),n[o.uuid]=s}}return n}parseMaterials(t,e){const n={},r={};if(void 0!==t){const i=new sm;i.setTextures(e);for(let e=0,s=t.length;e<s;e++){const s=t[e];if("MultiMaterial"===s.type){const t=[];for(let e=0;e<s.materials.length;e++){const r=s.materials[e];void 0===n[r.uuid]&&(n[r.uuid]=i.parse(r)),t.push(n[r.uuid])}r[s.uuid]=t}else void 0===n[s.uuid]&&(n[s.uuid]=i.parse(s)),r[s.uuid]=n[s.uuid]}}return r}parseAnimations(t){const e={};if(void 0!==t)for(let n=0;n<t.length;n++){const r=t[n],i=Ef.parse(r);e[i.uuid]=i}return e}parseImages(t,e){const n=this,r={};let i;function s(t){return n.manager.itemStart(t),i.load(t,(function(){n.manager.itemEnd(t)}),void 0,(function(){n.manager.itemError(t),n.manager.itemEnd(t)}))}function o(t){if("string"===typeof t){const e=t,r=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(e)?e:n.resourcePath+e;return s(r)}return t.data?{data:Gn(t.type,t.data),width:t.width,height:t.height}:null}if(void 0!==t&&t.length>0){const n=new Cf(e);i=new kf(n),i.setCrossOrigin(this.crossOrigin);for(let e=0,i=t.length;e<i;e++){const n=t[e],i=n.url;if(Array.isArray(i)){r[n.uuid]=[];for(let t=0,e=i.length;t<e;t++){const e=i[t],s=o(e);null!==s&&(s instanceof HTMLImageElement?r[n.uuid].push(s):r[n.uuid].push(new Hh(s.data,s.width,s.height)))}}else{const t=o(n.url);null!==t&&(r[n.uuid]=t)}}}return r}async parseImagesAsync(t){const e=this,n={};let r;async function i(t){if("string"===typeof t){const n=t,i=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(n)?n:e.resourcePath+n;return await r.loadAsync(i)}return t.data?{data:Gn(t.type,t.data),width:t.width,height:t.height}:null}if(void 0!==t&&t.length>0){r=new kf(this.manager),r.setCrossOrigin(this.crossOrigin);for(let e=0,r=t.length;e<r;e++){const r=t[e],s=r.url;if(Array.isArray(s)){n[r.uuid]=[];for(let t=0,e=s.length;t<e;t++){const e=s[t],o=await i(e);null!==o&&(o instanceof HTMLImageElement?n[r.uuid].push(o):n[r.uuid].push(new Hh(o.data,o.width,o.height)))}}else{const t=await i(r.url);null!==t&&(n[r.uuid]=t)}}}return n}parseTextures(t,e){function n(t,e){return"number"===typeof t?t:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",t),e[t])}const r={};if(void 0!==t)for(let i=0,s=t.length;i<s;i++){const s=t[i];let o;void 0===s.image&&console.warn('THREE.ObjectLoader: No "image" specified for',s.uuid),void 0===e[s.image]&&console.warn("THREE.ObjectLoader: Undefined image",s.image);const a=e[s.image];Array.isArray(a)?(o=new ys(a),6===a.length&&(o.needsUpdate=!0)):(o=a&&a.data?new Hh(a.data,a.width,a.height):new Yn(a),a&&(o.needsUpdate=!0)),o.uuid=s.uuid,void 0!==s.name&&(o.name=s.name),void 0!==s.mapping&&(o.mapping=n(s.mapping,um)),void 0!==s.offset&&o.offset.fromArray(s.offset),void 0!==s.repeat&&o.repeat.fromArray(s.repeat),void 0!==s.center&&o.center.fromArray(s.center),void 0!==s.rotation&&(o.rotation=s.rotation),void 0!==s.wrap&&(o.wrapS=n(s.wrap[0],hm),o.wrapT=n(s.wrap[1],hm)),void 0!==s.format&&(o.format=s.format),void 0!==s.type&&(o.type=s.type),void 0!==s.encoding&&(o.encoding=s.encoding),void 0!==s.minFilter&&(o.minFilter=n(s.minFilter,dm)),void 0!==s.magFilter&&(o.magFilter=n(s.magFilter,dm)),void 0!==s.anisotropy&&(o.anisotropy=s.anisotropy),void 0!==s.flipY&&(o.flipY=s.flipY),void 0!==s.premultiplyAlpha&&(o.premultiplyAlpha=s.premultiplyAlpha),void 0!==s.unpackAlignment&&(o.unpackAlignment=s.unpackAlignment),void 0!==s.userData&&(o.userData=s.userData),r[s.uuid]=o}return r}parseObject(t,e,n,r,i){let s,o,a;function c(t){return void 0===e[t]&&console.warn("THREE.ObjectLoader: Undefined geometry",t),e[t]}function l(t){if(void 0!==t){if(Array.isArray(t)){const e=[];for(let r=0,i=t.length;r<i;r++){const i=t[r];void 0===n[i]&&console.warn("THREE.ObjectLoader: Undefined material",i),e.push(n[i])}return e}return void 0===n[t]&&console.warn("THREE.ObjectLoader: Undefined material",t),n[t]}}function u(t){return void 0===r[t]&&console.warn("THREE.ObjectLoader: Undefined texture",t),r[t]}switch(t.type){case"Scene":s=new hh,void 0!==t.background&&(Number.isInteger(t.background)?s.background=new Mi(t.background):s.background=u(t.background)),void 0!==t.environment&&(s.environment=u(t.environment)),void 0!==t.fog&&("Fog"===t.fog.type?s.fog=new uh(t.fog.color,t.fog.near,t.fog.far):"FogExp2"===t.fog.type&&(s.fog=new lh(t.fog.color,t.fog.density)));break;case"PerspectiveCamera":s=new fs(t.fov,t.aspect,t.near,t.far),void 0!==t.focus&&(s.focus=t.focus),void 0!==t.zoom&&(s.zoom=t.zoom),void 0!==t.filmGauge&&(s.filmGauge=t.filmGauge),void 0!==t.filmOffset&&(s.filmOffset=t.filmOffset),void 0!==t.view&&(s.view=Object.assign({},t.view));break;case"OrthographicCamera":s=new dc(t.left,t.right,t.top,t.bottom,t.near,t.far),void 0!==t.zoom&&(s.zoom=t.zoom),void 0!==t.view&&(s.view=Object.assign({},t.view));break;case"AmbientLight":s=new em(t.color,t.intensity);break;case"DirectionalLight":s=new tm(t.color,t.intensity);break;case"PointLight":s=new $f(t.color,t.intensity,t.distance,t.decay);break;case"RectAreaLight":s=new nm(t.color,t.intensity,t.width,t.height);break;case"SpotLight":s=new Xf(t.color,t.intensity,t.distance,t.angle,t.penumbra,t.decay);break;case"HemisphereLight":s=new Hf(t.color,t.groundColor,t.intensity);break;case"LightProbe":s=(new im).fromJSON(t);break;case"SkinnedMesh":o=c(t.geometry),a=l(t.material),s=new Uh(o,a),void 0!==t.bindMode&&(s.bindMode=t.bindMode),void 0!==t.bindMatrix&&s.bindMatrix.fromArray(t.bindMatrix),void 0!==t.skeleton&&(s.skeleton=t.skeleton);break;case"Mesh":o=c(t.geometry),a=l(t.material),s=new rs(o,a);break;case"InstancedMesh":o=c(t.geometry),a=l(t.material);const e=t.count,n=t.instanceMatrix,r=t.instanceColor;s=new Zh(o,a,e),s.instanceMatrix=new jh(new Float32Array(n.array),16),void 0!==r&&(s.instanceColor=new jh(new Float32Array(r.array),r.itemSize));break;case"LOD":s=new Nh;break;case"Line":s=new rd(c(t.geometry),l(t.material));break;case"LineLoop":s=new ad(c(t.geometry),l(t.material));break;case"LineSegments":s=new od(c(t.geometry),l(t.material));break;case"PointCloud":case"Points":s=new pd(c(t.geometry),l(t.material));break;case"Sprite":s=new Rh(l(t.material));break;case"Group":s=new th;break;case"Bone":s=new Bh;break;default:s=new ri}if(s.uuid=t.uuid,void 0!==t.name&&(s.name=t.name),void 0!==t.matrix?(s.matrix.fromArray(t.matrix),void 0!==t.matrixAutoUpdate&&(s.matrixAutoUpdate=t.matrixAutoUpdate),s.matrixAutoUpdate&&s.matrix.decompose(s.position,s.quaternion,s.scale)):(void 0!==t.position&&s.position.fromArray(t.position),void 0!==t.rotation&&s.rotation.fromArray(t.rotation),void 0!==t.quaternion&&s.quaternion.fromArray(t.quaternion),void 0!==t.scale&&s.scale.fromArray(t.scale)),void 0!==t.castShadow&&(s.castShadow=t.castShadow),void 0!==t.receiveShadow&&(s.receiveShadow=t.receiveShadow),t.shadow&&(void 0!==t.shadow.bias&&(s.shadow.bias=t.shadow.bias),void 0!==t.shadow.normalBias&&(s.shadow.normalBias=t.shadow.normalBias),void 0!==t.shadow.radius&&(s.shadow.radius=t.shadow.radius),void 0!==t.shadow.mapSize&&s.shadow.mapSize.fromArray(t.shadow.mapSize),void 0!==t.shadow.camera&&(s.shadow.camera=this.parseObject(t.shadow.camera))),void 0!==t.visible&&(s.visible=t.visible),void 0!==t.frustumCulled&&(s.frustumCulled=t.frustumCulled),void 0!==t.renderOrder&&(s.renderOrder=t.renderOrder),void 0!==t.userData&&(s.userData=t.userData),void 0!==t.layers&&(s.layers.mask=t.layers),void 0!==t.children){const o=t.children;for(let t=0;t<o.length;t++)s.add(this.parseObject(o[t],e,n,r,i))}if(void 0!==t.animations){const e=t.animations;for(let t=0;t<e.length;t++){const n=e[t];s.animations.push(i[n])}}if("LOD"===t.type){void 0!==t.autoUpdate&&(s.autoUpdate=t.autoUpdate);const e=t.levels;for(let t=0;t<e.length;t++){const n=e[t],r=s.getObjectByProperty("uuid",n.object);void 0!==r&&s.addLevel(r,n.distance)}}return s}bindSkeletons(t,e){0!==Object.keys(e).length&&t.traverse((function(t){if(!0===t.isSkinnedMesh&&void 0!==t.skeleton){const n=e[t.skeleton];void 0===n?console.warn("THREE.ObjectLoader: No skeleton found with UUID:",t.skeleton):t.bind(n,t.bindMatrix)}}))}setTexturePath(t){return console.warn("THREE.ObjectLoader: .setTexturePath() has been renamed to .setResourcePath()."),this.setResourcePath(t)}}const um={UVMapping:at,CubeReflectionMapping:ct,CubeRefractionMapping:lt,EquirectangularReflectionMapping:ut,EquirectangularRefractionMapping:ht,CubeUVReflectionMapping:dt,CubeUVRefractionMapping:pt},hm={RepeatWrapping:ft,ClampToEdgeWrapping:mt,MirroredRepeatWrapping:gt},dm={NearestFilter:vt,NearestMipmapNearestFilter:yt,NearestMipmapLinearFilter:xt,LinearFilter:bt,LinearMipmapNearestFilter:wt,LinearMipmapLinearFilter:_t};class pm extends If{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,r){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const i=this,s=Rf.get(t);if(void 0!==s)return i.manager.itemStart(t),setTimeout((function(){e&&e(s),i.manager.itemEnd(t)}),0),s;const o={};o.credentials="anonymous"===this.crossOrigin?"same-origin":"include",o.headers=this.requestHeader,fetch(t,o).then((function(t){return t.blob()})).then((function(t){return createImageBitmap(t,Object.assign(i.options,{colorSpaceConversion:"none"}))})).then((function(n){Rf.add(t,n),e&&e(n),i.manager.itemEnd(t)})).catch((function(e){r&&r(e),i.manager.itemError(t),i.manager.itemEnd(t)})),i.manager.itemStart(t)}}let fm;pm.prototype.isImageBitmapLoader=!0;const mm={getContext:function(){return void 0===fm&&(fm=new(window.AudioContext||window.webkitAudioContext)),fm},setContext:function(t){fm=t}};class gm extends If{constructor(t){super(t)}load(t,e,n,r){const i=this,s=new Of(this.manager);s.setResponseType("arraybuffer"),s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(t,(function(n){try{const t=n.slice(0),r=mm.getContext();r.decodeAudioData(t,(function(t){e(t)}))}catch(s){r?r(s):console.error(s),i.manager.itemError(t)}}),n,r)}}class vm extends im{constructor(t,e,n=1){super(void 0,n);const r=(new Mi).set(t),i=(new Mi).set(e),s=new er(r.r,r.g,r.b),o=new er(i.r,i.g,i.b),a=Math.sqrt(Math.PI),c=a*Math.sqrt(.75);this.sh.coefficients[0].copy(s).add(o).multiplyScalar(a),this.sh.coefficients[1].copy(s).sub(o).multiplyScalar(c)}}vm.prototype.isHemisphereLightProbe=!0;class ym extends im{constructor(t,e=1){super(void 0,e);const n=(new Mi).set(t);this.sh.coefficients[0].set(n.r,n.g,n.b).multiplyScalar(2*Math.sqrt(Math.PI))}}ym.prototype.isAmbientLightProbe=!0;class xm extends ri{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}}class bm{constructor(t,e=2048){this.analyser=t.context.createAnalyser(),this.analyser.fftSize=e,this.data=new Uint8Array(this.analyser.frequencyBinCount),t.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let t=0;const e=this.getFrequencyData();for(let n=0;n<e.length;n++)t+=e[n];return t/e.length}}class wm{constructor(t,e,n){let r,i,s;switch(this.binding=t,this.valueSize=n,e){case"quaternion":r=this._slerp,i=this._slerpAdditive,s=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(6*n),this._workIndex=5;break;case"string":case"bool":r=this._select,i=this._select,s=this._setAdditiveIdentityOther,this.buffer=new Array(5*n);break;default:r=this._lerp,i=this._lerpAdditive,s=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(5*n)}this._mixBufferRegion=r,this._mixBufferRegionAdditive=i,this._setIdentity=s,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(t,e){const n=this.buffer,r=this.valueSize,i=t*r+r;let s=this.cumulativeWeight;if(0===s){for(let t=0;t!==r;++t)n[i+t]=n[t];s=e}else{s+=e;const t=e/s;this._mixBufferRegion(n,i,0,t,r)}this.cumulativeWeight=s}accumulateAdditive(t){const e=this.buffer,n=this.valueSize,r=n*this._addIndex;0===this.cumulativeWeightAdditive&&this._setIdentity(),this._mixBufferRegionAdditive(e,r,0,t,n),this.cumulativeWeightAdditive+=t}apply(t){const e=this.valueSize,n=this.buffer,r=t*e+e,i=this.cumulativeWeight,s=this.cumulativeWeightAdditive,o=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,i<1){const t=e*this._origIndex;this._mixBufferRegion(n,r,t,1-i,e)}s>0&&this._mixBufferRegionAdditive(n,r,this._addIndex*e,1,e);for(let a=e,c=e+e;a!==c;++a)if(n[a]!==n[a+e]){o.setValue(n,r);break}}saveOriginalState(){const t=this.binding,e=this.buffer,n=this.valueSize,r=n*this._origIndex;t.getValue(e,r);for(let i=n,s=r;i!==s;++i)e[i]=e[r+i%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const t=3*this.valueSize;this.binding.setValue(this.buffer,t)}_setAdditiveIdentityNumeric(){const t=this._addIndex*this.valueSize,e=t+this.valueSize;for(let n=t;n<e;n++)this.buffer[n]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){const t=this._origIndex*this.valueSize,e=this._addIndex*this.valueSize;for(let n=0;n<this.valueSize;n++)this.buffer[e+n]=this.buffer[t+n]}_select(t,e,n,r,i){if(r>=.5)for(let s=0;s!==i;++s)t[e+s]=t[n+s]}_slerp(t,e,n,r){tr.slerpFlat(t,e,t,e,t,n,r)}_slerpAdditive(t,e,n,r,i){const s=this._workIndex*i;tr.multiplyQuaternionsFlat(t,s,t,e,t,n),tr.slerpFlat(t,e,t,e,t,s,r)}_lerp(t,e,n,r,i){const s=1-r;for(let o=0;o!==i;++o){const i=e+o;t[i]=t[i]*s+t[n+o]*r}}_lerpAdditive(t,e,n,r,i){for(let s=0;s!==i;++s){const i=e+s;t[i]=t[i]+t[n+s]*r}}}const _m="\\[\\]\\.:\\/",Mm=new RegExp("["+_m+"]","g"),Sm="[^"+_m+"]",Tm="[^"+_m.replace("\\.","")+"]",Em=/((?:WC+[\/:])*)/.source.replace("WC",Sm),Am=/(WCOD+)?/.source.replace("WCOD",Tm),Lm=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Sm),Rm=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Sm),Cm=new RegExp("^"+Em+Am+Lm+Rm+"$"),Pm=["material","materials","bones"];class Im{constructor(t,e,n){const r=n||Nm.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,r)}getValue(t,e){this.bind();const n=this._targetGroup.nCachedObjects_,r=this._bindings[n];void 0!==r&&r.getValue(t,e)}setValue(t,e){const n=this._bindings;for(let r=this._targetGroup.nCachedObjects_,i=n.length;r!==i;++r)n[r].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()}}class Nm{constructor(t,e,n){this.path=e,this.parsedPath=n||Nm.parseTrackName(e),this.node=Nm.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 Nm.Composite(t,e,n):new Nm(t,e,n)}static sanitizeNodeName(t){return t.replace(/\s/g,"_").replace(Mm,"")}static parseTrackName(t){const e=Cm.exec(t);if(!e)throw new Error("PropertyBinding: Cannot parse trackName: "+t);const n={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},r=n.nodeName&&n.nodeName.lastIndexOf(".");if(void 0!==r&&-1!==r){const t=n.nodeName.substring(r+1);-1!==Pm.indexOf(t)&&(n.nodeName=n.nodeName.substring(0,r),n.objectName=t)}if(null===n.propertyName||0===n.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return n}static findNode(t,e){if(!e||""===e||"."===e||-1===e||e===t.name||e===t.uuid)return t;if(t.skeleton){const n=t.skeleton.getBoneByName(e);if(void 0!==n)return n}if(t.children){const n=function(t){for(let r=0;r<t.length;r++){const i=t[r];if(i.name===e||i.uuid===e)return i;const s=n(i.children);if(s)return s}return null},r=n(t.children);if(r)return r}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 r=0,i=n.length;r!==i;++r)t[e++]=n[r]}_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 r=0,i=n.length;r!==i;++r)n[r]=t[e++]}_setValue_array_setNeedsUpdate(t,e){const n=this.resolvedProperty;for(let r=0,i=n.length;r!==i;++r)n[r]=t[e++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(t,e){const n=this.resolvedProperty;for(let r=0,i=n.length;r!==i;++r)n[r]=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,r=e.propertyName;let i=e.propertyIndex;if(t||(t=Nm.findNode(this.rootNode,e.nodeName)||this.rootNode,this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t)return void console.error("THREE.PropertyBinding: Trying to update node for track: "+this.path+" but it wasn't found.");if(n){let r=e.objectIndex;switch(n){case"materials":if(!t.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!t.material.materials)return void console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);t=t.material.materials;break;case"bones":if(!t.skeleton)return void console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);t=t.skeleton.bones;for(let e=0;e<t.length;e++)if(t[e].name===r){r=e;break}break;default:if(void 0===t[n])return void console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);t=t[n]}if(void 0!==r){if(void 0===t[r])return void console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,t);t=t[r]}}const s=t[r];if(void 0===s){const n=e.nodeName;return void console.error("THREE.PropertyBinding: Trying to update property for track: "+n+"."+r+" but it wasn't found.",t)}let o=this.Versioning.None;this.targetObject=t,void 0!==t.needsUpdate?o=this.Versioning.NeedsUpdate:void 0!==t.matrixWorldNeedsUpdate&&(o=this.Versioning.MatrixWorldNeedsUpdate);let a=this.BindingType.Direct;if(void 0!==i){if("morphTargetInfluences"===r){if(!t.geometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);if(!t.geometry.isBufferGeometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences on THREE.Geometry. Use THREE.BufferGeometry instead.",this);if(!t.geometry.morphAttributes)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);void 0!==t.morphTargetDictionary[i]&&(i=t.morphTargetDictionary[i])}a=this.BindingType.ArrayElement,this.resolvedProperty=s,this.propertyIndex=i}else void 0!==s.fromArray&&void 0!==s.toArray?(a=this.BindingType.HasFromToArray,this.resolvedProperty=s):Array.isArray(s)?(a=this.BindingType.EntireArray,this.resolvedProperty=s):this.propertyName=r;this.getValue=this.GetterByBindingType[a],this.setValue=this.SetterByBindingTypeAndVersioning[a][o]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}Nm.Composite=Im,Nm.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Nm.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},Nm.prototype.GetterByBindingType=[Nm.prototype._getValue_direct,Nm.prototype._getValue_array,Nm.prototype._getValue_arrayElement,Nm.prototype._getValue_toArray],Nm.prototype.SetterByBindingTypeAndVersioning=[[Nm.prototype._setValue_direct,Nm.prototype._setValue_direct_setNeedsUpdate,Nm.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Nm.prototype._setValue_array,Nm.prototype._setValue_array_setNeedsUpdate,Nm.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Nm.prototype._setValue_arrayElement,Nm.prototype._setValue_arrayElement_setNeedsUpdate,Nm.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Nm.prototype._setValue_fromArray,Nm.prototype._setValue_fromArray_setNeedsUpdate,Nm.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class Om{constructor(){this.uuid=vn(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;const t={};this._indicesByUUID=t;for(let n=0,r=arguments.length;n!==r;++n)t[arguments[n].uuid]=n;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};const e=this;this.stats={objects:{get total(){return e._objects.length},get inUse(){return this.total-e.nCachedObjects_}},get bindingsPerObject(){return e._bindings.length}}}add(){const t=this._objects,e=this._indicesByUUID,n=this._paths,r=this._parsedPaths,i=this._bindings,s=i.length;let o=void 0,a=t.length,c=this.nCachedObjects_;for(let l=0,u=arguments.length;l!==u;++l){const u=arguments[l],h=u.uuid;let d=e[h];if(void 0===d){d=a++,e[h]=d,t.push(u);for(let t=0,e=s;t!==e;++t)i[t].push(new Nm(u,n[t],r[t]))}else if(d<c){o=t[d];const a=--c,l=t[a];e[l.uuid]=d,t[d]=l,e[h]=a,t[a]=u;for(let t=0,e=s;t!==e;++t){const e=i[t],s=e[a];let o=e[d];e[d]=s,void 0===o&&(o=new Nm(u,n[t],r[t])),e[a]=o}}else t[d]!==o&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=c}remove(){const t=this._objects,e=this._indicesByUUID,n=this._bindings,r=n.length;let i=this.nCachedObjects_;for(let s=0,o=arguments.length;s!==o;++s){const o=arguments[s],a=o.uuid,c=e[a];if(void 0!==c&&c>=i){const s=i++,l=t[s];e[l.uuid]=c,t[c]=l,e[a]=s,t[s]=o;for(let t=0,e=r;t!==e;++t){const e=n[t],r=e[s],i=e[c];e[c]=r,e[s]=i}}}this.nCachedObjects_=i}uncache(){const t=this._objects,e=this._indicesByUUID,n=this._bindings,r=n.length;let i=this.nCachedObjects_,s=t.length;for(let o=0,a=arguments.length;o!==a;++o){const a=arguments[o],c=a.uuid,l=e[c];if(void 0!==l)if(delete e[c],l<i){const o=--i,a=t[o],c=--s,u=t[c];e[a.uuid]=l,t[l]=a,e[u.uuid]=o,t[o]=u,t.pop();for(let t=0,e=r;t!==e;++t){const e=n[t],r=e[o],i=e[c];e[l]=r,e[o]=i,e.pop()}}else{const i=--s,o=t[i];i>0&&(e[o.uuid]=l),t[l]=o,t.pop();for(let t=0,e=r;t!==e;++t){const e=n[t];e[l]=e[i],e.pop()}}}this.nCachedObjects_=i}subscribe_(t,e){const n=this._bindingsIndicesByPath;let r=n[t];const i=this._bindings;if(void 0!==r)return i[r];const s=this._paths,o=this._parsedPaths,a=this._objects,c=a.length,l=this.nCachedObjects_,u=new Array(c);r=i.length,n[t]=r,s.push(t),o.push(e),i.push(u);for(let h=l,d=a.length;h!==d;++h){const n=a[h];u[h]=new Nm(n,t,e)}return u}unsubscribe_(t){const e=this._bindingsIndicesByPath,n=e[t];if(void 0!==n){const r=this._paths,i=this._parsedPaths,s=this._bindings,o=s.length-1,a=s[o],c=t[o];e[c]=n,s[n]=a,s.pop(),i[n]=i[o],i.pop(),r[n]=r[o],r.pop()}}}Om.prototype.isAnimationObjectGroup=!0;class Dm{constructor(t,e,n=null,r=e.blendMode){this._mixer=t,this._clip=e,this._localRoot=n,this.blendMode=r;const i=e.tracks,s=i.length,o=new Array(s),a={endingStart:He,endingEnd:He};for(let c=0;c!==s;++c){const t=i[c].createInterpolant(null);o[c]=t,t.settings=a}this._interpolantSettings=a,this._interpolants=o,this._propertyBindings=new Array(s),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=ke,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(t){return this._startTime=t,this}setLoop(t,e){return this.loop=t,this.repetitions=e,this}setEffectiveWeight(t){return this.weight=t,this._effectiveWeight=this.enabled?t:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(t){return this._scheduleFading(t,0,1)}fadeOut(t){return this._scheduleFading(t,1,0)}crossFadeFrom(t,e,n){if(t.fadeOut(e),this.fadeIn(e),n){const n=this._clip.duration,r=t._clip.duration,i=r/n,s=n/r;t.warp(1,i,e),this.warp(s,1,e)}return this}crossFadeTo(t,e,n){return t.crossFadeFrom(this,e,n)}stopFading(){const t=this._weightInterpolant;return null!==t&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}setEffectiveTimeScale(t){return this.timeScale=t,this._effectiveTimeScale=this.paused?0:t,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(t){return this.timeScale=this._clip.duration/t,this.stopWarping()}syncWith(t){return this.time=t.time,this.timeScale=t.timeScale,this.stopWarping()}halt(t){return this.warp(this._effectiveTimeScale,0,t)}warp(t,e,n){const r=this._mixer,i=r.time,s=this.timeScale;let o=this._timeScaleInterpolant;null===o&&(o=r._lendControlInterpolant(),this._timeScaleInterpolant=o);const a=o.parameterPositions,c=o.sampleValues;return a[0]=i,a[1]=i+n,c[0]=t/s,c[1]=e/s,this}stopWarping(){const t=this._timeScaleInterpolant;return null!==t&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(t,e,n,r){if(!this.enabled)return void this._updateWeight(t);const i=this._startTime;if(null!==i){const r=(t-i)*n;if(r<0||0===n)return;this._startTime=null,e=n*r}e*=this._updateTimeScale(t);const s=this._updateTime(e),o=this._updateWeight(t);if(o>0){const t=this._interpolants,e=this._propertyBindings;switch(this.blendMode){case je:for(let n=0,r=t.length;n!==r;++n)t[n].evaluate(s),e[n].accumulateAdditive(o);break;case We:default:for(let n=0,i=t.length;n!==i;++n)t[n].evaluate(s),e[n].accumulate(r,o)}}}_updateWeight(t){let e=0;if(this.enabled){e=this.weight;const n=this._weightInterpolant;if(null!==n){const r=n.evaluate(t)[0];e*=r,t>n.parameterPositions[1]&&(this.stopFading(),0===r&&(this.enabled=!1))}}return this._effectiveWeight=e,e}_updateTimeScale(t){let e=0;if(!this.paused){e=this.timeScale;const n=this._timeScaleInterpolant;if(null!==n){const r=n.evaluate(t)[0];e*=r,t>n.parameterPositions[1]&&(this.stopWarping(),0===e?this.paused=!0:this.timeScale=e)}}return this._effectiveTimeScale=e,e}_updateTime(t){const e=this._clip.duration,n=this.loop;let r=this.time+t,i=this._loopCount;const s=n===ze;if(0===t)return-1===i?r:s&&1===(1&i)?e-r:r;if(n===De){-1===i&&(this._loopCount=0,this._setEndings(!0,!0,!1));t:{if(r>=e)r=e;else{if(!(r<0)){this.time=r;break t}r=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:t<0?-1:1})}}else{if(-1===i&&(t>=0?(i=0,this._setEndings(!0,0===this.repetitions,s)):this._setEndings(0===this.repetitions,!0,s)),r>=e||r<0){const n=Math.floor(r/e);r-=e*n,i+=Math.abs(n);const o=this.repetitions-i;if(o<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,r=t>0?e:0,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:t>0?1:-1});else{if(1===o){const e=t<0;this._setEndings(e,!e,s)}else this._setEndings(!1,!1,s);this._loopCount=i,this.time=r,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:n})}}else this.time=r;if(s&&1===(1&i))return e-r}return r}_setEndings(t,e,n){const r=this._interpolantSettings;n?(r.endingStart=Ge,r.endingEnd=Ge):(r.endingStart=t?this.zeroSlopeAtStart?Ge:He:Ve,r.endingEnd=e?this.zeroSlopeAtEnd?Ge:He:Ve)}_scheduleFading(t,e,n){const r=this._mixer,i=r.time;let s=this._weightInterpolant;null===s&&(s=r._lendControlInterpolant(),this._weightInterpolant=s);const o=s.parameterPositions,a=s.sampleValues;return o[0]=i,a[0]=e,o[1]=i+t,a[1]=n,this}}class km extends dn{constructor(t){super(),this._root=t,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(t,e){const n=t._localRoot||this._root,r=t._clip.tracks,i=r.length,s=t._propertyBindings,o=t._interpolants,a=n.uuid,c=this._bindingsByRootAndName;let l=c[a];void 0===l&&(l={},c[a]=l);for(let u=0;u!==i;++u){const t=r[u],i=t.name;let c=l[i];if(void 0!==c)s[u]=c;else{if(c=s[u],void 0!==c){null===c._cacheIndex&&(++c.referenceCount,this._addInactiveBinding(c,a,i));continue}const r=e&&e._propertyBindings[u].binding.parsedPath;c=new wm(Nm.create(n,i,r),t.ValueTypeName,t.getValueSize()),++c.referenceCount,this._addInactiveBinding(c,a,i),s[u]=c}o[u].resultBuffer=c.buffer}}_activateAction(t){if(!this._isActiveAction(t)){if(null===t._cacheIndex){const e=(t._localRoot||this._root).uuid,n=t._clip.uuid,r=this._actionsByClip[n];this._bindAction(t,r&&r.knownActions[0]),this._addInactiveAction(t,n,e)}const e=t._propertyBindings;for(let t=0,n=e.length;t!==n;++t){const n=e[t];0===n.useCount++&&(this._lendBinding(n),n.saveOriginalState())}this._lendAction(t)}}_deactivateAction(t){if(this._isActiveAction(t)){const e=t._propertyBindings;for(let t=0,n=e.length;t!==n;++t){const n=e[t];0===--n.useCount&&(n.restoreOriginalState(),this._takeBackBinding(n))}this._takeBackAction(t)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const t=this;this.stats={actions:{get total(){return t._actions.length},get inUse(){return t._nActiveActions}},bindings:{get total(){return t._bindings.length},get inUse(){return t._nActiveBindings}},controlInterpolants:{get total(){return t._controlInterpolants.length},get inUse(){return t._nActiveControlInterpolants}}}}_isActiveAction(t){const e=t._cacheIndex;return null!==e&&e<this._nActiveActions}_addInactiveAction(t,e,n){const r=this._actions,i=this._actionsByClip;let s=i[e];if(void 0===s)s={knownActions:[t],actionByRoot:{}},t._byClipCacheIndex=0,i[e]=s;else{const e=s.knownActions;t._byClipCacheIndex=e.length,e.push(t)}t._cacheIndex=r.length,r.push(t),s.actionByRoot[n]=t}_removeInactiveAction(t){const e=this._actions,n=e[e.length-1],r=t._cacheIndex;n._cacheIndex=r,e[r]=n,e.pop(),t._cacheIndex=null;const i=t._clip.uuid,s=this._actionsByClip,o=s[i],a=o.knownActions,c=a[a.length-1],l=t._byClipCacheIndex;c._byClipCacheIndex=l,a[l]=c,a.pop(),t._byClipCacheIndex=null;const u=o.actionByRoot,h=(t._localRoot||this._root).uuid;delete u[h],0===a.length&&delete s[i],this._removeInactiveBindingsForAction(t)}_removeInactiveBindingsForAction(t){const e=t._propertyBindings;for(let n=0,r=e.length;n!==r;++n){const t=e[n];0===--t.referenceCount&&this._removeInactiveBinding(t)}}_lendAction(t){const e=this._actions,n=t._cacheIndex,r=this._nActiveActions++,i=e[r];t._cacheIndex=r,e[r]=t,i._cacheIndex=n,e[n]=i}_takeBackAction(t){const e=this._actions,n=t._cacheIndex,r=--this._nActiveActions,i=e[r];t._cacheIndex=r,e[r]=t,i._cacheIndex=n,e[n]=i}_addInactiveBinding(t,e,n){const r=this._bindingsByRootAndName,i=this._bindings;let s=r[e];void 0===s&&(s={},r[e]=s),s[n]=t,t._cacheIndex=i.length,i.push(t)}_removeInactiveBinding(t){const e=this._bindings,n=t.binding,r=n.rootNode.uuid,i=n.path,s=this._bindingsByRootAndName,o=s[r],a=e[e.length-1],c=t._cacheIndex;a._cacheIndex=c,e[c]=a,e.pop(),delete o[i],0===Object.keys(o).length&&delete s[r]}_lendBinding(t){const e=this._bindings,n=t._cacheIndex,r=this._nActiveBindings++,i=e[r];t._cacheIndex=r,e[r]=t,i._cacheIndex=n,e[n]=i}_takeBackBinding(t){const e=this._bindings,n=t._cacheIndex,r=--this._nActiveBindings,i=e[r];t._cacheIndex=r,e[r]=t,i._cacheIndex=n,e[n]=i}_lendControlInterpolant(){const t=this._controlInterpolants,e=this._nActiveControlInterpolants++;let n=t[e];return void 0===n&&(n=new gf(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer),n.__cacheIndex=e,t[e]=n),n}_takeBackControlInterpolant(t){const e=this._controlInterpolants,n=t.__cacheIndex,r=--this._nActiveControlInterpolants,i=e[r];t.__cacheIndex=r,e[r]=t,i.__cacheIndex=n,e[n]=i}clipAction(t,e,n){const r=e||this._root,i=r.uuid;let s="string"===typeof t?Ef.findByName(r,t):t;const o=null!==s?s.uuid:t,a=this._actionsByClip[o];let c=null;if(void 0===n&&(n=null!==s?s.blendMode:We),void 0!==a){const t=a.actionByRoot[i];if(void 0!==t&&t.blendMode===n)return t;c=a.knownActions[0],null===s&&(s=c._clip)}if(null===s)return null;const l=new Dm(this,s,e,n);return this._bindAction(l,c),this._addInactiveAction(l,o,i),l}existingAction(t,e){const n=e||this._root,r=n.uuid,i="string"===typeof t?Ef.findByName(n,t):t,s=i?i.uuid:t,o=this._actionsByClip[s];return void 0!==o&&o.actionByRoot[r]||null}stopAllAction(){const t=this._actions,e=this._nActiveActions;for(let n=e-1;n>=0;--n)t[n].stop();return this}update(t){t*=this.timeScale;const e=this._actions,n=this._nActiveActions,r=this.time+=t,i=Math.sign(t),s=this._accuIndex^=1;for(let c=0;c!==n;++c){const n=e[c];n._update(r,t,i,s)}const o=this._bindings,a=this._nActiveBindings;for(let c=0;c!==a;++c)o[c].apply(s);return this}setTime(t){this.time=0;for(let e=0;e<this._actions.length;e++)this._actions[e].time=0;return this.update(t)}getRoot(){return this._root}uncacheClip(t){const e=this._actions,n=t.uuid,r=this._actionsByClip,i=r[n];if(void 0!==i){const t=i.knownActions;for(let n=0,r=t.length;n!==r;++n){const r=t[n];this._deactivateAction(r);const i=r._cacheIndex,s=e[e.length-1];r._cacheIndex=null,r._byClipCacheIndex=null,s._cacheIndex=i,e[i]=s,e.pop(),this._removeInactiveBindingsForAction(r)}delete r[n]}}uncacheRoot(t){const e=t.uuid,n=this._actionsByClip;for(const s in n){const t=n[s].actionByRoot,r=t[e];void 0!==r&&(this._deactivateAction(r),this._removeInactiveAction(r))}const r=this._bindingsByRootAndName,i=r[e];if(void 0!==i)for(const s in i){const t=i[s];t.restoreOriginalState(),this._removeInactiveBinding(t)}}uncacheAction(t,e){const n=this.existingAction(t,e);null!==n&&(this._deactivateAction(n),this._removeInactiveAction(n))}}km.prototype._controlInterpolantsResultBuffer=new Float32Array(1);class zm{constructor(t){"string"===typeof t&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),t=arguments[1]),this.value=t}clone(){return new zm(void 0===this.value.clone?this.value:this.value.clone())}}class Fm extends dh{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}}Fm.prototype.isInstancedInterleavedBuffer=!0;class Um{constructor(t,e,n,r,i){this.buffer=t,this.type=e,this.itemSize=n,this.elementSize=r,this.count=i,this.version=0}set needsUpdate(t){!0===t&&this.version++}setBuffer(t){return this.buffer=t,this}setType(t,e){return this.type=t,this.elementSize=e,this}setItemSize(t){return this.itemSize=t,this}setCount(t){return this.count=t,this}}Um.prototype.isGLBufferAttribute=!0;class Bm{constructor(t,e,n=0,r=1/0){this.ray=new Pr(t,e),this.near=n,this.far=r,this.camera=null,this.layers=new Vr,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(t,e){this.ray.set(t,e)}setFromCamera(t,e){e&&e.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(t.x,t.y,.5).unproject(e).sub(this.ray.origin).normalize(),this.camera=e):e&&e.isOrthographicCamera?(this.ray.origin.set(t.x,t.y,(e.near+e.far)/(e.near-e.far)).unproject(e),this.ray.direction.set(0,0,-1).transformDirection(e.matrixWorld),this.camera=e):console.error("THREE.Raycaster: Unsupported camera type: "+e.type)}intersectObject(t,e=!0,n=[]){return Gm(t,this,n,e),n.sort(Hm),n}intersectObjects(t,e=!0,n=[]){for(let r=0,i=t.length;r<i;r++)Gm(t[r],this,n,e);return n.sort(Hm),n}}function Hm(t,e){return t.distance-e.distance}function Gm(t,e,n,r){if(t.layers.test(e.layers)&&t.raycast(e,n),!0===r){const r=t.children;for(let t=0,i=r.length;t<i;t++)Gm(r[t],e,n,!0)}}class Vm{constructor(t=1,e=0,n=0){return this.radius=t,this.phi=e,this.theta=n,this}set(t,e,n){return this.radius=t,this.phi=e,this.theta=n,this}copy(t){return this.radius=t.radius,this.phi=t.phi,this.theta=t.theta,this}makeSafe(){const t=1e-6;return this.phi=Math.max(t,Math.min(Math.PI-t,this.phi)),this}setFromVector3(t){return this.setFromCartesianCoords(t.x,t.y,t.z)}setFromCartesianCoords(t,e,n){return this.radius=Math.sqrt(t*t+e*e+n*n),0===this.radius?(this.theta=0,this.phi=0):(this.theta=Math.atan2(t,n),this.phi=Math.acos(yn(e/this.radius,-1,1))),this}clone(){return(new this.constructor).copy(this)}}const Wm=new Fn;class jm{constructor(t=new Fn(1/0,1/0),e=new Fn(-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=Wm.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){const e=Wm.copy(t).clamp(this.min,this.max);return e.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)}}jm.prototype.isBox2=!0;const qm=new er,Xm=new er;class Ym{constructor(t=new er,e=new er){this.start=t,this.end=e}set(t,e){return this.start.copy(t),this.end.copy(e),this}copy(t){return this.start.copy(t.start),this.end.copy(t.end),this}getCenter(t){return t.addVectors(this.start,this.end).multiplyScalar(.5)}delta(t){return t.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(t,e){return this.delta(e).multiplyScalar(t).add(this.start)}closestPointToPointParameter(t,e){qm.subVectors(t,this.start),Xm.subVectors(this.end,this.start);const n=Xm.dot(Xm),r=Xm.dot(qm);let i=r/n;return e&&(i=yn(i,0,1)),i}closestPointToPoint(t,e,n){const r=this.closestPointToPointParameter(t,e);return this.delta(n).multiplyScalar(r).add(this.start)}applyMatrix4(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this}equals(t){return t.start.equals(this.start)&&t.end.equals(this.end)}clone(){return(new this.constructor).copy(this)}}const Jm=new er,Zm=new Ir,Km=new Ir;class $m extends od{constructor(t){const e=Qm(t),n=new Ui,r=[],i=[],s=new Mi(0,0,1),o=new Mi(0,1,0);for(let c=0;c<e.length;c++){const t=e[c];t.parent&&t.parent.isBone&&(r.push(0,0,0),r.push(0,0,0),i.push(s.r,s.g,s.b),i.push(o.r,o.g,o.b))}n.setAttribute("position",new Pi(r,3)),n.setAttribute("color",new Pi(i,3));const a=new Kh({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});super(n,a),this.type="SkeletonHelper",this.isSkeletonHelper=!0,this.root=t,this.bones=e,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1}updateMatrixWorld(t){const e=this.bones,n=this.geometry,r=n.getAttribute("position");Km.copy(this.root.matrixWorld).invert();for(let i=0,s=0;i<e.length;i++){const t=e[i];t.parent&&t.parent.isBone&&(Zm.multiplyMatrices(Km,t.matrixWorld),Jm.setFromMatrixPosition(Zm),r.setXYZ(s,Jm.x,Jm.y,Jm.z),Zm.multiplyMatrices(Km,t.parent.matrixWorld),Jm.setFromMatrixPosition(Zm),r.setXYZ(s+1,Jm.x,Jm.y,Jm.z),s+=2)}n.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(t)}}function Qm(t){const e=[];t&&t.isBone&&e.push(t);for(let n=0;n<t.children.length;n++)e.push.apply(e,Qm(t.children[n]));return e}class tg extends od{constructor(t=10,e=10,n=4473924,r=8947848){n=new Mi(n),r=new Mi(r);const i=e/2,s=t/e,o=t/2,a=[],c=[];for(let h=0,d=0,p=-o;h<=e;h++,p+=s){a.push(-o,0,p,o,0,p),a.push(p,0,-o,p,0,o);const t=h===i?n:r;t.toArray(c,d),d+=3,t.toArray(c,d),d+=3,t.toArray(c,d),d+=3,t.toArray(c,d),d+=3}const l=new Ui;l.setAttribute("position",new Pi(a,3)),l.setAttribute("color",new Pi(c,3));const u=new Kh({vertexColors:!0,toneMapped:!1});super(l,u),this.type="GridHelper"}}const eg=new Float32Array(1);new Int32Array(eg.buffer);Ld.create=function(t,e){return console.log("THREE.Curve.create() has been deprecated"),t.prototype=Object.create(Ld.prototype),t.prototype.constructor=t,t.prototype.getPoint=e,t},np.prototype.fromPoints=function(t){return console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints()."),this.setFromPoints(t)},tg.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")},$m.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")},If.prototype.extractUrlBase=function(t){return console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead."),om.extractUrlBase(t)},If.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.")}},jm.prototype.center=function(t){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(t)},jm.prototype.empty=function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()},jm.prototype.isIntersectionBox=function(t){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},jm.prototype.size=function(t){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(t)},ir.prototype.center=function(t){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(t)},ir.prototype.empty=function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()},ir.prototype.isIntersectionBox=function(t){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},ir.prototype.isIntersectionSphere=function(t){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(t)},ir.prototype.size=function(t){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(t)},Mr.prototype.empty=function(){return console.warn("THREE.Sphere: .empty() has been renamed to .isEmpty()."),this.isEmpty()},Es.prototype.setFromMatrix=function(t){return console.warn("THREE.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix()."),this.setFromProjectionMatrix(t)},Ym.prototype.center=function(t){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(t)},Un.prototype.flattenToArrayOffset=function(t,e){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(t,e)},Un.prototype.multiplyVector3=function(t){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),t.applyMatrix3(this)},Un.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.")},Un.prototype.applyToBufferAttribute=function(t){return console.warn("THREE.Matrix3: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix3( matrix ) instead."),t.applyMatrix3(this)},Un.prototype.applyToVector3Array=function(){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")},Un.prototype.getInverse=function(t){return console.warn("THREE.Matrix3: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(t).invert()},Ir.prototype.extractPosition=function(t){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(t)},Ir.prototype.flattenToArrayOffset=function(t,e){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(t,e)},Ir.prototype.getPosition=function(){return console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),(new er).setFromMatrixColumn(this,3)},Ir.prototype.setRotationFromQuaternion=function(t){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(t)},Ir.prototype.multiplyToArray=function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")},Ir.prototype.multiplyVector3=function(t){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},Ir.prototype.multiplyVector4=function(t){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},Ir.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.")},Ir.prototype.rotateAxis=function(t){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),t.transformDirection(this)},Ir.prototype.crossVector=function(t){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},Ir.prototype.translate=function(){console.error("THREE.Matrix4: .translate() has been removed.")},Ir.prototype.rotateX=function(){console.error("THREE.Matrix4: .rotateX() has been removed.")},Ir.prototype.rotateY=function(){console.error("THREE.Matrix4: .rotateY() has been removed.")},Ir.prototype.rotateZ=function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")},Ir.prototype.rotateByAxis=function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")},Ir.prototype.applyToBufferAttribute=function(t){return console.warn("THREE.Matrix4: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},Ir.prototype.applyToVector3Array=function(){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")},Ir.prototype.makeFrustum=function(t,e,n,r,i,s){return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."),this.makePerspective(t,e,r,n,i,s)},Ir.prototype.getInverse=function(t){return console.warn("THREE.Matrix4: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(t).invert()},Ms.prototype.isIntersectionLine=function(t){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(t)},tr.prototype.multiplyVector3=function(t){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),t.applyQuaternion(this)},tr.prototype.inverse=function(){return console.warn("THREE.Quaternion: .inverse() has been renamed to invert()."),this.invert()},Pr.prototype.isIntersectionBox=function(t){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},Pr.prototype.isIntersectionPlane=function(t){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(t)},Pr.prototype.isIntersectionSphere=function(t){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(t)},fi.prototype.area=function(){return console.warn("THREE.Triangle: .area() has been renamed to .getArea()."),this.getArea()},fi.prototype.barycoordFromPoint=function(t,e){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),this.getBarycoord(t,e)},fi.prototype.midpoint=function(t){return console.warn("THREE.Triangle: .midpoint() has been renamed to .getMidpoint()."),this.getMidpoint(t)},fi.prototypenormal=function(t){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),this.getNormal(t)},fi.prototype.plane=function(t){return console.warn("THREE.Triangle: .plane() has been renamed to .getPlane()."),this.getPlane(t)},fi.barycoordFromPoint=function(t,e,n,r,i){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),fi.getBarycoord(t,e,n,r,i)},fi.normal=function(t,e,n,r){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),fi.getNormal(t,e,n,r)},rp.prototype.extractAllPoints=function(t){return console.warn("THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead."),this.extractPoints(t)},rp.prototype.extrude=function(t){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new Up(this,t)},rp.prototype.makeGeometry=function(t){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new qp(this,t)},Fn.prototype.fromAttribute=function(t,e,n){return console.warn("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,n)},Fn.prototype.distanceToManhattan=function(t){return console.warn("THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(t)},Fn.prototype.lengthManhattan=function(){return console.warn("THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},er.prototype.setEulerFromRotationMatrix=function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},er.prototype.setEulerFromQuaternion=function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},er.prototype.getPositionFromMatrix=function(t){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(t)},er.prototype.getScaleFromMatrix=function(t){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(t)},er.prototype.getColumnFromMatrix=function(t,e){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(e,t)},er.prototype.applyProjection=function(t){return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."),this.applyMatrix4(t)},er.prototype.fromAttribute=function(t,e,n){return console.warn("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,n)},er.prototype.distanceToManhattan=function(t){return console.warn("THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(t)},er.prototype.lengthManhattan=function(){return console.warn("THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},Zn.prototype.fromAttribute=function(t,e,n){return console.warn("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,n)},Zn.prototype.lengthManhattan=function(){return console.warn("THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},ri.prototype.getChildByName=function(t){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(t)},ri.prototype.renderDepth=function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},ri.prototype.translate=function(t,e){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(e,t)},ri.prototype.getWorldRotation=function(){console.error("THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.")},ri.prototype.applyMatrix=function(t){return console.warn("THREE.Object3D: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(t)},Object.defineProperties(ri.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.")}}}),rs.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(rs.prototype,{drawMode:{get:function(){return console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode."),qe},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.")}}}),Uh.prototype.initBones=function(){console.error("THREE.SkinnedMesh: initBones() has been removed.")},fs.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(Bf.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(Ai.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===un},set:function(){console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.setUsage(un)}}}),Ai.prototype.setDynamic=function(t){return console.warn("THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===t?un:ln),this},Ai.prototype.copyIndicesArray=function(){console.error("THREE.BufferAttribute: .copyIndicesArray() has been removed.")},Ai.prototype.setArray=function(){console.error("THREE.BufferAttribute: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")},Ui.prototype.addIndex=function(t){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(t)},Ui.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 Ai(arguments[1],arguments[2])))},Ui.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)},Ui.prototype.clearDrawCalls=function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()},Ui.prototype.computeOffsets=function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")},Ui.prototype.removeAttribute=function(t){return console.warn("THREE.BufferGeometry: .removeAttribute() has been renamed to .deleteAttribute()."),this.deleteAttribute(t)},Ui.prototype.applyMatrix=function(t){return console.warn("THREE.BufferGeometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(t)},Object.defineProperties(Ui.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}}}),dh.prototype.setDynamic=function(t){return console.warn("THREE.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===t?un:ln),this},dh.prototype.setArray=function(){console.error("THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")},Up.prototype.getArrays=function(){console.error("THREE.ExtrudeGeometry: .getArrays() has been removed.")},Up.prototype.addShapeList=function(){console.error("THREE.ExtrudeGeometry: .addShapeList() has been removed.")},Up.prototype.addShape=function(){console.error("THREE.ExtrudeGeometry: .addShape() has been removed.")},hh.prototype.dispose=function(){console.error("THREE.Scene: .dispose() has been removed.")},zm.prototype.onUpdate=function(){return console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."),this},Object.defineProperties(gi.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 Mi}},shading:{get:function(){console.error("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead.")},set:function(t){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=t===w}},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(ds.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}}}),ah.prototype.clearTarget=function(t,e,n,r){console.warn("THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead."),this.setRenderTarget(t),this.clear(e,n,r)},ah.prototype.animate=function(t){console.warn("THREE.WebGLRenderer: .animate() is now .setAnimationLoop()."),this.setAnimationLoop(t)},ah.prototype.getCurrentRenderTarget=function(){return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),this.getRenderTarget()},ah.prototype.getMaxAnisotropy=function(){return console.warn("THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy()."),this.capabilities.getMaxAnisotropy()},ah.prototype.getPrecision=function(){return console.warn("THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision."),this.capabilities.precision},ah.prototype.resetGLState=function(){return console.warn("THREE.WebGLRenderer: .resetGLState() is now .state.reset()."),this.state.reset()},ah.prototype.supportsFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")},ah.prototype.supportsHalfFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")},ah.prototype.supportsStandardDerivatives=function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")},ah.prototype.supportsCompressedTextureS3TC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")},ah.prototype.supportsCompressedTexturePVRTC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")},ah.prototype.supportsBlendMinMax=function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")},ah.prototype.supportsVertexTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),this.capabilities.vertexTextures},ah.prototype.supportsInstancedArrays=function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")},ah.prototype.enableScissorTest=function(t){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(t)},ah.prototype.initMaterial=function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")},ah.prototype.addPrePlugin=function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")},ah.prototype.addPostPlugin=function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")},ah.prototype.updateShadowMap=function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")},ah.prototype.setFaceCulling=function(){console.warn("THREE.WebGLRenderer: .setFaceCulling() has been removed.")},ah.prototype.allocTextureUnit=function(){console.warn("THREE.WebGLRenderer: .allocTextureUnit() has been removed.")},ah.prototype.setTexture=function(){console.warn("THREE.WebGLRenderer: .setTexture() has been removed.")},ah.prototype.setTexture2D=function(){console.warn("THREE.WebGLRenderer: .setTexture2D() has been removed.")},ah.prototype.setTextureCube=function(){console.warn("THREE.WebGLRenderer: .setTextureCube() has been removed.")},ah.prototype.getActiveMipMapLevel=function(){return console.warn("THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel()."),this.getActiveMipmapLevel()},Object.defineProperties(ah.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?Ze:Je}},toneMappingWhitePoint:{get:function(){return console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed."),1},set:function(){console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed.")}}}),Object.defineProperties(Ju.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(Kn.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}}}),xm.prototype.load=function(t){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");const e=this,n=new gm;return n.load(t,(function(t){e.setBuffer(t)})),this},bm.prototype.getData=function(){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()},vs.prototype.updateCubeMap=function(t,e){return console.warn("THREE.CubeCamera: .updateCubeMap() is now .update()."),this.update(t,e)},vs.prototype.clear=function(t,e,n,r){return console.warn("THREE.CubeCamera: .clear() is now .renderTarget.clear()."),this.renderTarget.clear(t,e,n,r)},qn.crossOrigin=void 0,qn.loadTexture=function(t,e,n,r){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");const i=new Uf;i.setCrossOrigin(this.crossOrigin);const s=i.load(t,n,void 0,r);return e&&(s.mapping=e),s},qn.loadTextureCube=function(t,e,n,r){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");const i=new zf;i.setCrossOrigin(this.crossOrigin);const s=i.load(t,n,void 0,r);return e&&(s.mapping=e),s},qn.loadCompressedTexture=function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")},qn.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:l}})),"undefined"!==typeof window&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=l);const ng=/^[og]\s*(.+)?/,rg=/^mtllib /,ig=/^usemtl /,sg=/^usemap /,og=new er,ag=new er,cg=new er,lg=new er,ug=new er;function hg(){const t={objects:[],object:{},vertices:[],normals:[],colors:[],uvs:[],materials:{},materialLibraries:[],startObject:function(t,e){if(this.object&&!1===this.object.fromDeclaration)return this.object.name=t,void(this.object.fromDeclaration=!1!==e);const n=this.object&&"function"===typeof this.object.currentMaterial?this.object.currentMaterial():void 0;if(this.object&&"function"===typeof this.object._finalize&&this.object._finalize(!0),this.object={name:t||"",fromDeclaration:!1!==e,geometry:{vertices:[],normals:[],colors:[],uvs:[],hasUVIndices:!1},materials:[],smooth:!0,startMaterial:function(t,e){const n=this._finalize(!1);n&&(n.inherited||n.groupCount<=0)&&this.materials.splice(n.index,1);const r={index:this.materials.length,name:t||"",mtllib:Array.isArray(e)&&e.length>0?e[e.length-1]:"",smooth:void 0!==n?n.smooth:this.smooth,groupStart:void 0!==n?n.groupEnd:0,groupEnd:-1,groupCount:-1,inherited:!1,clone:function(t){const e={index:"number"===typeof t?t:this.index,name:this.name,mtllib:this.mtllib,smooth:this.smooth,groupStart:0,groupEnd:-1,groupCount:-1,inherited:!1};return e.clone=this.clone.bind(e),e}};return this.materials.push(r),r},currentMaterial:function(){if(this.materials.length>0)return this.materials[this.materials.length-1]},_finalize:function(t){const e=this.currentMaterial();if(e&&-1===e.groupEnd&&(e.groupEnd=this.geometry.vertices.length/3,e.groupCount=e.groupEnd-e.groupStart,e.inherited=!1),t&&this.materials.length>1)for(let n=this.materials.length-1;n>=0;n--)this.materials[n].groupCount<=0&&this.materials.splice(n,1);return t&&0===this.materials.length&&this.materials.push({name:"",smooth:this.smooth}),e}},n&&n.name&&"function"===typeof n.clone){const t=n.clone(0);t.inherited=!0,this.object.materials.push(t)}this.objects.push(this.object)},finalize:function(){this.object&&"function"===typeof this.object._finalize&&this.object._finalize(!0)},parseVertexIndex:function(t,e){const n=parseInt(t,10);return 3*(n>=0?n-1:n+e/3)},parseNormalIndex:function(t,e){const n=parseInt(t,10);return 3*(n>=0?n-1:n+e/3)},parseUVIndex:function(t,e){const n=parseInt(t,10);return 2*(n>=0?n-1:n+e/2)},addVertex:function(t,e,n){const r=this.vertices,i=this.object.geometry.vertices;i.push(r[t+0],r[t+1],r[t+2]),i.push(r[e+0],r[e+1],r[e+2]),i.push(r[n+0],r[n+1],r[n+2])},addVertexPoint:function(t){const e=this.vertices,n=this.object.geometry.vertices;n.push(e[t+0],e[t+1],e[t+2])},addVertexLine:function(t){const e=this.vertices,n=this.object.geometry.vertices;n.push(e[t+0],e[t+1],e[t+2])},addNormal:function(t,e,n){const r=this.normals,i=this.object.geometry.normals;i.push(r[t+0],r[t+1],r[t+2]),i.push(r[e+0],r[e+1],r[e+2]),i.push(r[n+0],r[n+1],r[n+2])},addFaceNormal:function(t,e,n){const r=this.vertices,i=this.object.geometry.normals;og.fromArray(r,t),ag.fromArray(r,e),cg.fromArray(r,n),ug.subVectors(cg,ag),lg.subVectors(og,ag),ug.cross(lg),ug.normalize(),i.push(ug.x,ug.y,ug.z),i.push(ug.x,ug.y,ug.z),i.push(ug.x,ug.y,ug.z)},addColor:function(t,e,n){const r=this.colors,i=this.object.geometry.colors;void 0!==r[t]&&i.push(r[t+0],r[t+1],r[t+2]),void 0!==r[e]&&i.push(r[e+0],r[e+1],r[e+2]),void 0!==r[n]&&i.push(r[n+0],r[n+1],r[n+2])},addUV:function(t,e,n){const r=this.uvs,i=this.object.geometry.uvs;i.push(r[t+0],r[t+1]),i.push(r[e+0],r[e+1]),i.push(r[n+0],r[n+1])},addDefaultUV:function(){const t=this.object.geometry.uvs;t.push(0,0),t.push(0,0),t.push(0,0)},addUVLine:function(t){const e=this.uvs,n=this.object.geometry.uvs;n.push(e[t+0],e[t+1])},addFace:function(t,e,n,r,i,s,o,a,c){const l=this.vertices.length;let u=this.parseVertexIndex(t,l),h=this.parseVertexIndex(e,l),d=this.parseVertexIndex(n,l);if(this.addVertex(u,h,d),this.addColor(u,h,d),void 0!==o&&""!==o){const t=this.normals.length;u=this.parseNormalIndex(o,t),h=this.parseNormalIndex(a,t),d=this.parseNormalIndex(c,t),this.addNormal(u,h,d)}else this.addFaceNormal(u,h,d);if(void 0!==r&&""!==r){const t=this.uvs.length;u=this.parseUVIndex(r,t),h=this.parseUVIndex(i,t),d=this.parseUVIndex(s,t),this.addUV(u,h,d),this.object.geometry.hasUVIndices=!0}else this.addDefaultUV()},addPointGeometry:function(t){this.object.geometry.type="Points";const e=this.vertices.length;for(let n=0,r=t.length;n<r;n++){const r=this.parseVertexIndex(t[n],e);this.addVertexPoint(r),this.addColor(r)}},addLineGeometry:function(t,e){this.object.geometry.type="Line";const n=this.vertices.length,r=this.uvs.length;for(let i=0,s=t.length;i<s;i++)this.addVertexLine(this.parseVertexIndex(t[i],n));for(let i=0,s=e.length;i<s;i++)this.addUVLine(this.parseUVIndex(e[i],r))}};return t.startObject("",!1),t}class dg extends If{constructor(t){super(t),this.materials=null}load(t,e,n,r){const i=this,s=new Of(this.manager);s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(t,(function(n){try{e(i.parse(n))}catch(s){r?r(s):console.error(s),i.manager.itemError(t)}}),n,r)}setMaterials(t){return this.materials=t,this}parse(t){const e=new hg;-1!==t.indexOf("\r\n")&&(t=t.replace(/\r\n/g,"\n")),-1!==t.indexOf("\\\n")&&(t=t.replace(/\\\n/g,""));const n=t.split("\n");let r="",i="",s=0,o=[];const a="function"===typeof"".trimLeft;for(let u=0,h=n.length;u<h;u++)if(r=n[u],r=a?r.trimLeft():r.trim(),s=r.length,0!==s&&(i=r.charAt(0),"#"!==i))if("v"===i){const t=r.split(/\s+/);switch(t[0]){case"v":e.vertices.push(parseFloat(t[1]),parseFloat(t[2]),parseFloat(t[3])),t.length>=7?e.colors.push(parseFloat(t[4]),parseFloat(t[5]),parseFloat(t[6])):e.colors.push(void 0,void 0,void 0);break;case"vn":e.normals.push(parseFloat(t[1]),parseFloat(t[2]),parseFloat(t[3]));break;case"vt":e.uvs.push(parseFloat(t[1]),parseFloat(t[2]));break}}else if("f"===i){const t=r.substr(1).trim(),n=t.split(/\s+/),i=[];for(let e=0,r=n.length;e<r;e++){const t=n[e];if(t.length>0){const e=t.split("/");i.push(e)}}const s=i[0];for(let r=1,o=i.length-1;r<o;r++){const t=i[r],n=i[r+1];e.addFace(s[0],t[0],n[0],s[1],t[1],n[1],s[2],t[2],n[2])}}else if("l"===i){const t=r.substring(1).trim().split(" ");let n=[];const i=[];if(-1===r.indexOf("/"))n=t;else for(let e=0,r=t.length;e<r;e++){const r=t[e].split("/");""!==r[0]&&n.push(r[0]),""!==r[1]&&i.push(r[1])}e.addLineGeometry(n,i)}else if("p"===i){const t=r.substr(1).trim(),n=t.split(" ");e.addPointGeometry(n)}else if(null!==(o=ng.exec(r))){const t=(" "+o[0].substr(1).trim()).substr(1);e.startObject(t)}else if(ig.test(r))e.object.startMaterial(r.substring(7).trim(),e.materialLibraries);else if(rg.test(r))e.materialLibraries.push(r.substring(7).trim());else if(sg.test(r))console.warn('THREE.OBJLoader: Rendering identifier "usemap" not supported. Textures must be defined in MTL files.');else if("s"===i){if(o=r.split(" "),o.length>1){const t=o[1].trim().toLowerCase();e.object.smooth="0"!==t&&"off"!==t}else e.object.smooth=!0;const t=e.object.currentMaterial();t&&(t.smooth=e.object.smooth)}else{if("\0"===r)continue;console.warn('THREE.OBJLoader: Unexpected line: "'+r+'"')}e.finalize();const c=new th;c.materialLibraries=[].concat(e.materialLibraries);const l=!(1===e.objects.length&&0===e.objects[0].geometry.vertices.length);if(!0===l)for(let u=0,h=e.objects.length;u<h;u++){const t=e.objects[u],n=t.geometry,r=t.materials,i="Line"===n.type,s="Points"===n.type;let o=!1;if(0===n.vertices.length)continue;const a=new Ui;a.setAttribute("position",new Pi(n.vertices,3)),n.normals.length>0&&a.setAttribute("normal",new Pi(n.normals,3)),n.colors.length>0&&(o=!0,a.setAttribute("color",new Pi(n.colors,3))),!0===n.hasUVIndices&&a.setAttribute("uv",new Pi(n.uvs,2));const l=[];for(let c=0,u=r.length;c<u;c++){const t=r[c],n=t.name+"_"+t.smooth+"_"+o;let a=e.materials[n];if(null!==this.materials)if(a=this.materials.create(t.name),!i||!a||a instanceof Kh){if(s&&a&&!(a instanceof cd)){const t=new cd({size:10,sizeAttenuation:!1});gi.prototype.copy.call(t,a),t.color.copy(a.color),t.map=a.map,a=t}}else{const t=new Kh;gi.prototype.copy.call(t,a),t.color.copy(a.color),a=t}void 0===a&&(a=i?new Kh:s?new cd({size:1,sizeAttenuation:!1}):new of,a.name=t.name,a.flatShading=!t.smooth,a.vertexColors=o,e.materials[n]=a),l.push(a)}let h;if(l.length>1){for(let t=0,e=r.length;t<e;t++){const e=r[t];a.addGroup(e.groupStart,e.groupCount,t)}h=i?new od(a,l):s?new pd(a,l):new rs(a,l)}else h=i?new od(a,l[0]):s?new pd(a,l[0]):new rs(a,l[0]);h.name=t.name,c.add(h)}else if(e.vertices.length>0){const t=new cd({size:1,sizeAttenuation:!1}),n=new Ui;n.setAttribute("position",new Pi(e.vertices,3)),e.colors.length>0&&void 0!==e.colors[0]&&(n.setAttribute("color",new Pi(e.colors,3)),t.vertexColors=!0);const r=new pd(n,t);c.add(r)}return c}}class pg extends If{constructor(t){super(t)}load(t,e,n,r){const i=this,s=""===this.path?om.extractUrlBase(t):this.path,o=new Of(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(t,(function(n){try{e(i.parse(n,s))}catch(o){r?r(o):console.error(o),i.manager.itemError(t)}}),n,r)}setMaterialOptions(t){return this.materialOptions=t,this}parse(t,e){const n=t.split("\n");let r={};const i=/\s+/,s={};for(let a=0;a<n.length;a++){let t=n[a];if(t=t.trim(),0===t.length||"#"===t.charAt(0))continue;const e=t.indexOf(" ");let o=e>=0?t.substring(0,e):t;o=o.toLowerCase();let c=e>=0?t.substring(e+1):"";if(c=c.trim(),"newmtl"===o)r={name:c},s[c]=r;else if("ka"===o||"kd"===o||"ks"===o||"ke"===o){const t=c.split(i,3);r[o]=[parseFloat(t[0]),parseFloat(t[1]),parseFloat(t[2])]}else r[o]=c}const o=new fg(this.resourcePath||e,this.materialOptions);return o.setCrossOrigin(this.crossOrigin),o.setManager(this.manager),o.setMaterials(s),o}}class fg{constructor(t="",e={}){this.baseUrl=t,this.options=e,this.materialsInfo={},this.materials={},this.materialsArray=[],this.nameLookup={},this.crossOrigin="anonymous",this.side=void 0!==this.options.side?this.options.side:y,this.wrap=void 0!==this.options.wrap?this.options.wrap:ft}setCrossOrigin(t){return this.crossOrigin=t,this}setManager(t){this.manager=t}setMaterials(t){this.materialsInfo=this.convert(t),this.materials={},this.materialsArray=[],this.nameLookup={}}convert(t){if(!this.options)return t;const e={};for(const n in t){const r=t[n],i={};e[n]=i;for(const t in r){let e=!0,n=r[t];const s=t.toLowerCase();switch(s){case"kd":case"ka":case"ks":this.options&&this.options.normalizeRGB&&(n=[n[0]/255,n[1]/255,n[2]/255]),this.options&&this.options.ignoreZeroRGBs&&0===n[0]&&0===n[1]&&0===n[2]&&(e=!1);break;default:break}e&&(i[s]=n)}}return e}preload(){for(const t in this.materialsInfo)this.create(t)}getIndex(t){return this.nameLookup[t]}getAsArray(){let t=0;for(const e in this.materialsInfo)this.materialsArray[t]=this.create(e),this.nameLookup[e]=t,t++;return this.materialsArray}create(t){return void 0===this.materials[t]&&this.createMaterial_(t),this.materials[t]}createMaterial_(t){const e=this,n=this.materialsInfo[t],r={name:t,side:this.side};function i(t,e){return"string"!==typeof e||""===e?"":/^https?:\/\//i.test(e)?e:t+e}function s(t,n){if(r[t])return;const s=e.getTextureParams(n,r),o=e.loadTexture(i(e.baseUrl,s.url));o.repeat.copy(s.scale),o.offset.copy(s.offset),o.wrapS=e.wrap,o.wrapT=e.wrap,r[t]=o}for(const o in n){const t=n[o];let e;if(""!==t)switch(o.toLowerCase()){case"kd":r.color=(new Mi).fromArray(t);break;case"ks":r.specular=(new Mi).fromArray(t);break;case"ke":r.emissive=(new Mi).fromArray(t);break;case"map_kd":s("map",t);break;case"map_ks":s("specularMap",t);break;case"map_ke":s("emissiveMap",t);break;case"norm":s("normalMap",t);break;case"map_bump":case"bump":s("bumpMap",t);break;case"map_d":s("alphaMap",t),r.transparent=!0;break;case"ns":r.shininess=parseFloat(t);break;case"d":e=parseFloat(t),e<1&&(r.opacity=e,r.transparent=!0);break;case"tr":e=parseFloat(t),this.options&&this.options.invertTrProperty&&(e=1-e),e>0&&(r.opacity=1-e,r.transparent=!0);break;default:break}}return this.materials[t]=new of(r),this.materials[t]}getTextureParams(t,e){const n={scale:new Fn(1,1),offset:new Fn(0,0)},r=t.split(/\s+/);let i;return i=r.indexOf("-bm"),i>=0&&(e.bumpScale=parseFloat(r[i+1]),r.splice(i,2)),i=r.indexOf("-s"),i>=0&&(n.scale.set(parseFloat(r[i+1]),parseFloat(r[i+2])),r.splice(i,4)),i=r.indexOf("-o"),i>=0&&(n.offset.set(parseFloat(r[i+1]),parseFloat(r[i+2])),r.splice(i,4)),n.url=r.join(" ").trim(),n}loadTexture(t,e,n,r,i){const s=void 0!==this.manager?this.manager:Pf;let o=s.getHandler(t);null===o&&(o=new Uf(s)),o.setCrossOrigin&&o.setCrossOrigin(this.crossOrigin);const a=o.load(t,n,r,i);return void 0!==e&&(a.mapping=e),a}}class mg extends Df{constructor(t){super(t)}parse(t,e){const n={mipmaps:[],width:0,height:0,format:null,mipmapCount:1},r=542327876,i=131072,s=512,o=1024,a=2048,c=4096,l=8192,u=16384,h=32768,d=4;function p(t){return t.charCodeAt(0)+(t.charCodeAt(1)<<8)+(t.charCodeAt(2)<<16)+(t.charCodeAt(3)<<24)}function f(t){return String.fromCharCode(255&t,t>>8&255,t>>16&255,t>>24&255)}function m(t,e,n,r){const i=n*r*4,s=new Uint8Array(t,e,i),o=new Uint8Array(i);let a=0,c=0;for(let l=0;l<r;l++)for(let t=0;t<n;t++){const t=s[c];c++;const e=s[c];c++;const n=s[c];c++;const r=s[c];c++,o[a]=n,a++,o[a]=e,a++,o[a]=t,a++,o[a]=r,a++}return o}const g=p("DXT1"),v=p("DXT3"),y=p("DXT5"),x=p("ETC1"),b=31,w=0,_=1,M=2,S=3,T=4,E=7,A=20,L=21,R=22,C=23,P=24,I=25,N=26,O=28,D=new Int32Array(t,0,b);if(D[w]!==r)return console.error("THREE.DDSLoader.parse: Invalid magic number in DDS header."),n;if(!D[A]&d)return console.error("THREE.DDSLoader.parse: Unsupported format, must contain a FourCC code."),n;let k;const z=D[L];let F=!1;switch(z){case g:k=8,n.format=Jt;break;case v:k=16,n.format=Kt;break;case y:k=16,n.format=$t;break;case x:k=8,n.format=re;break;default:if(!(32===D[R]&&16711680&D[C]&&65280&D[P]&&255&D[I]&&4278190080&D[N]))return console.error("THREE.DDSLoader.parse: Unsupported FourCC code ",f(z)),n;F=!0,k=64,n.format=zt}n.mipmapCount=1,D[M]&i&&!1!==e&&(n.mipmapCount=Math.max(1,D[E]));const U=D[O];if(n.isCubemap=!!(U&s),n.isCubemap&&(!(U&o)||!(U&a)||!(U&c)||!(U&l)||!(U&u)||!(U&h)))return console.error("THREE.DDSLoader.parse: Incomplete cubemap faces"),n;n.width=D[T],n.height=D[S];let B=D[_]+4;const H=n.isCubemap?6:1;for(let G=0;G<H;G++){let e=n.width,r=n.height;for(let i=0;i<n.mipmapCount;i++){let i,s;F?(i=m(t,B,e,r),s=i.length):(s=Math.max(4,e)/4*Math.max(4,r)/4*k,i=new Uint8Array(t,B,s));const o={data:i,width:e,height:r};n.mipmaps.push(o),B+=s,e=Math.max(e>>1,1),r=Math.max(r>>1,1)}}return n}}class gg{constructor(t,e,n){const r=this;let i=!1,s=0,o=0,a=void 0;const c=[];this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=n,this.itemStart=function(t){o++,!1===i&&void 0!==r.onStart&&r.onStart(t,s,o),i=!0},this.itemEnd=function(t){s++,void 0!==r.onProgress&&r.onProgress(t,s,o),s===o&&(i=!1,void 0!==r.onLoad&&r.onLoad())},this.itemError=function(t){void 0!==r.onError&&r.onError(t)},this.resolveURL=function(t){return a?a(t):t},this.setURLModifier=function(t){return a=t,this},this.addHandler=function(t,e){return c.push(t,e),this},this.removeHandler=function(t){const e=c.indexOf(t);return-1!==e&&c.splice(e,2),this},this.getHandler=function(t){for(let e=0,n=c.length;e<n;e+=2){const n=c[e],r=c[e+1];if(n.global&&(n.lastIndex=0),n.test(t))return r}return null}}}new gg;n("e260"),n("ace4"),n("cfc3"),n("907a"),n("9a8c"),n("a975"),n("735e"),n("c1ac"),n("d139"),n("3a7b"),n("d5d6"),n("82f8"),n("e91f"),n("60bd"),n("5f96"),n("3280"),n("3fcc"),n("ca91"),n("25a1"),n("cd26"),n("3c5d"),n("2954"),n("649e"),n("219c"),n("170b"),n("b39a"),n("72f7"),n("fa9e"),n("77d9"),n("fb2c");var vg=new ir;function yg(t){return vg.setFromObject(t),vg.getSize(new er)}function xg(t){return vg.setFromObject(t),vg.getCenter(new er)}function bg(t){var e,n,r=t.getAttribute("position").array,i=void 0!==t.getAttribute("uv");i&&(e=t.getAttribute("uv").array);var s=void 0!==t.getAttribute("normal");s&&(n=t.getAttribute("normal").array);for(var o,a,c,l,u=[],h=[],d=[],p=[],f=new er,m=new er,g=new er,v=new er,y=new er,x=new er,b=new Fn,w=new Fn,_=new Fn,M=0;M<r.length;M+=9)f.x=r[M],f.y=r[M+1],f.z=r[M+2],m.x=r[M+3],m.y=r[M+4],m.z=r[M+5],g.x=r[M+6],g.y=r[M+7],g.z=r[M+8],o=[f,m,g],s&&(v.x=n[M],v.y=n[M+1],v.z=n[M+2],y.x=n[M+3],y.y=n[M+4],y.z=n[M+5],x.x=n[M+6],x.y=n[M+7],x.z=n[M+8],a=[v,y,x]),i&&(b.x=e[M],b.y=e[M+1],w.x=e[M+2],w.y=e[M+3],_.x=e[M+4],_.y=e[M+5],c=[b,w,_]),l=[],o.forEach((function(t,e){var n=C(t,h);-1===n&&(n=h.length,h.push(t.clone()),s&&d.push(a[e].clone()),i&&p.push(c[e].clone())),l.push(n)})),u.push(l[0],l[1],l[2]);var S,T,E=new Float32Array(3*h.length);s&&(S=new Float32Array(3*h.length)),i&&(T=new Float32Array(2*h.length));for(var A=0,L=0,R=0;R<h.length;R++)L=3*R,E[L]=h[R].x,E[L+1]=h[R].y,E[L+2]=h[R].z,s&&(S[L]=d[R].x,S[L+1]=d[R].y,S[L+2]=d[R].z),i&&(A=2*R,T[A]=p[R].x,T[A+1]=p[R].y);return t.addAttribute("position",new Ai(E,3)),s&&t.addAttribute("normal",new Ai(S,3)),i&&t.addAttribute("uv",new Ai(T,2)),t.setIndex(new Ai(new Uint32Array(u),1)),t;function C(t,e){for(var n=0;n<e.length;n++)if(t.equals(e[n]))return n;return-1}}var wg=function(){var t=this,e=t._self._c;return e("div",{staticStyle:{width:"100%",height:"100%",margin:"0",border:"0",padding:"0"}},[t.suportWebGL?e("canvas",{ref:"canvas",staticStyle:{width:"100%",height:"100%"}}):e("div",[t._t("default",(function(){return[t._v(" Your browser does not seem to support "),e("a",{staticStyle:{color:"#000"},attrs:{href:"http://khronos.org/webgl/wiki/Getting_a_WebGL_Implementation"}},[t._v("WebGL")]),t._v("."),e("br"),t._v("' ")]}))],2)])},_g=[];function Mg(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function Sg(t){if(Array.isArray(t))return Mg(t)}n("a4d3"),n("e01a"),n("d28b"),n("3ca3"),n("ddb0"),n("a630");function Tg(t){if("undefined"!==typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}n("fb6a"),n("00b4");function Eg(t,e){if(t){if("string"===typeof t)return Mg(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Mg(t,e):void 0}}n("d9e2");function Ag(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Lg(t){return Sg(t)||Tg(t)||Eg(t)||Ag()}n("a9e3"),n("cca6");const Rg={type:"change"},Cg={type:"start"},Pg={type:"end"};class Ig extends dn{constructor(t,e){super(),void 0===e&&console.warn('THREE.OrbitControls: The second parameter "domElement" is now mandatory.'),e===document&&console.error('THREE.OrbitControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.'),this.object=t,this.domElement=e,this.domElement.style.touchAction="none",this.enabled=!0,this.target=new er,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:u.ROTATE,MIDDLE:u.DOLLY,RIGHT:u.PAN},this.touches={ONE:h.ROTATE,TWO:h.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this.getPolarAngle=function(){return o.phi},this.getAzimuthalAngle=function(){return o.theta},this.getDistance=function(){return this.object.position.distanceTo(this.target)},this.listenToKeyEvents=function(t){t.addEventListener("keydown",it),this._domElementKeyEvents=t},this.saveState=function(){n.target0.copy(n.target),n.position0.copy(n.object.position),n.zoom0=n.object.zoom},this.reset=function(){n.target.copy(n.target0),n.object.position.copy(n.position0),n.object.zoom=n.zoom0,n.object.updateProjectionMatrix(),n.dispatchEvent(Rg),n.update(),i=r.NONE},this.update=function(){const e=new er,u=(new tr).setFromUnitVectors(t.up,new er(0,1,0)),h=u.clone().invert(),p=new er,f=new tr,m=2*Math.PI;return function(){const t=n.object.position;e.copy(t).sub(n.target),e.applyQuaternion(u),o.setFromVector3(e),n.autoRotate&&i===r.NONE&&E(S()),n.enableDamping?(o.theta+=a.theta*n.dampingFactor,o.phi+=a.phi*n.dampingFactor):(o.theta+=a.theta,o.phi+=a.phi);let g=n.minAzimuthAngle,v=n.maxAzimuthAngle;return isFinite(g)&&isFinite(v)&&(g<-Math.PI?g+=m:g>Math.PI&&(g-=m),v<-Math.PI?v+=m:v>Math.PI&&(v-=m),o.theta=g<=v?Math.max(g,Math.min(v,o.theta)):o.theta>(g+v)/2?Math.max(g,o.theta):Math.min(v,o.theta)),o.phi=Math.max(n.minPolarAngle,Math.min(n.maxPolarAngle,o.phi)),o.makeSafe(),o.radius*=c,o.radius=Math.max(n.minDistance,Math.min(n.maxDistance,o.radius)),!0===n.enableDamping?n.target.addScaledVector(l,n.dampingFactor):n.target.add(l),e.setFromSpherical(o),e.applyQuaternion(h),t.copy(n.target).add(e),n.object.lookAt(n.target),!0===n.enableDamping?(a.theta*=1-n.dampingFactor,a.phi*=1-n.dampingFactor,l.multiplyScalar(1-n.dampingFactor)):(a.set(0,0,0),l.set(0,0,0)),c=1,!!(d||p.distanceToSquared(n.object.position)>s||8*(1-f.dot(n.object.quaternion))>s)&&(n.dispatchEvent(Rg),p.copy(n.object.position),f.copy(n.object.quaternion),d=!1,!0)}}(),this.dispose=function(){n.domElement.removeEventListener("contextmenu",at),n.domElement.removeEventListener("pointerdown",K),n.domElement.removeEventListener("pointercancel",tt),n.domElement.removeEventListener("wheel",rt),n.domElement.removeEventListener("pointermove",$),n.domElement.removeEventListener("pointerup",Q),null!==n._domElementKeyEvents&&n._domElementKeyEvents.removeEventListener("keydown",it)};const n=this,r={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let i=r.NONE;const s=1e-6,o=new Vm,a=new Vm;let c=1;const l=new er;let d=!1;const p=new Fn,f=new Fn,m=new Fn,g=new Fn,v=new Fn,y=new Fn,x=new Fn,b=new Fn,w=new Fn,_=[],M={};function S(){return 2*Math.PI/60/60*n.autoRotateSpeed}function T(){return Math.pow(.95,n.zoomSpeed)}function E(t){a.theta-=t}function A(t){a.phi-=t}const L=function(){const t=new er;return function(e,n){t.setFromMatrixColumn(n,0),t.multiplyScalar(-e),l.add(t)}}(),R=function(){const t=new er;return function(e,r){!0===n.screenSpacePanning?t.setFromMatrixColumn(r,1):(t.setFromMatrixColumn(r,0),t.crossVectors(n.object.up,t)),t.multiplyScalar(e),l.add(t)}}(),C=function(){const t=new er;return function(e,r){const i=n.domElement;if(n.object.isPerspectiveCamera){const s=n.object.position;t.copy(s).sub(n.target);let o=t.length();o*=Math.tan(n.object.fov/2*Math.PI/180),L(2*e*o/i.clientHeight,n.object.matrix),R(2*r*o/i.clientHeight,n.object.matrix)}else n.object.isOrthographicCamera?(L(e*(n.object.right-n.object.left)/n.object.zoom/i.clientWidth,n.object.matrix),R(r*(n.object.top-n.object.bottom)/n.object.zoom/i.clientHeight,n.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),n.enablePan=!1)}}();function P(t){n.object.isPerspectiveCamera?c/=t:n.object.isOrthographicCamera?(n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom*t)),n.object.updateProjectionMatrix(),d=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function I(t){n.object.isPerspectiveCamera?c*=t:n.object.isOrthographicCamera?(n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/t)),n.object.updateProjectionMatrix(),d=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function N(t){p.set(t.clientX,t.clientY)}function O(t){x.set(t.clientX,t.clientY)}function D(t){g.set(t.clientX,t.clientY)}function k(t){f.set(t.clientX,t.clientY),m.subVectors(f,p).multiplyScalar(n.rotateSpeed);const e=n.domElement;E(2*Math.PI*m.x/e.clientHeight),A(2*Math.PI*m.y/e.clientHeight),p.copy(f),n.update()}function z(t){b.set(t.clientX,t.clientY),w.subVectors(b,x),w.y>0?P(T()):w.y<0&&I(T()),x.copy(b),n.update()}function F(t){v.set(t.clientX,t.clientY),y.subVectors(v,g).multiplyScalar(n.panSpeed),C(y.x,y.y),g.copy(v),n.update()}function U(t){t.deltaY<0?I(T()):t.deltaY>0&&P(T()),n.update()}function B(t){let e=!1;switch(t.code){case n.keys.UP:C(0,n.keyPanSpeed),e=!0;break;case n.keys.BOTTOM:C(0,-n.keyPanSpeed),e=!0;break;case n.keys.LEFT:C(n.keyPanSpeed,0),e=!0;break;case n.keys.RIGHT:C(-n.keyPanSpeed,0),e=!0;break}e&&(t.preventDefault(),n.update())}function H(){if(1===_.length)p.set(_[0].pageX,_[0].pageY);else{const t=.5*(_[0].pageX+_[1].pageX),e=.5*(_[0].pageY+_[1].pageY);p.set(t,e)}}function G(){if(1===_.length)g.set(_[0].pageX,_[0].pageY);else{const t=.5*(_[0].pageX+_[1].pageX),e=.5*(_[0].pageY+_[1].pageY);g.set(t,e)}}function V(){const t=_[0].pageX-_[1].pageX,e=_[0].pageY-_[1].pageY,n=Math.sqrt(t*t+e*e);x.set(0,n)}function W(){n.enableZoom&&V(),n.enablePan&&G()}function j(){n.enableZoom&&V(),n.enableRotate&&H()}function q(t){if(1==_.length)f.set(t.pageX,t.pageY);else{const e=ht(t),n=.5*(t.pageX+e.x),r=.5*(t.pageY+e.y);f.set(n,r)}m.subVectors(f,p).multiplyScalar(n.rotateSpeed);const e=n.domElement;E(2*Math.PI*m.x/e.clientHeight),A(2*Math.PI*m.y/e.clientHeight),p.copy(f)}function X(t){if(1===_.length)v.set(t.pageX,t.pageY);else{const e=ht(t),n=.5*(t.pageX+e.x),r=.5*(t.pageY+e.y);v.set(n,r)}y.subVectors(v,g).multiplyScalar(n.panSpeed),C(y.x,y.y),g.copy(v)}function Y(t){const e=ht(t),r=t.pageX-e.x,i=t.pageY-e.y,s=Math.sqrt(r*r+i*i);b.set(0,s),w.set(0,Math.pow(b.y/x.y,n.zoomSpeed)),P(w.y),x.copy(b)}function J(t){n.enableZoom&&Y(t),n.enablePan&&X(t)}function Z(t){n.enableZoom&&Y(t),n.enableRotate&&q(t)}function K(t){!1!==n.enabled&&(0===_.length&&(n.domElement.setPointerCapture(t.pointerId),n.domElement.addEventListener("pointermove",$),n.domElement.addEventListener("pointerup",Q)),ct(t),"touch"===t.pointerType?st(t):et(t))}function $(t){!1!==n.enabled&&("touch"===t.pointerType?ot(t):nt(t))}function Q(t){lt(t),0===_.length&&(n.domElement.releasePointerCapture(t.pointerId),n.domElement.removeEventListener("pointermove",$),n.domElement.removeEventListener("pointerup",Q)),n.dispatchEvent(Pg),i=r.NONE}function tt(t){lt(t)}function et(t){let e;switch(t.button){case 0:e=n.mouseButtons.LEFT;break;case 1:e=n.mouseButtons.MIDDLE;break;case 2:e=n.mouseButtons.RIGHT;break;default:e=-1}switch(e){case u.DOLLY:if(!1===n.enableZoom)return;O(t),i=r.DOLLY;break;case u.ROTATE:if(t.ctrlKey||t.metaKey||t.shiftKey){if(!1===n.enablePan)return;D(t),i=r.PAN}else{if(!1===n.enableRotate)return;N(t),i=r.ROTATE}break;case u.PAN:if(t.ctrlKey||t.metaKey||t.shiftKey){if(!1===n.enableRotate)return;N(t),i=r.ROTATE}else{if(!1===n.enablePan)return;D(t),i=r.PAN}break;default:i=r.NONE}i!==r.NONE&&n.dispatchEvent(Cg)}function nt(t){if(!1!==n.enabled)switch(i){case r.ROTATE:if(!1===n.enableRotate)return;k(t);break;case r.DOLLY:if(!1===n.enableZoom)return;z(t);break;case r.PAN:if(!1===n.enablePan)return;F(t);break}}function rt(t){!1!==n.enabled&&!1!==n.enableZoom&&i===r.NONE&&(t.preventDefault(),n.dispatchEvent(Cg),U(t),n.dispatchEvent(Pg))}function it(t){!1!==n.enabled&&!1!==n.enablePan&&B(t)}function st(t){switch(ut(t),_.length){case 1:switch(n.touches.ONE){case h.ROTATE:if(!1===n.enableRotate)return;H(),i=r.TOUCH_ROTATE;break;case h.PAN:if(!1===n.enablePan)return;G(),i=r.TOUCH_PAN;break;default:i=r.NONE}break;case 2:switch(n.touches.TWO){case h.DOLLY_PAN:if(!1===n.enableZoom&&!1===n.enablePan)return;W(),i=r.TOUCH_DOLLY_PAN;break;case h.DOLLY_ROTATE:if(!1===n.enableZoom&&!1===n.enableRotate)return;j(),i=r.TOUCH_DOLLY_ROTATE;break;default:i=r.NONE}break;default:i=r.NONE}i!==r.NONE&&n.dispatchEvent(Cg)}function ot(t){switch(ut(t),i){case r.TOUCH_ROTATE:if(!1===n.enableRotate)return;q(t),n.update();break;case r.TOUCH_PAN:if(!1===n.enablePan)return;X(t),n.update();break;case r.TOUCH_DOLLY_PAN:if(!1===n.enableZoom&&!1===n.enablePan)return;J(t),n.update();break;case r.TOUCH_DOLLY_ROTATE:if(!1===n.enableZoom&&!1===n.enableRotate)return;Z(t),n.update();break;default:i=r.NONE}}function at(t){!1!==n.enabled&&t.preventDefault()}function ct(t){_.push(t)}function lt(t){delete M[t.pointerId];for(let e=0;e<_.length;e++)if(_[e].pointerId==t.pointerId)return void _.splice(e,1)}function ut(t){let e=M[t.pointerId];void 0===e&&(e=new Fn,M[t.pointerId]=e),e.set(t.pageX,t.pageY)}function ht(t){const e=t.pointerId===_[0].pointerId?_[1]:_[0];return M[e.pointerId]}n.domElement.addEventListener("contextmenu",at),n.domElement.addEventListener("pointerdown",K),n.domElement.addEventListener("pointercancel",tt),n.domElement.addEventListener("wheel",rt,{passive:!1}),this.update()}}var Ng=function(){try{var t=document.createElement("canvas");return!(!window.WebGLRenderingContext||!t.getContext("webgl")&&!t.getContext("experimental-webgl"))}catch(e){return!1}}(),Og={antialias:!0,alpha:!0},Dg={props:{src:{type:String},width:{type:Number},height:{type:Number},position:{type:Object,default:function(){return{x:0,y:0,z:0}}},rotation:{type:Object,default:function(){return{x:0,y:0,z:0}}},scale:{type:Object,default:function(){return{x:1,y:1,z:1}}},lights:{type:Array,default:function(){return[]}},cameraPosition:{type:Object,default:function(){return{x:0,y:0,z:0}}},cameraRotation:{type:Object,default:function(){return{x:0,y:0,z:0}}},cameraUp:{type:Object},cameraLookAt:{type:Object},backgroundColor:{default:16777215},backgroundAlpha:{type:Number,default:1},controlsOptions:{type:Object},crossOrigin:{default:"anonymous"},requestHeader:{default:function(){}},outputEncoding:{type:Number,default:Je},glOptions:{type:Object}},data:function(){return{suportWebGL:Ng,size:{width:this.width,height:this.height},object:null,raycaster:new Bm,mouse:new Fn,camera:new fs(45,1,.01,1e5),scene:new hh,wrapper:new ri,renderer:null,controls:null,allLights:[],clock:"undefined"===typeof performance?Date:performance,reqId:null}},computed:{hasListener:function(){var t=this._events,e={};return["on-mousemove","on-mouseup","on-mousedown","on-click"].forEach((function(n){e[n]=!!t[n]&&t[n].length>0})),e}},mounted:function(){void 0!==this.width&&void 0!==this.height||(this.size={width:this.$el.offsetWidth,height:this.$el.offsetHeight});var t=Object.assign({},Og,this.glOptions,{canvas:this.$refs.canvas});this.renderer=new ah(t),this.renderer.shadowMap.enabled=!0,this.renderer.outputEncoding=this.outputEncoding,this.controls=new Ig(this.camera,this.$el),this.controls.type="orbit",this.scene.add(this.wrapper),this.load(),this.update(),this.$el.addEventListener("mousedown",this.onMouseDown,!1),this.$el.addEventListener("mousemove",this.onMouseMove,!1),this.$el.addEventListener("mouseup",this.onMouseUp,!1),this.$el.addEventListener("click",this.onClick,!1),window.addEventListener("resize",this.onResize,!1),this.animate()},beforeDestroy:function(){cancelAnimationFrame(this.reqId),this.renderer.dispose(),this.controls&&this.controls.dispose(),this.$el.removeEventListener("mousedown",this.onMouseDown,!1),this.$el.removeEventListener("mousemove",this.onMouseMove,!1),this.$el.removeEventListener("mouseup",this.onMouseUp,!1),this.$el.removeEventListener("click",this.onClick,!1),window.removeEventListener("resize",this.onResize,!1)},watch:{src:function(){this.load()},rotation:{deep:!0,handler:function(t){this.object&&this.object.rotation.set(t.x,t.y,t.z)}},position:{deep:!0,handler:function(t){this.object&&this.object.position.set(t.x,t.y,t.z)}},scale:{deep:!0,handler:function(t){this.object&&this.object.scale.set(t.x,t.y,t.z)}},lights:{deep:!0,handler:function(){this.updateLights()}},size:{deep:!0,handler:function(){this.updateCamera(),this.updateRenderer()}},controlsOptions:{deep:!0,handler:function(){this.updateControls()}},backgroundAlpha:function(){this.updateRenderer()},backgroundColor:function(){this.updateRenderer()}},methods:{onResize:function(){var t=this;void 0!==this.width&&void 0!==this.height||this.$nextTick((function(){t.size={width:t.$el.offsetWidth,height:t.$el.offsetHeight}}))},onMouseDown:function(t){if(this.hasListener["on-mousedown"]){var e=this.pick(t.clientX,t.clientY);this.$emit("on-mousedown",e)}},onMouseMove:function(t){if(this.hasListener["on-mousemove"]){var e=this.pick(t.clientX,t.clientY);this.$emit("on-mousemove",e)}},onMouseUp:function(t){if(this.hasListener["on-mouseup"]){var e=this.pick(t.clientX,t.clientY);this.$emit("on-mouseup",e)}},onClick:function(t){if(this.hasListener["on-click"]){var e=this.pick(t.clientX,t.clientY);this.$emit("on-click",e)}},pick:function(t,e){if(!this.object)return null;var n=this.$el.getBoundingClientRect();t-=n.left,e-=n.top,this.mouse.x=t/this.size.width*2-1,this.mouse.y=-e/this.size.height*2+1,this.raycaster.setFromCamera(this.mouse,this.camera);var r=this.raycaster.intersectObject(this.object,!0);return(r&&r.length)>0?r[0]:null},update:function(){this.updateRenderer(),this.updateCamera(),this.updateLights(),this.updateControls()},updateModel:function(){var t=this.object;if(t){var e=this.position,n=this.rotation,r=this.scale;t.position.set(e.x,e.y,e.z),t.rotation.set(n.x,n.y,n.z),t.scale.set(r.x,r.y,r.z)}},updateRenderer:function(){var t=this.renderer;t.setSize(this.size.width,this.size.height),t.setPixelRatio(window.devicePixelRatio||1),t.setClearColor(new Mi(this.backgroundColor).getHex()),t.setClearAlpha(this.backgroundAlpha)},updateCamera:function(){var t=this.camera,e=this.object;if(t.aspect=this.size.width/this.size.height,t.updateProjectionMatrix(),this.cameraLookAt||this.cameraUp)t.position.set(this.cameraPosition.x,this.cameraPosition.y,this.cameraPosition.z),t.rotation.set(this.cameraRotation.x,this.cameraRotation.y,this.cameraRotation.z),t.up.set(this.cameraUp.x,this.cameraUp.y,this.cameraUp.z),t.lookAt(new er(this.cameraLookAt.x,this.cameraLookAt.y,this.cameraLookAt.z));else{if(!e)return;var n=yg(e).length();t.position.set(this.cameraPosition.x,this.cameraPosition.y,this.cameraPosition.z),t.rotation.set(this.cameraRotation.x,this.cameraRotation.y,this.cameraRotation.z),0===this.cameraPosition.x&&0===this.cameraPosition.y&&0===this.cameraPosition.z&&(t.position.z=n),t.lookAt(new er)}},updateLights:function(){var t,e=this;(t=this.scene).remove.apply(t,Lg(this.allLights)),this.allLights=[],this.lights.forEach((function(t){if(t.type){var n=t.type.toLowerCase(),r=null;if("ambient"===n||"ambientlight"===n){var i=0===t.color?t.color:t.color||4210752,s=0===t.intensity?t.intensity:t.intensity||1;r=new em(i,s)}else if("point"===n||"pointlight"===n){var o=0===t.color?t.color:t.color||16777215,a=0===t.intensity?t.intensity:t.intensity||1,c=t.distance||0,l=0===t.decay?t.decay:t.decay||1;r=new $f(o,a,c,l),t.position&&r.position.copy(t.position)}else if("directional"===n||"directionallight"===n){var u=0===t.color?t.color:t.color||16777215,h=0===t.intensity?t.intensity:t.intensity||1;r=new tm(u,h),t.position&&r.position.copy(t.position),t.target&&r.target.copy(t.target)}else if("hemisphere"===n||"hemispherelight"===n){var d=0===t.skyColor?t.skyColor:t.skyColor||16777215,p=0===t.groundColor?t.groundColor:t.groundColor||16777215,f=0===t.intensity?t.intensity:t.intensity||1;r=new Hf(d,p,f),t.position&&r.position.copy(t.position)}e.allLights.push(r),e.scene.add(r)}}))},updateControls:function(){this.controlsOptions&&Object.assign(this.controls,this.controlsOptions)},load:function(){var t=this;this.src&&(this.object&&this.wrapper.remove(this.object),this.loader.setRequestHeader(this.requestHeader),this.loader.load(this.src,(function(){var e=t.getObject.apply(t,arguments);t.process&&t.process(e),t.addObject(e),t.$emit("on-load")}),(function(e){t.$emit("on-progress",e)}),(function(e){t.$emit("on-error",e)})))},getObject:function(t){return t},addObject:function(t){this.object=t,this.wrapper.add(t),this.updateCamera(),this.updateModel();var e=xg(t);this.wrapper.position.copy(e.negate())},animate:function(){this.reqId=requestAnimationFrame(this.animate),this.render()},render:function(){this.renderer.render(this.scene,this.camera)}}},kg=Dg;function zg(t,e,n,r,i,s,o,a){var c,l="function"===typeof t?t.options:t;if(e&&(l.render=e,l.staticRenderFns=n,l._compiled=!0),r&&(l.functional=!0),s&&(l._scopeId="data-v-"+s),o?(c=function(t){t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,t||"undefined"===typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),i&&i.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(o)},l._ssrRegister=c):i&&(c=a?function(){i.call(this,(l.functional?this.parent:this).$root.$options.shadowRoot)}:i),c)if(l.functional){l._injectStyles=c;var u=l.render;l.render=function(t,e){return c.call(e),u(t,e)}}else{var h=l.beforeCreate;l.beforeCreate=h?[].concat(h,c):[c]}return{exports:t,options:l}}var Fg=zg(kg,wg,_g,!1,null,null,null),Ug=Fg.exports,Bg=new gg;Bg.addHandler(/\.dds$/i,new mg);var Hg,Gg,Vg={name:"model-obj",mixins:[Ug],props:{lights:{type:Array,default:function(){return[{type:"HemisphereLight",position:{x:0,y:1,z:0},skyColor:11184895,groundColor:8413280,intensity:.2},{type:"DirectionalLight",position:{x:1,y:1,z:1},color:16777215,intensity:.8}]}},smoothing:{type:Boolean,default:!1},mtlPath:{type:String},mtl:{type:String}},data:function(){var t=new dg(Bg),e=new pg(Bg);return e.setCrossOrigin(this.crossOrigin),e.setRequestHeader(this.requestHeader),t.setRequestHeader(this.requestHeader),{loader:t,mtlLoader:e}},watch:{mtl:function(){this.load()}},methods:{process:function(t){this.smoothing&&t.traverse((function(t){t.geometry&&(t.geometry=bg(t.geometry),t.geometry.computeVertexNormals())}))},load:function(){var t=this;if(this.src){this.object&&this.wrapper.remove(this.object);var e=function(e){t.process&&t.process(e),t.addObject(e),t.$emit("on-load")},n=function(e){t.$emit("on-progress",e)},r=function(e){t.$emit("on-error",e)};if(this.mtl){var i=this.mtlPath,s=this.mtl;if(!this.mtlPath){var o=/^(.*\/)([^/]*)$/.exec(this.mtl);o&&(i=o[1],s=o[2])}i&&this.mtlLoader.setPath(i),this.mtlLoader.load(s,(function(i){i.preload(),t.loader.setMaterials(i).load(t.src,e,n,r)}),(function(){}),r)}else this.loader.load(this.src,e,n,r)}}}},Wg=Vg,jg=zg(Wg,Hg,Gg,!1,null,null,null),qg=jg.exports,Xg={},Yg=function(t){return URL.createObjectURL(new Blob([t],{type:"text/javascript"}))},Jg=function(t){return new Worker(t)};try{URL.revokeObjectURL(Yg(""))}catch(kw){Yg=function(t){return"data:application/javascript;charset=UTF-8,"+encodeURI(t)},Jg=function(t){return new Worker(t,{type:"module"})}}var Zg=function(t,e,n,r,i){var s=Jg(Xg[e]||(Xg[e]=Yg(t)));return s.onerror=function(t){return i(t.error,null)},s.onmessage=function(t){return i(null,t.data)},s.postMessage(n,r),s},Kg=Uint8Array,$g=Uint16Array,Qg=Uint32Array,tv=new Kg([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),ev=new Kg([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),nv=new Kg([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),rv=function(t,e){for(var n=new $g(31),r=0;r<31;++r)n[r]=e+=1<<t[r-1];var i=new Qg(n[30]);for(r=1;r<30;++r)for(var s=n[r];s<n[r+1];++s)i[s]=s-n[r]<<5|r;return[n,i]},iv=rv(tv,2),sv=iv[0],ov=iv[1];sv[28]=258,ov[258]=28;for(var av=rv(ev,0),cv=av[0],lv=av[1],uv=new $g(32768),hv=0;hv<32768;++hv){var dv=(43690&hv)>>>1|(21845&hv)<<1;dv=(52428&dv)>>>2|(13107&dv)<<2,dv=(61680&dv)>>>4|(3855&dv)<<4,uv[hv]=((65280&dv)>>>8|(255&dv)<<8)>>>1}var pv=function(t,e,n){for(var r=t.length,i=0,s=new $g(e);i<r;++i)++s[t[i]-1];var o,a=new $g(e);for(i=0;i<e;++i)a[i]=a[i-1]+s[i-1]<<1;if(n){o=new $g(1<<e);var c=15-e;for(i=0;i<r;++i)if(t[i])for(var l=i<<4|t[i],u=e-t[i],h=a[t[i]-1]++<<u,d=h|(1<<u)-1;h<=d;++h)o[uv[h]>>>c]=l}else for(o=new $g(r),i=0;i<r;++i)t[i]&&(o[i]=uv[a[t[i]-1]++]>>>15-t[i]);return o},fv=new Kg(288);for(hv=0;hv<144;++hv)fv[hv]=8;for(hv=144;hv<256;++hv)fv[hv]=9;for(hv=256;hv<280;++hv)fv[hv]=7;for(hv=280;hv<288;++hv)fv[hv]=8;var mv=new Kg(32);for(hv=0;hv<32;++hv)mv[hv]=5;var gv=pv(fv,9,0),vv=pv(fv,9,1),yv=pv(mv,5,0),xv=pv(mv,5,1),bv=function(t){for(var e=t[0],n=1;n<t.length;++n)t[n]>e&&(e=t[n]);return e},wv=function(t,e,n){var r=e/8|0;return(t[r]|t[r+1]<<8)>>(7&e)&n},_v=function(t,e){var n=e/8|0;return(t[n]|t[n+1]<<8|t[n+2]<<16)>>(7&e)},Mv=function(t){return(t/8|0)+(7&t&&1)},Sv=function(t,e,n){(null==e||e<0)&&(e=0),(null==n||n>t.length)&&(n=t.length);var r=new(t instanceof $g?$g:t instanceof Qg?Qg:Kg)(n-e);return r.set(t.subarray(e,n)),r},Tv=function(t,e,n){var r=t.length;if(!r||n&&!n.l&&r<5)return e||new Kg(0);var i=!e||n,s=!n||n.i;n||(n={}),e||(e=new Kg(3*r));var o=function(t){var n=e.length;if(t>n){var r=new Kg(Math.max(2*n,t));r.set(e),e=r}},a=n.f||0,c=n.p||0,l=n.b||0,u=n.l,h=n.d,d=n.m,p=n.n,f=8*r;do{if(!u){n.f=a=wv(t,c,1);var m=wv(t,c+1,3);if(c+=3,!m){var g=Mv(c)+4,v=t[g-4]|t[g-3]<<8,y=g+v;if(y>r){if(s)throw"unexpected EOF";break}i&&o(l+v),e.set(t.subarray(g,y),l),n.b=l+=v,n.p=c=8*y;continue}if(1==m)u=vv,h=xv,d=9,p=5;else{if(2!=m)throw"invalid block type";var x=wv(t,c,31)+257,b=wv(t,c+10,15)+4,w=x+wv(t,c+5,31)+1;c+=14;for(var _=new Kg(w),M=new Kg(19),S=0;S<b;++S)M[nv[S]]=wv(t,c+3*S,7);c+=3*b;var T=bv(M),E=(1<<T)-1,A=pv(M,T,1);for(S=0;S<w;){var L=A[wv(t,c,E)];c+=15&L;g=L>>>4;if(g<16)_[S++]=g;else{var R=0,C=0;16==g?(C=3+wv(t,c,3),c+=2,R=_[S-1]):17==g?(C=3+wv(t,c,7),c+=3):18==g&&(C=11+wv(t,c,127),c+=7);while(C--)_[S++]=R}}var P=_.subarray(0,x),I=_.subarray(x);d=bv(P),p=bv(I),u=pv(P,d,1),h=pv(I,p,1)}if(c>f){if(s)throw"unexpected EOF";break}}i&&o(l+131072);for(var N=(1<<d)-1,O=(1<<p)-1,D=c;;D=c){R=u[_v(t,c)&N];var k=R>>>4;if(c+=15&R,c>f){if(s)throw"unexpected EOF";break}if(!R)throw"invalid length/literal";if(k<256)e[l++]=k;else{if(256==k){D=c,u=null;break}var z=k-254;if(k>264){S=k-257;var F=tv[S];z=wv(t,c,(1<<F)-1)+sv[S],c+=F}var U=h[_v(t,c)&O],B=U>>>4;if(!U)throw"invalid distance";c+=15&U;I=cv[B];if(B>3){F=ev[B];I+=_v(t,c)&(1<<F)-1,c+=F}if(c>f){if(s)throw"unexpected EOF";break}i&&o(l+131072);for(var H=l+z;l<H;l+=4)e[l]=e[l-I],e[l+1]=e[l+1-I],e[l+2]=e[l+2-I],e[l+3]=e[l+3-I];l=H}}n.l=u,n.p=D,n.b=l,u&&(a=1,n.m=d,n.d=h,n.n=p)}while(!a);return l==e.length?e:Sv(e,0,l)},Ev=function(t,e,n){n<<=7&e;var r=e/8|0;t[r]|=n,t[r+1]|=n>>>8},Av=function(t,e,n){n<<=7&e;var r=e/8|0;t[r]|=n,t[r+1]|=n>>>8,t[r+2]|=n>>>16},Lv=function(t,e){for(var n=[],r=0;r<t.length;++r)t[r]&&n.push({s:r,f:t[r]});var i=n.length,s=n.slice();if(!i)return[Dv,0];if(1==i){var o=new Kg(n[0].s+1);return o[n[0].s]=1,[o,1]}n.sort((function(t,e){return t.f-e.f})),n.push({s:-1,f:25001});var a=n[0],c=n[1],l=0,u=1,h=2;n[0]={s:-1,f:a.f+c.f,l:a,r:c};while(u!=i-1)a=n[n[l].f<n[h].f?l++:h++],c=n[l!=u&&n[l].f<n[h].f?l++:h++],n[u++]={s:-1,f:a.f+c.f,l:a,r:c};var d=s[0].s;for(r=1;r<i;++r)s[r].s>d&&(d=s[r].s);var p=new $g(d+1),f=Rv(n[u-1],p,0);if(f>e){r=0;var m=0,g=f-e,v=1<<g;for(s.sort((function(t,e){return p[e.s]-p[t.s]||t.f-e.f}));r<i;++r){var y=s[r].s;if(!(p[y]>e))break;m+=v-(1<<f-p[y]),p[y]=e}m>>>=g;while(m>0){var x=s[r].s;p[x]<e?m-=1<<e-p[x]++-1:++r}for(;r>=0&&m;--r){var b=s[r].s;p[b]==e&&(--p[b],++m)}f=e}return[new Kg(p),f]},Rv=function(t,e,n){return-1==t.s?Math.max(Rv(t.l,e,n+1),Rv(t.r,e,n+1)):e[t.s]=n},Cv=function(t){var e=t.length;while(e&&!t[--e]);for(var n=new $g(++e),r=0,i=t[0],s=1,o=function(t){n[r++]=t},a=1;a<=e;++a)if(t[a]==i&&a!=e)++s;else{if(!i&&s>2){for(;s>138;s-=138)o(32754);s>2&&(o(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(o(i),--s;s>6;s-=6)o(8304);s>2&&(o(s-3<<5|8208),s=0)}while(s--)o(i);s=1,i=t[a]}return[n.subarray(0,r),e]},Pv=function(t,e){for(var n=0,r=0;r<e.length;++r)n+=t[r]*e[r];return n},Iv=function(t,e,n){var r=n.length,i=Mv(e+2);t[i]=255&r,t[i+1]=r>>>8,t[i+2]=255^t[i],t[i+3]=255^t[i+1];for(var s=0;s<r;++s)t[i+s+4]=n[s];return 8*(i+4+r)},Nv=function(t,e,n,r,i,s,o,a,c,l,u){Ev(e,u++,n),++i[256];for(var h=Lv(i,15),d=h[0],p=h[1],f=Lv(s,15),m=f[0],g=f[1],v=Cv(d),y=v[0],x=v[1],b=Cv(m),w=b[0],_=b[1],M=new $g(19),S=0;S<y.length;++S)M[31&y[S]]++;for(S=0;S<w.length;++S)M[31&w[S]]++;for(var T=Lv(M,7),E=T[0],A=T[1],L=19;L>4&&!E[nv[L-1]];--L);var R,C,P,I,N=l+5<<3,O=Pv(i,fv)+Pv(s,mv)+o,D=Pv(i,d)+Pv(s,m)+o+14+3*L+Pv(M,E)+(2*M[16]+3*M[17]+7*M[18]);if(N<=O&&N<=D)return Iv(e,u,t.subarray(c,c+l));if(Ev(e,u,1+(D<O)),u+=2,D<O){R=pv(d,p,0),C=d,P=pv(m,g,0),I=m;var k=pv(E,A,0);Ev(e,u,x-257),Ev(e,u+5,_-1),Ev(e,u+10,L-4),u+=14;for(S=0;S<L;++S)Ev(e,u+3*S,E[nv[S]]);u+=3*L;for(var z=[y,w],F=0;F<2;++F){var U=z[F];for(S=0;S<U.length;++S){var B=31&U[S];Ev(e,u,k[B]),u+=E[B],B>15&&(Ev(e,u,U[S]>>>5&127),u+=U[S]>>>12)}}}else R=gv,C=fv,P=yv,I=mv;for(S=0;S<a;++S)if(r[S]>255){B=r[S]>>>18&31;Av(e,u,R[B+257]),u+=C[B+257],B>7&&(Ev(e,u,r[S]>>>23&31),u+=tv[B]);var H=31&r[S];Av(e,u,P[H]),u+=I[H],H>3&&(Av(e,u,r[S]>>>5&8191),u+=ev[H])}else Av(e,u,R[r[S]]),u+=C[r[S]];return Av(e,u,R[256]),u+C[256]},Ov=new Qg([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Dv=new Kg(0),kv=function(t,e,n,r,i,s){var o=t.length,a=new Kg(r+o+5*(1+Math.ceil(o/7e3))+i),c=a.subarray(r,a.length-i),l=0;if(!e||o<8)for(var u=0;u<=o;u+=65535){var h=u+65535;h<o?l=Iv(c,l,t.subarray(u,h)):(c[u]=s,l=Iv(c,l,t.subarray(u,o)))}else{for(var d=Ov[e-1],p=d>>>13,f=8191&d,m=(1<<n)-1,g=new $g(32768),v=new $g(m+1),y=Math.ceil(n/3),x=2*y,b=function(e){return(t[e]^t[e+1]<<y^t[e+2]<<x)&m},w=new Qg(25e3),_=new $g(288),M=new $g(32),S=0,T=0,E=(u=0,0),A=0,L=0;u<o;++u){var R=b(u),C=32767&u,P=v[R];if(g[C]=P,v[R]=C,A<=u){var I=o-u;if((S>7e3||E>24576)&&I>423){l=Nv(t,c,0,w,_,M,T,E,L,u-L,l),E=S=T=0,L=u;for(var N=0;N<286;++N)_[N]=0;for(N=0;N<30;++N)M[N]=0}var O=2,D=0,k=f,z=C-P&32767;if(I>2&&R==b(u-z)){var F=Math.min(p,I)-1,U=Math.min(32767,u),B=Math.min(258,I);while(z<=U&&--k&&C!=P){if(t[u+O]==t[u+O-z]){for(var H=0;H<B&&t[u+H]==t[u+H-z];++H);if(H>O){if(O=H,D=z,H>F)break;var G=Math.min(z,H-2),V=0;for(N=0;N<G;++N){var W=u-z+N+32768&32767,j=g[W],q=W-j+32768&32767;q>V&&(V=q,P=W)}}}C=P,P=g[C],z+=C-P+32768&32767}}if(D){w[E++]=268435456|ov[O]<<18|lv[D];var X=31&ov[O],Y=31&lv[D];T+=tv[X]+ev[Y],++_[257+X],++M[Y],A=u+O,++S}else w[E++]=t[u],++_[t[u]]}}l=Nv(t,c,s,w,_,M,T,E,L,u-L,l),!s&&7&l&&(l=Iv(c,l+1,Dv))}return Sv(a,0,r+Mv(l)+i)},zv=function(){for(var t=new Qg(256),e=0;e<256;++e){var n=e,r=9;while(--r)n=(1&n&&3988292384)^n>>>1;t[e]=n}return t}(),Fv=function(){var t=-1;return{p:function(e){for(var n=t,r=0;r<e.length;++r)n=zv[255&n^e[r]]^n>>>8;t=n},d:function(){return~t}}},Uv=function(){var t=1,e=0;return{p:function(n){for(var r=t,i=e,s=n.length,o=0;o!=s;){for(var a=Math.min(o+2655,s);o<a;++o)i+=r+=n[o];r=(65535&r)+15*(r>>16),i=(65535&i)+15*(i>>16)}t=r,e=i},d:function(){return t%=65521,e%=65521,(255&t)<<24|t>>>8<<16|(255&e)<<8|e>>>8}}},Bv=function(t,e,n,r,i){return kv(t,null==e.level?6:e.level,null==e.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(t.length)))):12+e.mem,n,r,!i)},Hv=function(t,e){var n={};for(var r in t)n[r]=t[r];for(var r in e)n[r]=e[r];return n},Gv=function(t,e,n){for(var r=t(),i=t.toString(),s=i.slice(i.indexOf("[")+1,i.lastIndexOf("]")).replace(/ /g,"").split(","),o=0;o<r.length;++o){var a=r[o],c=s[o];if("function"==typeof a){e+=";"+c+"=";var l=a.toString();if(a.prototype)if(-1!=l.indexOf("[native code]")){var u=l.indexOf(" ",8)+1;e+=l.slice(u,l.indexOf("(",u))}else for(var h in e+=l,a.prototype)e+=";"+c+".prototype."+h+"="+a.prototype[h].toString();else e+=l}else n[c]=a}return[e,n]},Vv=[],Wv=function(t){var e=[];for(var n in t)(t[n]instanceof Kg||t[n]instanceof $g||t[n]instanceof Qg)&&e.push((t[n]=new t[n].constructor(t[n])).buffer);return e},jv=function(t,e,n,r){var i;if(!Vv[n]){for(var s="",o={},a=t.length-1,c=0;c<a;++c)i=Gv(t[c],s,o),s=i[0],o=i[1];Vv[n]=Gv(t[a],s,o)}var l=Hv({},Vv[n][1]);return Zg(Vv[n][0]+";onmessage=function(e){for(var k in e.data)self[k]=e.data[k];onmessage="+e.toString()+"}",n,l,Wv(l),r)},qv=function(){return[Kg,$g,Qg,tv,ev,nv,sv,cv,vv,xv,uv,pv,bv,wv,_v,Mv,Sv,Tv,wy,$v,Qv]},Xv=function(){return[Kg,$g,Qg,tv,ev,nv,ov,lv,gv,fv,yv,mv,uv,Ov,Dv,pv,Ev,Av,Lv,Rv,Cv,Pv,Iv,Nv,Mv,Sv,kv,Bv,vy,$v]},Yv=function(){return[ay,uy,oy,Fv,zv]},Jv=function(){return[cy,ly]},Zv=function(){return[hy,oy,Uv]},Kv=function(){return[dy]},$v=function(t){return postMessage(t,[t.buffer])},Qv=function(t){return t&&t.size&&new Kg(t.size)},ty=function(t,e,n,r,i,s){var o=jv(n,r,i,(function(t,e){o.terminate(),s(t,e)}));return o.postMessage([t,e],e.consume?[t.buffer]:[]),function(){o.terminate()}},ey=function(t){return t.ondata=function(t,e){return postMessage([t,e],[t.buffer])},function(e){return t.push(e.data[0],e.data[1])}},ny=function(t,e,n,r,i){var s,o=jv(t,r,i,(function(t,n){t?(o.terminate(),e.ondata.call(e,t)):(n[1]&&o.terminate(),e.ondata.call(e,t,n[0],n[1]))}));o.postMessage(n),e.push=function(t,n){if(s)throw"stream finished";if(!e.ondata)throw"no stream handler";o.postMessage([t,s=n],[t.buffer])},e.terminate=function(){o.terminate()}},ry=function(t,e){return t[e]|t[e+1]<<8},iy=function(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16|t[e+3]<<24)>>>0},sy=function(t,e){return iy(t,e)+4294967296*iy(t,e+4)},oy=function(t,e,n){for(;n;++e)t[e]=n,n>>>=8},ay=function(t,e){var n=e.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=e.level<2?4:9==e.level?2:0,t[9]=3,0!=e.mtime&&oy(t,4,Math.floor(new Date(e.mtime||Date.now())/1e3)),n){t[3]=8;for(var r=0;r<=n.length;++r)t[r+10]=n.charCodeAt(r)}},cy=function(t){if(31!=t[0]||139!=t[1]||8!=t[2])throw"invalid gzip data";var e=t[3],n=10;4&e&&(n+=t[10]|2+(t[11]<<8));for(var r=(e>>3&1)+(e>>4&1);r>0;r-=!t[n++]);return n+(2&e)},ly=function(t){var e=t.length;return(t[e-4]|t[e-3]<<8|t[e-2]<<16|t[e-1]<<24)>>>0},uy=function(t){return 10+(t.filename&&t.filename.length+1||0)},hy=function(t,e){var n=e.level,r=0==n?0:n<6?1:9==n?3:2;t[0]=120,t[1]=r<<6|(r?32-2*r:1)},dy=function(t){if(8!=(15&t[0])||t[0]>>>4>7||(t[0]<<8|t[1])%31)throw"invalid zlib data";if(32&t[1])throw"invalid zlib data: preset dictionaries not supported"};function py(t,e){return e||"function"!=typeof t||(e=t,t={}),this.ondata=e,t}var fy=function(){function t(t,e){e||"function"!=typeof t||(e=t,t={}),this.ondata=e,this.o=t||{}}return t.prototype.p=function(t,e){this.ondata(Bv(t,this.o,0,0,!e),e)},t.prototype.push=function(t,e){if(this.d)throw"stream finished";if(!this.ondata)throw"no stream handler";this.d=e,this.p(t,e||!1)},t}(),my=function(){function t(t,e){ny([Xv,function(){return[ey,fy]}],this,py.call(this,t,e),(function(t){var e=new fy(t.data);onmessage=ey(e)}),6)}return t}();function gy(t,e,n){if(n||(n=e,e={}),"function"!=typeof n)throw"no callback";return ty(t,e,[Xv],(function(t){return $v(vy(t.data[0],t.data[1]))}),0,n)}function vy(t,e){return Bv(t,e||{},0,0)}var yy=function(){function t(t){this.s={},this.p=new Kg(0),this.ondata=t}return t.prototype.e=function(t){if(this.d)throw"stream finished";if(!this.ondata)throw"no stream handler";var e=this.p.length,n=new Kg(e+t.length);n.set(this.p),n.set(t,e),this.p=n},t.prototype.c=function(t){this.d=this.s.i=t||!1;var e=this.s.b,n=Tv(this.p,this.o,this.s);this.ondata(Sv(n,e,this.s.b),this.d),this.o=Sv(n,this.s.b-32768),this.s.b=this.o.length,this.p=Sv(this.p,this.s.p/8|0),this.s.p&=7},t.prototype.push=function(t,e){this.e(t),this.c(e)},t}(),xy=function(){function t(t){this.ondata=t,ny([qv,function(){return[ey,yy]}],this,0,(function(){var t=new yy;onmessage=ey(t)}),7)}return t}();function by(t,e,n){if(n||(n=e,e={}),"function"!=typeof n)throw"no callback";return ty(t,e,[qv],(function(t){return $v(wy(t.data[0],Qv(t.data[1])))}),1,n)}function wy(t,e){return Tv(t,e)}var _y=function(){function t(t,e){this.c=Fv(),this.l=0,this.v=1,fy.call(this,t,e)}return t.prototype.push=function(t,e){fy.prototype.push.call(this,t,e)},t.prototype.p=function(t,e){this.c.p(t),this.l+=t.length;var n=Bv(t,this.o,this.v&&uy(this.o),e&&8,!e);this.v&&(ay(n,this.o),this.v=0),e&&(oy(n,n.length-8,this.c.d()),oy(n,n.length-4,this.l)),this.ondata(n,e)},t}(),My=function(){function t(t,e){ny([Xv,Yv,function(){return[ey,fy,_y]}],this,py.call(this,t,e),(function(t){var e=new _y(t.data);onmessage=ey(e)}),8)}return t}();function Sy(t,e,n){if(n||(n=e,e={}),"function"!=typeof n)throw"no callback";return ty(t,e,[Xv,Yv,function(){return[Ty]}],(function(t){return $v(Ty(t.data[0],t.data[1]))}),2,n)}function Ty(t,e){e||(e={});var n=Fv(),r=t.length;n.p(t);var i=Bv(t,e,uy(e),8),s=i.length;return ay(i,e),oy(i,s-8,n.d()),oy(i,s-4,r),i}var Ey=function(){function t(t){this.v=1,yy.call(this,t)}return t.prototype.push=function(t,e){if(yy.prototype.e.call(this,t),this.v){var n=this.p.length>3?cy(this.p):4;if(n>=this.p.length&&!e)return;this.p=this.p.subarray(n),this.v=0}if(e){if(this.p.length<8)throw"invalid gzip stream";this.p=this.p.subarray(0,-8)}yy.prototype.c.call(this,e)},t}(),Ay=function(){function t(t){this.ondata=t,ny([qv,Jv,function(){return[ey,yy,Ey]}],this,0,(function(){var t=new Ey;onmessage=ey(t)}),9)}return t}();function Ly(t,e,n){if(n||(n=e,e={}),"function"!=typeof n)throw"no callback";return ty(t,e,[qv,Jv,function(){return[Ry]}],(function(t){return $v(Ry(t.data[0]))}),3,n)}function Ry(t,e){return Tv(t.subarray(cy(t),-8),e||new Kg(ly(t)))}var Cy=function(){function t(t,e){this.c=Uv(),this.v=1,fy.call(this,t,e)}return t.prototype.push=function(t,e){fy.prototype.push.call(this,t,e)},t.prototype.p=function(t,e){this.c.p(t);var n=Bv(t,this.o,this.v&&2,e&&4,!e);this.v&&(hy(n,this.o),this.v=0),e&&oy(n,n.length-4,this.c.d()),this.ondata(n,e)},t}(),Py=function(){function t(t,e){ny([Xv,Zv,function(){return[ey,fy,Cy]}],this,py.call(this,t,e),(function(t){var e=new Cy(t.data);onmessage=ey(e)}),10)}return t}();function Iy(t,e,n){if(n||(n=e,e={}),"function"!=typeof n)throw"no callback";return ty(t,e,[Xv,Zv,function(){return[Ny]}],(function(t){return $v(Ny(t.data[0],t.data[1]))}),4,n)}function Ny(t,e){e||(e={});var n=Uv();n.p(t);var r=Bv(t,e,2,4);return hy(r,e),oy(r,r.length-4,n.d()),r}var Oy=function(){function t(t){this.v=1,yy.call(this,t)}return t.prototype.push=function(t,e){if(yy.prototype.e.call(this,t),this.v){if(this.p.length<2&&!e)return;this.p=this.p.subarray(2),this.v=0}if(e){if(this.p.length<4)throw"invalid zlib stream";this.p=this.p.subarray(0,-4)}yy.prototype.c.call(this,e)},t}(),Dy=function(){function t(t){this.ondata=t,ny([qv,Kv,function(){return[ey,yy,Oy]}],this,0,(function(){var t=new Oy;onmessage=ey(t)}),11)}return t}();function ky(t,e,n){if(n||(n=e,e={}),"function"!=typeof n)throw"no callback";return ty(t,e,[qv,Kv,function(){return[zy]}],(function(t){return $v(zy(t.data[0],Qv(t.data[1])))}),5,n)}function zy(t,e){return Tv((dy(t),t.subarray(2,-4)),e)}var Fy=function(){function t(t){this.G=Ey,this.I=yy,this.Z=Oy,this.ondata=t}return t.prototype.push=function(t,e){if(!this.ondata)throw"no stream handler";if(this.s)this.s.push(t,e);else{if(this.p&&this.p.length){var n=new Kg(this.p.length+t.length);n.set(this.p),n.set(t,this.p.length)}else this.p=t;if(this.p.length>2){var r=this,i=function(){r.ondata.apply(r,arguments)};this.s=31==this.p[0]&&139==this.p[1]&&8==this.p[2]?new this.G(i):8!=(15&this.p[0])||this.p[0]>>4>7||(this.p[0]<<8|this.p[1])%31?new this.I(i):new this.Z(i),this.s.push(this.p,e),this.p=null}}},t}(),Uy=function(){function t(t){this.G=Ay,this.I=xy,this.Z=Dy,this.ondata=t}return t.prototype.push=function(t,e){Fy.prototype.push.call(this,t,e)},t}();function By(t,e,n){if(n||(n=e,e={}),"function"!=typeof n)throw"no callback";return 31==t[0]&&139==t[1]&&8==t[2]?Ly(t,e,n):8!=(15&t[0])||t[0]>>4>7||(t[0]<<8|t[1])%31?by(t,e,n):ky(t,e,n)}function Hy(t,e){return 31==t[0]&&139==t[1]&&8==t[2]?Ry(t,e):8!=(15&t[0])||t[0]>>4>7||(t[0]<<8|t[1])%31?wy(t,e):zy(t,e)}var Gy=function(t,e,n,r){for(var i in t){var s=t[i],o=e+i;s instanceof Kg?n[o]=[s,r]:Array.isArray(s)?n[o]=[s[0],Hv(r,s[1])]:Gy(s,o+"/",n,r)}},Vy="undefined"!=typeof TextEncoder&&new TextEncoder,Wy="undefined"!=typeof TextDecoder&&new TextDecoder,jy=0;try{Wy.decode(Dv,{stream:!0}),jy=1}catch(kw){}var qy=function(t){for(var e="",n=0;;){var r=t[n++],i=(r>127)+(r>223)+(r>239);if(n+i>t.length)return[e,Sv(t,n-1)];i?3==i?(r=((15&r)<<18|(63&t[n++])<<12|(63&t[n++])<<6|63&t[n++])-65536,e+=String.fromCharCode(55296|r>>10,56320|1023&r)):e+=1&i?String.fromCharCode((31&r)<<6|63&t[n++]):String.fromCharCode((15&r)<<12|(63&t[n++])<<6|63&t[n++]):e+=String.fromCharCode(r)}},Xy=function(){function t(t){this.ondata=t,jy?this.t=new TextDecoder:this.p=Dv}return t.prototype.push=function(t,e){if(!this.ondata)throw"no callback";if(e=!!e,this.t){if(this.ondata(this.t.decode(t,{stream:!0}),e),e){if(this.t.decode().length)throw"invalid utf-8 data";this.t=null}}else{if(!this.p)throw"stream finished";var n=new Kg(this.p.length+t.length);n.set(this.p),n.set(t,this.p.length);var r=qy(n),i=r[0],s=r[1];if(e){if(s.length)throw"invalid utf-8 data";this.p=null}else this.p=s;this.ondata(i,e)}},t}(),Yy=function(){function t(t){this.ondata=t}return t.prototype.push=function(t,e){if(!this.ondata)throw"no callback";if(this.d)throw"stream finished";this.ondata(Jy(t),this.d=e||!1)},t}();function Jy(t,e){if(e){for(var n=new Kg(t.length),r=0;r<t.length;++r)n[r]=t.charCodeAt(r);return n}if(Vy)return Vy.encode(t);var i=t.length,s=new Kg(t.length+(t.length>>1)),o=0,a=function(t){s[o++]=t};for(r=0;r<i;++r){if(o+5>s.length){var c=new Kg(o+8+(i-r<<1));c.set(s),s=c}var l=t.charCodeAt(r);l<128||e?a(l):l<2048?(a(192|l>>6),a(128|63&l)):l>55295&&l<57344?(l=65536+(1047552&l)|1023&t.charCodeAt(++r),a(240|l>>18),a(128|l>>12&63),a(128|l>>6&63),a(128|63&l)):(a(224|l>>12),a(128|l>>6&63),a(128|63&l))}return Sv(s,0,o)}function Zy(t,e){if(e){for(var n="",r=0;r<t.length;r+=16384)n+=String.fromCharCode.apply(null,t.subarray(r,r+16384));return n}if(Wy)return Wy.decode(t);var i=qy(t),s=i[0],o=i[1];if(o.length)throw"invalid utf-8 data";return s}var Ky=function(t){return 1==t?3:t<6?2:9==t?1:0},$y=function(t,e){return e+30+ry(t,e+26)+ry(t,e+28)},Qy=function(t,e,n){var r=ry(t,e+28),i=Zy(t.subarray(e+46,e+46+r),!(2048&ry(t,e+8))),s=e+46+r,o=iy(t,e+20),a=n&&4294967295==o?tx(t,s):[o,iy(t,e+24),iy(t,e+42)],c=a[0],l=a[1],u=a[2];return[ry(t,e+10),c,l,i,s+ry(t,e+30)+ry(t,e+32),u]},tx=function(t,e){for(;1!=ry(t,e);e+=4+ry(t,e+2));return[sy(t,e+12),sy(t,e+4),sy(t,e+20)]},ex=function(t){var e=0;if(t)for(var n in t){var r=t[n].length;if(r>65535)throw"extra field too long";e+=r+4}return e},nx=function(t,e,n,r,i,s,o,a){var c=r.length,l=n.extra,u=a&&a.length,h=ex(l);oy(t,e,null!=o?33639248:67324752),e+=4,null!=o&&(t[e++]=20,t[e++]=n.os),t[e]=20,e+=2,t[e++]=n.flag<<1|(null==s&&8),t[e++]=i&&8,t[e++]=255&n.compression,t[e++]=n.compression>>8;var d=new Date(null==n.mtime?Date.now():n.mtime),p=d.getFullYear()-1980;if(p<0||p>119)throw"date not in range 1980-2099";if(oy(t,e,p<<25|d.getMonth()+1<<21|d.getDate()<<16|d.getHours()<<11|d.getMinutes()<<5|d.getSeconds()>>>1),e+=4,null!=s&&(oy(t,e,n.crc),oy(t,e+4,s),oy(t,e+8,n.size)),oy(t,e+12,c),oy(t,e+14,h),e+=16,null!=o&&(oy(t,e,u),oy(t,e+6,n.attrs),oy(t,e+10,o),e+=14),t.set(r,e),e+=c,h)for(var f in l){var m=l[f],g=m.length;oy(t,e,+f),oy(t,e+2,g),t.set(m,e+4),e+=4+g}return u&&(t.set(a,e),e+=u),e},rx=function(t,e,n,r,i){oy(t,e,101010256),oy(t,e+8,n),oy(t,e+10,n),oy(t,e+12,r),oy(t,e+16,i)},ix=function(){function t(t){this.filename=t,this.c=Fv(),this.size=0,this.compression=0}return t.prototype.process=function(t,e){this.ondata(null,t,e)},t.prototype.push=function(t,e){if(!this.ondata)throw"no callback - add to ZIP archive before pushing";this.c.p(t),this.size+=t.length,e&&(this.crc=this.c.d()),this.process(t,e||!1)},t}(),sx=function(){function t(t,e){var n=this;e||(e={}),ix.call(this,t),this.d=new fy(e,(function(t,e){n.ondata(null,t,e)})),this.compression=8,this.flag=Ky(e.level)}return t.prototype.process=function(t,e){try{this.d.push(t,e)}catch(kw){this.ondata(kw,null,e)}},t.prototype.push=function(t,e){ix.prototype.push.call(this,t,e)},t}(),ox=function(){function t(t,e){var n=this;e||(e={}),ix.call(this,t),this.d=new my(e,(function(t,e,r){n.ondata(t,e,r)})),this.compression=8,this.flag=Ky(e.level),this.terminate=this.d.terminate}return t.prototype.process=function(t,e){this.d.push(t,e)},t.prototype.push=function(t,e){ix.prototype.push.call(this,t,e)},t}(),ax=function(){function t(t){this.ondata=t,this.u=[],this.d=1}return t.prototype.add=function(t){var e=this;if(2&this.d)throw"stream finished";var n=Jy(t.filename),r=n.length,i=t.comment,s=i&&Jy(i),o=r!=t.filename.length||s&&i.length!=s.length,a=r+ex(t.extra)+30;if(r>65535)throw"filename too long";var c=new Kg(a);nx(c,0,t,n,o);var l=[c],u=function(){for(var t=0,n=l;t<n.length;t++){var r=n[t];e.ondata(null,r,!1)}l=[]},h=this.d;this.d=0;var d=this.u.length,p=Hv(t,{f:n,u:o,o:s,t:function(){t.terminate&&t.terminate()},r:function(){if(u(),h){var t=e.u[d+1];t?t.r():e.d=1}h=1}}),f=0;t.ondata=function(n,r,i){if(n)e.ondata(n,r,i),e.terminate();else if(f+=r.length,l.push(r),i){var s=new Kg(16);oy(s,0,134695760),oy(s,4,t.crc),oy(s,8,f),oy(s,12,t.size),l.push(s),p.c=f,p.b=a+f+16,p.crc=t.crc,p.size=t.size,h&&p.r(),h=1}else h&&u()},this.u.push(p)},t.prototype.end=function(){var t=this;if(2&this.d){if(1&this.d)throw"stream finishing";throw"stream finished"}this.d?this.e():this.u.push({r:function(){1&t.d&&(t.u.splice(-1,1),t.e())},t:function(){}}),this.d=3},t.prototype.e=function(){for(var t=0,e=0,n=0,r=0,i=this.u;r<i.length;r++){var s=i[r];n+=46+s.f.length+ex(s.extra)+(s.o?s.o.length:0)}for(var o=new Kg(n+22),a=0,c=this.u;a<c.length;a++){s=c[a];nx(o,t,s,s.f,s.u,s.c,e,s.o),t+=46+s.f.length+ex(s.extra)+(s.o?s.o.length:0),e+=s.b}rx(o,t,this.u.length,n,e),this.ondata(null,o,!0),this.d=2},t.prototype.terminate=function(){for(var t=0,e=this.u;t<e.length;t++){var n=e[t];n.t()}this.d=2},t}();function cx(t,e,n){if(n||(n=e,e={}),"function"!=typeof n)throw"no callback";var r={};Gy(t,"",r,e);var i=Object.keys(r),s=i.length,o=0,a=0,c=s,l=new Array(s),u=[],h=function(){for(var t=0;t<u.length;++t)u[t]()},d=function(){var t=new Kg(a+22),e=o,r=a-o;a=0;for(var i=0;i<c;++i){var s=l[i];try{var u=s.c.length;nx(t,a,s,s.f,s.u,u);var h=30+s.f.length+ex(s.extra),d=a+h;t.set(s.c,d),nx(t,o,s,s.f,s.u,u,a,s.m),o+=16+h+(s.m?s.m.length:0),a=d+u}catch(kw){return n(kw,null)}}rx(t,o,l.length,r,e),n(null,t)};s||d();for(var p=function(t){var e=i[t],c=r[e],p=c[0],f=c[1],m=Fv(),g=p.length;m.p(p);var v=Jy(e),y=v.length,x=f.comment,b=x&&Jy(x),w=b&&b.length,_=ex(f.extra),M=0==f.level?0:8,S=function(r,i){if(r)h(),n(r,null);else{var c=i.length;l[t]=Hv(f,{size:g,crc:m.d(),c:i,f:v,m:b,u:y!=e.length||b&&x.length!=w,compression:M}),o+=30+y+_+c,a+=76+2*(y+_)+(w||0)+c,--s||d()}};if(y>65535&&S("filename too long",null),M)if(g<16e4)try{S(null,vy(p,f))}catch(kw){S(kw,null)}else u.push(gy(p,f,S));else S(null,p)},f=0;f<c;++f)p(f);return h}function lx(t,e){e||(e={});var n={},r=[];Gy(t,"",n,e);var i=0,s=0;for(var o in n){var a=n[o],c=a[0],l=a[1],u=0==l.level?0:8,h=Jy(o),d=h.length,p=l.comment,f=p&&Jy(p),m=f&&f.length,g=ex(l.extra);if(d>65535)throw"filename too long";var v=u?vy(c,l):c,y=v.length,x=Fv();x.p(c),r.push(Hv(l,{size:c.length,crc:x.d(),c:v,f:h,m:f,u:d!=o.length||f&&p.length!=m,o:i,compression:u})),i+=30+d+g+y,s+=76+2*(d+g)+(m||0)+y}for(var b=new Kg(s+22),w=i,_=s-i,M=0;M<r.length;++M){h=r[M];nx(b,h.o,h,h.f,h.u,h.c.length);var S=30+h.f.length+ex(h.extra);b.set(h.c,h.o+S),nx(b,i,h,h.f,h.u,h.c.length,h.o,h.m),i+=16+S+(h.m?h.m.length:0)}return rx(b,i,r.length,_,w),b}var ux=function(){function t(){}return t.prototype.push=function(t,e){this.ondata(null,t,e)},t.compression=0,t}(),hx=function(){function t(){var t=this;this.i=new yy((function(e,n){t.ondata(null,e,n)}))}return t.prototype.push=function(t,e){try{this.i.push(t,e)}catch(kw){this.ondata(kw,t,e)}},t.compression=8,t}(),dx=function(){function t(t,e){var n=this;e<32e4?this.i=new yy((function(t,e){n.ondata(null,t,e)})):(this.i=new xy((function(t,e,r){n.ondata(t,e,r)})),this.terminate=this.i.terminate)}return t.prototype.push=function(t,e){this.i.terminate&&(t=Sv(t,0)),this.i.push(t,e)},t.compression=8,t}(),px=function(){function t(t){this.onfile=t,this.k=[],this.o={0:ux},this.p=Dv}return t.prototype.push=function(t,e){var n=this;if(!this.onfile)throw"no callback";if(!this.p)throw"stream finished";if(this.c>0){var r=Math.min(this.c,t.length),i=t.subarray(0,r);if(this.c-=r,this.d?this.d.push(i,!this.c):this.k[0].push(i),t=t.subarray(r),t.length)return this.push(t,e)}else{var s=0,o=0,a=void 0,c=void 0;this.p.length?t.length?(c=new Kg(this.p.length+t.length),c.set(this.p),c.set(t,this.p.length)):c=this.p:c=t;for(var l=c.length,u=this.c,h=u&&this.d,d=function(){var t,e=iy(c,o);if(67324752==e){s=1,a=o,p.d=null,p.c=0;var r=ry(c,o+6),i=ry(c,o+8),h=2048&r,d=8&r,f=ry(c,o+26),m=ry(c,o+28);if(l>o+30+f+m){var g=[];p.k.unshift(g),s=2;var v,y=iy(c,o+18),x=iy(c,o+22),b=Zy(c.subarray(o+30,o+=30+f),!h);4294967295==y?(t=d?[-2]:tx(c,o),y=t[0],x=t[1]):d&&(y=-1),o+=m,p.c=y;var w={name:b,compression:i,start:function(){if(!w.ondata)throw"no callback";if(y){var t=n.o[i];if(!t)throw"unknown compression type "+i;v=y<0?new t(b):new t(b,y,x),v.ondata=function(t,e,n){w.ondata(t,e,n)};for(var e=0,r=g;e<r.length;e++){var s=r[e];v.push(s,!1)}n.k[0]==g&&n.c?n.d=v:v.push(Dv,!0)}else w.ondata(null,Dv,!0)},terminate:function(){v&&v.terminate&&v.terminate()}};y>=0&&(w.size=y,w.originalSize=x),p.onfile(w)}return"break"}if(u){if(134695760==e)return a=o+=12+(-2==u&&8),s=3,p.c=0,"break";if(33639248==e)return a=o-=4,s=3,p.c=0,"break"}},p=this;o<l-4;++o){var f=d();if("break"===f)break}if(this.p=Dv,u<0){var m=s?c.subarray(0,a-12-(-2==u&&8)-(134695760==iy(c,a-16)&&4)):c.subarray(0,o);h?h.push(m,!!s):this.k[+(2==s)].push(m)}if(2&s)return this.push(c.subarray(o),e);this.p=c.subarray(o)}if(e){if(this.c)throw"invalid zip file";this.p=null}},t.prototype.register=function(t){this.o[t.compression]=t},t}();function fx(t,e){if("function"!=typeof e)throw"no callback";for(var n=[],r=function(){for(var t=0;t<n.length;++t)n[t]()},i={},s=t.length-22;101010256!=iy(t,s);--s)if(!s||t.length-s>65558)return void e("invalid zip file",null);var o=ry(t,s+8);o||e(null,{});var a=o,c=iy(t,s+16),l=4294967295==c;if(l){if(s=iy(t,s-12),101075792!=iy(t,s))return void e("invalid zip file",null);a=o=iy(t,s+32),c=iy(t,s+48)}for(var u=function(a){var u=Qy(t,c,l),h=u[0],d=u[1],p=u[2],f=u[3],m=u[4],g=u[5],v=$y(t,g);c=m;var y=function(t,n){t?(r(),e(t,null)):(i[f]=n,--o||e(null,i))};if(h)if(8==h){var x=t.subarray(v,v+d);if(d<32e4)try{y(null,wy(x,new Kg(p)))}catch(s){y(s,null)}else n.push(by(x,{size:p},y))}else y("unknown compression type "+h,null);else y(null,Sv(t,v,v+d))},h=0;h<a;++h)u(h);return r}function mx(t){for(var e={},n=t.length-22;101010256!=iy(t,n);--n)if(!n||t.length-n>65558)throw"invalid zip file";var r=ry(t,n+8);if(!r)return{};var i=iy(t,n+16),s=4294967295==i;if(s){if(n=iy(t,n-12),101075792!=iy(t,n))throw"invalid zip file";r=iy(t,n+32),i=iy(t,n+48)}for(var o=0;o<r;++o){var a=Qy(t,i,s),c=a[0],l=a[1],u=a[2],h=a[3],d=a[4],p=a[5],f=$y(t,p);if(i=d,c){if(8!=c)throw"unknown compression type "+c;e[h]=wy(t.subarray(f,f+l),new Kg(u))}else e[h]=Sv(t,f,f+l)}return e}function gx(t,e,n){const r=n.length-t-1;if(e>=n[r])return r-1;if(e<=n[t])return t;let i=t,s=r,o=Math.floor((i+s)/2);while(e<n[o]||e>=n[o+1])e<n[o]?s=o:i=o,o=Math.floor((i+s)/2);return o}function vx(t,e,n,r){const i=[],s=[],o=[];i[0]=1;for(let a=1;a<=n;++a){s[a]=e-r[t+1-a],o[a]=r[t+a]-e;let n=0;for(let t=0;t<a;++t){const e=o[t+1],r=s[a-t],c=i[t]/(e+r);i[t]=n+e*c,n=r*c}i[a]=n}return i}function yx(t,e,n,r){const i=gx(t,r,e),s=vx(i,r,t,e),o=new Zn(0,0,0,0);for(let a=0;a<=t;++a){const e=n[i-t+a],r=s[a],c=e.w*r;o.x+=e.x*c,o.y+=e.y*c,o.z+=e.z*c,o.w+=e.w*r}return o}function xx(t,e,n,r,i){const s=[];for(let h=0;h<=n;++h)s[h]=0;const o=[];for(let h=0;h<=r;++h)o[h]=s.slice(0);const a=[];for(let h=0;h<=n;++h)a[h]=s.slice(0);a[0][0]=1;const c=s.slice(0),l=s.slice(0);for(let h=1;h<=n;++h){c[h]=e-i[t+1-h],l[h]=i[t+h]-e;let n=0;for(let t=0;t<h;++t){const e=l[t+1],r=c[h-t];a[h][t]=e+r;const i=a[t][h-1]/a[h][t];a[t][h]=n+e*i,n=r*i}a[h][h]=n}for(let h=0;h<=n;++h)o[0][h]=a[h][n];for(let h=0;h<=n;++h){let t=0,e=1;const i=[];for(let r=0;r<=n;++r)i[r]=s.slice(0);i[0][0]=1;for(let s=1;s<=r;++s){let r=0;const c=h-s,l=n-s;h>=s&&(i[e][0]=i[t][0]/a[l+1][c],r=i[e][0]*a[c][l]);const u=c>=-1?1:-c,d=h-1<=l?s-1:n-h;for(let n=u;n<=d;++n)i[e][n]=(i[t][n]-i[t][n-1])/a[l+1][c+n],r+=i[e][n]*a[c+n][l];h<=l&&(i[e][s]=-i[t][s-1]/a[l+1][h],r+=i[e][s]*a[h][l]),o[s][h]=r;const p=t;t=e,e=p}}let u=n;for(let h=1;h<=r;++h){for(let t=0;t<=n;++t)o[h][t]*=u;u*=n-h}return o}function bx(t,e,n,r,i){const s=i<t?i:t,o=[],a=gx(t,r,e),c=xx(a,r,t,s,e),l=[];for(let u=0;u<n.length;++u){const t=n[u].clone(),e=t.w;t.x*=e,t.y*=e,t.z*=e,l[u]=t}for(let u=0;u<=s;++u){const e=l[a-t].clone().multiplyScalar(c[u][0]);for(let n=1;n<=t;++n)e.add(l[a-t+n].clone().multiplyScalar(c[u][n]));o[u]=e}for(let u=s+1;u<=i+1;++u)o[u]=new Zn(0,0,0);return o}function wx(t,e){let n=1;for(let i=2;i<=t;++i)n*=i;let r=1;for(let i=2;i<=e;++i)r*=i;for(let i=2;i<=t-e;++i)r*=i;return n/r}function _x(t){const e=t.length,n=[],r=[];for(let s=0;s<e;++s){const e=t[s];n[s]=new er(e.x,e.y,e.z),r[s]=e.w}const i=[];for(let s=0;s<e;++s){const t=n[s].clone();for(let e=1;e<=s;++e)t.sub(i[s-e].clone().multiplyScalar(wx(s,e)*r[e]));i[s]=t.divideScalar(r[0])}return i}function Mx(t,e,n,r,i){const s=bx(t,e,n,r,i);return _x(s)}class Sx extends Ld{constructor(t,e,n,r,i){super(),this.degree=t,this.knots=e,this.controlPoints=[],this.startKnot=r||0,this.endKnot=i||this.knots.length-1;for(let s=0;s<n.length;++s){const t=n[s];this.controlPoints[s]=new Zn(t.x,t.y,t.z,t.w)}}getPoint(t,e=new er){const n=e,r=this.knots[this.startKnot]+t*(this.knots[this.endKnot]-this.knots[this.startKnot]),i=yx(this.degree,this.knots,this.controlPoints,r);return 1!==i.w&&i.divideScalar(i.w),n.set(i.x,i.y,i.z)}getTangent(t,e=new er){const n=e,r=this.knots[0]+t*(this.knots[this.knots.length-1]-this.knots[0]),i=Mx(this.degree,this.knots,this.controlPoints,r,1);return n.copy(i[1]).normalize(),n}}let Tx,Ex,Ax;class Lx extends If{constructor(t){super(t)}load(t,e,n,r){const i=this,s=""===i.path?om.extractUrlBase(t):i.path,o=new Of(this.manager);o.setPath(i.path),o.setResponseType("arraybuffer"),o.setRequestHeader(i.requestHeader),o.setWithCredentials(i.withCredentials),o.load(t,(function(n){try{e(i.parse(n,s))}catch(kw){r?r(kw):console.error(kw),i.manager.itemError(t)}}),n,r)}parse(t,e){if(kx(t))Tx=(new Nx).parse(t);else{const e=Xx(t);if(!zx(e))throw new Error("THREE.FBXLoader: Unknown format.");if(Fx(e)<7e3)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+Fx(e));Tx=(new Ix).parse(e)}const n=new Uf(this.manager).setPath(this.resourcePath||e).setCrossOrigin(this.crossOrigin);return new Rx(n,this.manager).parse(Tx)}}class Rx{constructor(t,e){this.textureLoader=t,this.manager=e}parse(){Ex=this.parseConnections();const t=this.parseImages(),e=this.parseTextures(t),n=this.parseMaterials(e),r=this.parseDeformers(),i=(new Cx).parse(r);return this.parseScene(r,i,n),Ax}parseConnections(){const t=new Map;if("Connections"in Tx){const e=Tx.Connections.connections;e.forEach((function(e){const n=e[0],r=e[1],i=e[2];t.has(n)||t.set(n,{parents:[],children:[]});const s={ID:r,relationship:i};t.get(n).parents.push(s),t.has(r)||t.set(r,{parents:[],children:[]});const o={ID:n,relationship:i};t.get(r).children.push(o)}))}return t}parseImages(){const t={},e={};if("Video"in Tx.Objects){const n=Tx.Objects.Video;for(const r in n){const i=n[r],s=parseInt(r);if(t[s]=i.RelativeFilename||i.Filename,"Content"in i){const t=i.Content instanceof ArrayBuffer&&i.Content.byteLength>0,s="string"===typeof i.Content&&""!==i.Content;if(t||s){const t=this.parseImage(n[r]);e[i.RelativeFilename||i.Filename]=t}}}}for(const n in t){const r=t[n];void 0!==e[r]?t[n]=e[r]:t[n]=t[n].split("\\").pop()}return t}parseImage(t){const e=t.Content,n=t.RelativeFilename||t.Filename,r=n.slice(n.lastIndexOf(".")+1).toLowerCase();let i;switch(r){case"bmp":i="image/bmp";break;case"jpg":case"jpeg":i="image/jpeg";break;case"png":i="image/png";break;case"tif":i="image/tiff";break;case"tga":null===this.manager.getHandler(".tga")&&console.warn("FBXLoader: TGA loader not found, skipping ",n),i="image/tga";break;default:return void console.warn('FBXLoader: Image type "'+r+'" is not supported.')}if("string"===typeof e)return"data:"+i+";base64,"+e;{const t=new Uint8Array(e);return window.URL.createObjectURL(new Blob([t],{type:i}))}}parseTextures(t){const e=new Map;if("Texture"in Tx.Objects){const n=Tx.Objects.Texture;for(const r in n){const i=this.parseTexture(n[r],t);e.set(parseInt(r),i)}}return e}parseTexture(t,e){const n=this.loadTexture(t,e);n.ID=t.id,n.name=t.attrName;const r=t.WrapModeU,i=t.WrapModeV,s=void 0!==r?r.value:0,o=void 0!==i?i.value:0;if(n.wrapS=0===s?ft:mt,n.wrapT=0===o?ft:mt,"Scaling"in t){const e=t.Scaling.value;n.repeat.x=e[0],n.repeat.y=e[1]}return n}loadTexture(t,e){let n;const r=this.textureLoader.path,i=Ex.get(t.id).children;let s;void 0!==i&&i.length>0&&void 0!==e[i[0].ID]&&(n=e[i[0].ID],0!==n.indexOf("blob:")&&0!==n.indexOf("data:")||this.textureLoader.setPath(void 0));const o=t.FileName.slice(-3).toLowerCase();if("tga"===o){const e=this.manager.getHandler(".tga");null===e?(console.warn("FBXLoader: TGA loader not found, creating placeholder texture for",t.RelativeFilename),s=new Yn):(e.setPath(this.textureLoader.path),s=e.load(n))}else"psd"===o?(console.warn("FBXLoader: PSD textures are not supported, creating placeholder texture for",t.RelativeFilename),s=new Yn):s=this.textureLoader.load(n);return this.textureLoader.setPath(r),s}parseMaterials(t){const e=new Map;if("Material"in Tx.Objects){const n=Tx.Objects.Material;for(const r in n){const i=this.parseMaterial(n[r],t);null!==i&&e.set(parseInt(r),i)}}return e}parseMaterial(t,e){const n=t.id,r=t.attrName;let i=t.ShadingModel;if("object"===typeof i&&(i=i.value),!Ex.has(n))return null;const s=this.parseParameters(t,e,n);let o;switch(i.toLowerCase()){case"phong":o=new of;break;case"lambert":o=new lf;break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.',i),o=new of;break}return o.setValues(s),o.name=r,o}parseParameters(t,e,n){const r={};t.BumpFactor&&(r.bumpScale=t.BumpFactor.value),t.Diffuse?r.color=(new Mi).fromArray(t.Diffuse.value):!t.DiffuseColor||"Color"!==t.DiffuseColor.type&&"ColorRGB"!==t.DiffuseColor.type||(r.color=(new Mi).fromArray(t.DiffuseColor.value)),t.DisplacementFactor&&(r.displacementScale=t.DisplacementFactor.value),t.Emissive?r.emissive=(new Mi).fromArray(t.Emissive.value):!t.EmissiveColor||"Color"!==t.EmissiveColor.type&&"ColorRGB"!==t.EmissiveColor.type||(r.emissive=(new Mi).fromArray(t.EmissiveColor.value)),t.EmissiveFactor&&(r.emissiveIntensity=parseFloat(t.EmissiveFactor.value)),t.Opacity&&(r.opacity=parseFloat(t.Opacity.value)),r.opacity<1&&(r.transparent=!0),t.ReflectionFactor&&(r.reflectivity=t.ReflectionFactor.value),t.Shininess&&(r.shininess=t.Shininess.value),t.Specular?r.specular=(new Mi).fromArray(t.Specular.value):t.SpecularColor&&"Color"===t.SpecularColor.type&&(r.specular=(new Mi).fromArray(t.SpecularColor.value));const i=this;return Ex.get(n).children.forEach((function(t){const n=t.relationship;switch(n){case"Bump":r.bumpMap=i.getTexture(e,t.ID);break;case"Maya|TEX_ao_map":r.aoMap=i.getTexture(e,t.ID);break;case"DiffuseColor":case"Maya|TEX_color_map":r.map=i.getTexture(e,t.ID),void 0!==r.map&&(r.map.encoding=Ze);break;case"DisplacementColor":r.displacementMap=i.getTexture(e,t.ID);break;case"EmissiveColor":r.emissiveMap=i.getTexture(e,t.ID),void 0!==r.emissiveMap&&(r.emissiveMap.encoding=Ze);break;case"NormalMap":case"Maya|TEX_normal_map":r.normalMap=i.getTexture(e,t.ID);break;case"ReflectionColor":r.envMap=i.getTexture(e,t.ID),void 0!==r.envMap&&(r.envMap.mapping=ut,r.envMap.encoding=Ze);break;case"SpecularColor":r.specularMap=i.getTexture(e,t.ID),void 0!==r.specularMap&&(r.specularMap.encoding=Ze);break;case"TransparentColor":case"TransparencyFactor":r.alphaMap=i.getTexture(e,t.ID),r.transparent=!0;break;case"AmbientColor":case"ShininessExponent":case"SpecularFactor":case"VectorDisplacementColor":default:console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.",n);break}})),r}getTexture(t,e){return"LayeredTexture"in Tx.Objects&&e in Tx.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),e=Ex.get(e).children[0].ID),t.get(e)}parseDeformers(){const t={},e={};if("Deformer"in Tx.Objects){const n=Tx.Objects.Deformer;for(const r in n){const i=n[r],s=Ex.get(parseInt(r));if("Skin"===i.attrType){const e=this.parseSkeleton(s,n);e.ID=r,s.parents.length>1&&console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."),e.geometryID=s.parents[0].ID,t[r]=e}else if("BlendShape"===i.attrType){const t={id:r};t.rawTargets=this.parseMorphTargets(s,n),t.id=r,s.parents.length>1&&console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),e[r]=t}}}return{skeletons:t,morphTargets:e}}parseSkeleton(t,e){const n=[];return t.children.forEach((function(t){const r=e[t.ID];if("Cluster"!==r.attrType)return;const i={ID:t.ID,indices:[],weights:[],transformLink:(new Ir).fromArray(r.TransformLink.a)};"Indexes"in r&&(i.indices=r.Indexes.a,i.weights=r.Weights.a),n.push(i)})),{rawBones:n,bones:[]}}parseMorphTargets(t,e){const n=[];for(let r=0;r<t.children.length;r++){const i=t.children[r],s=e[i.ID],o={name:s.attrName,initialWeight:s.DeformPercent,id:s.id,fullWeights:s.FullWeights.a};if("BlendShapeChannel"!==s.attrType)return;o.geoID=Ex.get(parseInt(i.ID)).children.filter((function(t){return void 0===t.relationship}))[0].ID,n.push(o)}return n}parseScene(t,e,n){Ax=new th;const r=this.parseModels(t.skeletons,e,n),i=Tx.Objects.Model,s=this;r.forEach((function(t){const e=i[t.ID];s.setLookAtProperties(t,e);const n=Ex.get(t.ID).parents;n.forEach((function(e){const n=r.get(e.ID);void 0!==n&&n.add(t)})),null===t.parent&&Ax.add(t)})),this.bindSkeleton(t.skeletons,e,r),this.createAmbientLight(),Ax.traverse((function(t){if(t.userData.transformData){t.parent&&(t.userData.transformData.parentMatrix=t.parent.matrix,t.userData.transformData.parentMatrixWorld=t.parent.matrixWorld);const e=Wx(t.userData.transformData);t.applyMatrix4(e),t.updateWorldMatrix()}}));const o=(new Px).parse();1===Ax.children.length&&Ax.children[0].isGroup&&(Ax.children[0].animations=o,Ax=Ax.children[0]),Ax.animations=o}parseModels(t,e,n){const r=new Map,i=Tx.Objects.Model;for(const s in i){const o=parseInt(s),a=i[s],c=Ex.get(o);let l=this.buildSkeleton(c,t,o,a.attrName);if(!l){switch(a.attrType){case"Camera":l=this.createCamera(c);break;case"Light":l=this.createLight(c);break;case"Mesh":l=this.createMesh(c,e,n);break;case"NurbsCurve":l=this.createCurve(c,e);break;case"LimbNode":case"Root":l=new Bh;break;case"Null":default:l=new th;break}l.name=a.attrName?Nm.sanitizeNodeName(a.attrName):"",l.ID=o}this.getTransformData(l,a),r.set(o,l)}return r}buildSkeleton(t,e,n,r){let i=null;return t.parents.forEach((function(t){for(const s in e){const o=e[s];o.rawBones.forEach((function(e,s){if(e.ID===t.ID){const t=i;i=new Bh,i.matrixWorld.copy(e.transformLink),i.name=r?Nm.sanitizeNodeName(r):"",i.ID=n,o.bones[s]=i,null!==t&&i.add(t)}}))}})),i}createCamera(t){let e,n;if(t.children.forEach((function(t){const e=Tx.Objects.NodeAttribute[t.ID];void 0!==e&&(n=e)})),void 0===n)e=new ri;else{let t=0;void 0!==n.CameraProjectionType&&1===n.CameraProjectionType.value&&(t=1);let r=1;void 0!==n.NearPlane&&(r=n.NearPlane.value/1e3);let i=1e3;void 0!==n.FarPlane&&(i=n.FarPlane.value/1e3);let s=window.innerWidth,o=window.innerHeight;void 0!==n.AspectWidth&&void 0!==n.AspectHeight&&(s=n.AspectWidth.value,o=n.AspectHeight.value);const a=s/o;let c=45;void 0!==n.FieldOfView&&(c=n.FieldOfView.value);const l=n.FocalLength?n.FocalLength.value:null;switch(t){case 0:e=new fs(c,a,r,i),null!==l&&e.setFocalLength(l);break;case 1:e=new dc(-s/2,s/2,o/2,-o/2,r,i);break;default:console.warn("THREE.FBXLoader: Unknown camera type "+t+"."),e=new ri;break}}return e}createLight(t){let e,n;if(t.children.forEach((function(t){const e=Tx.Objects.NodeAttribute[t.ID];void 0!==e&&(n=e)})),void 0===n)e=new ri;else{let t;t=void 0===n.LightType?0:n.LightType.value;let r=16777215;void 0!==n.Color&&(r=(new Mi).fromArray(n.Color.value));let i=void 0===n.Intensity?1:n.Intensity.value/100;void 0!==n.CastLightOnObject&&0===n.CastLightOnObject.value&&(i=0);let s=0;void 0!==n.FarAttenuationEnd&&(s=void 0!==n.EnableFarAttenuation&&0===n.EnableFarAttenuation.value?0:n.FarAttenuationEnd.value);const o=1;switch(t){case 0:e=new $f(r,i,s,o);break;case 1:e=new tm(r,i);break;case 2:let t=Math.PI/3;void 0!==n.InnerAngle&&(t=zn.degToRad(n.InnerAngle.value));let a=0;void 0!==n.OuterAngle&&(a=zn.degToRad(n.OuterAngle.value),a=Math.max(a,1)),e=new Xf(r,i,s,t,a,o);break;default:console.warn("THREE.FBXLoader: Unknown light type "+n.LightType.value+", defaulting to a PointLight."),e=new $f(r,i);break}void 0!==n.CastShadows&&1===n.CastShadows.value&&(e.castShadow=!0)}return e}createMesh(t,e,n){let r,i=null,s=null;const o=[];return t.children.forEach((function(t){e.has(t.ID)&&(i=e.get(t.ID)),n.has(t.ID)&&o.push(n.get(t.ID))})),o.length>1?s=o:o.length>0?s=o[0]:(s=new of({color:13421772}),o.push(s)),"color"in i.attributes&&o.forEach((function(t){t.vertexColors=!0})),i.FBX_Deformer?(r=new Uh(i,s),r.normalizeSkinWeights()):r=new rs(i,s),r}createCurve(t,e){const n=t.children.reduce((function(t,n){return e.has(n.ID)&&(t=e.get(n.ID)),t}),null),r=new Kh({color:3342591,linewidth:1});return new rd(n,r)}getTransformData(t,e){const n={};"InheritType"in e&&(n.inheritType=parseInt(e.InheritType.value)),n.eulerOrder="RotationOrder"in e?jx(e.RotationOrder.value):"ZYX","Lcl_Translation"in e&&(n.translation=e.Lcl_Translation.value),"PreRotation"in e&&(n.preRotation=e.PreRotation.value),"Lcl_Rotation"in e&&(n.rotation=e.Lcl_Rotation.value),"PostRotation"in e&&(n.postRotation=e.PostRotation.value),"Lcl_Scaling"in e&&(n.scale=e.Lcl_Scaling.value),"ScalingOffset"in e&&(n.scalingOffset=e.ScalingOffset.value),"ScalingPivot"in e&&(n.scalingPivot=e.ScalingPivot.value),"RotationOffset"in e&&(n.rotationOffset=e.RotationOffset.value),"RotationPivot"in e&&(n.rotationPivot=e.RotationPivot.value),t.userData.transformData=n}setLookAtProperties(t,e){if("LookAtProperty"in e){const e=Ex.get(t.ID).children;e.forEach((function(e){if("LookAtProperty"===e.relationship){const n=Tx.Objects.Model[e.ID];if("Lcl_Translation"in n){const e=n.Lcl_Translation.value;void 0!==t.target?(t.target.position.fromArray(e),Ax.add(t.target)):t.lookAt((new er).fromArray(e))}}}))}}bindSkeleton(t,e,n){const r=this.parsePoseNodes();for(const i in t){const s=t[i],o=Ex.get(parseInt(s.ID)).parents;o.forEach((function(t){if(e.has(t.ID)){const e=t.ID,i=Ex.get(e);i.parents.forEach((function(t){if(n.has(t.ID)){const e=n.get(t.ID);e.bind(new Wh(s.bones),r[t.ID])}}))}}))}}parsePoseNodes(){const t={};if("Pose"in Tx.Objects){const e=Tx.Objects.Pose;for(const n in e)if("BindPose"===e[n].attrType&&e[n].NbPoseNodes>0){const r=e[n].PoseNode;Array.isArray(r)?r.forEach((function(e){t[e.Node]=(new Ir).fromArray(e.Matrix.a)})):t[r.Node]=(new Ir).fromArray(r.Matrix.a)}}return t}createAmbientLight(){if("GlobalSettings"in Tx&&"AmbientColor"in Tx.GlobalSettings){const t=Tx.GlobalSettings.AmbientColor.value,e=t[0],n=t[1],r=t[2];if(0!==e||0!==n||0!==r){const t=new Mi(e,n,r);Ax.add(new em(t,1))}}}}class Cx{parse(t){const e=new Map;if("Geometry"in Tx.Objects){const n=Tx.Objects.Geometry;for(const r in n){const i=Ex.get(parseInt(r)),s=this.parseGeometry(i,n[r],t);e.set(parseInt(r),s)}}return e}parseGeometry(t,e,n){switch(e.attrType){case"Mesh":return this.parseMeshGeometry(t,e,n);case"NurbsCurve":return this.parseNurbsGeometry(e)}}parseMeshGeometry(t,e,n){const r=n.skeletons,i=[],s=t.parents.map((function(t){return Tx.Objects.Model[t.ID]}));if(0===s.length)return;const o=t.children.reduce((function(t,e){return void 0!==r[e.ID]&&(t=r[e.ID]),t}),null);t.children.forEach((function(t){void 0!==n.morphTargets[t.ID]&&i.push(n.morphTargets[t.ID])}));const a=s[0],c={};"RotationOrder"in a&&(c.eulerOrder=jx(a.RotationOrder.value)),"InheritType"in a&&(c.inheritType=parseInt(a.InheritType.value)),"GeometricTranslation"in a&&(c.translation=a.GeometricTranslation.value),"GeometricRotation"in a&&(c.rotation=a.GeometricRotation.value),"GeometricScaling"in a&&(c.scale=a.GeometricScaling.value);const l=Wx(c);return this.genGeometry(e,o,i,l)}genGeometry(t,e,n,r){const i=new Ui;t.attrName&&(i.name=t.attrName);const s=this.parseGeoNode(t,e),o=this.genBuffers(s),a=new Pi(o.vertex,3);if(a.applyMatrix4(r),i.setAttribute("position",a),o.colors.length>0&&i.setAttribute("color",new Pi(o.colors,3)),e&&(i.setAttribute("skinIndex",new Li(o.weightsIndices,4)),i.setAttribute("skinWeight",new Pi(o.vertexWeights,4)),i.FBX_Deformer=e),o.normal.length>0){const t=(new Un).getNormalMatrix(r),e=new Pi(o.normal,3);e.applyNormalMatrix(t),i.setAttribute("normal",e)}if(o.uvs.forEach((function(t,e){let n="uv"+(e+1).toString();0===e&&(n="uv"),i.setAttribute(n,new Pi(o.uvs[e],2))})),s.material&&"AllSame"!==s.material.mappingType){let t=o.materialIndex[0],e=0;if(o.materialIndex.forEach((function(n,r){n!==t&&(i.addGroup(e,r-e,t),t=n,e=r)})),i.groups.length>0){const e=i.groups[i.groups.length-1],n=e.start+e.count;n!==o.materialIndex.length&&i.addGroup(n,o.materialIndex.length-n,t)}0===i.groups.length&&i.addGroup(0,o.materialIndex.length,o.materialIndex[0])}return this.addMorphTargets(i,t,n,r),i}parseGeoNode(t,e){const n={};if(n.vertexPositions=void 0!==t.Vertices?t.Vertices.a:[],n.vertexIndices=void 0!==t.PolygonVertexIndex?t.PolygonVertexIndex.a:[],t.LayerElementColor&&(n.color=this.parseVertexColors(t.LayerElementColor[0])),t.LayerElementMaterial&&(n.material=this.parseMaterialIndices(t.LayerElementMaterial[0])),t.LayerElementNormal&&(n.normal=this.parseNormals(t.LayerElementNormal[0])),t.LayerElementUV){n.uv=[];let e=0;while(t.LayerElementUV[e])t.LayerElementUV[e].UV&&n.uv.push(this.parseUVs(t.LayerElementUV[e])),e++}return n.weightTable={},null!==e&&(n.skeleton=e,e.rawBones.forEach((function(t,e){t.indices.forEach((function(r,i){void 0===n.weightTable[r]&&(n.weightTable[r]=[]),n.weightTable[r].push({id:e,weight:t.weights[i]})}))}))),n}genBuffers(t){const e={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]};let n=0,r=0,i=!1,s=[],o=[],a=[],c=[],l=[],u=[];const h=this;return t.vertexIndices.forEach((function(d,p){let f,m=!1;d<0&&(d^=-1,m=!0);let g=[],v=[];if(s.push(3*d,3*d+1,3*d+2),t.color){const e=Hx(p,n,d,t.color);a.push(e[0],e[1],e[2])}if(t.skeleton){if(void 0!==t.weightTable[d]&&t.weightTable[d].forEach((function(t){v.push(t.weight),g.push(t.id)})),v.length>4){i||(console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."),i=!0);const t=[0,0,0,0],e=[0,0,0,0];v.forEach((function(n,r){let i=n,s=g[r];e.forEach((function(e,n,r){if(i>e){r[n]=i,i=e;const o=t[n];t[n]=s,s=o}}))})),g=t,v=e}while(v.length<4)v.push(0),g.push(0);for(let t=0;t<4;++t)l.push(v[t]),u.push(g[t])}if(t.normal){const e=Hx(p,n,d,t.normal);o.push(e[0],e[1],e[2])}t.material&&"AllSame"!==t.material.mappingType&&(f=Hx(p,n,d,t.material)[0]),t.uv&&t.uv.forEach((function(t,e){const r=Hx(p,n,d,t);void 0===c[e]&&(c[e]=[]),c[e].push(r[0]),c[e].push(r[1])})),r++,m&&(h.genFace(e,t,s,f,o,a,c,l,u,r),n++,r=0,s=[],o=[],a=[],c=[],l=[],u=[])})),e}genFace(t,e,n,r,i,s,o,a,c,l){for(let u=2;u<l;u++)t.vertex.push(e.vertexPositions[n[0]]),t.vertex.push(e.vertexPositions[n[1]]),t.vertex.push(e.vertexPositions[n[2]]),t.vertex.push(e.vertexPositions[n[3*(u-1)]]),t.vertex.push(e.vertexPositions[n[3*(u-1)+1]]),t.vertex.push(e.vertexPositions[n[3*(u-1)+2]]),t.vertex.push(e.vertexPositions[n[3*u]]),t.vertex.push(e.vertexPositions[n[3*u+1]]),t.vertex.push(e.vertexPositions[n[3*u+2]]),e.skeleton&&(t.vertexWeights.push(a[0]),t.vertexWeights.push(a[1]),t.vertexWeights.push(a[2]),t.vertexWeights.push(a[3]),t.vertexWeights.push(a[4*(u-1)]),t.vertexWeights.push(a[4*(u-1)+1]),t.vertexWeights.push(a[4*(u-1)+2]),t.vertexWeights.push(a[4*(u-1)+3]),t.vertexWeights.push(a[4*u]),t.vertexWeights.push(a[4*u+1]),t.vertexWeights.push(a[4*u+2]),t.vertexWeights.push(a[4*u+3]),t.weightsIndices.push(c[0]),t.weightsIndices.push(c[1]),t.weightsIndices.push(c[2]),t.weightsIndices.push(c[3]),t.weightsIndices.push(c[4*(u-1)]),t.weightsIndices.push(c[4*(u-1)+1]),t.weightsIndices.push(c[4*(u-1)+2]),t.weightsIndices.push(c[4*(u-1)+3]),t.weightsIndices.push(c[4*u]),t.weightsIndices.push(c[4*u+1]),t.weightsIndices.push(c[4*u+2]),t.weightsIndices.push(c[4*u+3])),e.color&&(t.colors.push(s[0]),t.colors.push(s[1]),t.colors.push(s[2]),t.colors.push(s[3*(u-1)]),t.colors.push(s[3*(u-1)+1]),t.colors.push(s[3*(u-1)+2]),t.colors.push(s[3*u]),t.colors.push(s[3*u+1]),t.colors.push(s[3*u+2])),e.material&&"AllSame"!==e.material.mappingType&&(t.materialIndex.push(r),t.materialIndex.push(r),t.materialIndex.push(r)),e.normal&&(t.normal.push(i[0]),t.normal.push(i[1]),t.normal.push(i[2]),t.normal.push(i[3*(u-1)]),t.normal.push(i[3*(u-1)+1]),t.normal.push(i[3*(u-1)+2]),t.normal.push(i[3*u]),t.normal.push(i[3*u+1]),t.normal.push(i[3*u+2])),e.uv&&e.uv.forEach((function(e,n){void 0===t.uvs[n]&&(t.uvs[n]=[]),t.uvs[n].push(o[n][0]),t.uvs[n].push(o[n][1]),t.uvs[n].push(o[n][2*(u-1)]),t.uvs[n].push(o[n][2*(u-1)+1]),t.uvs[n].push(o[n][2*u]),t.uvs[n].push(o[n][2*u+1])}))}addMorphTargets(t,e,n,r){if(0===n.length)return;t.morphTargetsRelative=!0,t.morphAttributes.position=[];const i=this;n.forEach((function(n){n.rawTargets.forEach((function(n){const s=Tx.Objects.Geometry[n.geoID];void 0!==s&&i.genMorphGeometry(t,e,s,r,n.name)}))}))}genMorphGeometry(t,e,n,r,i){const s=void 0!==e.PolygonVertexIndex?e.PolygonVertexIndex.a:[],o=void 0!==n.Vertices?n.Vertices.a:[],a=void 0!==n.Indexes?n.Indexes.a:[],c=3*t.attributes.position.count,l=new Float32Array(c);for(let p=0;p<a.length;p++){const t=3*a[p];l[t]=o[3*p],l[t+1]=o[3*p+1],l[t+2]=o[3*p+2]}const u={vertexIndices:s,vertexPositions:l},h=this.genBuffers(u),d=new Pi(h.vertex,3);d.name=i||n.attrName,d.applyMatrix4(r),t.morphAttributes.position.push(d)}parseNormals(t){const e=t.MappingInformationType,n=t.ReferenceInformationType,r=t.Normals.a;let i=[];return"IndexToDirect"===n&&("NormalIndex"in t?i=t.NormalIndex.a:"NormalsIndex"in t&&(i=t.NormalsIndex.a)),{dataSize:3,buffer:r,indices:i,mappingType:e,referenceType:n}}parseUVs(t){const e=t.MappingInformationType,n=t.ReferenceInformationType,r=t.UV.a;let i=[];return"IndexToDirect"===n&&(i=t.UVIndex.a),{dataSize:2,buffer:r,indices:i,mappingType:e,referenceType:n}}parseVertexColors(t){const e=t.MappingInformationType,n=t.ReferenceInformationType,r=t.Colors.a;let i=[];return"IndexToDirect"===n&&(i=t.ColorIndex.a),{dataSize:4,buffer:r,indices:i,mappingType:e,referenceType:n}}parseMaterialIndices(t){const e=t.MappingInformationType,n=t.ReferenceInformationType;if("NoMappingInformation"===e)return{dataSize:1,buffer:[0],indices:[0],mappingType:"AllSame",referenceType:n};const r=t.Materials.a,i=[];for(let s=0;s<r.length;++s)i.push(s);return{dataSize:1,buffer:r,indices:i,mappingType:e,referenceType:n}}parseNurbsGeometry(t){if(void 0===Sx)return console.error("THREE.FBXLoader: The loader relies on NURBSCurve for any nurbs present in the model. Nurbs will show up as empty geometry."),new Ui;const e=parseInt(t.Order);if(isNaN(e))return console.error("THREE.FBXLoader: Invalid Order %s given for geometry ID: %s",t.Order,t.id),new Ui;const n=e-1,r=t.KnotVector.a,i=[],s=t.Points.a;for(let u=0,h=s.length;u<h;u+=4)i.push((new Zn).fromArray(s,u));let o,a;if("Closed"===t.Form)i.push(i[0]);else if("Periodic"===t.Form){o=n,a=r.length-1-o;for(let t=0;t<n;++t)i.push(i[t])}const c=new Sx(n,r,i,o,a),l=c.getPoints(12*i.length);return(new Ui).setFromPoints(l)}}class Px{parse(){const t=[],e=this.parseClips();if(void 0!==e)for(const n in e){const r=e[n],i=this.addClip(r);t.push(i)}return t}parseClips(){if(void 0===Tx.Objects.AnimationCurve)return;const t=this.parseAnimationCurveNodes();this.parseAnimationCurves(t);const e=this.parseAnimationLayers(t),n=this.parseAnimStacks(e);return n}parseAnimationCurveNodes(){const t=Tx.Objects.AnimationCurveNode,e=new Map;for(const n in t){const r=t[n];if(null!==r.attrName.match(/S|R|T|DeformPercent/)){const t={id:r.id,attr:r.attrName,curves:{}};e.set(t.id,t)}}return e}parseAnimationCurves(t){const e=Tx.Objects.AnimationCurve;for(const n in e){const r={id:e[n].id,times:e[n].KeyTime.a.map(Ux),values:e[n].KeyValueFloat.a},i=Ex.get(r.id);if(void 0!==i){const e=i.parents[0].ID,n=i.parents[0].relationship;n.match(/X/)?t.get(e).curves["x"]=r:n.match(/Y/)?t.get(e).curves["y"]=r:n.match(/Z/)?t.get(e).curves["z"]=r:n.match(/d|DeformPercent/)&&t.has(e)&&(t.get(e).curves["morph"]=r)}}}parseAnimationLayers(t){const e=Tx.Objects.AnimationLayer,n=new Map;for(const r in e){const e=[],i=Ex.get(parseInt(r));if(void 0!==i){const s=i.children;s.forEach((function(n,r){if(t.has(n.ID)){const i=t.get(n.ID);if(void 0!==i.curves.x||void 0!==i.curves.y||void 0!==i.curves.z){if(void 0===e[r]){const t=Ex.get(n.ID).parents.filter((function(t){return void 0!==t.relationship}))[0].ID;if(void 0!==t){const i=Tx.Objects.Model[t.toString()];if(void 0===i)return void console.warn("THREE.FBXLoader: Encountered a unused curve.",n);const s={modelName:i.attrName?Nm.sanitizeNodeName(i.attrName):"",ID:i.id,initialPosition:[0,0,0],initialRotation:[0,0,0],initialScale:[1,1,1]};Ax.traverse((function(t){t.ID===i.id&&(s.transform=t.matrix,t.userData.transformData&&(s.eulerOrder=t.userData.transformData.eulerOrder))})),s.transform||(s.transform=new Ir),"PreRotation"in i&&(s.preRotation=i.PreRotation.value),"PostRotation"in i&&(s.postRotation=i.PostRotation.value),e[r]=s}}e[r]&&(e[r][i.attr]=i)}else if(void 0!==i.curves.morph){if(void 0===e[r]){const t=Ex.get(n.ID).parents.filter((function(t){return void 0!==t.relationship}))[0].ID,i=Ex.get(t).parents[0].ID,s=Ex.get(i).parents[0].ID,o=Ex.get(s).parents[0].ID,a=Tx.Objects.Model[o],c={modelName:a.attrName?Nm.sanitizeNodeName(a.attrName):"",morphName:Tx.Objects.Deformer[t].attrName};e[r]=c}e[r][i.attr]=i}}})),n.set(parseInt(r),e)}}return n}parseAnimStacks(t){const e=Tx.Objects.AnimationStack,n={};for(const r in e){const i=Ex.get(parseInt(r)).children;i.length>1&&console.warn("THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.");const s=t.get(i[0].ID);n[r]={name:e[r].attrName,layer:s}}return n}addClip(t){let e=[];const n=this;return t.layer.forEach((function(t){e=e.concat(n.generateTracks(t))})),new Ef(t.name,-1,e)}generateTracks(t){const e=[];let n=new er,r=new tr,i=new er;if(t.transform&&t.transform.decompose(n,r,i),n=n.toArray(),r=(new Gr).setFromQuaternion(r,t.eulerOrder).toArray(),i=i.toArray(),void 0!==t.T&&Object.keys(t.T.curves).length>0){const r=this.generateVectorTrack(t.modelName,t.T.curves,n,"position");void 0!==r&&e.push(r)}if(void 0!==t.R&&Object.keys(t.R.curves).length>0){const n=this.generateRotationTrack(t.modelName,t.R.curves,r,t.preRotation,t.postRotation,t.eulerOrder);void 0!==n&&e.push(n)}if(void 0!==t.S&&Object.keys(t.S.curves).length>0){const n=this.generateVectorTrack(t.modelName,t.S.curves,i,"scale");void 0!==n&&e.push(n)}if(void 0!==t.DeformPercent){const n=this.generateMorphTrack(t);void 0!==n&&e.push(n)}return e}generateVectorTrack(t,e,n,r){const i=this.getTimesForAllAxes(e),s=this.getKeyframeTrackValues(i,e,n);return new Tf(t+"."+r,i,s)}generateRotationTrack(t,e,n,r,i,s){void 0!==e.x&&(this.interpolateRotations(e.x),e.x.values=e.x.values.map(zn.degToRad)),void 0!==e.y&&(this.interpolateRotations(e.y),e.y.values=e.y.values.map(zn.degToRad)),void 0!==e.z&&(this.interpolateRotations(e.z),e.z.values=e.z.values.map(zn.degToRad));const o=this.getTimesForAllAxes(e),a=this.getKeyframeTrackValues(o,e,n);void 0!==r&&(r=r.map(zn.degToRad),r.push(s),r=(new Gr).fromArray(r),r=(new tr).setFromEuler(r)),void 0!==i&&(i=i.map(zn.degToRad),i.push(s),i=(new Gr).fromArray(i),i=(new tr).setFromEuler(i).invert());const c=new tr,l=new Gr,u=[];for(let h=0;h<a.length;h+=3)l.set(a[h],a[h+1],a[h+2],s),c.setFromEuler(l),void 0!==r&&c.premultiply(r),void 0!==i&&c.multiply(i),c.toArray(u,h/3*4);return new Mf(t+".quaternion",o,u)}generateMorphTrack(t){const e=t.DeformPercent.curves.morph,n=e.values.map((function(t){return t/100})),r=Ax.getObjectByName(t.modelName).morphTargetDictionary[t.morphName];return new wf(t.modelName+".morphTargetInfluences["+r+"]",e.times,n)}getTimesForAllAxes(t){let e=[];if(void 0!==t.x&&(e=e.concat(t.x.times)),void 0!==t.y&&(e=e.concat(t.y.times)),void 0!==t.z&&(e=e.concat(t.z.times)),e=e.sort((function(t,e){return t-e})),e.length>1){let t=1,n=e[0];for(let r=1;r<e.length;r++){const i=e[r];i!==n&&(e[t]=i,n=i,t++)}e=e.slice(0,t)}return e}getKeyframeTrackValues(t,e,n){const r=n,i=[];let s=-1,o=-1,a=-1;return t.forEach((function(t){if(e.x&&(s=e.x.times.indexOf(t)),e.y&&(o=e.y.times.indexOf(t)),e.z&&(a=e.z.times.indexOf(t)),-1!==s){const t=e.x.values[s];i.push(t),r[0]=t}else i.push(r[0]);if(-1!==o){const t=e.y.values[o];i.push(t),r[1]=t}else i.push(r[1]);if(-1!==a){const t=e.z.values[a];i.push(t),r[2]=t}else i.push(r[2])})),i}interpolateRotations(t){for(let e=1;e<t.values.length;e++){const n=t.values[e-1],r=t.values[e]-n,i=Math.abs(r);if(i>=180){const s=i/180,o=r/s;let a=n+o;const c=t.times[e-1],l=t.times[e]-c,u=l/s;let h=c+u;const d=[],p=[];while(h<t.times[e])d.push(h),h+=u,p.push(a),a+=o;t.times=Zx(t.times,e,d),t.values=Zx(t.values,e,p)}}}}class Ix{getPrevNode(){return this.nodeStack[this.currentIndent-2]}getCurrentNode(){return this.nodeStack[this.currentIndent-1]}getCurrentProp(){return this.currentProp}pushStack(t){this.nodeStack.push(t),this.currentIndent+=1}popStack(){this.nodeStack.pop(),this.currentIndent-=1}setCurrentProp(t,e){this.currentProp=t,this.currentPropName=e}parse(t){this.currentIndent=0,this.allNodes=new Dx,this.nodeStack=[],this.currentProp=[],this.currentPropName="";const e=this,n=t.split(/[\r\n]+/);return n.forEach((function(t,r){const i=t.match(/^[\s\t]*;/),s=t.match(/^[\s\t]*$/);if(i||s)return;const o=t.match("^\\t{"+e.currentIndent+"}(\\w+):(.*){",""),a=t.match("^\\t{"+e.currentIndent+"}(\\w+):[\\s\\t\\r\\n](.*)"),c=t.match("^\\t{"+(e.currentIndent-1)+"}}");o?e.parseNodeBegin(t,o):a?e.parseNodeProperty(t,a,n[++r]):c?e.popStack():t.match(/^[^\s\t}]/)&&e.parseNodePropertyContinued(t)})),this.allNodes}parseNodeBegin(t,e){const n=e[1].trim().replace(/^"/,"").replace(/"$/,""),r=e[2].split(",").map((function(t){return t.trim().replace(/^"/,"").replace(/"$/,"")})),i={name:n},s=this.parseNodeAttr(r),o=this.getCurrentNode();0===this.currentIndent?this.allNodes.add(n,i):n in o?("PoseNode"===n?o.PoseNode.push(i):void 0!==o[n].id&&(o[n]={},o[n][o[n].id]=o[n]),""!==s.id&&(o[n][s.id]=i)):"number"===typeof s.id?(o[n]={},o[n][s.id]=i):"Properties70"!==n&&(o[n]="PoseNode"===n?[i]:i),"number"===typeof s.id&&(i.id=s.id),""!==s.name&&(i.attrName=s.name),""!==s.type&&(i.attrType=s.type),this.pushStack(i)}parseNodeAttr(t){let e=t[0];""!==t[0]&&(e=parseInt(t[0]),isNaN(e)&&(e=t[0]));let n="",r="";return t.length>1&&(n=t[1].replace(/^(\w+)::/,""),r=t[2]),{id:e,name:n,type:r}}parseNodeProperty(t,e,n){let r=e[1].replace(/^"/,"").replace(/"$/,"").trim(),i=e[2].replace(/^"/,"").replace(/"$/,"").trim();"Content"===r&&","===i&&(i=n.replace(/"/g,"").replace(/,$/,"").trim());const s=this.getCurrentNode(),o=s.name;if("Properties70"!==o){if("C"===r){const t=i.split(",").slice(1),e=parseInt(t[0]),n=parseInt(t[1]);let o=i.split(",").slice(3);o=o.map((function(t){return t.trim().replace(/^"/,"")})),r="connections",i=[e,n],Yx(i,o),void 0===s[r]&&(s[r]=[])}"Node"===r&&(s.id=i),r in s&&Array.isArray(s[r])?s[r].push(i):"a"!==r?s[r]=i:s.a=i,this.setCurrentProp(s,r),"a"===r&&","!==i.slice(-1)&&(s.a=qx(i))}else this.parseNodeSpecialProperty(t,r,i)}parseNodePropertyContinued(t){const e=this.getCurrentNode();e.a+=t,","!==t.slice(-1)&&(e.a=qx(e.a))}parseNodeSpecialProperty(t,e,n){const r=n.split('",').map((function(t){return t.trim().replace(/^\"/,"").replace(/\s/,"_")})),i=r[0],s=r[1],o=r[2],a=r[3];let c=r[4];switch(s){case"int":case"enum":case"bool":case"ULongLong":case"double":case"Number":case"FieldOfView":c=parseFloat(c);break;case"Color":case"ColorRGB":case"Vector3D":case"Lcl_Translation":case"Lcl_Rotation":case"Lcl_Scaling":c=qx(c);break}this.getPrevNode()[i]={type:s,type2:o,flag:a,value:c},this.setCurrentProp(this.getPrevNode(),i)}}class Nx{parse(t){const e=new Ox(t);e.skip(23);const n=e.getUint32();if(n<6400)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+n);const r=new Dx;while(!this.endOfContent(e)){const t=this.parseNode(e,n);null!==t&&r.add(t.name,t)}return r}endOfContent(t){return t.size()%16===0?(t.getOffset()+160+16&-16)>=t.size():t.getOffset()+160+16>=t.size()}parseNode(t,e){const n={},r=e>=7500?t.getUint64():t.getUint32(),i=e>=7500?t.getUint64():t.getUint32();e>=7500?t.getUint64():t.getUint32();const s=t.getUint8(),o=t.getString(s);if(0===r)return null;const a=[];for(let h=0;h<i;h++)a.push(this.parseProperty(t));const c=a.length>0?a[0]:"",l=a.length>1?a[1]:"",u=a.length>2?a[2]:"";n.singleProperty=1===i&&t.getOffset()===r;while(r>t.getOffset()){const r=this.parseNode(t,e);null!==r&&this.parseSubNode(o,n,r)}return n.propertyList=a,"number"===typeof c&&(n.id=c),""!==l&&(n.attrName=l),""!==u&&(n.attrType=u),""!==o&&(n.name=o),n}parseSubNode(t,e,n){if(!0===n.singleProperty){const t=n.propertyList[0];Array.isArray(t)?(e[n.name]=n,n.a=t):e[n.name]=t}else if("Connections"===t&&"C"===n.name){const t=[];n.propertyList.forEach((function(e,n){0!==n&&t.push(e)})),void 0===e.connections&&(e.connections=[]),e.connections.push(t)}else if("Properties70"===n.name){const t=Object.keys(n);t.forEach((function(t){e[t]=n[t]}))}else if("Properties70"===t&&"P"===n.name){let t=n.propertyList[0],r=n.propertyList[1];const i=n.propertyList[2],s=n.propertyList[3];let o;0===t.indexOf("Lcl ")&&(t=t.replace("Lcl ","Lcl_")),0===r.indexOf("Lcl ")&&(r=r.replace("Lcl ","Lcl_")),o="Color"===r||"ColorRGB"===r||"Vector"===r||"Vector3D"===r||0===r.indexOf("Lcl_")?[n.propertyList[4],n.propertyList[5],n.propertyList[6]]:n.propertyList[4],e[t]={type:r,type2:i,flag:s,value:o}}else void 0===e[n.name]?"number"===typeof n.id?(e[n.name]={},e[n.name][n.id]=n):e[n.name]=n:"PoseNode"===n.name?(Array.isArray(e[n.name])||(e[n.name]=[e[n.name]]),e[n.name].push(n)):void 0===e[n.name][n.id]&&(e[n.name][n.id]=n)}parseProperty(t){const e=t.getString(1);let n;switch(e){case"C":return t.getBoolean();case"D":return t.getFloat64();case"F":return t.getFloat32();case"I":return t.getInt32();case"L":return t.getInt64();case"R":return n=t.getUint32(),t.getArrayBuffer(n);case"S":return n=t.getUint32(),t.getString(n);case"Y":return t.getInt16();case"b":case"c":case"d":case"f":case"i":case"l":const i=t.getUint32(),s=t.getUint32(),o=t.getUint32();if(0===s)switch(e){case"b":case"c":return t.getBooleanArray(i);case"d":return t.getFloat64Array(i);case"f":return t.getFloat32Array(i);case"i":return t.getInt32Array(i);case"l":return t.getInt64Array(i)}"undefined"===typeof r&&console.error("THREE.FBXLoader: External library fflate.min.js required.");const a=zy(new Uint8Array(t.getArrayBuffer(o))),c=new Ox(a.buffer);switch(e){case"b":case"c":return c.getBooleanArray(i);case"d":return c.getFloat64Array(i);case"f":return c.getFloat32Array(i);case"i":return c.getInt32Array(i);case"l":return c.getInt64Array(i)}default:throw new Error("THREE.FBXLoader: Unknown property type "+e)}}}class Ox{constructor(t,e){this.dv=new DataView(t),this.offset=0,this.littleEndian=void 0===e||e}getOffset(){return this.offset}size(){return this.dv.buffer.byteLength}skip(t){this.offset+=t}getBoolean(){return 1===(1&this.getUint8())}getBooleanArray(t){const e=[];for(let n=0;n<t;n++)e.push(this.getBoolean());return e}getUint8(){const t=this.dv.getUint8(this.offset);return this.offset+=1,t}getInt16(){const t=this.dv.getInt16(this.offset,this.littleEndian);return this.offset+=2,t}getInt32(){const t=this.dv.getInt32(this.offset,this.littleEndian);return this.offset+=4,t}getInt32Array(t){const e=[];for(let n=0;n<t;n++)e.push(this.getInt32());return e}getUint32(){const t=this.dv.getUint32(this.offset,this.littleEndian);return this.offset+=4,t}getInt64(){let t,e;return this.littleEndian?(t=this.getUint32(),e=this.getUint32()):(e=this.getUint32(),t=this.getUint32()),2147483648&e?(e=4294967295&~e,t=4294967295&~t,4294967295===t&&(e=e+1&4294967295),t=t+1&4294967295,-(4294967296*e+t)):4294967296*e+t}getInt64Array(t){const e=[];for(let n=0;n<t;n++)e.push(this.getInt64());return e}getUint64(){let t,e;return this.littleEndian?(t=this.getUint32(),e=this.getUint32()):(e=this.getUint32(),t=this.getUint32()),4294967296*e+t}getFloat32(){const t=this.dv.getFloat32(this.offset,this.littleEndian);return this.offset+=4,t}getFloat32Array(t){const e=[];for(let n=0;n<t;n++)e.push(this.getFloat32());return e}getFloat64(){const t=this.dv.getFloat64(this.offset,this.littleEndian);return this.offset+=8,t}getFloat64Array(t){const e=[];for(let n=0;n<t;n++)e.push(this.getFloat64());return e}getArrayBuffer(t){const e=this.dv.buffer.slice(this.offset,this.offset+t);return this.offset+=t,e}getString(t){let e=[];for(let r=0;r<t;r++)e[r]=this.getUint8();const n=e.indexOf(0);return n>=0&&(e=e.slice(0,n)),om.decodeText(new Uint8Array(e))}}class Dx{add(t,e){this[t]=e}}function kx(t){const e="Kaydara FBX Binary \0";return t.byteLength>=e.length&&e===Xx(t,0,e.length)}function zx(t){const e=["K","a","y","d","a","r","a","\\","F","B","X","\\","B","i","n","a","r","y","\\","\\"];let n=0;function r(e){const r=t[e-1];return t=t.slice(n+e),n++,r}for(let i=0;i<e.length;++i){const t=r(1);if(t===e[i])return!1}return!0}function Fx(t){const e=/FBXVersion: (\d+)/,n=t.match(e);if(n){const t=parseInt(n[1]);return t}throw new Error("THREE.FBXLoader: Cannot find the version number for the file given.")}function Ux(t){return t/46186158e3}const Bx=[];function Hx(t,e,n,r){let i;switch(r.mappingType){case"ByPolygonVertex":i=t;break;case"ByPolygon":i=e;break;case"ByVertice":i=n;break;case"AllSame":i=r.indices[0];break;default:console.warn("THREE.FBXLoader: unknown attribute mapping type "+r.mappingType)}"IndexToDirect"===r.referenceType&&(i=r.indices[i]);const s=i*r.dataSize,o=s+r.dataSize;return Jx(Bx,r.buffer,s,o)}const Gx=new Gr,Vx=new er;function Wx(t){const e=new Ir,n=new Ir,r=new Ir,i=new Ir,s=new Ir,o=new Ir,a=new Ir,c=new Ir,l=new Ir,u=new Ir,h=new Ir,d=new Ir,p=t.inheritType?t.inheritType:0;if(t.translation&&e.setPosition(Vx.fromArray(t.translation)),t.preRotation){const e=t.preRotation.map(zn.degToRad);e.push(t.eulerOrder),n.makeRotationFromEuler(Gx.fromArray(e))}if(t.rotation){const e=t.rotation.map(zn.degToRad);e.push(t.eulerOrder),r.makeRotationFromEuler(Gx.fromArray(e))}if(t.postRotation){const e=t.postRotation.map(zn.degToRad);e.push(t.eulerOrder),i.makeRotationFromEuler(Gx.fromArray(e)),i.invert()}t.scale&&s.scale(Vx.fromArray(t.scale)),t.scalingOffset&&a.setPosition(Vx.fromArray(t.scalingOffset)),t.scalingPivot&&o.setPosition(Vx.fromArray(t.scalingPivot)),t.rotationOffset&&c.setPosition(Vx.fromArray(t.rotationOffset)),t.rotationPivot&&l.setPosition(Vx.fromArray(t.rotationPivot)),t.parentMatrixWorld&&(h.copy(t.parentMatrix),u.copy(t.parentMatrixWorld));const f=n.clone().multiply(r).multiply(i),m=new Ir;m.extractRotation(u);const g=new Ir;g.copyPosition(u);const v=g.clone().invert().multiply(u),y=m.clone().invert().multiply(v),x=s,b=new Ir;if(0===p)b.copy(m).multiply(f).multiply(y).multiply(x);else if(1===p)b.copy(m).multiply(y).multiply(f).multiply(x);else{const t=(new Ir).scale((new er).setFromMatrixScale(h)),e=t.clone().invert(),n=y.clone().multiply(e);b.copy(m).multiply(f).multiply(n).multiply(x)}const w=l.clone().invert(),_=o.clone().invert();let M=e.clone().multiply(c).multiply(l).multiply(n).multiply(r).multiply(i).multiply(w).multiply(a).multiply(o).multiply(s).multiply(_);const S=(new Ir).copyPosition(M),T=u.clone().multiply(S);return d.copyPosition(T),M=d.clone().multiply(b),M.premultiply(u.invert()),M}function jx(t){t=t||0;const e=["ZYX","YZX","XZY","ZXY","YXZ","XYZ"];return 6===t?(console.warn("THREE.FBXLoader: unsupported Euler Order: Spherical XYZ. Animations and rotations may be incorrect."),e[0]):e[t]}function qx(t){const e=t.split(",").map((function(t){return parseFloat(t)}));return e}function Xx(t,e,n){return void 0===e&&(e=0),void 0===n&&(n=t.byteLength),om.decodeText(new Uint8Array(t,e,n))}function Yx(t,e){for(let n=0,r=t.length,i=e.length;n<i;n++,r++)t[r]=e[n]}function Jx(t,e,n,r){for(let i=n,s=0;i<r;i++,s++)t[s]=e[i];return t}function Zx(t,e,n){return t.slice(0,e).concat(n).concat(t.slice(e))}var Kx,$x,Qx,tb,eb={name:"model-fbx",mixins:[Ug],props:{lights:{type:Array,default:function(){return[{type:"HemisphereLight",position:{x:0,y:1,z:0},skyColor:16777215,groundColor:16777215,intensity:.8},{type:"DirectionalLight",position:{x:1,y:1,z:1},color:16777215,intensity:.8}]}}},data:function(){return{loader:new Lx}},methods:{getObject:function(t){return this.animations=t.animations,t}}},nb=eb,rb=zg(nb,Kx,$x,!1,null,null,null),ib=rb.exports,sb={name:"model-three",mixins:[Ug],data:function(){var t=new lm;return t.setCrossOrigin(this.crossOrigin),t.setRequestHeader(this.requestHeader),{loader:t}}},ob=sb,ab=zg(ob,Qx,tb,!1,null,null,null),cb=ab.exports;class lb extends If{constructor(t){super(t)}load(t,e,n,r){const i=this,s=new Of(this.manager);s.setPath(this.path),s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(t,(function(n){try{e(i.parse(n))}catch(kw){r?r(kw):console.error(kw),i.manager.itemError(t)}}),n,r)}parse(t){function e(t){const e=new DataView(t),r=50,i=e.getUint32(80,!0),s=84+i*r;if(s===e.byteLength)return!0;const o=[115,111,108,105,100];for(let a=0;a<5;a++)if(n(o,e,a))return!1;return!0}function n(t,e,n){for(let r=0,i=t.length;r<i;r++)if(t[r]!==e.getUint8(n+r,!1))return!1;return!0}function r(t){const e=new DataView(t),n=e.getUint32(80,!0);let r,i,s,o,a,c,l,u,h=!1;for(let v=0;v<70;v++)1129270351==e.getUint32(v,!1)&&82==e.getUint8(v+4)&&61==e.getUint8(v+5)&&(h=!0,o=new Float32Array(3*n*3),a=e.getUint8(v+6)/255,c=e.getUint8(v+7)/255,l=e.getUint8(v+8)/255,u=e.getUint8(v+9)/255);const d=84,p=50,f=new Ui,m=new Float32Array(3*n*3),g=new Float32Array(3*n*3);for(let v=0;v<n;v++){const t=d+v*p,n=e.getFloat32(t,!0),u=e.getFloat32(t+4,!0),f=e.getFloat32(t+8,!0);if(h){const n=e.getUint16(t+48,!0);0===(32768&n)?(r=(31&n)/31,i=(n>>5&31)/31,s=(n>>10&31)/31):(r=a,i=c,s=l)}for(let a=1;a<=3;a++){const c=t+12*a,l=3*v*3+3*(a-1);m[l]=e.getFloat32(c,!0),m[l+1]=e.getFloat32(c+4,!0),m[l+2]=e.getFloat32(c+8,!0),g[l]=n,g[l+1]=u,g[l+2]=f,h&&(o[l]=r,o[l+1]=i,o[l+2]=s)}}return f.setAttribute("position",new Ai(m,3)),f.setAttribute("normal",new Ai(g,3)),h&&(f.setAttribute("color",new Ai(o,3)),f.hasColors=!0,f.alpha=u),f}function i(t){const e=new Ui,n=/solid([\s\S]*?)endsolid/g,r=/facet([\s\S]*?)endfacet/g;let i=0;const s=/[\s]+([+-]?(?:\d*)(?:\.\d*)?(?:[eE][+-]?\d+)?)/.source,o=new RegExp("vertex"+s+s+s,"g"),a=new RegExp("normal"+s+s+s,"g"),c=[],l=[],u=new er;let h,d=0,p=0,f=0;while(null!==(h=n.exec(t))){p=f;const t=h[0];while(null!==(h=r.exec(t))){let t=0,e=0;const n=h[0];while(null!==(h=a.exec(n)))u.x=parseFloat(h[1]),u.y=parseFloat(h[2]),u.z=parseFloat(h[3]),e++;while(null!==(h=o.exec(n)))c.push(parseFloat(h[1]),parseFloat(h[2]),parseFloat(h[3])),l.push(u.x,u.y,u.z),t++,f++;1!==e&&console.error("THREE.STLLoader: Something isn't right with the normal of face number "+i),3!==t&&console.error("THREE.STLLoader: Something isn't right with the vertices of face number "+i),i++}const n=p,s=f-p;e.addGroup(n,s,d),d++}return e.setAttribute("position",new Pi(c,3)),e.setAttribute("normal",new Pi(l,3)),e}function s(t){return"string"!==typeof t?om.decodeText(new Uint8Array(t)):t}function o(t){if("string"===typeof t){const e=new Uint8Array(t.length);for(let n=0;n<t.length;n++)e[n]=255&t.charCodeAt(n);return e.buffer||e}return t}const a=o(t);return e(a)?r(a):i(s(t))}}var ub,hb,db={name:"model-stl",mixins:[Ug],props:{lights:{type:Array,default:function(){return[{type:"HemisphereLight",position:{x:0,y:1,z:0},skyColor:11184895,groundColor:8413280,intensity:.2},{type:"DirectionalLight",position:{x:1,y:1,z:1},color:16777215,intensity:.8}]}}},data:function(){return{loader:new lb}},methods:{getObject:function(t){return new rs(t,new of)}}},pb=db,fb=zg(pb,ub,hb,!1,null,null,null),mb=fb.exports;class gb extends If{constructor(t){super(t),this.propertyNameMapping={}}load(t,e,n,r){const i=this,s=new Of(this.manager);s.setPath(this.path),s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(t,(function(n){try{e(i.parse(n))}catch(kw){r?r(kw):console.error(kw),i.manager.itemError(t)}}),n,r)}setPropertyNameMapping(t){this.propertyNameMapping=t}parse(t){function e(t){const e=/ply([\s\S]*)end_header\r?\n/;let n="",r=0;const i=e.exec(t);null!==i&&(n=i[1],r=new Blob([i[0]]).size);const s={comments:[],elements:[],headerLength:r,objInfo:""},o=n.split("\n");let a;function c(t,e){const n={type:t[0]};return"list"===n.type?(n.name=t[3],n.countType=t[1],n.itemType=t[2]):n.name=t[1],n.name in e&&(n.name=e[n.name]),n}for(let l=0;l<o.length;l++){let t=o[l];if(t=t.trim(),""===t)continue;const e=t.split(/\s+/),n=e.shift();switch(t=e.join(" "),n){case"format":s.format=e[0],s.version=e[1];break;case"comment":s.comments.push(t);break;case"element":void 0!==a&&s.elements.push(a),a={},a.name=e[0],a.count=parseInt(e[1]),a.properties=[];break;case"property":a.properties.push(c(e,h.propertyNameMapping));break;case"obj_info":s.objInfo=t;break;default:console.log("unhandled",n,e)}}return void 0!==a&&s.elements.push(a),s}function n(t,e){switch(e){case"char":case"uchar":case"short":case"ushort":case"int":case"uint":case"int8":case"uint8":case"int16":case"uint16":case"int32":case"uint32":return parseInt(t);case"float":case"double":case"float32":case"float64":return parseFloat(t)}}function r(t,e){const r=e.split(/\s+/),i={};for(let s=0;s<t.length;s++)if("list"===t[s].type){const e=[],o=n(r.shift(),t[s].countType);for(let i=0;i<o;i++)e.push(n(r.shift(),t[s].itemType));i[t[s].name]=e}else i[t[s].name]=n(r.shift(),t[s].type);return i}function i(t,e){const n={indices:[],vertices:[],normals:[],uvs:[],faceVertexUvs:[],colors:[]};let i;const a=/end_header\s([\s\S]*)$/;let c="";null!==(i=a.exec(t))&&(c=i[1]);const l=c.split("\n");let u=0,h=0;for(let s=0;s<l.length;s++){let t=l[s];if(t=t.trim(),""===t)continue;h>=e.elements[u].count&&(u++,h=0);const i=r(e.elements[u].properties,t);o(n,e.elements[u].name,i),h++}return s(n)}function s(t){let e=new Ui;return t.indices.length>0&&e.setIndex(t.indices),e.setAttribute("position",new Pi(t.vertices,3)),t.normals.length>0&&e.setAttribute("normal",new Pi(t.normals,3)),t.uvs.length>0&&e.setAttribute("uv",new Pi(t.uvs,2)),t.colors.length>0&&e.setAttribute("color",new Pi(t.colors,3)),t.faceVertexUvs.length>0&&(e=e.toNonIndexed(),e.setAttribute("uv",new Pi(t.faceVertexUvs,2))),e.computeBoundingSphere(),e}function o(t,e,n){function r(t){for(let e=0,r=t.length;e<r;e++){const r=t[e];if(r in n)return r}return null}const i=r(["x","px","posx"])||"x",s=r(["y","py","posy"])||"y",o=r(["z","pz","posz"])||"z",a=r(["nx","normalx"]),c=r(["ny","normaly"]),l=r(["nz","normalz"]),u=r(["s","u","texture_u","tx"]),h=r(["t","v","texture_v","ty"]),d=r(["red","diffuse_red","r","diffuse_r"]),p=r(["green","diffuse_green","g","diffuse_g"]),f=r(["blue","diffuse_blue","b","diffuse_b"]);if("vertex"===e)t.vertices.push(n[i],n[s],n[o]),null!==a&&null!==c&&null!==l&&t.normals.push(n[a],n[c],n[l]),null!==u&&null!==h&&t.uvs.push(n[u],n[h]),null!==d&&null!==p&&null!==f&&t.colors.push(n[d]/255,n[p]/255,n[f]/255);else if("face"===e){const e=n.vertex_indices||n.vertex_index,r=n.texcoord;3===e.length?(t.indices.push(e[0],e[1],e[2]),r&&6===r.length&&(t.faceVertexUvs.push(r[0],r[1]),t.faceVertexUvs.push(r[2],r[3]),t.faceVertexUvs.push(r[4],r[5]))):4===e.length&&(t.indices.push(e[0],e[1],e[3]),t.indices.push(e[1],e[2],e[3]))}}function a(t,e,n,r){switch(n){case"int8":case"char":return[t.getInt8(e),1];case"uint8":case"uchar":return[t.getUint8(e),1];case"int16":case"short":return[t.getInt16(e,r),2];case"uint16":case"ushort":return[t.getUint16(e,r),2];case"int32":case"int":return[t.getInt32(e,r),4];case"uint32":case"uint":return[t.getUint32(e,r),4];case"float32":case"float":return[t.getFloat32(e,r),4];case"float64":case"double":return[t.getFloat64(e,r),8]}}function c(t,e,n,r){const i={};let s,o=0;for(let c=0;c<n.length;c++)if("list"===n[c].type){const l=[];s=a(t,e+o,n[c].countType,r);const u=s[0];o+=s[1];for(let i=0;i<u;i++)s=a(t,e+o,n[c].itemType,r),l.push(s[0]),o+=s[1];i[n[c].name]=l}else s=a(t,e+o,n[c].type,r),i[n[c].name]=s[0],o+=s[1];return[i,o]}function l(t,e){const n={indices:[],vertices:[],normals:[],uvs:[],faceVertexUvs:[],colors:[]},r="binary_little_endian"===e.format,i=new DataView(t,e.headerLength);let a,l=0;for(let s=0;s<e.elements.length;s++)for(let t=0;t<e.elements[s].count;t++){a=c(i,l,e.elements[s].properties,r),l+=a[1];const t=a[0];o(n,e.elements[s].name,t)}return s(n)}let u;const h=this;if(t instanceof ArrayBuffer){const n=om.decodeText(new Uint8Array(t)),r=e(n);u="ascii"===r.format?i(n,r):l(t,r)}else u=i(t,e(t));return u}}var vb,yb,xb={name:"model-ply",mixins:[Ug],props:{lights:{type:Array,default:function(){return[{type:"HemisphereLight",position:{x:0,y:1,z:0},skyColor:11184895,groundColor:8413280,intensity:.2},{type:"DirectionalLight",position:{x:1,y:1,z:1},color:16777215,intensity:.8}]}}},data:function(){return{loader:new gb}},methods:{getObject:function(t){return t.computeVertexNormals(),new rs(t,new rf)}}},bb=xb,wb=zg(bb,vb,yb,!1,null,null,null),_b=wb.exports;class Mb extends Ff{constructor(t){super(t)}parse(t){function e(t){switch(t.image_type){case h:case f:(t.colormap_length>256||24!==t.colormap_size||1!==t.colormap_type)&&console.error("THREE.TGALoader: Invalid type colormap data for indexed type.");break;case d:case p:case m:case g:t.colormap_type&&console.error("THREE.TGALoader: Invalid type colormap data for colormap type.");break;case u:console.error("THREE.TGALoader: No data.");default:console.error('THREE.TGALoader: Invalid type "%s".',t.image_type)}(t.width<=0||t.height<=0)&&console.error("THREE.TGALoader: Invalid image size."),8!==t.pixel_size&&16!==t.pixel_size&&24!==t.pixel_size&&32!==t.pixel_size&&console.error('THREE.TGALoader: Invalid pixel size "%s".',t.pixel_size)}function n(t,e,n,r,i){let s,o;const a=n.pixel_size>>3,c=n.width*n.height*a;if(e&&(o=i.subarray(r,r+=n.colormap_length*(n.colormap_size>>3))),t){let t,e,n;s=new Uint8Array(c);let o=0;const l=new Uint8Array(a);while(o<c)if(t=i[r++],e=1+(127&t),128&t){for(n=0;n<a;++n)l[n]=i[r++];for(n=0;n<e;++n)s.set(l,o+n*a);o+=a*e}else{for(e*=a,n=0;n<e;++n)s[o+n]=i[r++];o+=e}}else s=i.subarray(r,r+=e?n.width*n.height:c);return{pixel_data:s,palettes:o}}function r(t,e,n,r,i,s,o,a,c){const l=c;let u,h,d,p=0;const f=T.width;for(d=e;d!==r;d+=n)for(h=i;h!==o;h+=s,p++)u=a[p],t[4*(h+f*d)+3]=255,t[4*(h+f*d)+2]=l[3*u+0],t[4*(h+f*d)+1]=l[3*u+1],t[4*(h+f*d)+0]=l[3*u+2];return t}function i(t,e,n,r,i,s,o,a){let c,l,u,h=0;const d=T.width;for(u=e;u!==r;u+=n)for(l=i;l!==o;l+=s,h+=2)c=a[h+0]+(a[h+1]<<8),t[4*(l+d*u)+0]=(31744&c)>>7,t[4*(l+d*u)+1]=(992&c)>>2,t[4*(l+d*u)+2]=(31&c)<<3,t[4*(l+d*u)+3]=32768&c?0:255;return t}function s(t,e,n,r,i,s,o,a){let c,l,u=0;const h=T.width;for(l=e;l!==r;l+=n)for(c=i;c!==o;c+=s,u+=3)t[4*(c+h*l)+3]=255,t[4*(c+h*l)+2]=a[u+0],t[4*(c+h*l)+1]=a[u+1],t[4*(c+h*l)+0]=a[u+2];return t}function o(t,e,n,r,i,s,o,a){let c,l,u=0;const h=T.width;for(l=e;l!==r;l+=n)for(c=i;c!==o;c+=s,u+=4)t[4*(c+h*l)+2]=a[u+0],t[4*(c+h*l)+1]=a[u+1],t[4*(c+h*l)+0]=a[u+2],t[4*(c+h*l)+3]=a[u+3];return t}function a(t,e,n,r,i,s,o,a){let c,l,u,h=0;const d=T.width;for(u=e;u!==r;u+=n)for(l=i;l!==o;l+=s,h++)c=a[h],t[4*(l+d*u)+0]=c,t[4*(l+d*u)+1]=c,t[4*(l+d*u)+2]=c,t[4*(l+d*u)+3]=255;return t}function c(t,e,n,r,i,s,o,a){let c,l,u=0;const h=T.width;for(l=e;l!==r;l+=n)for(c=i;c!==o;c+=s,u+=2)t[4*(c+h*l)+0]=a[u+0],t[4*(c+h*l)+1]=a[u+0],t[4*(c+h*l)+2]=a[u+0],t[4*(c+h*l)+3]=a[u+1];return t}function l(t,e,n,l,u){let h,d,p,f,m,g;switch((T.flags&v)>>y){default:case w:h=0,p=1,m=e,d=0,f=1,g=n;break;case x:h=0,p=1,m=e,d=n-1,f=-1,g=-1;break;case _:h=e-1,p=-1,m=-1,d=0,f=1,g=n;break;case b:h=e-1,p=-1,m=-1,d=n-1,f=-1,g=-1;break}if(L)switch(T.pixel_size){case 8:a(t,d,f,g,h,p,m,l);break;case 16:c(t,d,f,g,h,p,m,l);break;default:console.error("THREE.TGALoader: Format not supported.");break}else switch(T.pixel_size){case 8:r(t,d,f,g,h,p,m,l,u);break;case 16:i(t,d,f,g,h,p,m,l);break;case 24:s(t,d,f,g,h,p,m,l);break;case 32:o(t,d,f,g,h,p,m,l);break;default:console.error("THREE.TGALoader: Format not supported.");break}return t}const u=0,h=1,d=2,p=3,f=9,m=10,g=11,v=48,y=4,x=0,b=1,w=2,_=3;t.length<19&&console.error("THREE.TGALoader: Not enough data to contain header.");let M=0;const S=new Uint8Array(t),T={id_length:S[M++],colormap_type:S[M++],image_type:S[M++],colormap_index:S[M++]|S[M++]<<8,colormap_length:S[M++]|S[M++]<<8,colormap_size:S[M++],origin:[S[M++]|S[M++]<<8,S[M++]|S[M++]<<8],width:S[M++]|S[M++]<<8,height:S[M++]|S[M++]<<8,pixel_size:S[M++],flags:S[M++]};e(T),T.id_length+M>t.length&&console.error("THREE.TGALoader: No data."),M+=T.id_length;let E=!1,A=!1,L=!1;switch(T.image_type){case f:E=!0,A=!0;break;case h:A=!0;break;case m:E=!0;break;case d:break;case g:E=!0,L=!0;break;case p:L=!0;break}const R=new Uint8Array(T.width*T.height*4),C=n(E,A,T,M,S);return l(R,T.width,T.height,C.pixel_data,C.palettes),{data:R,width:T.width,height:T.height,flipY:!0,generateMipmaps:!0,minFilter:_t}}}class Sb extends If{constructor(t){super(t)}load(t,e,n,r){const i=this,s=""===i.path?om.extractUrlBase(t):i.path,o=new Of(i.manager);o.setPath(i.path),o.setRequestHeader(i.requestHeader),o.setWithCredentials(i.withCredentials),o.load(t,(function(n){try{e(i.parse(n,s))}catch(kw){r?r(kw):console.error(kw),i.manager.itemError(t)}}),n,r)}parse(t,e){function n(t,e){const n=[],r=t.childNodes;for(let i=0,s=r.length;i<s;i++){const t=r[i];t.nodeName===e&&n.push(t)}return n}function r(t){if(0===t.length)return[];const e=t.trim().split(/\s+/),n=new Array(e.length);for(let r=0,i=e.length;r<i;r++)n[r]=e[r];return n}function i(t){if(0===t.length)return[];const e=t.trim().split(/\s+/),n=new Array(e.length);for(let r=0,i=e.length;r<i;r++)n[r]=parseFloat(e[r]);return n}function s(t){if(0===t.length)return[];const e=t.trim().split(/\s+/),n=new Array(e.length);for(let r=0,i=e.length;r<i;r++)n[r]=parseInt(e[r]);return n}function o(t){return t.substring(1)}function a(){return"three_default_"+Le++}function c(t){return 0===Object.keys(t).length}function l(t){return{unit:u(n(t,"unit")[0]),upAxis:h(n(t,"up_axis")[0])}}function u(t){return void 0!==t&&!0===t.hasAttribute("meter")?parseFloat(t.getAttribute("meter")):1}function h(t){return void 0!==t?t.textContent:"Y_UP"}function d(t,e,r,i){const s=n(t,e)[0];if(void 0!==s){const t=n(s,r);for(let e=0;e<t.length;e++)i(t[e])}}function p(t,e){for(const n in t){const r=t[n];r.build=e(t[n])}}function f(t,e){return void 0!==t.build||(t.build=e(t)),t.build}function m(t){const e={sources:{},samplers:{},channels:{}};let n=!1;for(let r=0,i=t.childNodes.length;r<i;r++){const i=t.childNodes[r];if(1!==i.nodeType)continue;let s;switch(i.nodeName){case"source":s=i.getAttribute("id"),e.sources[s]=Et(i);break;case"sampler":s=i.getAttribute("id"),e.samplers[s]=g(i);break;case"channel":s=i.getAttribute("target"),e.channels[s]=v(i);break;case"animation":m(i),n=!0;break;default:console.log(i)}}!1===n&&(Re.animations[t.getAttribute("id")||zn.generateUUID()]=e)}function g(t){const e={inputs:{}};for(let n=0,r=t.childNodes.length;n<r;n++){const r=t.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"input":const t=o(r.getAttribute("source")),n=r.getAttribute("semantic");e.inputs[n]=t;break}}return e}function v(t){const e={},n=t.getAttribute("target");let r=n.split("/");const i=r.shift();let s=r.shift();const a=-1!==s.indexOf("("),c=-1!==s.indexOf(".");if(c)r=s.split("."),s=r.shift(),e.member=r.shift();else if(a){const t=s.split("(");s=t.shift();for(let e=0;e<t.length;e++)t[e]=parseInt(t[e].replace(/\)/,""));e.indices=t}return e.id=i,e.sid=s,e.arraySyntax=a,e.memberSyntax=c,e.sampler=o(t.getAttribute("source")),e}function x(t){const e=[],n=t.channels,r=t.samplers,i=t.sources;for(const s in n)if(n.hasOwnProperty(s)){const t=n[s],o=r[t.sampler],a=o.inputs.INPUT,c=o.inputs.OUTPUT,l=i[a],u=i[c],h=_(t,l,u);A(h,e)}return e}function w(t){return f(Re.animations[t],x)}function _(t,e,n){const r=Re.nodes[t.id],i=he(r.id),s=r.transforms[t.sid],o=r.matrix.clone().transpose();let a,c,l,u,h,d;const p={};switch(s){case"matrix":for(l=0,u=e.array.length;l<u;l++)if(a=e.array[l],c=l*n.stride,void 0===p[a]&&(p[a]={}),!0===t.arraySyntax){const e=n.array[c],r=t.indices[0]+4*t.indices[1];p[a][r]=e}else for(h=0,d=n.stride;h<d;h++)p[a][h]=n.array[c+h];break;case"translate":console.warn('THREE.ColladaLoader: Animation transform type "%s" not yet implemented.',s);break;case"rotate":console.warn('THREE.ColladaLoader: Animation transform type "%s" not yet implemented.',s);break;case"scale":console.warn('THREE.ColladaLoader: Animation transform type "%s" not yet implemented.',s);break}const f=M(p,o),m={name:i.uuid,keyframes:f};return m}function M(t,e){const n=[];for(const i in t)n.push({time:parseFloat(i),value:t[i]});n.sort(r);for(let i=0;i<16;i++)L(n,i,e.elements[i]);return n;function r(t,e){return t.time-e.time}}const S=new er,T=new er,E=new tr;function A(t,e){const n=t.keyframes,r=t.name,i=[],s=[],o=[],a=[];for(let c=0,l=n.length;c<l;c++){const t=n[c],e=t.time,r=t.value;te.fromArray(r).transpose(),te.decompose(S,E,T),i.push(e),s.push(S.x,S.y,S.z),o.push(E.x,E.y,E.z,E.w),a.push(T.x,T.y,T.z)}return s.length>0&&e.push(new Tf(r+".position",i,s)),o.length>0&&e.push(new Mf(r+".quaternion",i,o)),a.length>0&&e.push(new Tf(r+".scale",i,a)),e}function L(t,e,n){let r,i,s,o=!0;for(i=0,s=t.length;i<s;i++)r=t[i],void 0===r.value[e]?r.value[e]=null:o=!1;if(!0===o)for(i=0,s=t.length;i<s;i++)r=t[i],r.value[e]=n;else R(t,e)}function R(t,e){let n,r;for(let i=0,s=t.length;i<s;i++){const s=t[i];if(null===s.value[e]){if(n=C(t,i,e),r=P(t,i,e),null===n){s.value[e]=r.value[e];continue}if(null===r){s.value[e]=n.value[e];continue}I(s,n,r,e)}}}function C(t,e,n){while(e>=0){const r=t[e];if(null!==r.value[n])return r;e--}return null}function P(t,e,n){while(e<t.length){const r=t[e];if(null!==r.value[n])return r;e++}return null}function I(t,e,n,r){n.time-e.time!==0?t.value[r]=(t.time-e.time)*(n.value[r]-e.value[r])/(n.time-e.time)+e.value[r]:t.value[r]=e.value[r]}function N(t){const e={name:t.getAttribute("id")||"default",start:parseFloat(t.getAttribute("start")||0),end:parseFloat(t.getAttribute("end")||0),animations:[]};for(let n=0,r=t.childNodes.length;n<r;n++){const r=t.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"instance_animation":e.animations.push(o(r.getAttribute("url")));break}}Re.clips[t.getAttribute("id")]=e}function O(t){const e=[],n=t.name,r=t.end-t.start||-1,i=t.animations;for(let s=0,o=i.length;s<o;s++){const t=w(i[s]);for(let n=0,r=t.length;n<r;n++)e.push(t[n])}return new Ef(n,r,e)}function D(t){return f(Re.clips[t],O)}function k(t){const e={};for(let n=0,r=t.childNodes.length;n<r;n++){const r=t.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"skin":e.id=o(r.getAttribute("source")),e.skin=z(r);break;case"morph":e.id=o(r.getAttribute("source")),console.warn("THREE.ColladaLoader: Morph target animation not supported yet.");break}}Re.controllers[t.getAttribute("id")]=e}function z(t){const e={sources:{}};for(let n=0,r=t.childNodes.length;n<r;n++){const r=t.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"bind_shape_matrix":e.bindShapeMatrix=i(r.textContent);break;case"source":const t=r.getAttribute("id");e.sources[t]=Et(r);break;case"joints":e.joints=F(r);break;case"vertex_weights":e.vertexWeights=U(r);break}}return e}function F(t){const e={inputs:{}};for(let n=0,r=t.childNodes.length;n<r;n++){const r=t.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"input":const t=r.getAttribute("semantic"),n=o(r.getAttribute("source"));e.inputs[t]=n;break}}return e}function U(t){const e={inputs:{}};for(let n=0,r=t.childNodes.length;n<r;n++){const r=t.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"input":const t=r.getAttribute("semantic"),n=o(r.getAttribute("source")),i=parseInt(r.getAttribute("offset"));e.inputs[t]={id:n,offset:i};break;case"vcount":e.vcount=s(r.textContent);break;case"v":e.v=s(r.textContent);break}}return e}function B(t){const e={id:t.id},n=Re.geometries[e.id];return void 0!==t.skin&&(e.skin=H(t.skin),n.sources.skinIndices=e.skin.indices,n.sources.skinWeights=e.skin.weights),e}function H(t){const e=4,n={joints:[],indices:{array:[],stride:e},weights:{array:[],stride:e}},r=t.sources,i=t.vertexWeights,s=i.vcount,o=i.v,a=i.inputs.JOINT.offset,c=i.inputs.WEIGHT.offset,l=t.sources[t.joints.inputs.JOINT],u=t.sources[t.joints.inputs.INV_BIND_MATRIX],h=r[i.inputs.WEIGHT.id].array;let d,p,f,m=0;for(d=0,f=s.length;d<f;d++){const t=s[d],r=[];for(p=0;p<t;p++){const t=o[m+a],e=o[m+c],n=h[e];r.push({index:t,weight:n}),m+=2}for(r.sort(g),p=0;p<e;p++){const t=r[p];void 0!==t?(n.indices.array.push(t.index),n.weights.array.push(t.weight)):(n.indices.array.push(0),n.weights.array.push(0))}}for(t.bindShapeMatrix?n.bindMatrix=(new Ir).fromArray(t.bindShapeMatrix).transpose():n.bindMatrix=(new Ir).identity(),d=0,f=l.array.length;d<f;d++){const t=l.array[d],e=(new Ir).fromArray(u.array,d*u.stride).transpose();n.joints.push({name:t,boneInverse:e})}return n;function g(t,e){return e.weight-t.weight}}function G(t){return f(Re.controllers[t],B)}function V(t){const e={init_from:n(t,"init_from")[0].textContent};Re.images[t.getAttribute("id")]=e}function W(t){return void 0!==t.build?t.build:t.init_from}function j(t){const e=Re.images[t];return void 0!==e?f(e,W):(console.warn("THREE.ColladaLoader: Couldn't find image with ID:",t),null)}function q(t){const e={};for(let n=0,r=t.childNodes.length;n<r;n++){const r=t.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"profile_COMMON":e.profile=X(r);break}}Re.effects[t.getAttribute("id")]=e}function X(t){const e={surfaces:{},samplers:{}};for(let n=0,r=t.childNodes.length;n<r;n++){const r=t.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"newparam":Y(r,e);break;case"technique":e.technique=K(r);break;case"extra":e.extra=rt(r);break}}return e}function Y(t,e){const n=t.getAttribute("sid");for(let r=0,i=t.childNodes.length;r<i;r++){const i=t.childNodes[r];if(1===i.nodeType)switch(i.nodeName){case"surface":e.surfaces[n]=J(i);break;case"sampler2D":e.samplers[n]=Z(i);break}}}function J(t){const e={};for(let n=0,r=t.childNodes.length;n<r;n++){const r=t.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"init_from":e.init_from=r.textContent;break}}return e}function Z(t){const e={};for(let n=0,r=t.childNodes.length;n<r;n++){const r=t.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"source":e.source=r.textContent;break}}return e}function K(t){const e={};for(let n=0,r=t.childNodes.length;n<r;n++){const r=t.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"constant":case"lambert":case"blinn":case"phong":e.type=r.nodeName,e.parameters=$(r);break;case"extra":e.extra=rt(r);break}}return e}function $(t){const e={};for(let n=0,r=t.childNodes.length;n<r;n++){const r=t.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"emission":case"diffuse":case"specular":case"bump":case"ambient":case"shininess":case"transparency":e[r.nodeName]=Q(r);break;case"transparent":e[r.nodeName]={opaque:r.getAttribute("opaque"),data:Q(r)};break}}return e}function Q(t){const e={};for(let n=0,r=t.childNodes.length;n<r;n++){const r=t.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"color":e[r.nodeName]=i(r.textContent);break;case"float":e[r.nodeName]=parseFloat(r.textContent);break;case"texture":e[r.nodeName]={id:r.getAttribute("texture"),extra:tt(r)};break}}return e}function tt(t){const e={technique:{}};for(let n=0,r=t.childNodes.length;n<r;n++){const r=t.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"extra":et(r,e);break}}return e}function et(t,e){for(let n=0,r=t.childNodes.length;n<r;n++){const r=t.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"technique":nt(r,e);break}}}function nt(t,e){for(let n=0,r=t.childNodes.length;n<r;n++){const r=t.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"repeatU":case"repeatV":case"offsetU":case"offsetV":e.technique[r.nodeName]=parseFloat(r.textContent);break;case"wrapU":case"wrapV":"TRUE"===r.textContent.toUpperCase()?e.technique[r.nodeName]=1:"FALSE"===r.textContent.toUpperCase()?e.technique[r.nodeName]=0:e.technique[r.nodeName]=parseInt(r.textContent);break;case"bump":e[r.nodeName]=st(r);break}}}function rt(t){const e={};for(let n=0,r=t.childNodes.length;n<r;n++){const r=t.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"technique":e.technique=it(r);break}}return e}function it(t){const e={};for(let n=0,r=t.childNodes.length;n<r;n++){const r=t.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"double_sided":e[r.nodeName]=parseInt(r.textContent);break;case"bump":e[r.nodeName]=st(r);break}}return e}function st(t){for(var e={},n=0,r=t.childNodes.length;n<r;n++){var i=t.childNodes[n];if(1===i.nodeType)switch(i.nodeName){case"texture":e[i.nodeName]={id:i.getAttribute("texture"),texcoord:i.getAttribute("texcoord"),extra:tt(i)};break}}return e}function ot(t){return t}function at(t){return f(Re.effects[t],ot)}function ct(t){const e={name:t.getAttribute("name")};for(let n=0,r=t.childNodes.length;n<r;n++){const r=t.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"instance_effect":e.url=o(r.getAttribute("url"));break}}Re.materials[t.getAttribute("id")]=e}function lt(t){let e,n=t.slice(2+(t.lastIndexOf(".")-1>>>0));switch(n=n.toLowerCase(),n){case"tga":e=Te;break;default:e=Se}return e}function ut(t){const e=at(t.url),n=e.profile.technique;let r;switch(n.type){case"phong":case"blinn":r=new of;break;case"lambert":r=new lf;break;default:r=new Si;break}function i(t){const n=e.profile.samplers[t.id];let r=null;if(void 0!==n){const t=e.profile.surfaces[n.source];r=j(t.init_from)}else console.warn("THREE.ColladaLoader: Undefined sampler. Access image directly (see #12530)."),r=j(t.id);if(null!==r){const e=lt(r);if(void 0!==e){const n=e.load(r),i=t.extra;if(void 0!==i&&void 0!==i.technique&&!1===c(i.technique)){const t=i.technique;n.wrapS=t.wrapU?ft:mt,n.wrapT=t.wrapV?ft:mt,n.offset.set(t.offsetU||0,t.offsetV||0),n.repeat.set(t.repeatU||1,t.repeatV||1)}else n.wrapS=ft,n.wrapT=ft;return n}return console.warn("THREE.ColladaLoader: Loader for texture %s not found.",r),null}return console.warn("THREE.ColladaLoader: Couldn't create texture with ID:",t.id),null}r.name=t.name||"";const s=n.parameters;for(const c in s){const t=s[c];switch(c){case"diffuse":t.color&&r.color.fromArray(t.color),t.texture&&(r.map=i(t.texture));break;case"specular":t.color&&r.specular&&r.specular.fromArray(t.color),t.texture&&(r.specularMap=i(t.texture));break;case"bump":t.texture&&(r.normalMap=i(t.texture));break;case"ambient":t.texture&&(r.lightMap=i(t.texture));break;case"shininess":t.float&&r.shininess&&(r.shininess=t.float);break;case"emission":t.color&&r.emissive&&r.emissive.fromArray(t.color),t.texture&&(r.emissiveMap=i(t.texture));break}}let o=s["transparent"],a=s["transparency"];if(void 0===a&&o&&(a={float:1}),void 0===o&&a&&(o={opaque:"A_ONE",data:{color:[1,1,1,1]}}),o&&a)if(o.data.texture)r.transparent=!0;else{const t=o.data.color;switch(o.opaque){case"A_ONE":r.opacity=t[3]*a.float;break;case"RGB_ZERO":r.opacity=1-t[0]*a.float;break;case"A_ZERO":r.opacity=1-t[3]*a.float;break;case"RGB_ONE":r.opacity=t[0]*a.float;break;default:r.opacity=1-a.float,console.warn('THREE.ColladaLoader: Invalid opaque type "%s" of transparent tag.',o.opaque)}r.opacity<1&&(r.transparent=!0)}if(void 0!==n.extra&&void 0!==n.extra.technique){const t=n.extra.technique;for(const e in t){const n=t[e];switch(e){case"double_sided":r.side=1===n?b:y;break;case"bump":r.normalMap=i(n.texture),r.normalScale=new Fn(1,1);break}}}return r}function ht(t){return f(Re.materials[t],ut)}function dt(t){const e={name:t.getAttribute("name")};for(let n=0,r=t.childNodes.length;n<r;n++){const r=t.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"optics":e.optics=pt(r);break}}Re.cameras[t.getAttribute("id")]=e}function pt(t){for(let e=0;e<t.childNodes.length;e++){const n=t.childNodes[e];switch(n.nodeName){case"technique_common":return gt(n)}}return{}}function gt(t){const e={};for(let n=0;n<t.childNodes.length;n++){const r=t.childNodes[n];switch(r.nodeName){case"perspective":case"orthographic":e.technique=r.nodeName,e.parameters=vt(r);break}}return e}function vt(t){const e={};for(let n=0;n<t.childNodes.length;n++){const r=t.childNodes[n];switch(r.nodeName){case"xfov":case"yfov":case"xmag":case"ymag":case"znear":case"zfar":case"aspect_ratio":e[r.nodeName]=parseFloat(r.textContent);break}}return e}function yt(t){let e;switch(t.optics.technique){case"perspective":e=new fs(t.optics.parameters.yfov,t.optics.parameters.aspect_ratio,t.optics.parameters.znear,t.optics.parameters.zfar);break;case"orthographic":let n=t.optics.parameters.ymag,r=t.optics.parameters.xmag;const i=t.optics.parameters.aspect_ratio;r=void 0===r?n*i:r,n=void 0===n?r/i:n,r*=.5,n*=.5,e=new dc(-r,r,n,-n,t.optics.parameters.znear,t.optics.parameters.zfar);break;default:e=new fs;break}return e.name=t.name||"",e}function xt(t){const e=Re.cameras[t];return void 0!==e?f(e,yt):(console.warn("THREE.ColladaLoader: Couldn't find camera with ID:",t),null)}function bt(t){let e={};for(let n=0,r=t.childNodes.length;n<r;n++){const r=t.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"technique_common":e=wt(r);break}}Re.lights[t.getAttribute("id")]=e}function wt(t){const e={};for(let n=0,r=t.childNodes.length;n<r;n++){const r=t.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"directional":case"point":case"spot":case"ambient":e.technique=r.nodeName,e.parameters=_t(r)}}return e}function _t(t){const e={};for(let n=0,r=t.childNodes.length;n<r;n++){const r=t.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"color":const t=i(r.textContent);e.color=(new Mi).fromArray(t);break;case"falloff_angle":e.falloffAngle=parseFloat(r.textContent);break;case"quadratic_attenuation":const n=parseFloat(r.textContent);e.distance=n?Math.sqrt(1/n):0;break}}return e}function Mt(t){let e;switch(t.technique){case"directional":e=new tm;break;case"point":e=new $f;break;case"spot":e=new Xf;break;case"ambient":e=new em;break}return t.parameters.color&&e.color.copy(t.parameters.color),t.parameters.distance&&(e.distance=t.parameters.distance),e}function St(t){const e=Re.lights[t];return void 0!==e?f(e,Mt):(console.warn("THREE.ColladaLoader: Couldn't find light with ID:",t),null)}function Tt(t){const e={name:t.getAttribute("name"),sources:{},vertices:{},primitives:[]},r=n(t,"mesh")[0];if(void 0!==r){for(let t=0;t<r.childNodes.length;t++){const n=r.childNodes[t];if(1!==n.nodeType)continue;const i=n.getAttribute("id");switch(n.nodeName){case"source":e.sources[i]=Et(n);break;case"vertices":e.vertices=At(n);break;case"polygons":console.warn("THREE.ColladaLoader: Unsupported primitive type: ",n.nodeName);break;case"lines":case"linestrips":case"polylist":case"triangles":e.primitives.push(Lt(n));break;default:console.log(n)}}Re.geometries[t.getAttribute("id")]=e}}function Et(t){const e={array:[],stride:3};for(let s=0;s<t.childNodes.length;s++){const o=t.childNodes[s];if(1===o.nodeType)switch(o.nodeName){case"float_array":e.array=i(o.textContent);break;case"Name_array":e.array=r(o.textContent);break;case"technique_common":const t=n(o,"accessor")[0];void 0!==t&&(e.stride=parseInt(t.getAttribute("stride")));break}}return e}function At(t){const e={};for(let n=0;n<t.childNodes.length;n++){const r=t.childNodes[n];1===r.nodeType&&(e[r.getAttribute("semantic")]=o(r.getAttribute("source")))}return e}function Lt(t){const e={type:t.nodeName,material:t.getAttribute("material"),count:parseInt(t.getAttribute("count")),inputs:{},stride:0,hasUV:!1};for(let n=0,r=t.childNodes.length;n<r;n++){const r=t.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"input":const t=o(r.getAttribute("source")),n=r.getAttribute("semantic"),i=parseInt(r.getAttribute("offset")),a=parseInt(r.getAttribute("set")),c=a>0?n+a:n;e.inputs[c]={id:t,offset:i},e.stride=Math.max(e.stride,i+1),"TEXCOORD"===n&&(e.hasUV=!0);break;case"vcount":e.vcount=s(r.textContent);break;case"p":e.p=s(r.textContent);break}}return e}function Rt(t){const e={};for(let n=0;n<t.length;n++){const r=t[n];void 0===e[r.type]&&(e[r.type]=[]),e[r.type].push(r)}return e}function Ct(t){let e=0;for(let n=0,r=t.length;n<r;n++){const r=t[n];!0===r.hasUV&&e++}e>0&&e<t.length&&(t.uvsNeedsFix=!0)}function Pt(t){const e={},n=t.sources,r=t.vertices,i=t.primitives;if(0===i.length)return{};const s=Rt(i);for(const o in s){const t=s[o];Ct(t),e[o]=It(t,n,r)}return e}function It(t,e,n){const r={},i={array:[],stride:0},s={array:[],stride:0},o={array:[],stride:0},a={array:[],stride:0},c={array:[],stride:0},l={array:[],stride:4},u={array:[],stride:4},h=new Ui,d=[];let p=0;for(let f=0;f<t.length;f++){const r=t[f],m=r.inputs;let g=0;switch(r.type){case"lines":case"linestrips":g=2*r.count;break;case"triangles":g=3*r.count;break;case"polylist":for(let t=0;t<r.count;t++){const e=r.vcount[t];switch(e){case 3:g+=3;break;case 4:g+=6;break;default:g+=3*(e-2);break}}break;default:console.warn("THREE.ColladaLoader: Unknow primitive type:",r.type)}h.addGroup(p,g,f),p+=g,r.material&&d.push(r.material);for(const h in m){const d=m[h];switch(h){case"VERTEX":for(const h in n){const p=n[h];switch(h){case"POSITION":const n=i.array.length;if(Nt(r,e[p],d.offset,i.array),i.stride=e[p].stride,e.skinWeights&&e.skinIndices&&(Nt(r,e.skinIndices,d.offset,l.array),Nt(r,e.skinWeights,d.offset,u.array)),!1===r.hasUV&&!0===t.uvsNeedsFix){const t=(i.array.length-n)/i.stride;for(let e=0;e<t;e++)o.array.push(0,0)}break;case"NORMAL":Nt(r,e[p],d.offset,s.array),s.stride=e[p].stride;break;case"COLOR":Nt(r,e[p],d.offset,c.array),c.stride=e[p].stride;break;case"TEXCOORD":Nt(r,e[p],d.offset,o.array),o.stride=e[p].stride;break;case"TEXCOORD1":Nt(r,e[p],d.offset,a.array),o.stride=e[p].stride;break;default:console.warn('THREE.ColladaLoader: Semantic "%s" not handled in geometry build process.',h)}}break;case"NORMAL":Nt(r,e[d.id],d.offset,s.array),s.stride=e[d.id].stride;break;case"COLOR":Nt(r,e[d.id],d.offset,c.array),c.stride=e[d.id].stride;break;case"TEXCOORD":Nt(r,e[d.id],d.offset,o.array),o.stride=e[d.id].stride;break;case"TEXCOORD1":Nt(r,e[d.id],d.offset,a.array),a.stride=e[d.id].stride;break}}}return i.array.length>0&&h.setAttribute("position",new Pi(i.array,i.stride)),s.array.length>0&&h.setAttribute("normal",new Pi(s.array,s.stride)),c.array.length>0&&h.setAttribute("color",new Pi(c.array,c.stride)),o.array.length>0&&h.setAttribute("uv",new Pi(o.array,o.stride)),a.array.length>0&&h.setAttribute("uv2",new Pi(a.array,a.stride)),l.array.length>0&&h.setAttribute("skinIndex",new Pi(l.array,l.stride)),u.array.length>0&&h.setAttribute("skinWeight",new Pi(u.array,u.stride)),r.data=h,r.type=t[0].type,r.materialKeys=d,r}function Nt(t,e,n,r){const i=t.p,s=t.stride,o=t.vcount;function a(t){let e=i[t+n]*l;const s=e+l;for(;e<s;e++)r.push(c[e])}const c=e.array,l=e.stride;if(void 0!==t.vcount){let t=0;for(let e=0,n=o.length;e<n;e++){const n=o[e];if(4===n){const e=t+0*s,n=t+1*s,r=t+2*s,i=t+3*s;a(e),a(n),a(i),a(n),a(r),a(i)}else if(3===n){const e=t+0*s,n=t+1*s,r=t+2*s;a(e),a(n),a(r)}else if(n>4)for(let e=1,r=n-2;e<=r;e++){const n=t+0*s,r=t+s*e,i=t+s*(e+1);a(n),a(r),a(i)}t+=s*n}}else for(let u=0,h=i.length;u<h;u+=s)a(u)}function Ot(t){return f(Re.geometries[t],Pt)}function Dt(t){const e={name:t.getAttribute("name")||"",joints:{},links:[]};for(let n=0;n<t.childNodes.length;n++){const r=t.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"technique_common":Ft(r,e);break}}Re.kinematicsModels[t.getAttribute("id")]=e}function kt(t){return void 0!==t.build?t.build:t}function zt(t){return f(Re.kinematicsModels[t],kt)}function Ft(t,e){for(let n=0;n<t.childNodes.length;n++){const r=t.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"joint":e.joints[r.getAttribute("sid")]=Ut(r);break;case"link":e.links.push(Ht(r));break}}}function Ut(t){let e;for(let n=0;n<t.childNodes.length;n++){const r=t.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"prismatic":case"revolute":e=Bt(r);break}}return e}function Bt(t){const e={sid:t.getAttribute("sid"),name:t.getAttribute("name")||"",axis:new er,limits:{min:0,max:0},type:t.nodeName,static:!1,zeroPosition:0,middlePosition:0};for(let n=0;n<t.childNodes.length;n++){const r=t.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"axis":const t=i(r.textContent);e.axis.fromArray(t);break;case"limits":const n=r.getElementsByTagName("max")[0],s=r.getElementsByTagName("min")[0];e.limits.max=parseFloat(n.textContent),e.limits.min=parseFloat(s.textContent);break}}return e.limits.min>=e.limits.max&&(e.static=!0),e.middlePosition=(e.limits.min+e.limits.max)/2,e}function Ht(t){const e={sid:t.getAttribute("sid"),name:t.getAttribute("name")||"",attachments:[],transforms:[]};for(let n=0;n<t.childNodes.length;n++){const r=t.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"attachment_full":e.attachments.push(Gt(r));break;case"matrix":case"translate":case"rotate":e.transforms.push(Vt(r));break}}return e}function Gt(t){const e={joint:t.getAttribute("joint").split("/").pop(),transforms:[],links:[]};for(let n=0;n<t.childNodes.length;n++){const r=t.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"link":e.links.push(Ht(r));break;case"matrix":case"translate":case"rotate":e.transforms.push(Vt(r));break}}return e}function Vt(t){const e={type:t.nodeName},n=i(t.textContent);switch(e.type){case"matrix":e.obj=new Ir,e.obj.fromArray(n).transpose();break;case"translate":e.obj=new er,e.obj.fromArray(n);break;case"rotate":e.obj=new er,e.obj.fromArray(n),e.angle=zn.degToRad(n[3]);break}return e}function Wt(t){const e={name:t.getAttribute("name")||"",rigidBodies:{}};for(let n=0;n<t.childNodes.length;n++){const r=t.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"rigid_body":e.rigidBodies[r.getAttribute("name")]={},jt(r,e.rigidBodies[r.getAttribute("name")]);break}}Re.physicsModels[t.getAttribute("id")]=e}function jt(t,e){for(let n=0;n<t.childNodes.length;n++){const r=t.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"technique_common":qt(r,e);break}}}function qt(t,e){for(let n=0;n<t.childNodes.length;n++){const r=t.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"inertia":e.inertia=i(r.textContent);break;case"mass":e.mass=i(r.textContent)[0];break}}}function Xt(t){const e={bindJointAxis:[]};for(let n=0;n<t.childNodes.length;n++){const r=t.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"bind_joint_axis":e.bindJointAxis.push(Yt(r));break}}Re.kinematicsScenes[o(t.getAttribute("url"))]=e}function Yt(t){const e={target:t.getAttribute("target").split("/").pop()};for(let n=0;n<t.childNodes.length;n++){const r=t.childNodes[n];if(1===r.nodeType)switch(r.nodeName){case"axis":const t=r.getElementsByTagName("param")[0];e.axis=t.textContent;const n=e.axis.split("inst_").pop().split("axis")[0];e.jointIndex=n.substr(0,n.length-1);break}}return e}function Jt(t){return void 0!==t.build?t.build:t}function Zt(t){return f(Re.kinematicsScenes[t],Jt)}function Kt(){const t=Object.keys(Re.kinematicsModels)[0],e=Object.keys(Re.kinematicsScenes)[0],n=Object.keys(Re.visualScenes)[0];if(void 0===t||void 0===e)return;const r=zt(t),i=Zt(e),s=me(n),o=i.bindJointAxis,a={};for(let u=0,h=o.length;u<h;u++){const t=o[u],e=be.querySelector('[sid="'+t.target+'"]');if(e){const n=e.parentElement;c(t.jointIndex,n)}}function c(t,e){const n=e.getAttribute("name"),i=r.joints[t];s.traverse((function(r){r.name===n&&(a[t]={object:r,transforms:$t(e),joint:i,position:i.zeroPosition})}))}const l=new Ir;Ae={joints:r&&r.joints,getJointValue:function(t){const e=a[t];if(e)return e.position;console.warn("THREE.ColladaLoader: Joint "+t+" doesn't exist.")},setJointValue:function(t,e){const n=a[t];if(n){const r=n.joint;if(e>r.limits.max||e<r.limits.min)console.warn("THREE.ColladaLoader: Joint "+t+" value "+e+" outside of limits (min: "+r.limits.min+", max: "+r.limits.max+").");else if(r.static)console.warn("THREE.ColladaLoader: Joint "+t+" is static.");else{const i=n.object,s=r.axis,o=n.transforms;te.identity();for(let n=0;n<o.length;n++){const i=o[n];if(i.sid&&-1!==i.sid.indexOf(t))switch(r.type){case"revolute":te.multiply(l.makeRotationAxis(s,zn.degToRad(e)));break;case"prismatic":te.multiply(l.makeTranslation(s.x*e,s.y*e,s.z*e));break;default:console.warn("THREE.ColladaLoader: Unknown joint type: "+r.type);break}else switch(i.type){case"matrix":te.multiply(i.obj);break;case"translate":te.multiply(l.makeTranslation(i.obj.x,i.obj.y,i.obj.z));break;case"scale":te.scale(i.obj);break;case"rotate":te.multiply(l.makeRotationAxis(i.obj,i.angle));break}}i.matrix.copy(te),i.matrix.decompose(i.position,i.quaternion,i.scale),a[t].position=e}}else console.log("THREE.ColladaLoader: "+t+" does not exist.")}}}function $t(t){const e=[],n=be.querySelector('[id="'+t.id+'"]');for(let r=0;r<n.childNodes.length;r++){const t=n.childNodes[r];if(1!==t.nodeType)continue;let s,o;switch(t.nodeName){case"matrix":s=i(t.textContent);const n=(new Ir).fromArray(s).transpose();e.push({sid:t.getAttribute("sid"),type:t.nodeName,obj:n});break;case"translate":case"scale":s=i(t.textContent),o=(new er).fromArray(s),e.push({sid:t.getAttribute("sid"),type:t.nodeName,obj:o});break;case"rotate":s=i(t.textContent),o=(new er).fromArray(s);const r=zn.degToRad(s[3]);e.push({sid:t.getAttribute("sid"),type:t.nodeName,obj:o,angle:r});break}}return e}function Qt(t){const e=t.getElementsByTagName("node");for(let n=0;n<e.length;n++){const t=e[n];!1===t.hasAttribute("id")&&t.setAttribute("id",a())}}const te=new Ir,ee=new er;function ne(t){const e={name:t.getAttribute("name")||"",type:t.getAttribute("type"),id:t.getAttribute("id"),sid:t.getAttribute("sid"),matrix:new Ir,nodes:[],instanceCameras:[],instanceControllers:[],instanceLights:[],instanceGeometries:[],instanceNodes:[],transforms:{}};for(let n=0;n<t.childNodes.length;n++){const r=t.childNodes[n];if(1!==r.nodeType)continue;let s;switch(r.nodeName){case"node":e.nodes.push(r.getAttribute("id")),ne(r);break;case"instance_camera":e.instanceCameras.push(o(r.getAttribute("url")));break;case"instance_controller":e.instanceControllers.push(re(r));break;case"instance_light":e.instanceLights.push(o(r.getAttribute("url")));break;case"instance_geometry":e.instanceGeometries.push(re(r));break;case"instance_node":e.instanceNodes.push(o(r.getAttribute("url")));break;case"matrix":s=i(r.textContent),e.matrix.multiply(te.fromArray(s).transpose()),e.transforms[r.getAttribute("sid")]=r.nodeName;break;case"translate":s=i(r.textContent),ee.fromArray(s),e.matrix.multiply(te.makeTranslation(ee.x,ee.y,ee.z)),e.transforms[r.getAttribute("sid")]=r.nodeName;break;case"rotate":s=i(r.textContent);const t=zn.degToRad(s[3]);e.matrix.multiply(te.makeRotationAxis(ee.fromArray(s),t)),e.transforms[r.getAttribute("sid")]=r.nodeName;break;case"scale":s=i(r.textContent),e.matrix.scale(ee.fromArray(s)),e.transforms[r.getAttribute("sid")]=r.nodeName;break;case"extra":break;default:console.log(r)}}return ue(e.id)?console.warn("THREE.ColladaLoader: There is already a node with ID %s. Exclude current node from further processing.",e.id):Re.nodes[e.id]=e,e}function re(t){const e={id:o(t.getAttribute("url")),materials:{},skeletons:[]};for(let n=0;n<t.childNodes.length;n++){const r=t.childNodes[n];switch(r.nodeName){case"bind_material":const t=r.getElementsByTagName("instance_material");for(let n=0;n<t.length;n++){const r=t[n],i=r.getAttribute("symbol"),s=r.getAttribute("target");e.materials[i]=o(s)}break;case"skeleton":e.skeletons.push(o(r.textContent));break;default:break}}return e}function ie(t,e){const n=[],r=[];let i,s,o;for(i=0;i<t.length;i++){const r=t[i];let s;if(ue(r))s=he(r),se(s,e,n);else if(fe(r)){const t=Re.visualScenes[r],i=t.children;for(let r=0;r<i.length;r++){const t=i[r];if("JOINT"===t.type){const r=he(t.id);se(r,e,n)}}}else console.error("THREE.ColladaLoader: Unable to find root bone of skeleton with ID:",r)}for(i=0;i<e.length;i++)for(s=0;s<n.length;s++)if(o=n[s],o.bone.name===e[i].name){r[i]=o,o.processed=!0;break}for(i=0;i<n.length;i++)o=n[i],!1===o.processed&&(r.push(o),o.processed=!0);const a=[],c=[];for(i=0;i<r.length;i++)o=r[i],a.push(o.bone),c.push(o.boneInverse);return new Wh(a,c)}function se(t,e,n){t.traverse((function(t){if(!0===t.isBone){let r;for(let n=0;n<e.length;n++){const i=e[n];if(i.name===t.name){r=i.boneInverse;break}}void 0===r&&(r=new Ir),n.push({bone:t,boneInverse:r,processed:!1})}}))}function oe(t){const e=[],n=t.matrix,r=t.nodes,i=t.type,s=t.instanceCameras,o=t.instanceControllers,a=t.instanceLights,c=t.instanceGeometries,l=t.instanceNodes;for(let h=0,d=r.length;h<d;h++)e.push(he(r[h]));for(let h=0,d=s.length;h<d;h++){const t=xt(s[h]);null!==t&&e.push(t.clone())}for(let h=0,d=o.length;h<d;h++){const t=o[h],n=G(t.id),r=Ot(n.id),i=le(r,t.materials),s=t.skeletons,a=n.skin.joints,c=ie(s,a);for(let o=0,l=i.length;o<l;o++){const t=i[o];t.isSkinnedMesh&&(t.bind(c,n.skin.bindMatrix),t.normalizeSkinWeights()),e.push(t)}}for(let h=0,d=a.length;h<d;h++){const t=St(a[h]);null!==t&&e.push(t.clone())}for(let h=0,d=c.length;h<d;h++){const t=c[h],n=Ot(t.id),r=le(n,t.materials);for(let i=0,s=r.length;i<s;i++)e.push(r[i])}for(let h=0,d=l.length;h<d;h++)e.push(he(l[h]).clone());let u;if(0===r.length&&1===e.length)u=e[0];else{u="JOINT"===i?new Bh:new th;for(let t=0;t<e.length;t++)u.add(e[t])}return u.name="JOINT"===i?t.sid:t.name,u.matrix.copy(n),u.matrix.decompose(u.position,u.quaternion,u.scale),u}const ae=new Si({color:16711935});function ce(t,e){const n=[];for(let r=0,i=t.length;r<i;r++){const i=e[t[r]];void 0===i?(console.warn("THREE.ColladaLoader: Material with key %s not found. Apply fallback material.",t[r]),n.push(ae)):n.push(ht(i))}return n}function le(t,e){const n=[];for(const r in t){const i=t[r],s=ce(i.materialKeys,e);0===s.length&&("lines"===r||"linestrips"===r?s.push(new Kh):s.push(new of));const o=void 0!==i.data.attributes.skinIndex,a=1===s.length?s[0]:s;let c;switch(r){case"lines":c=new od(i.data,a);break;case"linestrips":c=new rd(i.data,a);break;case"triangles":case"polylist":c=o?new Uh(i.data,a):new rs(i.data,a);break}n.push(c)}return n}function ue(t){return void 0!==Re.nodes[t]}function he(t){return f(Re.nodes[t],oe)}function de(t){const e={name:t.getAttribute("name"),children:[]};Qt(t);const r=n(t,"node");for(let n=0;n<r.length;n++)e.children.push(ne(r[n]));Re.visualScenes[t.getAttribute("id")]=e}function pe(t){const e=new th;e.name=t.name;const n=t.children;for(let r=0;r<n.length;r++){const t=n[r];e.add(he(t.id))}return e}function fe(t){return void 0!==Re.visualScenes[t]}function me(t){return f(Re.visualScenes[t],pe)}function ge(t){const e=n(t,"instance_visual_scene")[0];return me(o(e.getAttribute("url")))}function ve(){const t=Re.clips;if(!0===c(t)){if(!1===c(Re.animations)){const t=[];for(const e in Re.animations){const n=w(e);for(let e=0,r=n.length;e<r;e++)t.push(n[e])}Ee.push(new Ef("default",-1,t))}}else for(const e in t)Ee.push(D(e))}function ye(t){let e="";const n=[t];while(n.length){const t=n.shift();t.nodeType===Node.TEXT_NODE?e+=t.textContent:(e+="\n",n.push.apply(n,t.childNodes))}return e.trim()}if(0===t.length)return{scene:new hh};const xe=(new DOMParser).parseFromString(t,"application/xml"),be=n(xe,"COLLADA")[0],we=xe.getElementsByTagName("parsererror")[0];if(void 0!==we){const t=n(we,"div")[0];let e;return e=t?t.textContent:ye(we),console.error("THREE.ColladaLoader: Failed to parse collada file.\n",e),null}const _e=be.getAttribute("version");console.log("THREE.ColladaLoader: File version",_e);const Me=l(n(be,"asset")[0]),Se=new Uf(this.manager);let Te;Se.setPath(this.resourcePath||e).setCrossOrigin(this.crossOrigin),Mb&&(Te=new Mb(this.manager),Te.setPath(this.resourcePath||e));const Ee=[];let Ae={},Le=0;const Re={animations:{},clips:{},controllers:{},images:{},effects:{},materials:{},cameras:{},lights:{},geometries:{},nodes:{},visualScenes:{},kinematicsModels:{},physicsModels:{},kinematicsScenes:{}};d(be,"library_animations","animation",m),d(be,"library_animation_clips","animation_clip",N),d(be,"library_controllers","controller",k),d(be,"library_images","image",V),d(be,"library_effects","effect",q),d(be,"library_materials","material",ct),d(be,"library_cameras","camera",dt),d(be,"library_lights","light",bt),d(be,"library_geometries","geometry",Tt),d(be,"library_nodes","node",ne),d(be,"library_visual_scenes","visual_scene",de),d(be,"library_kinematics_models","kinematics_model",Dt),d(be,"library_physics_models","physics_model",Wt),d(be,"scene","instance_kinematics_scene",Xt),p(Re.animations,x),p(Re.clips,O),p(Re.controllers,B),p(Re.images,W),p(Re.effects,ot),p(Re.materials,ut),p(Re.cameras,yt),p(Re.lights,Mt),p(Re.geometries,Pt),p(Re.visualScenes,pe),ve(),Kt();const Ce=ge(n(be,"scene")[0]);return Ce.animations=Ee,"Z_UP"===Me.upAxis&&Ce.quaternion.setFromEuler(new Gr(-Math.PI/2,0,0)),Ce.scale.multiplyScalar(Me.unit),{get animations(){return console.warn("THREE.ColladaLoader: Please access animations over scene.animations now."),Ee},kinematics:Ae,library:Re,scene:Ce}}}var Tb,Eb,Ab={name:"model-collada",mixins:[Ug],props:{lights:{type:Array,default:function(){return[{type:"HemisphereLight",position:{x:0,y:1,z:0},skyColor:11184895,groundColor:8413280,intensity:.2},{type:"DirectionalLight",position:{x:1,y:1,z:1},color:16777215,intensity:.8}]}},smoothing:{type:Boolean,default:!1}},data:function(){var t=new Sb;return t.setCrossOrigin(this.crossOrigin),{loader:t}},methods:{getObject:function(t){return t.scene}}},Lb=Ab,Rb=zg(Lb,Tb,Eb,!1,null,null,null),Cb=Rb.exports;class Pb extends If{constructor(t){super(t),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register((function(t){return new kb(t)})),this.register((function(t){return new Gb(t)})),this.register((function(t){return new Vb(t)})),this.register((function(t){return new zb(t)})),this.register((function(t){return new Fb(t)})),this.register((function(t){return new Ub(t)})),this.register((function(t){return new Bb(t)})),this.register((function(t){return new Hb(t)})),this.register((function(t){return new Ob(t)})),this.register((function(t){return new Wb(t)}))}load(t,e,n,r){const i=this;let s;s=""!==this.resourcePath?this.resourcePath:""!==this.path?this.path:om.extractUrlBase(t),this.manager.itemStart(t);const o=function(e){r?r(e):console.error(e),i.manager.itemError(t),i.manager.itemEnd(t)},a=new Of(this.manager);a.setPath(this.path),a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(t,(function(n){try{i.parse(n,s,(function(n){e(n),i.manager.itemEnd(t)}),o)}catch(kw){o(kw)}}),n,o)}setDRACOLoader(t){return this.dracoLoader=t,this}setDDSLoader(){throw new Error('THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".')}setKTX2Loader(t){return this.ktx2Loader=t,this}setMeshoptDecoder(t){return this.meshoptDecoder=t,this}register(t){return-1===this.pluginCallbacks.indexOf(t)&&this.pluginCallbacks.push(t),this}unregister(t){return-1!==this.pluginCallbacks.indexOf(t)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(t),1),this}parse(t,e,n,r){let i;const s={},o={};if("string"===typeof t)i=t;else{const e=om.decodeText(new Uint8Array(t,0,4));if(e===jb){try{s[Nb.KHR_BINARY_GLTF]=new Yb(t)}catch(l){return void(r&&r(l))}i=s[Nb.KHR_BINARY_GLTF].content}else i=om.decodeText(new Uint8Array(t))}const a=JSON.parse(i);if(void 0===a.asset||a.asset.version[0]<2)return void(r&&r(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported.")));const c=new bw(a,{path:e||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});c.fileLoader.setRequestHeader(this.requestHeader);for(let u=0;u<this.pluginCallbacks.length;u++){const t=this.pluginCallbacks[u](c);o[t.name]=t,s[t.name]=!0}if(a.extensionsUsed)for(let u=0;u<a.extensionsUsed.length;++u){const t=a.extensionsUsed[u],e=a.extensionsRequired||[];switch(t){case Nb.KHR_MATERIALS_UNLIT:s[t]=new Db;break;case Nb.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:s[t]=new $b;break;case Nb.KHR_DRACO_MESH_COMPRESSION:s[t]=new Jb(a,this.dracoLoader);break;case Nb.KHR_TEXTURE_TRANSFORM:s[t]=new Zb;break;case Nb.KHR_MESH_QUANTIZATION:s[t]=new Qb;break;default:e.indexOf(t)>=0&&void 0===o[t]&&console.warn('THREE.GLTFLoader: Unknown extension "'+t+'".')}}c.setExtensions(s),c.setPlugins(o),c.parse(n,r)}parseAsync(t,e){const n=this;return new Promise((function(r,i){n.parse(t,e,r,i)}))}}function Ib(){let t={};return{get:function(e){return t[e]},add:function(e,n){t[e]=n},remove:function(e){delete t[e]},removeAll:function(){t={}}}}const Nb={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:"KHR_materials_pbrSpecularGlossiness",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression"};class Ob{constructor(t){this.parser=t,this.name=Nb.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const t=this.parser,e=this.parser.json.nodes||[];for(let n=0,r=e.length;n<r;n++){const r=e[n];r.extensions&&r.extensions[this.name]&&void 0!==r.extensions[this.name].light&&t._addNodeRef(this.cache,r.extensions[this.name].light)}}_loadLight(t){const e=this.parser,n="light:"+t;let r=e.cache.get(n);if(r)return r;const i=e.json,s=i.extensions&&i.extensions[this.name]||{},o=s.lights||[],a=o[t];let c;const l=new Mi(16777215);void 0!==a.color&&l.fromArray(a.color);const u=void 0!==a.range?a.range:0;switch(a.type){case"directional":c=new tm(l),c.target.position.set(0,0,-1),c.add(c.target);break;case"point":c=new $f(l),c.distance=u;break;case"spot":c=new Xf(l),c.distance=u,a.spot=a.spot||{},a.spot.innerConeAngle=void 0!==a.spot.innerConeAngle?a.spot.innerConeAngle:0,a.spot.outerConeAngle=void 0!==a.spot.outerConeAngle?a.spot.outerConeAngle:Math.PI/4,c.angle=a.spot.outerConeAngle,c.penumbra=1-a.spot.innerConeAngle/a.spot.outerConeAngle,c.target.position.set(0,0,-1),c.add(c.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+a.type)}return c.position.set(0,0,0),c.decay=2,void 0!==a.intensity&&(c.intensity=a.intensity),c.name=e.createUniqueName(a.name||"light_"+t),r=Promise.resolve(c),e.cache.add(n,r),r}createNodeAttachment(t){const e=this,n=this.parser,r=n.json,i=r.nodes[t],s=i.extensions&&i.extensions[this.name]||{},o=s.light;return void 0===o?null:this._loadLight(o).then((function(t){return n._getNodeRef(e.cache,o,t)}))}}class Db{constructor(){this.name=Nb.KHR_MATERIALS_UNLIT}getMaterialType(){return Si}extendParams(t,e,n){const r=[];t.color=new Mi(1,1,1),t.opacity=1;const i=e.pbrMetallicRoughness;if(i){if(Array.isArray(i.baseColorFactor)){const e=i.baseColorFactor;t.color.fromArray(e),t.opacity=e[3]}void 0!==i.baseColorTexture&&r.push(n.assignTexture(t,"map",i.baseColorTexture))}return Promise.all(r)}}class kb{constructor(t){this.parser=t,this.name=Nb.KHR_MATERIALS_CLEARCOAT}getMaterialType(t){const e=this.parser,n=e.json.materials[t];return n.extensions&&n.extensions[this.name]?sf:null}extendMaterialParams(t,e){const n=this.parser,r=n.json.materials[t];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const i=[],s=r.extensions[this.name];if(void 0!==s.clearcoatFactor&&(e.clearcoat=s.clearcoatFactor),void 0!==s.clearcoatTexture&&i.push(n.assignTexture(e,"clearcoatMap",s.clearcoatTexture)),void 0!==s.clearcoatRoughnessFactor&&(e.clearcoatRoughness=s.clearcoatRoughnessFactor),void 0!==s.clearcoatRoughnessTexture&&i.push(n.assignTexture(e,"clearcoatRoughnessMap",s.clearcoatRoughnessTexture)),void 0!==s.clearcoatNormalTexture&&(i.push(n.assignTexture(e,"clearcoatNormalMap",s.clearcoatNormalTexture)),void 0!==s.clearcoatNormalTexture.scale)){const t=s.clearcoatNormalTexture.scale;e.clearcoatNormalScale=new Fn(t,t)}return Promise.all(i)}}class zb{constructor(t){this.parser=t,this.name=Nb.KHR_MATERIALS_SHEEN}getMaterialType(t){const e=this.parser,n=e.json.materials[t];return n.extensions&&n.extensions[this.name]?sf:null}extendMaterialParams(t,e){const n=this.parser,r=n.json.materials[t];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const i=[];e.sheenColor=new Mi(0,0,0),e.sheenRoughness=0,e.sheen=1;const s=r.extensions[this.name];return void 0!==s.sheenColorFactor&&e.sheenColor.fromArray(s.sheenColorFactor),void 0!==s.sheenRoughnessFactor&&(e.sheenRoughness=s.sheenRoughnessFactor),void 0!==s.sheenColorTexture&&i.push(n.assignTexture(e,"sheenColorMap",s.sheenColorTexture)),void 0!==s.sheenRoughnessTexture&&i.push(n.assignTexture(e,"sheenRoughnessMap",s.sheenRoughnessTexture)),Promise.all(i)}}class Fb{constructor(t){this.parser=t,this.name=Nb.KHR_MATERIALS_TRANSMISSION}getMaterialType(t){const e=this.parser,n=e.json.materials[t];return n.extensions&&n.extensions[this.name]?sf:null}extendMaterialParams(t,e){const n=this.parser,r=n.json.materials[t];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const i=[],s=r.extensions[this.name];return void 0!==s.transmissionFactor&&(e.transmission=s.transmissionFactor),void 0!==s.transmissionTexture&&i.push(n.assignTexture(e,"transmissionMap",s.transmissionTexture)),Promise.all(i)}}class Ub{constructor(t){this.parser=t,this.name=Nb.KHR_MATERIALS_VOLUME}getMaterialType(t){const e=this.parser,n=e.json.materials[t];return n.extensions&&n.extensions[this.name]?sf:null}extendMaterialParams(t,e){const n=this.parser,r=n.json.materials[t];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const i=[],s=r.extensions[this.name];e.thickness=void 0!==s.thicknessFactor?s.thicknessFactor:0,void 0!==s.thicknessTexture&&i.push(n.assignTexture(e,"thicknessMap",s.thicknessTexture)),e.attenuationDistance=s.attenuationDistance||0;const o=s.attenuationColor||[1,1,1];return e.attenuationColor=new Mi(o[0],o[1],o[2]),Promise.all(i)}}class Bb{constructor(t){this.parser=t,this.name=Nb.KHR_MATERIALS_IOR}getMaterialType(t){const e=this.parser,n=e.json.materials[t];return n.extensions&&n.extensions[this.name]?sf:null}extendMaterialParams(t,e){const n=this.parser,r=n.json.materials[t];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const i=r.extensions[this.name];return e.ior=void 0!==i.ior?i.ior:1.5,Promise.resolve()}}class Hb{constructor(t){this.parser=t,this.name=Nb.KHR_MATERIALS_SPECULAR}getMaterialType(t){const e=this.parser,n=e.json.materials[t];return n.extensions&&n.extensions[this.name]?sf:null}extendMaterialParams(t,e){const n=this.parser,r=n.json.materials[t];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const i=[],s=r.extensions[this.name];e.specularIntensity=void 0!==s.specularFactor?s.specularFactor:1,void 0!==s.specularTexture&&i.push(n.assignTexture(e,"specularIntensityMap",s.specularTexture));const o=s.specularColorFactor||[1,1,1];return e.specularColor=new Mi(o[0],o[1],o[2]),void 0!==s.specularColorTexture&&i.push(n.assignTexture(e,"specularColorMap",s.specularColorTexture).then((function(t){t.encoding=Ze}))),Promise.all(i)}}class Gb{constructor(t){this.parser=t,this.name=Nb.KHR_TEXTURE_BASISU}loadTexture(t){const e=this.parser,n=e.json,r=n.textures[t];if(!r.extensions||!r.extensions[this.name])return null;const i=r.extensions[this.name],s=n.images[i.source],o=e.options.ktx2Loader;if(!o){if(n.extensionsRequired&&n.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return e.loadTextureImage(t,s,o)}}class Vb{constructor(t){this.parser=t,this.name=Nb.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(t){const e=this.name,n=this.parser,r=n.json,i=r.textures[t];if(!i.extensions||!i.extensions[e])return null;const s=i.extensions[e],o=r.images[s.source];let a=n.textureLoader;if(o.uri){const t=n.options.manager.getHandler(o.uri);null!==t&&(a=t)}return this.detectSupport().then((function(i){if(i)return n.loadTextureImage(t,o,a);if(r.extensionsRequired&&r.extensionsRequired.indexOf(e)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return n.loadTexture(t)}))}detectSupport(){return this.isSupported||(this.isSupported=new Promise((function(t){const e=new Image;e.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",e.onload=e.onerror=function(){t(1===e.height)}}))),this.isSupported}}class Wb{constructor(t){this.name=Nb.EXT_MESHOPT_COMPRESSION,this.parser=t}loadBufferView(t){const e=this.parser.json,n=e.bufferViews[t];if(n.extensions&&n.extensions[this.name]){const t=n.extensions[this.name],r=this.parser.getDependency("buffer",t.buffer),i=this.parser.options.meshoptDecoder;if(!i||!i.supported){if(e.extensionsRequired&&e.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return Promise.all([r,i.ready]).then((function(e){const n=t.byteOffset||0,r=t.byteLength||0,s=t.count,o=t.byteStride,a=new ArrayBuffer(s*o),c=new Uint8Array(e[0],n,r);return i.decodeGltfBuffer(new Uint8Array(a),s,o,c,t.mode,t.filter),a}))}return null}}const jb="glTF",qb=12,Xb={JSON:1313821514,BIN:5130562};class Yb{constructor(t){this.name=Nb.KHR_BINARY_GLTF,this.content=null,this.body=null;const e=new DataView(t,0,qb);if(this.header={magic:om.decodeText(new Uint8Array(t.slice(0,4))),version:e.getUint32(4,!0),length:e.getUint32(8,!0)},this.header.magic!==jb)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const n=this.header.length-qb,r=new DataView(t,qb);let i=0;while(i<n){const e=r.getUint32(i,!0);i+=4;const n=r.getUint32(i,!0);if(i+=4,n===Xb.JSON){const n=new Uint8Array(t,qb+i,e);this.content=om.decodeText(n)}else if(n===Xb.BIN){const n=qb+i;this.body=t.slice(n,n+e)}i+=e}if(null===this.content)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class Jb{constructor(t,e){if(!e)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=Nb.KHR_DRACO_MESH_COMPRESSION,this.json=t,this.dracoLoader=e,this.dracoLoader.preload()}decodePrimitive(t,e){const n=this.json,r=this.dracoLoader,i=t.extensions[this.name].bufferView,s=t.extensions[this.name].attributes,o={},a={},c={};for(const l in s){const t=cw[l]||l.toLowerCase();o[t]=s[l]}for(const l in t.attributes){const e=cw[l]||l.toLowerCase();if(void 0!==s[l]){const r=n.accessors[t.attributes[l]],i=iw[r.componentType];c[e]=i,a[e]=!0===r.normalized}}return e.getDependency("bufferView",i).then((function(t){return new Promise((function(e){r.decodeDracoFile(t,(function(t){for(const e in t.attributes){const n=t.attributes[e],r=a[e];void 0!==r&&(n.normalized=r)}e(t)}),o,c)}))}))}}class Zb{constructor(){this.name=Nb.KHR_TEXTURE_TRANSFORM}extendTexture(t,e){return void 0!==e.texCoord&&console.warn('THREE.GLTFLoader: Custom UV sets in "'+this.name+'" extension not yet supported.'),void 0===e.offset&&void 0===e.rotation&&void 0===e.scale||(t=t.clone(),void 0!==e.offset&&t.offset.fromArray(e.offset),void 0!==e.rotation&&(t.rotation=e.rotation),void 0!==e.scale&&t.repeat.fromArray(e.scale),t.needsUpdate=!0),t}}class Kb extends rf{constructor(t){super(),this.isGLTFSpecularGlossinessMaterial=!0;const e=["#ifdef USE_SPECULARMAP","\tuniform sampler2D specularMap;","#endif"].join("\n"),n=["#ifdef USE_GLOSSINESSMAP","\tuniform sampler2D glossinessMap;","#endif"].join("\n"),r=["vec3 specularFactor = specular;","#ifdef USE_SPECULARMAP","\tvec4 texelSpecular = texture2D( specularMap, vUv );","\ttexelSpecular = sRGBToLinear( texelSpecular );","\t// reads channel RGB, compatible with a glTF Specular-Glossiness (RGBA) texture","\tspecularFactor *= texelSpecular.rgb;","#endif"].join("\n"),i=["float glossinessFactor = glossiness;","#ifdef USE_GLOSSINESSMAP","\tvec4 texelGlossiness = texture2D( glossinessMap, vUv );","\t// reads channel A, compatible with a glTF Specular-Glossiness (RGBA) texture","\tglossinessFactor *= texelGlossiness.a;","#endif"].join("\n"),s=["PhysicalMaterial material;","material.diffuseColor = diffuseColor.rgb * ( 1. - max( specularFactor.r, max( specularFactor.g, specularFactor.b ) ) );","vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );","float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );","material.roughness = max( 1.0 - glossinessFactor, 0.0525 ); // 0.0525 corresponds to the base mip of a 256 cubemap.","material.roughness += geometryRoughness;","material.roughness = min( material.roughness, 1.0 );","material.specularColor = specularFactor;"].join("\n"),o={specular:{value:(new Mi).setHex(16777215)},glossiness:{value:1},specularMap:{value:null},glossinessMap:{value:null}};this._extraUniforms=o,this.onBeforeCompile=function(t){for(const e in o)t.uniforms[e]=o[e];t.fragmentShader=t.fragmentShader.replace("uniform float roughness;","uniform vec3 specular;").replace("uniform float metalness;","uniform float glossiness;").replace("#include <roughnessmap_pars_fragment>",e).replace("#include <metalnessmap_pars_fragment>",n).replace("#include <roughnessmap_fragment>",r).replace("#include <metalnessmap_fragment>",i).replace("#include <lights_physical_fragment>",s)},Object.defineProperties(this,{specular:{get:function(){return o.specular.value},set:function(t){o.specular.value=t}},specularMap:{get:function(){return o.specularMap.value},set:function(t){o.specularMap.value=t,t?this.defines.USE_SPECULARMAP="":delete this.defines.USE_SPECULARMAP}},glossiness:{get:function(){return o.glossiness.value},set:function(t){o.glossiness.value=t}},glossinessMap:{get:function(){return o.glossinessMap.value},set:function(t){o.glossinessMap.value=t,t?(this.defines.USE_GLOSSINESSMAP="",this.defines.USE_UV=""):(delete this.defines.USE_GLOSSINESSMAP,delete this.defines.USE_UV)}}}),delete this.metalness,delete this.roughness,delete this.metalnessMap,delete this.roughnessMap,this.setValues(t)}copy(t){return super.copy(t),this.specularMap=t.specularMap,this.specular.copy(t.specular),this.glossinessMap=t.glossinessMap,this.glossiness=t.glossiness,delete this.metalness,delete this.roughness,delete this.metalnessMap,delete this.roughnessMap,this}}class $b{constructor(){this.name=Nb.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS,this.specularGlossinessParams=["color","map","lightMap","lightMapIntensity","aoMap","aoMapIntensity","emissive","emissiveIntensity","emissiveMap","bumpMap","bumpScale","normalMap","normalMapType","displacementMap","displacementScale","displacementBias","specularMap","specular","glossinessMap","glossiness","alphaMap","envMap","envMapIntensity","refractionRatio"]}getMaterialType(){return Kb}extendParams(t,e,n){const r=e.extensions[this.name];t.color=new Mi(1,1,1),t.opacity=1;const i=[];if(Array.isArray(r.diffuseFactor)){const e=r.diffuseFactor;t.color.fromArray(e),t.opacity=e[3]}if(void 0!==r.diffuseTexture&&i.push(n.assignTexture(t,"map",r.diffuseTexture)),t.emissive=new Mi(0,0,0),t.glossiness=void 0!==r.glossinessFactor?r.glossinessFactor:1,t.specular=new Mi(1,1,1),Array.isArray(r.specularFactor)&&t.specular.fromArray(r.specularFactor),void 0!==r.specularGlossinessTexture){const e=r.specularGlossinessTexture;i.push(n.assignTexture(t,"glossinessMap",e)),i.push(n.assignTexture(t,"specularMap",e))}return Promise.all(i)}createMaterial(t){const e=new Kb(t);return e.fog=!0,e.color=t.color,e.map=void 0===t.map?null:t.map,e.lightMap=null,e.lightMapIntensity=1,e.aoMap=void 0===t.aoMap?null:t.aoMap,e.aoMapIntensity=1,e.emissive=t.emissive,e.emissiveIntensity=1,e.emissiveMap=void 0===t.emissiveMap?null:t.emissiveMap,e.bumpMap=void 0===t.bumpMap?null:t.bumpMap,e.bumpScale=1,e.normalMap=void 0===t.normalMap?null:t.normalMap,e.normalMapType=sn,t.normalScale&&(e.normalScale=t.normalScale),e.displacementMap=null,e.displacementScale=1,e.displacementBias=0,e.specularMap=void 0===t.specularMap?null:t.specularMap,e.specular=t.specular,e.glossinessMap=void 0===t.glossinessMap?null:t.glossinessMap,e.glossiness=t.glossiness,e.alphaMap=null,e.envMap=void 0===t.envMap?null:t.envMap,e.envMapIntensity=1,e.refractionRatio=.98,e}}class Qb{constructor(){this.name=Nb.KHR_MESH_QUANTIZATION}}class tw extends ff{constructor(t,e,n,r){super(t,e,n,r)}copySampleValue_(t){const e=this.resultBuffer,n=this.sampleValues,r=this.valueSize,i=t*r*3+r;for(let s=0;s!==r;s++)e[s]=n[i+s];return e}}tw.prototype.beforeStart_=tw.prototype.copySampleValue_,tw.prototype.afterEnd_=tw.prototype.copySampleValue_,tw.prototype.interpolate_=function(t,e,n,r){const i=this.resultBuffer,s=this.sampleValues,o=this.valueSize,a=2*o,c=3*o,l=r-e,u=(n-e)/l,h=u*u,d=h*u,p=t*c,f=p-c,m=-2*d+3*h,g=d-h,v=1-m,y=g-h+u;for(let x=0;x!==o;x++){const t=s[f+x+o],e=s[f+x+a]*l,n=s[p+x+o],r=s[p+x]*l;i[x]=v*t+y*e+m*n+g*r}return i};const ew=new tr;class nw extends tw{interpolate_(t,e,n,r){const i=super.interpolate_(t,e,n,r);return ew.fromArray(i).normalize().toArray(i),i}}const rw={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},iw={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},sw={9728:vt,9729:bt,9984:yt,9985:wt,9986:xt,9987:_t},ow={33071:mt,33648:gt,10497:ft},aw={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},cw={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv2",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},lw={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},uw={CUBICSPLINE:void 0,LINEAR:Ue,STEP:Fe},hw={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function dw(t){return void 0===t["DefaultMaterial"]&&(t["DefaultMaterial"]=new rf({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:y})),t["DefaultMaterial"]}function pw(t,e,n){for(const r in n.extensions)void 0===t[r]&&(e.userData.gltfExtensions=e.userData.gltfExtensions||{},e.userData.gltfExtensions[r]=n.extensions[r])}function fw(t,e){void 0!==e.extras&&("object"===typeof e.extras?Object.assign(t.userData,e.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+e.extras))}function mw(t,e,n){let r=!1,i=!1;for(let a=0,c=e.length;a<c;a++){const t=e[a];if(void 0!==t.POSITION&&(r=!0),void 0!==t.NORMAL&&(i=!0),r&&i)break}if(!r&&!i)return Promise.resolve(t);const s=[],o=[];for(let a=0,c=e.length;a<c;a++){const c=e[a];if(r){const e=void 0!==c.POSITION?n.getDependency("accessor",c.POSITION):t.attributes.position;s.push(e)}if(i){const e=void 0!==c.NORMAL?n.getDependency("accessor",c.NORMAL):t.attributes.normal;o.push(e)}}return Promise.all([Promise.all(s),Promise.all(o)]).then((function(e){const n=e[0],s=e[1];return r&&(t.morphAttributes.position=n),i&&(t.morphAttributes.normal=s),t.morphTargetsRelative=!0,t}))}function gw(t,e){if(t.updateMorphTargets(),void 0!==e.weights)for(let n=0,r=e.weights.length;n<r;n++)t.morphTargetInfluences[n]=e.weights[n];if(e.extras&&Array.isArray(e.extras.targetNames)){const n=e.extras.targetNames;if(t.morphTargetInfluences.length===n.length){t.morphTargetDictionary={};for(let e=0,r=n.length;e<r;e++)t.morphTargetDictionary[n[e]]=e}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function vw(t){const e=t.extensions&&t.extensions[Nb.KHR_DRACO_MESH_COMPRESSION];let n;return n=e?"draco:"+e.bufferView+":"+e.indices+":"+yw(e.attributes):t.indices+":"+yw(t.attributes)+":"+t.mode,n}function yw(t){let e="";const n=Object.keys(t).sort();for(let r=0,i=n.length;r<i;r++)e+=n[r]+":"+t[n[r]]+";";return e}function xw(t){switch(t){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}class bw{constructor(t={},e={}){this.json=t,this.extensions={},this.plugins={},this.options=e,this.cache=new Ib,this.associations=new Map,this.primitiveCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.textureCache={},this.nodeNamesUsed={},"undefined"!==typeof createImageBitmap&&!1===/Firefox/.test(navigator.userAgent)?this.textureLoader=new pm(this.options.manager):this.textureLoader=new Uf(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new Of(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}setExtensions(t){this.extensions=t}setPlugins(t){this.plugins=t}parse(t,e){const n=this,r=this.json,i=this.extensions;this.cache.removeAll(),this._invokeAll((function(t){return t._markDefs&&t._markDefs()})),Promise.all(this._invokeAll((function(t){return t.beforeRoot&&t.beforeRoot()}))).then((function(){return Promise.all([n.getDependencies("scene"),n.getDependencies("animation"),n.getDependencies("camera")])})).then((function(e){const s={scene:e[0][r.scene||0],scenes:e[0],animations:e[1],cameras:e[2],asset:r.asset,parser:n,userData:{}};pw(i,s,r),fw(s,r),Promise.all(n._invokeAll((function(t){return t.afterRoot&&t.afterRoot(s)}))).then((function(){t(s)}))})).catch(e)}_markDefs(){const t=this.json.nodes||[],e=this.json.skins||[],n=this.json.meshes||[];for(let r=0,i=e.length;r<i;r++){const n=e[r].joints;for(let e=0,r=n.length;e<r;e++)t[n[e]].isBone=!0}for(let r=0,i=t.length;r<i;r++){const e=t[r];void 0!==e.mesh&&(this._addNodeRef(this.meshCache,e.mesh),void 0!==e.skin&&(n[e.mesh].isSkinnedMesh=!0)),void 0!==e.camera&&this._addNodeRef(this.cameraCache,e.camera)}}_addNodeRef(t,e){void 0!==e&&(void 0===t.refs[e]&&(t.refs[e]=t.uses[e]=0),t.refs[e]++)}_getNodeRef(t,e,n){if(t.refs[e]<=1)return n;const r=n.clone(),i=(t,e)=>{const n=this.associations.get(t);null!=n&&this.associations.set(e,n);for(const[r,s]of t.children.entries())i(s,e.children[r])};return i(n,r),r.name+="_instance_"+t.uses[e]++,r}_invokeOne(t){const e=Object.values(this.plugins);e.push(this);for(let n=0;n<e.length;n++){const r=t(e[n]);if(r)return r}return null}_invokeAll(t){const e=Object.values(this.plugins);e.unshift(this);const n=[];for(let r=0;r<e.length;r++){const i=t(e[r]);i&&n.push(i)}return n}getDependency(t,e){const n=t+":"+e;let r=this.cache.get(n);if(!r){switch(t){case"scene":r=this.loadScene(e);break;case"node":r=this.loadNode(e);break;case"mesh":r=this._invokeOne((function(t){return t.loadMesh&&t.loadMesh(e)}));break;case"accessor":r=this.loadAccessor(e);break;case"bufferView":r=this._invokeOne((function(t){return t.loadBufferView&&t.loadBufferView(e)}));break;case"buffer":r=this.loadBuffer(e);break;case"material":r=this._invokeOne((function(t){return t.loadMaterial&&t.loadMaterial(e)}));break;case"texture":r=this._invokeOne((function(t){return t.loadTexture&&t.loadTexture(e)}));break;case"skin":r=this.loadSkin(e);break;case"animation":r=this.loadAnimation(e);break;case"camera":r=this.loadCamera(e);break;default:throw new Error("Unknown type: "+t)}this.cache.add(n,r)}return r}getDependencies(t){let e=this.cache.get(t);if(!e){const n=this,r=this.json[t+("mesh"===t?"es":"s")]||[];e=Promise.all(r.map((function(e,r){return n.getDependency(t,r)}))),this.cache.add(t,e)}return e}loadBuffer(t){const e=this.json.buffers[t],n=this.fileLoader;if(e.type&&"arraybuffer"!==e.type)throw new Error("THREE.GLTFLoader: "+e.type+" buffer type is not supported.");if(void 0===e.uri&&0===t)return Promise.resolve(this.extensions[Nb.KHR_BINARY_GLTF].body);const r=this.options;return new Promise((function(t,i){n.load(om.resolveURL(e.uri,r.path),t,void 0,(function(){i(new Error('THREE.GLTFLoader: Failed to load buffer "'+e.uri+'".'))}))}))}loadBufferView(t){const e=this.json.bufferViews[t];return this.getDependency("buffer",e.buffer).then((function(t){const n=e.byteLength||0,r=e.byteOffset||0;return t.slice(r,r+n)}))}loadAccessor(t){const e=this,n=this.json,r=this.json.accessors[t];if(void 0===r.bufferView&&void 0===r.sparse)return Promise.resolve(null);const i=[];return void 0!==r.bufferView?i.push(this.getDependency("bufferView",r.bufferView)):i.push(null),void 0!==r.sparse&&(i.push(this.getDependency("bufferView",r.sparse.indices.bufferView)),i.push(this.getDependency("bufferView",r.sparse.values.bufferView))),Promise.all(i).then((function(t){const i=t[0],s=aw[r.type],o=iw[r.componentType],a=o.BYTES_PER_ELEMENT,c=a*s,l=r.byteOffset||0,u=void 0!==r.bufferView?n.bufferViews[r.bufferView].byteStride:void 0,h=!0===r.normalized;let d,p;if(u&&u!==c){const t=Math.floor(l/u),n="InterleavedBuffer:"+r.bufferView+":"+r.componentType+":"+t+":"+r.count;let c=e.cache.get(n);c||(d=new o(i,t*u,r.count*u/a),c=new dh(d,u/a),e.cache.add(n,c)),p=new fh(c,s,l%u/a,h)}else d=null===i?new o(r.count*s):new o(i,l,r.count*s),p=new Ai(d,s,h);if(void 0!==r.sparse){const e=aw.SCALAR,n=iw[r.sparse.indices.componentType],a=r.sparse.indices.byteOffset||0,c=r.sparse.values.byteOffset||0,l=new n(t[1],a,r.sparse.count*e),u=new o(t[2],c,r.sparse.count*s);null!==i&&(p=new Ai(p.array.slice(),p.itemSize,p.normalized));for(let t=0,r=l.length;t<r;t++){const e=l[t];if(p.setX(e,u[t*s]),s>=2&&p.setY(e,u[t*s+1]),s>=3&&p.setZ(e,u[t*s+2]),s>=4&&p.setW(e,u[t*s+3]),s>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return p}))}loadTexture(t){const e=this.json,n=this.options,r=e.textures[t],i=e.images[r.source];let s=this.textureLoader;if(i.uri){const t=n.manager.getHandler(i.uri);null!==t&&(s=t)}return this.loadTextureImage(t,i,s)}loadTextureImage(t,e,n){const r=this,i=this.json,s=this.options,o=i.textures[t],a=(e.uri||e.bufferView)+":"+o.sampler;if(this.textureCache[a])return this.textureCache[a];const c=self.URL||self.webkitURL;let l=e.uri||"",u=!1;if(void 0!==e.bufferView)l=r.getDependency("bufferView",e.bufferView).then((function(t){u=!0;const n=new Blob([t],{type:e.mimeType});return l=c.createObjectURL(n),l}));else if(void 0===e.uri)throw new Error("THREE.GLTFLoader: Image "+t+" is missing URI and bufferView");const h=Promise.resolve(l).then((function(t){return new Promise((function(e,r){let i=e;!0===n.isImageBitmapLoader&&(i=function(t){const n=new Yn(t);n.needsUpdate=!0,e(n)}),n.load(om.resolveURL(t,s.path),i,void 0,r)}))})).then((function(e){!0===u&&c.revokeObjectURL(l),e.flipY=!1,o.name&&(e.name=o.name);const n=i.samplers||{},s=n[o.sampler]||{};return e.magFilter=sw[s.magFilter]||bt,e.minFilter=sw[s.minFilter]||_t,e.wrapS=ow[s.wrapS]||ft,e.wrapT=ow[s.wrapT]||ft,r.associations.set(e,{textures:t}),e})).catch((function(){return console.error("THREE.GLTFLoader: Couldn't load texture",l),null}));return this.textureCache[a]=h,h}assignTexture(t,e,n){const r=this;return this.getDependency("texture",n.index).then((function(i){if(void 0===n.texCoord||0==n.texCoord||"aoMap"===e&&1==n.texCoord||console.warn("THREE.GLTFLoader: Custom UV set "+n.texCoord+" for texture "+e+" not yet supported."),r.extensions[Nb.KHR_TEXTURE_TRANSFORM]){const t=void 0!==n.extensions?n.extensions[Nb.KHR_TEXTURE_TRANSFORM]:void 0;if(t){const e=r.associations.get(i);i=r.extensions[Nb.KHR_TEXTURE_TRANSFORM].extendTexture(i,t),r.associations.set(i,e)}}return t[e]=i,i}))}assignFinalMaterial(t){const e=t.geometry;let n=t.material;const r=void 0===e.attributes.tangent,i=void 0!==e.attributes.color,s=void 0===e.attributes.normal;if(t.isPoints){const t="PointsMaterial:"+n.uuid;let e=this.cache.get(t);e||(e=new cd,gi.prototype.copy.call(e,n),e.color.copy(n.color),e.map=n.map,e.sizeAttenuation=!1,this.cache.add(t,e)),n=e}else if(t.isLine){const t="LineBasicMaterial:"+n.uuid;let e=this.cache.get(t);e||(e=new Kh,gi.prototype.copy.call(e,n),e.color.copy(n.color),this.cache.add(t,e)),n=e}if(r||i||s){let t="ClonedMaterial:"+n.uuid+":";n.isGLTFSpecularGlossinessMaterial&&(t+="specular-glossiness:"),r&&(t+="derivative-tangents:"),i&&(t+="vertex-colors:"),s&&(t+="flat-shading:");let e=this.cache.get(t);e||(e=n.clone(),i&&(e.vertexColors=!0),s&&(e.flatShading=!0),r&&(e.normalScale&&(e.normalScale.y*=-1),e.clearcoatNormalScale&&(e.clearcoatNormalScale.y*=-1)),this.cache.add(t,e),this.associations.set(e,this.associations.get(n))),n=e}n.aoMap&&void 0===e.attributes.uv2&&void 0!==e.attributes.uv&&e.setAttribute("uv2",e.attributes.uv),t.material=n}getMaterialType(){return rf}loadMaterial(t){const e=this,n=this.json,r=this.extensions,i=n.materials[t];let s;const o={},a=i.extensions||{},c=[];if(a[Nb.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS]){const t=r[Nb.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS];s=t.getMaterialType(),c.push(t.extendParams(o,i,e))}else if(a[Nb.KHR_MATERIALS_UNLIT]){const t=r[Nb.KHR_MATERIALS_UNLIT];s=t.getMaterialType(),c.push(t.extendParams(o,i,e))}else{const n=i.pbrMetallicRoughness||{};if(o.color=new Mi(1,1,1),o.opacity=1,Array.isArray(n.baseColorFactor)){const t=n.baseColorFactor;o.color.fromArray(t),o.opacity=t[3]}void 0!==n.baseColorTexture&&c.push(e.assignTexture(o,"map",n.baseColorTexture)),o.metalness=void 0!==n.metallicFactor?n.metallicFactor:1,o.roughness=void 0!==n.roughnessFactor?n.roughnessFactor:1,void 0!==n.metallicRoughnessTexture&&(c.push(e.assignTexture(o,"metalnessMap",n.metallicRoughnessTexture)),c.push(e.assignTexture(o,"roughnessMap",n.metallicRoughnessTexture))),s=this._invokeOne((function(e){return e.getMaterialType&&e.getMaterialType(t)})),c.push(Promise.all(this._invokeAll((function(e){return e.extendMaterialParams&&e.extendMaterialParams(t,o)}))))}!0===i.doubleSided&&(o.side=b);const l=i.alphaMode||hw.OPAQUE;if(l===hw.BLEND?(o.transparent=!0,o.depthWrite=!1):(o.format=kt,o.transparent=!1,l===hw.MASK&&(o.alphaTest=void 0!==i.alphaCutoff?i.alphaCutoff:.5)),void 0!==i.normalTexture&&s!==Si&&(c.push(e.assignTexture(o,"normalMap",i.normalTexture)),o.normalScale=new Fn(1,1),void 0!==i.normalTexture.scale)){const t=i.normalTexture.scale;o.normalScale.set(t,t)}return void 0!==i.occlusionTexture&&s!==Si&&(c.push(e.assignTexture(o,"aoMap",i.occlusionTexture)),void 0!==i.occlusionTexture.strength&&(o.aoMapIntensity=i.occlusionTexture.strength)),void 0!==i.emissiveFactor&&s!==Si&&(o.emissive=(new Mi).fromArray(i.emissiveFactor)),void 0!==i.emissiveTexture&&s!==Si&&c.push(e.assignTexture(o,"emissiveMap",i.emissiveTexture)),Promise.all(c).then((function(){let n;return n=s===Kb?r[Nb.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].createMaterial(o):new s(o),i.name&&(n.name=i.name),n.map&&(n.map.encoding=Ze),n.emissiveMap&&(n.emissiveMap.encoding=Ze),fw(n,i),e.associations.set(n,{materials:t}),i.extensions&&pw(r,n,i),n}))}createUniqueName(t){const e=Nm.sanitizeNodeName(t||"");let n=e;for(let r=1;this.nodeNamesUsed[n];++r)n=e+"_"+r;return this.nodeNamesUsed[n]=!0,n}loadGeometries(t){const e=this,n=this.extensions,r=this.primitiveCache;function i(t){return n[Nb.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(t,e).then((function(n){return Mw(n,t,e)}))}const s=[];for(let o=0,a=t.length;o<a;o++){const n=t[o],a=vw(n),c=r[a];if(c)s.push(c.promise);else{let t;t=n.extensions&&n.extensions[Nb.KHR_DRACO_MESH_COMPRESSION]?i(n):Mw(new Ui,n,e),r[a]={primitive:n,promise:t},s.push(t)}}return Promise.all(s)}loadMesh(t){const e=this,n=this.json,r=this.extensions,i=n.meshes[t],s=i.primitives,o=[];for(let a=0,c=s.length;a<c;a++){const t=void 0===s[a].material?dw(this.cache):this.getDependency("material",s[a].material);o.push(t)}return o.push(e.loadGeometries(s)),Promise.all(o).then((function(n){const o=n.slice(0,n.length-1),a=n[n.length-1],c=[];for(let u=0,h=a.length;u<h;u++){const n=a[u],l=s[u];let h;const d=o[u];if(l.mode===rw.TRIANGLES||l.mode===rw.TRIANGLE_STRIP||l.mode===rw.TRIANGLE_FAN||void 0===l.mode)h=!0===i.isSkinnedMesh?new Uh(n,d):new rs(n,d),!0!==h.isSkinnedMesh||h.geometry.attributes.skinWeight.normalized||h.normalizeSkinWeights(),l.mode===rw.TRIANGLE_STRIP?h.geometry=Sw(h.geometry,Xe):l.mode===rw.TRIANGLE_FAN&&(h.geometry=Sw(h.geometry,Ye));else if(l.mode===rw.LINES)h=new od(n,d);else if(l.mode===rw.LINE_STRIP)h=new rd(n,d);else if(l.mode===rw.LINE_LOOP)h=new ad(n,d);else{if(l.mode!==rw.POINTS)throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+l.mode);h=new pd(n,d)}Object.keys(h.geometry.morphAttributes).length>0&&gw(h,i),h.name=e.createUniqueName(i.name||"mesh_"+t),fw(h,i),l.extensions&&pw(r,h,l),e.assignFinalMaterial(h),c.push(h)}for(let r=0,i=c.length;r<i;r++)e.associations.set(c[r],{meshes:t,primitives:r});if(1===c.length)return c[0];const l=new th;e.associations.set(l,{meshes:t});for(let t=0,e=c.length;t<e;t++)l.add(c[t]);return l}))}loadCamera(t){let e;const n=this.json.cameras[t],r=n[n.type];if(r)return"perspective"===n.type?e=new fs(zn.radToDeg(r.yfov),r.aspectRatio||1,r.znear||1,r.zfar||2e6):"orthographic"===n.type&&(e=new dc(-r.xmag,r.xmag,r.ymag,-r.ymag,r.znear,r.zfar)),n.name&&(e.name=this.createUniqueName(n.name)),fw(e,n),Promise.resolve(e);console.warn("THREE.GLTFLoader: Missing camera parameters.")}loadSkin(t){const e=this.json.skins[t],n={joints:e.joints};return void 0===e.inverseBindMatrices?Promise.resolve(n):this.getDependency("accessor",e.inverseBindMatrices).then((function(t){return n.inverseBindMatrices=t,n}))}loadAnimation(t){const e=this.json,n=e.animations[t],r=[],i=[],s=[],o=[],a=[];for(let c=0,l=n.channels.length;c<l;c++){const t=n.channels[c],e=n.samplers[t.sampler],l=t.target,u=void 0!==l.node?l.node:l.id,h=void 0!==n.parameters?n.parameters[e.input]:e.input,d=void 0!==n.parameters?n.parameters[e.output]:e.output;r.push(this.getDependency("node",u)),i.push(this.getDependency("accessor",h)),s.push(this.getDependency("accessor",d)),o.push(e),a.push(l)}return Promise.all([Promise.all(r),Promise.all(i),Promise.all(s),Promise.all(o),Promise.all(a)]).then((function(e){const r=e[0],i=e[1],s=e[2],o=e[3],a=e[4],c=[];for(let t=0,n=r.length;t<n;t++){const e=r[t],n=i[t],l=s[t],u=o[t],h=a[t];if(void 0===e)continue;let d;switch(e.updateMatrix(),e.matrixAutoUpdate=!0,lw[h.path]){case lw.weights:d=wf;break;case lw.rotation:d=Mf;break;case lw.position:case lw.scale:default:d=Tf;break}const p=e.name?e.name:e.uuid,f=void 0!==u.interpolation?uw[u.interpolation]:Ue,m=[];lw[h.path]===lw.weights?e.traverse((function(t){t.morphTargetInfluences&&m.push(t.name?t.name:t.uuid)})):m.push(p);let g=l.array;if(l.normalized){const t=xw(g.constructor),e=new Float32Array(g.length);for(let n=0,r=g.length;n<r;n++)e[n]=g[n]*t;g=e}for(let t=0,r=m.length;t<r;t++){const e=new d(m[t]+"."+lw[h.path],n.array,g,f);"CUBICSPLINE"===u.interpolation&&(e.createInterpolant=function(t){const e=this instanceof Mf?nw:tw;return new e(this.times,this.values,this.getValueSize()/3,t)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0),c.push(e)}}const l=n.name?n.name:"animation_"+t;return new Ef(l,void 0,c)}))}createNodeMesh(t){const e=this.json,n=this,r=e.nodes[t];return void 0===r.mesh?null:n.getDependency("mesh",r.mesh).then((function(t){const e=n._getNodeRef(n.meshCache,r.mesh,t);return void 0!==r.weights&&e.traverse((function(t){if(t.isMesh)for(let e=0,n=r.weights.length;e<n;e++)t.morphTargetInfluences[e]=r.weights[e]})),e}))}loadNode(t){const e=this.json,n=this.extensions,r=this,i=e.nodes[t],s=i.name?r.createUniqueName(i.name):"";return function(){const e=[],n=r._invokeOne((function(e){return e.createNodeMesh&&e.createNodeMesh(t)}));return n&&e.push(n),void 0!==i.camera&&e.push(r.getDependency("camera",i.camera).then((function(t){return r._getNodeRef(r.cameraCache,i.camera,t)}))),r._invokeAll((function(e){return e.createNodeAttachment&&e.createNodeAttachment(t)})).forEach((function(t){e.push(t)})),Promise.all(e)}().then((function(e){let o;if(o=!0===i.isBone?new Bh:e.length>1?new th:1===e.length?e[0]:new ri,o!==e[0])for(let t=0,n=e.length;t<n;t++)o.add(e[t]);if(i.name&&(o.userData.name=i.name,o.name=s),fw(o,i),i.extensions&&pw(n,o,i),void 0!==i.matrix){const t=new Ir;t.fromArray(i.matrix),o.applyMatrix4(t)}else void 0!==i.translation&&o.position.fromArray(i.translation),void 0!==i.rotation&&o.quaternion.fromArray(i.rotation),void 0!==i.scale&&o.scale.fromArray(i.scale);return r.associations.has(o)||r.associations.set(o,{}),r.associations.get(o).nodes=t,o}))}loadScene(t){const e=this.json,n=this.extensions,r=this.json.scenes[t],i=this,s=new th;r.name&&(s.name=i.createUniqueName(r.name)),fw(s,r),r.extensions&&pw(n,s,r);const o=r.nodes||[],a=[];for(let c=0,l=o.length;c<l;c++)a.push(ww(o[c],s,e,i));return Promise.all(a).then((function(){const t=t=>{const e=new Map;for(const[n,r]of i.associations)(n instanceof gi||n instanceof Yn)&&e.set(n,r);return t.traverse(t=>{const n=i.associations.get(t);null!=n&&e.set(t,n)}),e};return i.associations=t(s),s}))}}function ww(t,e,n,r){const i=n.nodes[t];return r.getDependency("node",t).then((function(t){if(void 0===i.skin)return t;let e;return r.getDependency("skin",i.skin).then((function(t){e=t;const n=[];for(let i=0,s=e.joints.length;i<s;i++)n.push(r.getDependency("node",e.joints[i]));return Promise.all(n)})).then((function(n){return t.traverse((function(t){if(!t.isMesh)return;const r=[],i=[];for(let s=0,o=n.length;s<o;s++){const t=n[s];if(t){r.push(t);const n=new Ir;void 0!==e.inverseBindMatrices&&n.fromArray(e.inverseBindMatrices.array,16*s),i.push(n)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',e.joints[s])}t.bind(new Wh(r,i),t.matrixWorld)})),t}))})).then((function(t){e.add(t);const s=[];if(i.children){const e=i.children;for(let i=0,o=e.length;i<o;i++){const o=e[i];s.push(ww(o,t,n,r))}}return Promise.all(s)}))}function _w(t,e,n){const r=e.attributes,i=new ir;if(void 0===r.POSITION)return;{const t=n.json.accessors[r.POSITION],e=t.min,s=t.max;if(void 0===e||void 0===s)return void console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");if(i.set(new er(e[0],e[1],e[2]),new er(s[0],s[1],s[2])),t.normalized){const e=xw(iw[t.componentType]);i.min.multiplyScalar(e),i.max.multiplyScalar(e)}}const s=e.targets;if(void 0!==s){const t=new er,e=new er;for(let r=0,i=s.length;r<i;r++){const i=s[r];if(void 0!==i.POSITION){const r=n.json.accessors[i.POSITION],s=r.min,o=r.max;if(void 0!==s&&void 0!==o){if(e.setX(Math.max(Math.abs(s[0]),Math.abs(o[0]))),e.setY(Math.max(Math.abs(s[1]),Math.abs(o[1]))),e.setZ(Math.max(Math.abs(s[2]),Math.abs(o[2]))),r.normalized){const t=xw(iw[r.componentType]);e.multiplyScalar(t)}t.max(e)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}i.expandByVector(t)}t.boundingBox=i;const o=new Mr;i.getCenter(o.center),o.radius=i.min.distanceTo(i.max)/2,t.boundingSphere=o}function Mw(t,e,n){const r=e.attributes,i=[];function s(e,r){return n.getDependency("accessor",e).then((function(e){t.setAttribute(r,e)}))}for(const o in r){const e=cw[o]||o.toLowerCase();e in t.attributes||i.push(s(r[o],e))}if(void 0!==e.indices&&!t.index){const r=n.getDependency("accessor",e.indices).then((function(e){t.setIndex(e)}));i.push(r)}return fw(t,e),_w(t,e,n),Promise.all(i).then((function(){return void 0!==e.targets?mw(t,e.targets,n):t}))}function Sw(t,e){let n=t.getIndex();if(null===n){const e=[],r=t.getAttribute("position");if(void 0===r)return console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),t;for(let t=0;t<r.count;t++)e.push(t);t.setIndex(e),n=t.getIndex()}const r=n.count-2,i=[];if(e===Ye)for(let o=1;o<=r;o++)i.push(n.getX(0)),i.push(n.getX(o)),i.push(n.getX(o+1));else for(let o=0;o<r;o++)o%2===0?(i.push(n.getX(o)),i.push(n.getX(o+1)),i.push(n.getX(o+2))):(i.push(n.getX(o+2)),i.push(n.getX(o+1)),i.push(n.getX(o)));i.length/3!==r&&console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const s=t.clone();return s.setIndex(i),s}var Tw,Ew,Aw={name:"model-gltf",mixins:[Ug],props:{lights:{type:Array,default:function(){return[{type:"AmbientLight",color:11184810},{type:"DirectionalLight",position:{x:1,y:1,z:1},color:16777215,intensity:.8}]}},gammaOutput:{type:Boolean,default:!0}},data:function(){var t=new Pb;return t.setCrossOrigin(this.crossOrigin),t.setRequestHeader(this.requestHeader),{loader:t}},methods:{load:function(){var t=this;this.src&&(this.object&&this.wrapper.remove(this.object),this.loader.load(this.src,(function(e){t.addObject(e.scene),t.$emit("on-load")}),(function(e){t.$emit("on-progress",e)}),(function(e){t.$emit("on-error",e)})))}}},Lw=Aw,Rw=zg(Lw,Tw,Ew,!1,null,null,null),Cw=Rw.exports,Pw=c.a.extend(cb,{name:"model-json"}),Iw=c.a.extend(Cb,{name:"model-dae"}),Nw=[qg,ib,cb,Pw,mb,_b,Cb,Iw,Cw],Ow=function(t){Nw.forEach((function(e){t.component(e.name,e)}))};"undefined"!==typeof window&&window.Vue&&Ow(window.Vue);var Dw={install:Ow,ModelObj:qg,ModelFbx:ib,ModelThree:cb,ModelJson:Pw,ModelStl:mb,ModelPly:_b,ModelCollada:Cb,ModelDae:Iw,ModelGltf:Cw};e["default"]=Dw},fb2c:function(t,e,n){var r=n("74e8");r("Uint32",(function(t){return function(e,n,r){return t(this,e,n,r)}}))},fb6a:function(t,e,n){"use strict";var r=n("23e7"),i=n("e8b5"),s=n("68ee"),o=n("861d"),a=n("23cb"),c=n("07fa"),l=n("fc6a"),u=n("8418"),h=n("b622"),d=n("1dde"),p=n("f36a"),f=d("slice"),m=h("species"),g=Array,v=Math.max;r({target:"Array",proto:!0,forced:!f},{slice:function(t,e){var n,r,h,d=l(this),f=c(d),y=a(t,f),x=a(void 0===e?f:e,f);if(i(d)&&(n=d.constructor,s(n)&&(n===g||i(n.prototype))?n=void 0:o(n)&&(n=n[m],null===n&&(n=void 0)),n===g||void 0===n))return p(d,y,x);for(r=new(void 0===n?g:n)(v(x-y,0)),h=0;y<x;y++,h++)y in d&&u(r,h,d[y]);return r.length=h,r}})},fc6a:function(t,e,n){var r=n("44ad"),i=n("1d80");t.exports=function(t){return r(i(t))}},fce3:function(t,e,n){var r=n("d039"),i=n("da84"),s=i.RegExp;t.exports=r((function(){var t=s(".","s");return!(t.dotAll&&t.exec("\n")&&"s"===t.flags)}))},fdbc:function(t,e){t.exports={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0}},fdbf:function(t,e,n){var r=n("4930");t.exports=r&&!Symbol.sham&&"symbol"==typeof Symbol.iterator}})}));
- //# sourceMappingURL=vue-3d-model.umd.min.js.map
|