!function(){function e(e){if(null!=e){var t=e["function"==typeof Symbol&&Symbol.iterator||"@@iterator"],n=0;if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}}}throw new TypeError(P(e)+" is not iterable")}function t(e){var t=Object(e),n=[];for(var r in t)n.unshift(r);return function e(){for(;n.length;)if((r=n.pop())in t)return e.value=r,e.done=!1,e;return e.done=!0,e}}function n(e,t,n,i){var a=r(b(1&i?e.prototype:e),t,n);return 2&i&&"function"==typeof a?function(e){return a.apply(n,e)}:a}function r(){return r="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=b(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},r.apply(null,arguments)}function i(e,t,n){return n(h(e,t))}function a(e,t,n){return e.set(h(e,t),n),n}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function s(e){for(var t=1;t3?(i=p===r)&&(u=a[(s=a[4])?5:(s=3,3)],a[4]=a[5]=e):a[0]<=f&&((i=n<2&&fr||r>p)&&(a[4]=n,a[5]=r,d.n=p,s=0))}if(i||n>1)return o;throw h=!0,r}return function(i,c,p){if(l>1)throw TypeError("Generator is already running");for(h&&1===c&&f(c,p),s=c,u=p;(t=s<2?e:u)||!h;){a||(s?s<3?(s>1&&(d.n=-1),f(s,u)):d.n=u:d.v=u);try{if(l=2,a){if(s||(i="next"),t=a[i]){if(!(t=t.call(a,u)))throw TypeError("iterator result is not an object");if(!t.done)return t;u=t.value,s<2&&(s=0)}else 1===s&&(t=a.return)&&t.call(a),s<2&&(u=TypeError("The iterator does not provide a '"+i+"' method"),s=1);a=e}else if((t=(h=d.n<0)?u:n.call(r,d))!==o)break}catch(t){a=e,s=1,u=t}finally{l=1}}return{value:t,done:h}}}(n,i,a),!0),l}var o={};function s(){}function u(){}function l(){}t=Object.getPrototypeOf;var c=[][r]?t(t([][r]())):(f(t={},r,function(){return this}),t),h=l.prototype=s.prototype=Object.create(c);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,l):(e.__proto__=l,f(e,i,"GeneratorFunction")),e.prototype=Object.create(h),e}return u.prototype=l,f(h,"constructor",l),f(l,"constructor",u),u.displayName="GeneratorFunction",f(l,i,"GeneratorFunction"),f(h),f(h,i,"Generator"),f(h,r,function(){return this}),f(h,"toString",function(){return"[object Generator]"}),(d=function(){return{w:a,m:p}})()}function f(e,t,n,r){var i=Object.defineProperty;try{i({},"",{})}catch(e){i=0}f=function(e,t,n,r){if(t)i?i(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n;else{function a(t,n){f(e,t,function(e){return this._invoke(t,n,e)})}a("next",0),a("throw",1),a("return",2)}},f(e,t,n,r)}function p(e,t,n,r,i,a,o){try{var s=e[a](o),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,i)}function v(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var a=e.apply(t,n);function o(e){p(a,r,i,o,s,"next",e)}function s(e){p(a,r,i,o,s,"throw",e)}o(void 0)})}}function m(e){var t="function"==typeof Map?new Map:void 0;return m=function(e){if(null===e||!function(e){try{return-1!==Function.toString.call(e).indexOf("[native code]")}catch(t){return"function"==typeof e}}(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return g(e,arguments,b(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),S(n,e)},m(e)}function g(e,t,n){if(_())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,t);var i=new(e.bind.apply(e,r));return n&&S(i,n.prototype),i}function y(e,t,n){return t=b(t),function(e,t){if(t&&("object"==P(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,_()?Reflect.construct(t,n||[],b(e).constructor):t.apply(e,n))}function _(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(_=function(){return!!e})()}function b(e){return b=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},b(e)}function x(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&S(e,t)}function S(e,t){return S=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},S(e,t)}function A(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function w(e,t){for(var n=0;n=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==n.return||n.return()}finally{if(s)throw a}}}}function D(e,t){if(e){if("string"==typeof e)return O(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?O(e,t):void 0}}function O(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n122||e.charCodeAt(2)<97)},G=function(e){return e.startsWith("onUpdate:")},j=Object.assign,Q=function(e,t){var n=e.indexOf(t);n>-1&&e.splice(n,1)},q=Object.prototype.hasOwnProperty,X=function(e,t){return q.call(e,t)},Y=Array.isArray,K=function(e){return"[object Map]"===ie(e)},Z=function(e){return"[object Set]"===ie(e)},J=function(e){return"function"==typeof e},$=function(e){return"string"==typeof e},ee=function(e){return"symbol"===P(e)},te=function(e){return null!==e&&"object"===P(e)},ne=function(e){return(te(e)||J(e))&&J(e.then)&&J(e.catch)},re=Object.prototype.toString,ie=function(e){return re.call(e)},ae=function(e){return"[object Object]"===ie(e)},oe=function(e){return $(e)&&"NaN"!==e&&"-"!==e[0]&&""+parseInt(e,10)===e},se=S(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),ue=function(e){var t=Object.create(null);return function(n){return t[n]||(t[n]=e(n))}},le=/-(\w)/g,ce=ue(function(e){return e.replace(le,function(e,t){return t?t.toUpperCase():""})}),he=/\B([A-Z])/g,de=ue(function(e){return e.replace(he,"-$1").toLowerCase()}),fe=ue(function(e){return e.charAt(0).toUpperCase()+e.slice(1)}),pe=ue(function(e){return e?"on".concat(fe(e)):""}),ve=function(e,t){return!Object.is(e,t)},me=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r3&&void 0!==arguments[3]&&arguments[3];Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:r,value:n})},ye=function(e){var t=parseFloat(e);return isNaN(t)?e:t},_e=function(){return w||(w="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{})};function be(e){if(Y(e)){for(var t={},n=0;n1&&(t[n[0].trim()]=n[1].trim())}}),t}function Te(e){var t="";if($(e))t=e;else if(Y(e))for(var n=0;n"]=a,e},{})):Z(t)?M({},"Set(".concat(t.size,")"),I(t.values()).map(function(e){return Pe(e)})):ee(t)?Pe(t):!te(t)||Y(t)||ae(t)?t:String(t)},Pe=function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return ee(e)?"Symbol(".concat(null!=(t=e.description)?t:n,")"):e},Le=function(){return T(function e(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];A(this,e),this.detached=t,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this.parent=Ce,!t&&Ce&&(this.index=(Ce.scopes||(Ce.scopes=[])).push(this)-1)},[{key:"active",get:function(){return this._active}},{key:"pause",value:function(){if(this._active){var e,t;if(this._isPaused=!0,this.scopes)for(e=0,t=this.scopes.length;e0&&0===--this._on&&(Ce=this.prevScope,this.prevScope=void 0)}},{key:"stop",value:function(e){if(this._active){var t,n;for(this._active=!1,t=0,n=this.effects.length;t1&&void 0!==arguments[1]&&arguments[1];if(e.flags|=8,t)return e.next=Be,void(Be=e);e.next=Fe,Fe=e}function We(){Ve++}function Ge(){if(!(--Ve>0)){if(Be){var e=Be;for(Be=void 0;e;){var t=e.next;e.next=void 0,e.flags&=-9,e=t}}for(var n;Fe;){var r=Fe;for(Fe=void 0;r;){var i=r.next;if(r.next=void 0,r.flags&=-9,1&r.flags)try{r.trigger()}catch(a){n||(n=a)}r=i}}if(n)throw n}}function je(e){for(var t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function Qe(e){for(var t,n=e.depsTail,r=n;r;){var i=r.prevDep;-1===r.version?(r===n&&(n=i),Ye(r),Ke(r)):t=r,r.dep.activeLink=r.prevActiveLink,r.prevActiveLink=void 0,r=i}e.deps=t,e.depsTail=n}function qe(e){for(var t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(Xe(t.dep.computed)||t.dep.version!==t.version))return!0;return!!e._dirty}function Xe(e){if((!(4&e.flags)||16&e.flags)&&(e.flags&=-17,e.globalVersion!==nt&&(e.globalVersion=nt,e.isSSR||!(128&e.flags)||(e.deps||e._dirty)&&qe(e)))){e.flags|=2;var t=e.dep,n=ke,r=Ze;ke=e,Ze=!0;try{je(e);var i=e.fn(e._value);(0===t.version||ve(i,e._value))&&(e.flags|=128,e._value=i,t.version++)}catch(a){throw t.version++,a}finally{ke=n,Ze=r,Qe(e),e.flags&=-3}}}function Ye(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=e.dep,r=e.prevSub,i=e.nextSub;if(r&&(r.nextSub=i,e.prevSub=void 0),i&&(i.prevSub=r,e.nextSub=void 0),n.subs===e&&(n.subs=r,!r&&n.computed)){n.computed.flags&=-5;for(var a=n.computed.deps;a;a=a.nextDep)Ye(a,!0)}t||--n.sc||!n.map||n.map.delete(n.key)}function Ke(e){var t=e.prevDep,n=e.nextDep;t&&(t.nextDep=n,e.prevDep=void 0),n&&(n.prevDep=t,e.nextDep=void 0)}var Ze=!0,Je=[];function $e(){Je.push(Ze),Ze=!1}function et(){var e=Je.pop();Ze=void 0===e||e}function tt(e){var t=e.cleanup;if(e.cleanup=void 0,t){var n=ke;ke=void 0;try{t()}finally{ke=n}}}var nt=0,rt=T(function e(t,n){A(this,e),this.sub=t,this.dep=n,this.version=n.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}),it=function(){return T(function e(t){A(this,e),this.computed=t,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0,this.__v_skip=!0},[{key:"track",value:function(e){if(ke&&Ze&&ke!==this.computed){var t=this.activeLink;if(void 0===t||t.sub!==ke)t=this.activeLink=new rt(ke,this),ke.deps?(t.prevDep=ke.depsTail,ke.depsTail.nextDep=t,ke.depsTail=t):ke.deps=ke.depsTail=t,at(t);else if(-1===t.version&&(t.version=this.version,t.nextDep)){var n=t.nextDep;n.prevDep=t.prevDep,t.prevDep&&(t.prevDep.nextDep=n),t.prevDep=ke.depsTail,t.nextDep=void 0,ke.depsTail.nextDep=t,ke.depsTail=t,ke.deps===t&&(ke.deps=n)}return t}}},{key:"trigger",value:function(e){this.version++,nt++,this.notify(e)}},{key:"notify",value:function(e){We();try{0;for(var t=this.subs;t;t=t.prevSub)t.sub.notify()&&t.sub.dep.notify()}finally{Ge()}}}])}();function at(e){if(e.dep.sc++,4&e.sub.flags){var t=e.dep.computed;if(t&&!e.dep.subs){t.flags|=20;for(var n=t.deps;n;n=n.nextDep)at(n)}var r=e.dep.subs;r!==e&&(e.prevSub=r,r&&(r.nextSub=e)),e.dep.subs=e}}var ot=new WeakMap,st=Symbol(""),ut=Symbol(""),lt=Symbol("");function ct(e,t,n){if(Ze&&ke){var r=ot.get(e);r||ot.set(e,r=new Map);var i=r.get(n);i||(r.set(n,i=new it),i.map=r,i.key=n),i.track()}}function ht(e,t,n,r,i,a){var o=ot.get(e);if(o){var s=function(e){e&&e.trigger()};if(We(),"clear"===t)o.forEach(s);else{var u=Y(e),l=u&&oe(n);if(u&&"length"===n){var c=Number(r);o.forEach(function(e,t){("length"===t||t===lt||!ee(t)&&t>=c)&&s(e)})}else switch((void 0!==n||o.has(void 0))&&s(o.get(n)),l&&s(o.get(lt)),t){case"add":u?l&&s(o.get("length")):(s(o.get(st)),K(e)&&s(o.get(ut)));break;case"delete":u||(s(o.get(st)),K(e)&&s(o.get(ut)));break;case"set":K(e)&&s(o.get(st))}}Ge()}else nt++}function dt(e){var t=Kt(e);return t===e?t:(ct(t,0,lt),Xt(e)?t:t.map(Jt))}function ft(e){return ct(e=Kt(e),0,lt),e}var pt=(M(M(M(M(M(M(M(M(M(M(r={__proto__:null},Symbol.iterator,function(){return vt(this,Symbol.iterator,Jt)}),"concat",function(){for(var e,t=arguments.length,n=new Array(t),r=0;r1?t-1:0),r=1;r1?t-1:0),r=1;r2&&(c=function(t,r){return n.call(this,t,r,e)}));var h=u.call(o,c,r);return s&&i?i(h):h}function yt(e,t,n,r){var i=ft(e),a=n;return i!==e&&(Xt(e)?n.length>3&&(a=function(t,r,i){return n.call(this,t,r,i,e)}):a=function(t,r,i){return n.call(this,t,Jt(r),i,e)}),i[t].apply(i,[a].concat(I(r)))}function _t(e,t,n){var r=Kt(e);ct(r,0,lt);var i=r[t].apply(r,I(n));return-1!==i&&!1!==i||!Yt(n[0])?i:(n[0]=Kt(n[0]),r[t].apply(r,I(n)))}function bt(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];$e(),We();var r=Kt(e)[t].apply(e,n);return Ge(),et(),r}var xt=S("__proto__,__v_isRef,__isVue"),St=new Set(Object.getOwnPropertyNames(Symbol).filter(function(e){return"arguments"!==e&&"caller"!==e}).map(function(e){return Symbol[e]}).filter(ee));function At(e){ee(e)||(e=String(e));var t=Kt(this);return ct(t,0,e),t.hasOwnProperty(e)}var wt=function(){return T(function e(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];A(this,e),this._isReadonly=t,this._isShallow=n},[{key:"get",value:function(e,t,n){if("__v_skip"===t)return e.__v_skip;var r=this._isReadonly,i=this._isShallow;if("__v_isReactive"===t)return!r;if("__v_isReadonly"===t)return r;if("__v_isShallow"===t)return i;if("__v_raw"===t)return n===(r?i?Vt:zt:i?Ut:Bt).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(n)?e:void 0;var a=Y(e);if(!r){var o;if(a&&(o=pt[t]))return o;if("hasOwnProperty"===t)return At}var s=Reflect.get(e,t,en(e)?e:n);return(ee(t)?St.has(t):xt(t))?s:(r||ct(e,0,t),i?s:en(s)?a&&oe(t)?s:s.value:te(s)?r?Gt(s):Wt(s):s)}}])}(),Tt=function(e){function t(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return A(this,t),y(this,t,[!1,e])}return x(t,e),T(t,[{key:"set",value:function(e,t,n,r){var i=e[t];if(!this._isShallow){var a=qt(i);if(Xt(n)||qt(n)||(i=Kt(i),n=Kt(n)),!Y(e)&&en(i)&&!en(n))return!a&&(i.value=n,!0)}var o=Y(e)&&oe(t)?Number(t)0&&void 0!==arguments[0]&&arguments[0];return A(this,t),y(this,t,[!0,e])}return x(t,e),T(t,[{key:"set",value:function(e,t){return!0}},{key:"deleteProperty",value:function(e,t){return!0}}])}(wt),Et=new Tt,Ct=new Mt,kt=new Tt(!0),Rt=function(e){return e},It=function(e){return Reflect.getPrototypeOf(e)};function Nt(e){return function(){return"delete"!==e&&("clear"===e?void 0:this)}}function Pt(e,t){var n={get:function(n){var r=this.__v_raw,i=Kt(r),a=Kt(n);e||(ve(n,a)&&ct(i,0,n),ct(i,0,a));var o=It(i).has,s=t?Rt:e?$t:Jt;return o.call(i,n)?s(r.get(n)):o.call(i,a)?s(r.get(a)):void(r!==i&&r.get(n))},get size(){var t=this.__v_raw;return!e&&ct(Kt(t),0,st),Reflect.get(t,"size",t)},has:function(t){var n=this.__v_raw,r=Kt(n),i=Kt(t);return e||(ve(t,i)&&ct(r,0,t),ct(r,0,i)),t===i?n.has(t):n.has(t)||n.has(i)},forEach:function(n,r){var i=this,a=i.__v_raw,o=Kt(a),s=t?Rt:e?$t:Jt;return!e&&ct(o,0,st),a.forEach(function(e,t){return n.call(r,s(e),s(t),i)})}};return j(n,e?{add:Nt("add"),set:Nt("set"),delete:Nt("delete"),clear:Nt("clear")}:{add:function(e){t||Xt(e)||qt(e)||(e=Kt(e));var n=Kt(this);return It(n).has.call(n,e)||(n.add(e),ht(n,"add",e,e)),this},set:function(e,n){t||Xt(n)||qt(n)||(n=Kt(n));var r=Kt(this),i=It(r),a=i.has,o=i.get,s=a.call(r,e);s||(e=Kt(e),s=a.call(r,e));var u=o.call(r,e);return r.set(e,n),s?ve(n,u)&&ht(r,"set",e,n):ht(r,"add",e,n),this},delete:function(e){var t=Kt(this),n=It(t),r=n.has,i=n.get,a=r.call(t,e);a||(e=Kt(e),a=r.call(t,e)),i&&i.call(t,e);var o=t.delete(e);return a&&ht(t,"delete",e,void 0),o},clear:function(){var e=Kt(this),t=0!==e.size,n=e.clear();return t&&ht(e,"clear",void 0,void 0),n}}),["keys","values","entries",Symbol.iterator].forEach(function(r){n[r]=function(e,t,n){return function(){var r=this.__v_raw,i=Kt(r),a=K(i),o="entries"===e||e===Symbol.iterator&&a,s="keys"===e&&a,u=r[e].apply(r,arguments),l=n?Rt:t?$t:Jt;return!t&&ct(i,0,s?ut:st),M({next:function(){var e=u.next(),t=e.value,n=e.done;return n?{value:t,done:n}:{value:o?[l(t[0]),l(t[1])]:l(t),done:n}}},Symbol.iterator,function(){return this})}}(r,e,t)}),n}function Lt(e,t){var n=Pt(e,t);return function(t,r,i){return"__v_isReactive"===r?!e:"__v_isReadonly"===r?e:"__v_raw"===r?t:Reflect.get(X(n,r)&&r in t?n:t,r,i)}}var Dt={get:Lt(!1,!1)},Ot={get:Lt(!1,!0)},Ft={get:Lt(!0,!1)},Bt=new WeakMap,Ut=new WeakMap,zt=new WeakMap,Vt=new WeakMap;function Ht(e){return e.__v_skip||!Object.isExtensible(e)?0:function(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}(function(e){return ie(e).slice(8,-1)}(e))}function Wt(e){return qt(e)?e:jt(e,!1,Et,Dt,Bt)}function Gt(e){return jt(e,!0,Ct,Ft,zt)}function jt(e,t,n,r,i){if(!te(e))return e;if(e.__v_raw&&(!t||!e.__v_isReactive))return e;var a=Ht(e);if(0===a)return e;var o=i.get(e);if(o)return o;var s=new Proxy(e,2===a?r:n);return i.set(e,s),s}function Qt(e){return qt(e)?Qt(e.__v_raw):!(!e||!e.__v_isReactive)}function qt(e){return!(!e||!e.__v_isReadonly)}function Xt(e){return!(!e||!e.__v_isShallow)}function Yt(e){return!!e&&!!e.__v_raw}function Kt(e){var t=e&&e.__v_raw;return t?Kt(t):e}function Zt(e){return!X(e,"__v_skip")&&Object.isExtensible(e)&&ge(e,"__v_skip",!0),e}var Jt=function(e){return te(e)?Wt(e):e},$t=function(e){return te(e)?Gt(e):e};function en(e){return!!e&&!0===e.__v_isRef}function tn(e){return rn(e,!1)}function nn(e){return rn(e,!0)}function rn(e,t){return en(e)?e:new an(e,t)}var an=function(){return T(function e(t,n){A(this,e),this.dep=new it,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=n?t:Kt(t),this._value=n?t:Jt(t),this.__v_isShallow=n},[{key:"value",get:function(){return this.dep.track(),this._value},set:function(e){var t=this._rawValue,n=this.__v_isShallow||Xt(e)||qt(e);e=n?e:Kt(e),ve(e,t)&&(this._rawValue=e,this._value=n?e:Jt(e),this.dep.trigger())}}])}();function on(e){return en(e)?e.value:e}var sn={get:function(e,t,n){return"__v_raw"===t?e:on(Reflect.get(e,t,n))},set:function(e,t,n,r){var i=e[t];return en(i)&&!en(n)?(i.value=n,!0):Reflect.set(e,t,n,r)}};function un(e){return Qt(e)?e:new Proxy(e,sn)}var ln=function(){return T(function e(t,n,r){A(this,e),this._object=t,this._key=n,this._defaultValue=r,this.__v_isRef=!0,this._value=void 0},[{key:"value",get:function(){var e=this._object[this._key];return this._value=void 0===e?this._defaultValue:e},set:function(e){this._object[this._key]=e}},{key:"dep",get:function(){return function(e,t){var n=ot.get(e);return n&&n.get(t)}(Kt(this._object),this._key)}}])}(),cn=function(){return T(function e(t){A(this,e),this._getter=t,this.__v_isRef=!0,this.__v_isReadonly=!0,this._value=void 0},[{key:"value",get:function(){return this._value=this._getter()}}])}();function hn(e,t,n){var r=e[t];return en(r)?r:new ln(e,t,n)}var dn=function(){return T(function e(t,n,r){A(this,e),this.fn=t,this.setter=n,this._value=void 0,this.dep=new it(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=nt-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!n,this.isSSR=r},[{key:"notify",value:function(){if(this.flags|=16,!(8&this.flags)&&ke!==this)return He(this,!0),!0}},{key:"value",get:function(){var e=this.dep.track();return Xe(this),e&&(e.version=this.dep.version),this._value},set:function(e){this.setter&&this.setter(e)}}])}();var fn={},pn=new WeakMap,vn=void 0;function mn(e,t){var n,r,i,a,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:E,s=o.immediate,u=o.deep,l=o.once,c=o.scheduler,h=o.augmentJob,d=o.call,f=function(e){return u?e:Xt(e)||!1===u||0===u?gn(e,1):gn(e)},p=!1,v=!1;if(en(e)?(r=function(){return e.value},p=Xt(e)):Qt(e)?(r=function(){return f(e)},p=!0):Y(e)?(v=!0,p=e.some(function(e){return Qt(e)||Xt(e)}),r=function(){return e.map(function(e){return en(e)?e.value:Qt(e)?f(e):J(e)?d?d(e,2):e():void 0})}):r=J(e)?t?d?function(){return d(e,2)}:e:function(){if(i){$e();try{i()}finally{et()}}var t=vn;vn=n;try{return d?d(e,3,[a]):e(a)}finally{vn=t}}:B,t&&u){var m=r,g=!0===u?1/0:u;r=function(){return gn(m(),g)}}var y=Oe(),_=function(){n.stop(),y&&y.active&&Q(y.effects,n)};if(l&&t){var b=t;t=function(){b.apply(void 0,arguments),_()}}var x=v?new Array(e.length).fill(fn):fn,S=function(e){if(1&n.flags&&(n.dirty||e))if(t){var r=n.run();if(u||p||(v?r.some(function(e,t){return ve(e,x[t])}):ve(r,x))){i&&i();var o=vn;vn=n;try{var s=[r,x===fn?void 0:v&&x[0]===fn?[]:x,a];x=r,d?d(t,3,s):t.apply(void 0,s)}finally{vn=o}}}else n.run()};return h&&h(S),(n=new ze(r)).scheduler=c?function(){return c(S,!1)}:S,a=function(e){return function(e){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:vn;if(t){var n=pn.get(t);n||pn.set(t,n=[]),n.push(e)}}(e,!1,n)},i=n.onStop=function(){var e=pn.get(n);if(e){if(d)d(e,4);else{var t,r=L(e);try{for(r.s();!(t=r.n()).done;){(0,t.value)()}}catch(i){r.e(i)}finally{r.f()}}pn.delete(n)}},t?s?S(!0):x=n.run():c?c(S.bind(null,!0),!0):n.run(),_.pause=n.pause.bind(n),_.resume=n.resume.bind(n),_.stop=_,_}function gn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1/0,n=arguments.length>2?arguments[2]:void 0;if(t<=0||!te(e)||e.__v_skip)return e;if((n=n||new Set).has(e))return e;if(n.add(e),t--,en(e))gn(e.value,t,n);else if(Y(e))for(var r=0;r3&&void 0!==arguments[3])||arguments[3],i=t?t.vnode:null,a=t&&t.appContext.config||E,o=a.errorHandler,s=a.throwUnhandledErrorInProduction;if(t){for(var u=t.parent,l=t.proxy,c="https://vuejs.org/error-reference/#runtime-".concat(n);u;){var h=u.ec;if(h)for(var d=0;d4&&void 0!==arguments[4]&&arguments[4];if(r)throw e;console.error(e)}(e,n,i,r,s)}var xn=[],Sn=-1,An=[],wn=null,Tn=0,Mn=Promise.resolve(),En=null;function Cn(e){var t=En||Mn;return e?t.then(this?e.bind(this):e):t}function kn(e){if(!(1&e.flags)){var t=Pn(e),n=xn[xn.length-1];!n||!(2&e.flags)&&t>=Pn(n)?xn.push(e):xn.splice(function(e){for(var t=Sn+1,n=xn.length;t>>1,i=xn[r],a=Pn(i);a2&&void 0!==arguments[2]?arguments[2]:Sn+1;n1&&void 0!==arguments[1]?arguments[1]:Dn;if(!t)return e;if(e._n)return e;var n=function(){n._d&&Qi(-1);var r,i=Fn(t);try{r=e.apply(void 0,arguments)}finally{Fn(i),n._d&&Qi(1)}return r};return n._n=!0,n._c=!0,n._d=!0,n}function Un(e,t){if(null===Dn)return e;for(var n=Ta(Dn),r=e.dirs||(e.dirs=[]),i=0;i4&&void 0!==arguments[4]?arguments[4]:2;0===o&&i(e.targetAnchor,t,n);var s=e.el,u=e.anchor,l=e.shapeFlag,c=e.children,h=e.props,d=2===o;if(d&&i(s,t,n),(!d||Hn(h))&&16&l)for(var f=0;f1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2?arguments[2]:void 0,r=[],i=0,a=0;a1)for(var u=0;u4&&void 0!==arguments[4]&&arguments[4];if(Y(e))e.forEach(function(e,a){return ur(e,t&&(Y(t)?t[a]:t),n,r,i)});else if(!lr(r)||i){var a=4&r.shapeFlag?Ta(r.component):r.el,o=i?null:a,s=e.i,u=e.r,l=t&&t.r,c=s.refs===E?s.refs={}:s.refs,h=s.setupState,d=Kt(h),f=h===E?function(){return!1}:function(e){return X(d,e)};if(null!=l&&l!==u&&($(l)?(c[l]=null,f(l)&&(h[l]=null)):en(l)&&(l.value=null)),J(u))yn(u,s,12,[o,c]);else{var p=$(u),v=en(u);if(p||v){var m=function(){if(e.f){var t=p?f(u)?h[u]:c[u]:u.value;i?Y(t)&&Q(t,a):Y(t)?t.includes(a)||t.push(a):p?(c[u]=[a],f(u)&&(h[u]=c[u])):(u.value=[a],e.k&&(c[e.k]=u.value))}else p?(c[u]=o,f(u)&&(h[u]=o)):v&&(u.value=o,e.k&&(c[e.k]=o))};o?(m.id=-1,vi(m,n)):m()}}}else 512&r.shapeFlag&&r.type.__asyncResolved&&r.component.subTree.component&&ur(e,t,n,r.component.subTree)}_e().requestIdleCallback,_e().cancelIdleCallback;var lr=function(e){return!!e.type.__asyncLoader},cr=function(e){return e.type.__isKeepAlive};function hr(e,t){fr(e,"a",t)}function dr(e,t){fr(e,"da",t)}function fr(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:pa,r=e.__wdc||(e.__wdc=function(){for(var t=n;t;){if(t.isDeactivated)return;t=t.parent}return e()});if(vr(t,r,n),n)for(var i=n.parent;i&&i.parent;)cr(i.parent.vnode)&&pr(r,t,n,i),i=i.parent}function pr(e,t,n,r){var i=vr(t,e,r,!0);Sr(function(){Q(r[t],i)},n)}function vr(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:pa,r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(n){var i=n[e]||(n[e]=[]),a=t.__weh||(t.__weh=function(){$e();for(var r=ya(n),i=arguments.length,a=new Array(i),o=0;o1&&void 0!==arguments[1]?arguments[1]:pa)}},gr=mr("bm"),yr=mr("m"),_r=mr("bu"),br=mr("u"),xr=mr("bum"),Sr=mr("um"),Ar=mr("sp"),wr=mr("rtg"),Tr=mr("rtc");function Mr(e){vr("ec",e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:pa)}var Er="components",Cr=Symbol.for("v-ndc");function kr(e,t){var n=arguments.length>3&&void 0!==arguments[3]&&arguments[3],r=Dn||pa;if(r){var i=r.type;if(e===Er){var a=Ma(i,!1);if(a&&(a===t||a===ce(t)||a===fe(ce(t))))return i}var o=Rr(r[e]||i[e],t)||Rr(r.appContext[e],t);return!o&&n?i:o}}function Rr(e,t){return e&&(e[t]||e[ce(t)]||e[fe(ce(t))])}function Ir(e,t,n,r){var i,a=n,o=Y(e);if(o||$(e)){var s=!1,u=!1;o&&Qt(e)&&(s=!Xt(e),u=qt(e),e=ft(e)),i=new Array(e.length);for(var l=0,c=e.length;l3&&void 0!==arguments[3]&&arguments[3],i=t.mixins,a=t.extends;for(var o in a&&Hr(e,a,n,!0),i&&i.forEach(function(t){return Hr(e,t,n,!0)}),t)if(r&&"expose"===o);else{var s=Wr[o]||n&&n[o];e[o]=s?s(e[o],t[o]):t[o]}return e}var Wr={data:Gr,props:Xr,emits:Xr,methods:qr,computed:qr,beforeCreate:Qr,created:Qr,beforeMount:Qr,mounted:Qr,beforeUpdate:Qr,updated:Qr,beforeDestroy:Qr,beforeUnmount:Qr,destroyed:Qr,unmounted:Qr,activated:Qr,deactivated:Qr,errorCaptured:Qr,serverPrefetch:Qr,components:qr,directives:qr,watch:function(e,t){if(!e)return t;if(!t)return e;var n=j(Object.create(null),e);for(var r in t)n[r]=Qr(e[r],t[r]);return n},provide:Gr,inject:function(e,t){return qr(jr(e),jr(t))}};function Gr(e,t){return t?e?function(){return j(J(e)?e.call(this,this):e,J(t)?t.call(this,this):t)}:t:e}function jr(e){if(Y(e)){for(var t={},n=0;n1&&void 0!==arguments[1]?arguments[1]:null;J(t)||(t=j({},t)),null==n||te(n)||(n=null);var r=Yr(),i=new WeakSet,a=[],o=!1,s=r.app={_uid:Kr++,_component:t,_props:n,_container:null,_context:r,_instance:null,version:ka,get config(){return r.config},set config(e){},use:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r2&&void 0!==arguments[2]&&arguments[2],r=pa||Dn;if(r||Jr){var i=Jr?Jr._context.provides:r?null==r.parent||r.ce?r.vnode.appContext&&r.vnode.appContext.provides:r.parent.provides:void 0;if(i&&e in i)return i[e];if(arguments.length>1)return n&&J(t)?t.call(r&&r.proxy):t}}var ti={},ni=function(){return Object.create(ti)},ri=function(e){return Object.getPrototypeOf(e)===ti};function ii(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],i={},a=ni();for(var o in e.propsDefaults=Object.create(null),ai(e,t,i,a),e.propsOptions[0])o in i||(i[o]=void 0);n?e.props=r?i:function(e){return jt(e,!1,kt,Ot,Ut)}(i):e.type.props?e.props=i:e.props=a,e.attrs=a}function ai(e,t,n,r){var i,a=C(e.propsOptions,2),o=a[0],s=a[1],u=!1;if(t)for(var l in t)if(!se(l)){var c=t[l],h=void 0;o&&X(o,h=ce(l))?s&&s.includes(h)?(i||(i={}))[h]=c:n[h]=c:Ni(e.emitsOptions,l)||l in r&&c===r[l]||(r[l]=c,u=!0)}if(s)for(var d=Kt(n),f=i||E,p=0;p2&&void 0!==arguments[2]&&arguments[2],r=n?si:t.propsCache,i=r.get(e);if(i)return i;var a=e.props,o={},s=[],u=!1;if(!J(e)){var l=function(e){u=!0;var n=C(ui(e,t,!0),2),r=n[0],i=n[1];j(o,r),i&&s.push.apply(s,I(i))};!n&&t.mixins.length&&t.mixins.forEach(l),e.extends&&l(e.extends),e.mixins&&e.mixins.forEach(l)}if(!a&&!u)return te(e)&&r.set(e,O),O;if(Y(a))for(var c=0;c3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,o=arguments.length>6&&void 0!==arguments[6]?arguments[6]:void 0,s=arguments.length>7&&void 0!==arguments[7]?arguments[7]:null,u=arguments.length>8&&void 0!==arguments[8]?arguments[8]:!!t.dynamicChildren;if(e!==t){e&&!Zi(e,t)&&(r=K(e),W(e,i,a,!0),e=null),-2===t.patchFlag&&(u=!1,t.dynamicChildren=null);var l=t.type,c=t.ref,h=t.shapeFlag;switch(l){case Ui:g(e,t,n,r);break;case zi:y(e,t,n,r);break;case Vi:null==e&&_(t,n,r,o);break;case Bi:I(e,t,n,r,i,a,o,s,u);break;default:1&h?S(e,t,n,r,i,a,o,s,u):6&h?N(e,t,n,r,i,a,o,s,u):(64&h||128&h)&&l.process(e,t,n,r,i,a,o,s,u,$)}null!=c&&i?ur(c,e&&e.ref,a,t||e,!t):null==c&&e&&null!=e.ref&&ur(e.ref,null,a,e,!0)}},g=function(e,t,n,i){if(null==e)r(t.el=s(t.children),n,i);else{var a=t.el=e.el;t.children!==e.children&&l(a,t.children)}},y=function(e,t,n,i){null==e?r(t.el=u(t.children||""),n,i):t.el=e.el},_=function(e,t,n,r){var i=C(v(e.children,t,n,r,e.el,e.anchor),2);e.el=i[0],e.anchor=i[1]},b=function(e,t,n){for(var i,a=e.el,o=e.anchor;a&&a!==o;)i=d(a),r(a,t,n),a=i;r(o,t,n)},x=function(e){for(var t,n=e.el,r=e.anchor;n&&n!==r;)t=d(n),i(n),n=t;i(r)},S=function(e,t,n,r,i,a,o,s,u){"svg"===t.type?o="svg":"math"===t.type&&(o="mathml"),null==e?A(t,n,r,i,a,o,s,u):M(e,t,i,a,o,s,u)},A=function(e,t,n,i,s,u,l,h){var d,f,p=e.props,v=e.shapeFlag,m=e.transition,g=e.dirs;if(d=e.el=o(e.type,u,p&&p.is,p),8&v?c(d,e.children):16&v&&T(e.children,d,null,i,s,gi(e,u),l,h),g&&zn(e,null,i,"created"),w(d,e,e.scopeId,l,i),p){for(var y in p)"value"===y||se(y)||a(d,y,null,p[y],u,i);"value"in p&&a(d,"value",null,p.value,u),(f=p.onVnodeBeforeMount)&&la(f,i,e)}g&&zn(e,null,i,"beforeMount");var _=function(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}(s,m);_&&m.beforeEnter(d),r(d,t,n),((f=p&&p.onVnodeMounted)||_||g)&&vi(function(){f&&la(f,i,e),_&&m.enter(d),g&&zn(e,null,i,"mounted")},s)},w=function(e,t,n,r,i){if(n&&p(e,n),r)for(var a=0;a8&&void 0!==arguments[8]?arguments[8]:0;u0){if(16&l)R(u,p,v,n,i);else if(2&l&&p.class!==v.class&&a(u,"class",null,v.class,i),4&l&&a(u,"style",p.style,v.style,i),8&l)for(var m=t.dynamicProps,g=0;g0&&64&f&&p&&e.dynamicChildren?(k(e.dynamicChildren,p,n,a,o,u,l),(null!=t.key||a&&t===a.subTree)&&_i(e,t,!0)):U(e,t,n,d,a,o,u,l,c)},N=function(e,t,n,r,i,a,o,s,u){t.slotScopeIds=s,null==e?512&t.shapeFlag?i.ctx.activate(t,n,r,o,u):P(t,n,r,i,a,o,u):L(e,t,u)},P=function(e,t,n,r,i,a,o){var s=e.component=function(e,t,n){var r=e.type,i=(t?t.appContext:e.appContext)||ca,a={uid:ha++,vnode:e,type:r,parent:t,appContext:i,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new Le(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:t?t.provides:Object.create(i.provides),ids:t?t.ids:["",0,0],accessCache:null,renderCache:[],components:null,directives:null,propsOptions:ui(r,i),emitsOptions:Ii(r,i),emit:null,emitted:null,propsDefaults:E,inheritAttrs:r.inheritAttrs,ctx:E,data:E,props:E,attrs:E,slots:E,refs:E,setupState:E,setupContext:null,suspense:n,suspenseId:n?n.pendingId:0,asyncDep:null,asyncResolved:!1,isMounted:!1,isUnmounted:!1,isDeactivated:!1,bc:null,c:null,bm:null,m:null,bu:null,u:null,um:null,bum:null,da:null,a:null,rtg:null,rtc:null,ec:null,sp:null};a.ctx={_:a},a.root=t?t.root:a,a.emit=Ri.bind(null,a),e.ce&&e.ce(a);return a}(e,r,i);if(cr(e)&&(s.ctx.renderer=$),function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];t&&fa(t);var r=e.vnode,i=r.props,a=r.children,o=ba(e);ii(e,i,o,t),function(e,t,n){var r=e.slots=ni();if(32&e.vnode.shapeFlag){var i=t.__;i&&ge(r,"__",i,!0);var a=t._;a?(pi(r,t,n),n&&ge(r,"_",a,!0)):di(t,r)}else t&&fi(e,t)}(e,a,n||t);var s=o?function(e,t){var n=e.type;e.accessCache=Object.create(null),e.proxy=new Proxy(e.ctx,Dr);var r=n.setup;if(r){$e();var i=e.setupContext=r.length>1?function(e){var t=function(t){e.exposed=t||{}};return{attrs:new Proxy(e.attrs,wa),slots:e.slots,emit:e.emit,expose:t}}(e):null,a=ya(e),o=yn(r,e,0,[e.props,i]),s=ne(o);if(et(),a(),!s&&!e.sp||lr(e)||or(e),s){if(o.then(_a,_a),t)return o.then(function(t){Sa(e,t)}).catch(function(t){bn(t,e,0)});e.asyncDep=o}else Sa(e,o)}else Aa(e)}(e,t):void 0;t&&fa(!1)}(s,!1,o),s.asyncDep){if(i&&i.registerDep(s,D,o),!e.el){var u=s.subTree=ta(zi);y(null,u,t,n)}}else D(s,e,t,n,i,a,o)},L=function(e,t,n){var r=t.component=e.component;if(function(e,t,n){var r=e.props,i=e.children,a=e.component,o=t.props,s=t.children,u=t.patchFlag,l=a.emitsOptions;if(t.dirs||t.transition)return!0;if(!(n&&u>=0))return!(!i&&!s||s&&s.$stable)||r!==o&&(r?!o||Oi(r,o,l):!!o);if(1024&u)return!0;if(16&u)return r?Oi(r,o,l):!!o;if(8&u)for(var c=t.dynamicProps,h=0;h0)||16&o){var c;for(var h in ai(e,t,i,a)&&(l=!0),s)t&&(X(t,h)||(c=de(h))!==h&&X(t,c))||(u?!n||void 0===n[h]&&void 0===n[c]||(i[h]=oi(u,s,h,void 0,e,!0)):delete i[h]);if(a!==s)for(var d in a)t&&X(t,d)||(delete a[d],l=!0)}else if(8&o)for(var f=e.vnode.dynamicProps,p=0;p8&&void 0!==arguments[8]&&arguments[8],l=e&&e.children,h=e?e.shapeFlag:0,d=t.children,f=t.patchFlag,p=t.shapeFlag;if(f>0){if(128&f)return void V(l,d,n,r,i,a,o,s,u);if(256&f)return void z(l,d,n,r,i,a,o,s,u)}8&p?(16&h&&q(l,i,a),d!==l&&c(n,d)):16&h?16&p?V(l,d,n,r,i,a,o,s,u):q(l,i,a,!0):(8&h&&c(n,""),16&p&&T(d,n,r,i,a,o,s,u))},z=function(e,t,n,r,i,a,o,s,u){t=t||O;var l,c=(e=e||O).length,h=t.length,d=Math.min(c,h);for(l=0;lh?q(e,i,a,!0,!1,d):T(t,n,r,i,a,o,s,u,d)},V=function(e,t,n,r,i,a,o,s,u){for(var l=0,c=t.length,h=e.length-1,d=c-1;l<=h&&l<=d;){var f=e[l],p=t[l]=u?sa(t[l]):oa(t[l]);if(!Zi(f,p))break;m(f,p,n,null,i,a,o,s,u),l++}for(;l<=h&&l<=d;){var v=e[h],g=t[d]=u?sa(t[d]):oa(t[d]);if(!Zi(v,g))break;m(v,g,n,null,i,a,o,s,u),h--,d--}if(l>h){if(l<=d)for(var y=d+1,_=yd)for(;l<=h;)W(e[l],i,a,!0),l++;else{var b,x=l,S=l,A=new Map;for(l=S;l<=d;l++){var w=t[l]=u?sa(t[l]):oa(t[l]);null!=w.key&&A.set(w.key,l)}var T=0,M=d-S+1,E=!1,C=0,k=new Array(M);for(l=0;l=M)W(R,i,a,!0);else{var I=void 0;if(null!=R.key)I=A.get(R.key);else for(b=S;b<=d;b++)if(0===k[b-S]&&Zi(R,t[b])){I=b;break}void 0===I?W(R,i,a,!0):(k[I-S]=l+1,I>=C?C=I:E=!0,m(R,t[I],n,null,i,a,o,s,u),T++)}}var N=E?function(e){var t,n,r,i,a,o=e.slice(),s=[0],u=e.length;for(t=0;t>1]]0&&(o[t]=s[r-1]),s[r]=t)}}r=s.length,i=s[r-1];for(;r-- >0;)s[r]=i,i=o[i];return s}(k):O;for(b=N.length-1,l=M-1;l>=0;l--){var P=S+l,L=t[P],D=P+14&&void 0!==arguments[4]?arguments[4]:null,s=e.el,u=e.type,l=e.transition,c=e.children,h=e.shapeFlag;if(6&h)H(e.component.subTree,t,n,a);else if(128&h)e.suspense.move(t,n,a);else if(64&h)u.move(e,t,n,$);else if(u!==Bi){if(u!==Vi)if(2!==a&&1&h&&l)if(0===a)l.beforeEnter(s),r(s,t,n),vi(function(){return l.enter(s)},o);else{var d=l.leave,f=l.delayLeave,p=l.afterLeave,v=function(){e.ctx.isUnmounted?i(s):r(s,t,n)},m=function(){d(s,function(){v(),p&&p()})};f?f(s,v,m):m()}else r(s,t,n);else b(e,t,n)}else{r(s,t,n);for(var g=0;g3&&void 0!==arguments[3]&&arguments[3],i=arguments.length>4&&void 0!==arguments[4]&&arguments[4],a=e.type,o=e.props,s=e.ref,u=e.children,l=e.dynamicChildren,c=e.shapeFlag,h=e.patchFlag,d=e.dirs,f=e.cacheIndex;if(-2===h&&(i=!1),null!=s&&($e(),ur(s,null,n,e,!0),et()),null!=f&&(t.renderCache[f]=void 0),256&c)t.ctx.deactivate(e);else{var p,v=1&c&&d,m=!lr(e);if(m&&(p=o&&o.onVnodeBeforeUnmount)&&la(p,t,e),6&c)Q(e.component,n,r);else{if(128&c)return void e.suspense.unmount(n,r);v&&zn(e,null,t,"beforeUnmount"),64&c?e.type.remove(e,t,n,$,r):l&&!l.hasOnce&&(a!==Bi||h>0&&64&h)?q(l,t,n,!1,!0):(a===Bi&&384&h||!i&&16&c)&&q(u,t,n),r&&G(e)}(m&&(p=o&&o.onVnodeUnmounted)||v)&&vi(function(){p&&la(p,t,e),v&&zn(e,null,t,"unmounted")},n)}},G=function(e){var t=e.type,n=e.el,r=e.anchor,a=e.transition;if(t!==Bi)if(t!==Vi){var o=function(){i(n),a&&!a.persisted&&a.afterLeave&&a.afterLeave()};if(1&e.shapeFlag&&a&&!a.persisted){var s=a.leave,u=a.delayLeave,l=function(){return s(n,o)};u?u(e.el,o,l):l()}else o()}else x(e);else j(n,r)},j=function(e,t){for(var n;e!==t;)n=d(e),i(e),e=n;i(t)},Q=function(e,t,n){var r=e.bum,i=e.scope,a=e.job,o=e.subTree,s=e.um,u=e.m,l=e.a,c=e.parent,h=e.slots.__;xi(u),xi(l),r&&me(r),c&&Y(h)&&h.forEach(function(e){c.renderCache[e]=void 0}),i.stop(),a&&(a.flags|=8,W(o,e,t,n)),s&&vi(s,t),vi(function(){e.isUnmounted=!0},t),t&&t.pendingBranch&&!t.isUnmounted&&e.asyncDep&&!e.asyncResolved&&e.suspenseId===t.pendingId&&(t.deps--,0===t.deps&&t.resolve())},q=function(e,t,n){for(var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],i=arguments.length>4&&void 0!==arguments[4]&&arguments[4],a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;a2&&void 0!==arguments[2]&&arguments[2],r=e.children,i=t.children;if(Y(r)&&Y(i))for(var a=0;a2&&void 0!==arguments[2]?arguments[2]:E,i=r.immediate,a=(r.deep,r.flush),o=(r.once,j({},r)),s=t&&i||!t&&"post"!==a;if(xa)if("sync"===a){var u=Ai();n=u.__watcherHandles||(u.__watcherHandles=[])}else if(!s){var l=function(){};return l.stop=B,l.resume=B,l.pause=B,l}var c=pa;o.call=function(e,t,n){return _n(e,c,t,n)};var h=!1;"post"===a?o.scheduler=function(e){vi(e,c&&c.suspense)}:"sync"!==a&&(h=!0,o.scheduler=function(e,t){t?e():kn(e)}),o.augmentJob=function(e){t&&(e.flags|=4),h&&(e.flags|=2,c&&(e.id=c.uid,e.i=c))};var d=mn(e,t,o);return xa&&(n?n.push(d):s&&d()),d}function Ei(e,t,n){var r,i=this.proxy,a=$(e)?e.includes(".")?Ci(i,e):function(){return i[e]}:e.bind(i,i);J(t)?r=t:(r=t.handler,n=t);var o=ya(this),s=Mi(a,r.bind(i),n);return o(),s}function Ci(e,t){var n=t.split(".");return function(){for(var t=e,r=0;r2?r-2:0),a=2;a2&&void 0!==arguments[2]&&arguments[2],r=t.emitsCache,i=r.get(e);if(void 0!==i)return i;var a=e.emits,o={},s=!1;if(!J(e)){var u=function(e){var n=Ii(e,t,!0);n&&(s=!0,j(o,n))};!n&&t.mixins.length&&t.mixins.forEach(u),e.extends&&u(e.extends),e.mixins&&e.mixins.forEach(u)}return a||s?(Y(a)?a.forEach(function(e){return o[e]=null}):j(o,a),te(e)&&r.set(e,o),o):(te(e)&&r.set(e,null),null)}function Ni(e,t){return!(!e||!W(t))&&(t=t.slice(2).replace(/Once$/,""),X(e,t[0].toLowerCase()+t.slice(1))||X(e,de(t))||X(e,t))}function Pi(e){var t,n,r=e.type,i=e.vnode,a=e.proxy,o=e.withProxy,s=C(e.propsOptions,1)[0],u=e.slots,l=e.attrs,c=e.emit,h=e.render,d=e.renderCache,f=e.props,p=e.data,v=e.setupState,m=e.ctx,g=e.inheritAttrs,y=Fn(e);try{if(4&i.shapeFlag){var _=o||a,b=_;t=oa(h.call(b,_,d,f,v,p,m)),n=l}else{var x=r;0,t=oa(x.length>1?x(f,{attrs:l,slots:u,emit:c}):x(f,null)),n=r.props?l:Li(l)}}catch(T){Hi.length=0,bn(T,e,1),t=ta(zi)}var S=t;if(n&&!1!==g){var A=Object.keys(n),w=S.shapeFlag;A.length&&7&w&&(s&&A.some(G)&&(n=Di(n,s)),S=na(S,n,!1,!0))}return i.dirs&&((S=na(S,null,!1,!0)).dirs=S.dirs?S.dirs.concat(i.dirs):i.dirs),i.transition&&rr(S,i.transition),t=S,Fn(y),t}var Li=function(e){var t;for(var n in e)("class"===n||"style"===n||W(n))&&((t||(t={}))[n]=e[n]);return t},Di=function(e,t){var n={};for(var r in e)G(r)&&r.slice(9)in t||(n[r]=e[r]);return n};function Oi(e,t,n){var r=Object.keys(t);if(r.length!==Object.keys(e).length)return!0;for(var i=0;i0&&void 0!==arguments[0]&&arguments[0];Hi.push(Wi=e?null:[])}var ji=1;function Qi(e){ji+=e,e<0&&Wi&&(arguments.length>1&&void 0!==arguments[1]&&arguments[1])&&(Wi.hasOnce=!0)}function qi(e){return e.dynamicChildren=ji>0?Wi||O:null,Hi.pop(),Wi=Hi[Hi.length-1]||null,ji>0&&Wi&&Wi.push(e),e}function Xi(e,t,n,r,i,a){return qi(ea(e,t,n,r,i,a,!0))}function Yi(e,t,n,r,i){return qi(ta(e,t,n,r,i,!0))}function Ki(e){return!!e&&!0===e.__v_isVNode}function Zi(e,t){return e.type===t.type&&e.key===t.key}var Ji=function(e){var t=e.key;return null!=t?t:null},$i=function(e){var t=e.ref,n=e.ref_key,r=e.ref_for;return"number"==typeof t&&(t=""+t),null!=t?$(t)||en(t)||J(t)?{i:Dn,r:t,k:n,f:!!r}:t:null};function ea(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:e===Bi?0:1,o=arguments.length>6&&void 0!==arguments[6]&&arguments[6],s=arguments.length>7&&void 0!==arguments[7]&&arguments[7],u={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&Ji(t),ref:t&&$i(t),scopeId:On,slotScopeIds:null,children:n,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:a,patchFlag:r,dynamicProps:i,dynamicChildren:null,appContext:null,ctx:Dn};return s?(ua(u,n),128&a&&e.normalize(u)):n&&(u.shapeFlag|=$(n)?8:16),ji>0&&!o&&Wi&&(u.patchFlag>0||6&a)&&32!==u.patchFlag&&Wi.push(u),u}var ta=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=arguments.length>5&&void 0!==arguments[5]&&arguments[5];e&&e!==Cr||(e=zi);if(Ki(e)){var o=na(e,t,!0);return n&&ua(o,n),ji>0&&!a&&Wi&&(6&o.shapeFlag?Wi[Wi.indexOf(e)]=o:Wi.push(o)),o.patchFlag=-2,o}s=e,J(s)&&"__vccOpts"in s&&(e=e.__vccOpts);var s;if(t){var u=t=function(e){return e?Yt(e)||ri(e)?j({},e):e:null}(t),l=u.class,c=u.style;l&&!$(l)&&(t.class=Te(l)),te(c)&&(Yt(c)&&!Y(c)&&(c=j({},c)),t.style=be(c))}var h=$(e)?1:Fi(e)?128:function(e){return e.__isTeleport}(e)?64:te(e)?4:J(e)?2:0;return ea(e,t,n,r,i,h,a,!0)};function na(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],i=e.props,a=e.ref,o=e.patchFlag,s=e.children,u=e.transition,l=t?function(){for(var e={},t=0;t0&&void 0!==arguments[0]?arguments[0]:" ",arguments.length>1&&void 0!==arguments[1]?arguments[1]:0)}function ia(e,t){var n=ta(Vi,null,e);return n.staticCount=t,n}function aa(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?(Gi(),Yi(zi,null,e)):ta(zi,null,e)}function oa(e){return null==e||"boolean"==typeof e?ta(zi):Y(e)?ta(Bi,null,e.slice()):Ki(e)?sa(e):ta(Ui,null,String(e))}function sa(e){return null===e.el&&-1!==e.patchFlag||e.memo?e:na(e)}function ua(e,t){var n=0,r=e.shapeFlag;if(null==t)t=null;else if(Y(t))n=16;else if("object"===P(t)){if(65&r){var i=t.default;return void(i&&(i._c&&(i._d=!1),ua(e,i()),i._c&&(i._d=!0)))}n=32;var a=t._;a||ri(t)?3===a&&Dn&&(1===Dn.slots._?t._=1:(t._=2,e.patchFlag|=1024)):t._ctx=Dn}else J(t)?(t={default:t,_ctx:Dn},n=32):(t=String(t),64&r?(n=16,t=[ra(t)]):n=8);e.children=t,e.shapeFlag|=n}function la(e,t,n){_n(e,t,7,[n,arguments.length>3&&void 0!==arguments[3]?arguments[3]:null])}var ca=Yr(),ha=0;var da,fa,pa=null,va=function(){return pa||Dn},ma=_e(),ga=function(e,t){var n;return(n=ma[e])||(n=ma[e]=[]),n.push(t),function(e){n.length>1?n.forEach(function(t){return t(e)}):n[0](e)}};da=ga("__VUE_INSTANCE_SETTERS__",function(e){return pa=e}),fa=ga("__VUE_SSR_SETTERS__",function(e){return xa=e});var ya=function(e){var t=pa;return da(e),e.scope.on(),function(){e.scope.off(),da(t)}},_a=function(){pa&&pa.scope.off(),da(null)};function ba(e){return 4&e.vnode.shapeFlag}var xa=!1;function Sa(e,t,n){J(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:te(t)&&(e.setupState=un(t)),Aa(e)}function Aa(e,t,n){var r=e.type;e.render||(e.render=r.render||B);var i=ya(e);$e();try{Br(e)}finally{et(),i()}}var wa={get:function(e,t){return ct(e,0,""),e[t]}};function Ta(e){return e.exposed?e.exposeProxy||(e.exposeProxy=new Proxy(un(Zt(e.exposed)),{get:function(t,n){return n in t?t[n]:n in Pr?Pr[n](e):void 0},has:function(e,t){return t in e||t in Pr}})):e.proxy}function Ma(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return J(e)?e.displayName||e.name:e.name||t&&e.__name}var Ea=function(e,t){var n=function(e,t){var n,r,i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return J(e)?n=e:(n=e.get,r=e.set),new dn(n,r,i)}(e,t,xa);return n};function Ca(e,t,n){var r=arguments.length;return 2===r?te(t)&&!Y(t)?Ki(t)?ta(e,null,[t]):ta(e,t):ta(e,null,t):(r>3?n=Array.prototype.slice.call(arguments,2):3===r&&Ki(n)&&(n=[n]),ta(e,t,n))}var ka="3.5.17",Ra=void 0,Ia="undefined"!=typeof window&&window.trustedTypes; /** * @vue/runtime-dom v3.5.17 * (c) 2018-present Yuxi (Evan) You and Vue contributors * @license MIT **/if(Ia)try{Ra=Ia.createPolicy("vue",{createHTML:function(e){return e}})}catch(HJ){}var Na=Ra?function(e){return Ra.createHTML(e)}:function(e){return e},Pa="undefined"!=typeof document?document:null,La=Pa&&Pa.createElement("template"),Da={insert:function(e,t,n){t.insertBefore(e,n||null)},remove:function(e){var t=e.parentNode;t&&t.removeChild(e)},createElement:function(e,t,n,r){var i="svg"===t?Pa.createElementNS("http://www.w3.org/2000/svg",e):"mathml"===t?Pa.createElementNS("http://www.w3.org/1998/Math/MathML",e):n?Pa.createElement(e,{is:n}):Pa.createElement(e);return"select"===e&&r&&null!=r.multiple&&i.setAttribute("multiple",r.multiple),i},createText:function(e){return Pa.createTextNode(e)},createComment:function(e){return Pa.createComment(e)},setText:function(e,t){e.nodeValue=t},setElementText:function(e,t){e.textContent=t},parentNode:function(e){return e.parentNode},nextSibling:function(e){return e.nextSibling},querySelector:function(e){return Pa.querySelector(e)},setScopeId:function(e,t){e.setAttribute(t,"")},insertStaticContent:function(e,t,n,r,i,a){var o=n?n.previousSibling:t.lastChild;if(i&&(i===a||i.nextSibling))for(;t.insertBefore(i.cloneNode(!0),n),i!==a&&(i=i.nextSibling););else{La.innerHTML=Na("svg"===r?"".concat(e,""):"mathml"===r?"".concat(e,""):e);var s=La.content;if("svg"===r||"mathml"===r){for(var u=s.firstChild;u.firstChild;)s.appendChild(u.firstChild);s.removeChild(u)}t.insertBefore(s,n)}return[o?o.nextSibling:t.firstChild,n?n.previousSibling:t.lastChild]}},Oa="transition",Fa="animation",Ba=Symbol("_vtc"),Ua={name:String,type:String,css:{type:Boolean,default:!0},duration:[String,Number,Object],enterFromClass:String,enterActiveClass:String,enterToClass:String,appearFromClass:String,appearActiveClass:String,appearToClass:String,leaveFromClass:String,leaveActiveClass:String,leaveToClass:String},za=j({},tr,Ua),Va=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];Y(e)?e.forEach(function(e){return e.apply(void 0,I(t))}):e&&e.apply(void 0,I(t))},Ha=function(e){return!!e&&(Y(e)?e.some(function(e){return e.length>1}):e.length>1)};function Wa(e){var t={};for(var n in e)n in Ua||(t[n]=e[n]);if(!1===e.css)return t;var r=e.name,i=void 0===r?"v":r,a=e.type,o=e.duration,s=e.enterFromClass,u=void 0===s?"".concat(i,"-enter-from"):s,l=e.enterActiveClass,c=void 0===l?"".concat(i,"-enter-active"):l,h=e.enterToClass,d=void 0===h?"".concat(i,"-enter-to"):h,f=e.appearFromClass,p=void 0===f?u:f,v=e.appearActiveClass,m=void 0===v?c:v,g=e.appearToClass,y=void 0===g?d:g,_=e.leaveFromClass,b=void 0===_?"".concat(i,"-leave-from"):_,x=e.leaveActiveClass,S=void 0===x?"".concat(i,"-leave-active"):x,A=e.leaveToClass,w=void 0===A?"".concat(i,"-leave-to"):A,T=function(e){if(null==e)return null;if(te(e))return[Ga(e.enter),Ga(e.leave)];var t=Ga(e);return[t,t]}(o),M=T&&T[0],E=T&&T[1],C=t.onBeforeEnter,k=t.onEnter,R=t.onEnterCancelled,I=t.onLeave,N=t.onLeaveCancelled,P=t.onBeforeAppear,L=void 0===P?C:P,D=t.onAppear,O=void 0===D?k:D,F=t.onAppearCancelled,B=void 0===F?R:F,U=function(e,t,n,r){e._enterCancelled=r,Qa(e,t?y:d),Qa(e,t?m:c),n&&n()},z=function(e,t){e._isLeaving=!1,Qa(e,b),Qa(e,w),Qa(e,S),t&&t()},V=function(e){return function(t,n){var r=e?O:k,i=function(){return U(t,e,n)};Va(r,[t,i]),qa(function(){Qa(t,e?p:u),ja(t,e?y:d),Ha(r)||Ya(t,a,M,i)})}};return j(t,{onBeforeEnter:function(e){Va(C,[e]),ja(e,u),ja(e,c)},onBeforeAppear:function(e){Va(L,[e]),ja(e,p),ja(e,m)},onEnter:V(!1),onAppear:V(!0),onLeave:function(e,t){e._isLeaving=!0;var n=function(){return z(e,t)};ja(e,b),e._enterCancelled?(ja(e,S),$a()):($a(),ja(e,S)),qa(function(){e._isLeaving&&(Qa(e,b),ja(e,w),Ha(I)||Ya(e,a,E,n))}),Va(I,[e,n])},onEnterCancelled:function(e){U(e,!1,void 0,!0),Va(R,[e])},onAppearCancelled:function(e){U(e,!0,void 0,!0),Va(B,[e])},onLeaveCancelled:function(e){z(e),Va(N,[e])}})}function Ga(e){var t=function(e){var t=$(e)?Number(e):NaN;return isNaN(t)?e:t}(e);return t}function ja(e,t){t.split(/\s+/).forEach(function(t){return t&&e.classList.add(t)}),(e[Ba]||(e[Ba]=new Set)).add(t)}function Qa(e,t){t.split(/\s+/).forEach(function(t){return t&&e.classList.remove(t)});var n=e[Ba];n&&(n.delete(t),n.size||(e[Ba]=void 0))}function qa(e){requestAnimationFrame(function(){requestAnimationFrame(e)})}var Xa=0;function Ya(e,t,n,r){var i=e._endId=++Xa,a=function(){i===e._endId&&r()};if(null!=n)return setTimeout(a,n);var o=Ka(e,t),s=o.type,u=o.timeout,l=o.propCount;if(!s)return r();var c=s+"end",h=0,d=function(){e.removeEventListener(c,f),a()},f=function(t){t.target===e&&++h>=l&&d()};setTimeout(function(){h0&&(c=Oa,h=o,d=a.length):t===Fa?l>0&&(c=Fa,h=l,d=u.length):d=(c=(h=Math.max(o,l))>0?o>l?Oa:Fa:null)?c===Oa?a.length:u.length:0,{type:c,timeout:h,propCount:d,hasTransform:c===Oa&&/\b(transform|all)(,|$)/.test(r("".concat(Oa,"Property")).toString())}}function Za(e,t){for(;e.length5&&void 0!==arguments[5]?arguments[5]:Me(t);r&&t.startsWith("xlink:")?null==n?e.removeAttributeNS(co,t.slice(6,t.length)):e.setAttributeNS(co,t,n):null==n||a&&!Ee(n)?e.removeAttribute(t):e.setAttribute(t,a?"":ee(n)?String(n):n)}function fo(e,t,n,r,i){if("innerHTML"!==t&&"textContent"!==t){var a=e.tagName;if("value"===t&&"PROGRESS"!==a&&!a.includes("-")){var o="OPTION"===a?e.getAttribute("value")||"":e.value,s=null==n?"checkbox"===e.type?"on":"":String(n);return o===s&&"_value"in e||(e.value=s),null==n&&e.removeAttribute(t),void(e._value=n)}var u=!1;if(""===n||null==n){var l=P(e[t]);"boolean"===l?n=Ee(n):null==n&&"string"===l?(n="",u=!0):"number"===l&&(n=0,u=!0)}try{e[t]=n}catch(HJ){}u&&e.removeAttribute(i||t)}else null!=n&&(e[t]="innerHTML"===t?Na(n):n)}var po=Symbol("_vei");function vo(e,t,n,r){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=e[po]||(e[po]={}),o=a[t];if(r&&o)o.value=r;else{var s=function(e){var t;if(mo.test(e)){var n;for(t={};n=e.match(mo);)e=e.slice(0,e.length-n[0].length),t[n[0].toLowerCase()]=!0}var r=":"===e[2]?e.slice(3):de(e.slice(2));return[r,t]}(t),u=C(s,2),l=u[0],c=u[1];if(r){var h=a[t]=function(e,t){var n=function(e){if(e._vts){if(e._vts<=n.attached)return}else e._vts=Date.now();_n(function(e,t){if(Y(t)){var n=e.stopImmediatePropagation;return e.stopImmediatePropagation=function(){n.call(e),e._stopped=!0},t.map(function(e){return function(t){return!t._stopped&&e&&e(t)}})}return t}(e,n.value),t,5,[e])};return n.value=e,n.attached=_o(),n}(r,i);!function(e,t,n,r){e.addEventListener(t,n,r)}(e,l,h,c)}else o&&(!function(e,t,n,r){e.removeEventListener(t,n,r)}(e,l,o,c),a[t]=void 0)}}var mo=/(?:Once|Passive|Capture)$/;var go=0,yo=Promise.resolve(),_o=function(){return go||(yo.then(function(){return go=0}),go=Date.now())};var bo=function(e){return 111===e.charCodeAt(0)&&110===e.charCodeAt(1)&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123};var xo=new WeakMap,So=new WeakMap,Ao=Symbol("_moveCb"),wo=Symbol("_enterCb"),To=function(e){return delete e.props.mode,e},Mo=To({name:"TransitionGroup",props:j({},za,{tag:String,moveClass:String}),setup:function(e,t){var n,r,i=t.slots,a=va(),o=function(){var e={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return yr(function(){e.isMounted=!0}),xr(function(){e.isUnmounting=!0}),e}();return br(function(){if(n.length){var t=e.moveClass||"".concat(e.name||"v","-move");if(function(e,t,n){var r=e.cloneNode(),i=e[Ba];i&&i.forEach(function(e){e.split(/\s+/).forEach(function(e){return e&&r.classList.remove(e)})});n.split(/\s+/).forEach(function(e){return e&&r.classList.add(e)}),r.style.display="none";var a=1===t.nodeType?t:t.parentNode;a.appendChild(r);var o=Ka(r).hasTransform;return a.removeChild(r),o}(n[0].el,a.vnode.el,t)){n.forEach(Co),n.forEach(ko);var r=n.filter(Ro);$a(),r.forEach(function(e){var n=e.el,r=n.style;ja(n,t),r.transform=r.webkitTransform=r.transitionDuration="";var i=n[Ao]=function(e){e&&e.target!==n||e&&!/transform$/.test(e.propertyName)||(n.removeEventListener("transitionend",i),n[Ao]=null,Qa(n,t))};n.addEventListener("transitionend",i)}),n=[]}else n=[]}}),function(){var t=Kt(e),s=Wa(t),u=t.tag||Bi;if(n=[],r)for(var l=0;l1?a-1:0),s=1;s3&&void 0!==arguments[3]?arguments[3]:Go;e.push(t);var i,a=function(){var n=e.indexOf(t);n>-1&&(e.splice(n,1),r())};return!n&&Oe()&&(i=a,Ce&&Ce.cleanups.push(i)),a}function Qo(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r2&&void 0!==arguments[2]?arguments[2]:{},u=arguments.length>3?arguments[3]:void 0,l=arguments.length>5?arguments[5]:void 0,c=$o({actions:{}},s),h={deep:!0},d=[],f=[],p=u.state.value[e];function v(t){var n;r=i=!1,"function"==typeof t?(t(u.state.value[e]),n={type:Uo.patchFunction,storeId:e,events:a}):(Ko(u.state.value[e],t),n={type:Uo.patchObject,payload:t,storeId:e,events:a});var s=o=Symbol();Cn().then(function(){o===s&&(r=!0)}),i=!0,Qo(d,n,u.state.value[e])}l||p||(u.state.value[e]={}),tn({});var m=l?function(){var e=s.state,t=e?e():{};this.$patch(function(e){$o(e,t)})}:Go;var g=function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(Xo in t)return t[Yo]=n,t;var r=function(){Vo(u);var n,i=Array.from(arguments),a=[],o=[];Qo(f,{args:i,name:r[Yo],store:_,after:function(e){a.push(e)},onError:function(e){o.push(e)}});try{n=t.apply(this&&this.$id===e?this:_,i)}catch(s){throw Qo(o,s),s}return n instanceof Promise?n.then(function(e){return Qo(a,e),e}).catch(function(e){return Qo(o,e),Promise.reject(e)}):(Qo(a,n),n)};return r[Xo]=!0,r[Yo]=n,r},y={_p:u,$id:e,$onAction:jo.bind(null,f),$patch:v,$reset:m,$subscribe:function(t){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=jo(d,t,o.detached,function(){return l()}),l=n.run(function(){return Ti(function(){return u.state.value[e]},function(n){("sync"===o.flush?i:r)&&t({storeId:e,type:Uo.direct,events:a},n)},$o({},h,o))});return s},$dispose:function(){n.stop(),d=[],f=[],u._s.delete(e)}},_=Wt(y);u._s.set(e,_);var b=(u._a&&u._a.runWithContext||qo)(function(){return u._e.run(function(){return(n=De()).run(function(){return t({action:g})})})});for(var x in b){var S=b[x];if(en(S)&&!es(S)||Qt(S))l||(p&&Jo(S)&&(en(S)?S.value=p[x]:Ko(S,p[x])),u.state.value[e][x]=S);else if("function"==typeof S){var A=g(S,x);b[x]=A,c.actions[x]=S}}return $o(_,b),$o(Kt(_),b),Object.defineProperty(_,"$state",{get:function(){return u.state.value[e]},set:function(e){v(function(t){$o(t,e)})}}),u._p.forEach(function(e){$o(_,n.run(function(){return e({store:_,app:u._a,pinia:u,options:c})}))}),p&&l&&s.hydrate&&s.hydrate(_.$state,p),r=!0,i=!0,_}/*! #__NO_SIDE_EFFECTS__ */function rs(e,t,n){var r,i="function"==typeof t;function a(n,a){return(n=n||(!!(pa||Dn||Jr)?ei(Ho,null):null))&&Vo(n),(n=Fo)._s.has(e)||(i?ns(e,t,r,n):ts(e,r,n)),n._s.get(e)}return r=i?n:t,a.$id=e,a}function is(e){var t=Kt(e),n={},r=function(r){var i=t[r];i.effect?n[r]=Ea({get:function(){return e[r]},set:function(t){e[r]=t}}):(en(i)||Qt(i))&&(n[r]=function(e,t,n){return en(e)?e:J(e)?new cn(e):te(e)&&arguments.length>1?hn(e,t,n):tn(e)}(e,r))};for(var i in t)r(i);return n}function as(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var os,ss={exports:{}};var us=(os||(os=1,function(e){var t=Object.prototype.hasOwnProperty,n="~";function r(){}function i(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function a(e,t,r,a,o){if("function"!=typeof r)throw new TypeError("The listener must be a function");var s=new i(r,a||e,o),u=n?n+t:t;return e._events[u]?e._events[u].fn?e._events[u]=[e._events[u],s]:e._events[u].push(s):(e._events[u]=s,e._eventsCount++),e}function o(e,t){0===--e._eventsCount?e._events=new r:delete e._events[t]}function s(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(n=!1)),s.prototype.eventNames=function(){var e,r,i=[];if(0===this._eventsCount)return i;for(r in e=this._events)t.call(e,r)&&i.push(n?r.slice(1):r);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(e)):i},s.prototype.listeners=function(e){var t=n?n+e:e,r=this._events[t];if(!r)return[];if(r.fn)return[r.fn];for(var i=0,a=r.length,o=new Array(a);i=t.priority)c(Ss,this).push(n);else{var r=function(e,t,n){for(var r=0,i=e.length;i>0;){var a=Math.trunc(i/2),o=r+a;n(e[o],t)<=0?(r=++o,i-=a+1):i=a}return r}(c(Ss,this),n,function(e,t){return t.priority-e.priority});c(Ss,this).splice(r,0,n)}}},{key:"setPriority",value:function(e,t){var n=c(Ss,this).findIndex(function(t){return t.id===e});if(-1===n)throw new ReferenceError('No promise function with the id "'.concat(e,'" exists in the queue.'));var r=C(c(Ss,this).splice(n,1),1)[0];this.enqueue(r.run,{priority:t,id:e})}},{key:"dequeue",value:function(){var e=c(Ss,this).shift();return null==e?void 0:e.run}},{key:"filter",value:function(e){return c(Ss,this).filter(function(t){return t.priority===e.priority}).map(function(e){return e.run})}},{key:"size",get:function(){return c(Ss,this).length}}])}(),ws=new WeakMap,Ts=new WeakMap,Ms=new WeakMap,Es=new WeakMap,Cs=new WeakMap,ks=new WeakMap,Rs=new WeakMap,Is=new WeakMap,Ns=new WeakMap,Ps=new WeakMap,Ls=new WeakMap,Ds=new WeakMap,Os=new WeakMap,Fs=new WeakMap,Bs=new WeakMap,Us=new WeakSet,zs=function(e){function t(e){var n,r,i,o,c;if(A(this,t),function(e,t){l(e,t),t.add(e)}(n=y(this,t),Us),u(n,ws,void 0),u(n,Ts,void 0),u(n,Ms,0),u(n,Es,void 0),u(n,Cs,void 0),u(n,ks,0),u(n,Rs,void 0),u(n,Is,void 0),u(n,Ns,void 0),u(n,Ps,void 0),u(n,Ls,0),u(n,Ds,void 0),u(n,Os,void 0),u(n,Fs,void 0),u(n,Bs,1n),M(n,"timeout",void 0),!("number"==typeof(e=s({carryoverConcurrencyCount:!1,intervalCap:Number.POSITIVE_INFINITY,interval:0,concurrency:Number.POSITIVE_INFINITY,autoStart:!0,queueClass:As},e)).intervalCap&&e.intervalCap>=1))throw new TypeError("Expected `intervalCap` to be a number from 1 and up, got `".concat(null!==(r=null===(i=e.intervalCap)||void 0===i?void 0:i.toString())&&void 0!==r?r:"","` (").concat(P(e.intervalCap),")"));if(void 0===e.interval||!(Number.isFinite(e.interval)&&e.interval>=0))throw new TypeError("Expected `interval` to be a finite number >= 0, got `".concat(null!==(o=null===(c=e.interval)||void 0===c?void 0:c.toString())&&void 0!==o?o:"","` (").concat(P(e.interval),")"));return a(ws,n,e.carryoverConcurrencyCount),a(Ts,n,e.intervalCap===Number.POSITIVE_INFINITY||0===e.interval),a(Es,n,e.intervalCap),a(Cs,n,e.interval),a(Ns,n,new e.queueClass),a(Ps,n,e.queueClass),n.concurrency=e.concurrency,n.timeout=e.timeout,a(Fs,n,!0===e.throwOnTimeout),a(Os,n,!1===e.autoStart),n}return x(t,e),T(t,[{key:"concurrency",get:function(){return c(Ds,this)},set:function(e){if(!("number"==typeof e&&e>=1))throw new TypeError("Expected `concurrency` to be a number from 1 and up, got `".concat(e,"` (").concat(P(e),")"));a(Ds,this,e),h(Us,this,Ys).call(this)}},{key:"setPriority",value:function(e,t){c(Ns,this).setPriority(e,t)}},{key:"add",value:(f=v(d().m(function e(t){var n,r,i,o,u,l=this,f=arguments;return d().w(function(e){for(;;)if(0===e.n)return null!==(o=(i=u=f.length>1&&void 0!==f[1]?f[1]:{}).id)&&void 0!==o||(i.id=(a(Bs,this,(n=c(Bs,this),r=n++,n)),r).toString()),u=s({timeout:this.timeout,throwOnTimeout:c(Fs,this)},u),e.a(2,new Promise(function(e,n){c(Ns,l).enqueue(v(d().m(function r(){var i,o,s,f,p,v;return d().w(function(r){for(;;)switch(r.n){case 0:return a(Ls,l,(i=c(Ls,l),++i)),a(Ms,l,(o=c(Ms,l),++o)),r.p=1,null===(s=u.signal)||void 0===s||s.throwIfAborted(),f=t({signal:u.signal}),u.timeout&&(f=xs(Promise.resolve(f),{milliseconds:u.timeout})),u.signal&&(f=Promise.race([f,h(Us,l,Ks).call(l,u.signal)])),r.n=2,f;case 2:p=r.v,e(p),l.emit("completed",p),r.n=5;break;case 3:if(r.p=3,!((v=r.v)instanceof gs)||u.throwOnTimeout){r.n=4;break}return e(),r.a(2);case 4:n(v),l.emit("error",v);case 5:return r.p=5,h(Us,l,Ws).call(l),r.f(5);case 6:return r.a(2)}},r,null,[[1,3,5,6]])})),u),l.emit("add"),h(Us,l,Qs).call(l)}))},e,this)})),function(e){return f.apply(this,arguments)})},{key:"addAll",value:(o=v(d().m(function e(t,n){var r=this;return d().w(function(e){for(;;)if(0===e.n)return e.a(2,Promise.all(t.map(function(){var e=v(d().m(function e(t){return d().w(function(e){for(;;)if(0===e.n)return e.a(2,r.add(t,n))},e)}));return function(t){return e.apply(this,arguments)}}())))},e)})),function(e,t){return o.apply(this,arguments)})},{key:"start",value:function(){return c(Os,this)?(a(Os,this,!1),h(Us,this,Ys).call(this),this):this}},{key:"pause",value:function(){a(Os,this,!0)}},{key:"clear",value:function(){a(Ns,this,new(c(Ps,this)))}},{key:"onEmpty",value:(i=v(d().m(function e(){return d().w(function(e){for(;;)switch(e.n){case 0:if(0!==c(Ns,this).size){e.n=1;break}return e.a(2);case 1:return e.n=2,h(Us,this,Js).call(this,"empty");case 2:return e.a(2)}},e,this)})),function(){return i.apply(this,arguments)})},{key:"onSizeLessThan",value:(r=v(d().m(function e(t){var n=this;return d().w(function(e){for(;;)switch(e.n){case 0:if(!(c(Ns,this).size0?s-4:s;for(i=0;i>16&255,l[c++]=r>>8&255,l[c++]=255&r;2===u&&(r=t[e.charCodeAt(i)]<<2|t[e.charCodeAt(i+1)]>>4,l[c++]=255&r);1===u&&(r=t[e.charCodeAt(i)]<<10|t[e.charCodeAt(i+1)]<<4|t[e.charCodeAt(i+2)]>>2,l[c++]=r>>8&255,l[c++]=255&r);return l},tu.fromByteArray=function(t){for(var n,r=t.length,i=r%3,a=[],o=16383,u=0,l=r-i;ul?l:u+o));1===i?(n=t[r-1],a.push(e[n>>2]+e[n<<4&63]+"==")):2===i&&(n=(t[r-2]<<8)+t[r-1],a.push(e[n>>10]+e[n>>4&63]+e[n<<2&63]+"="));return a.join("")};for(var e=[],t=[],n="undefined"!=typeof Uint8Array?Uint8Array:Array,r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0;i<64;++i)e[i]=r[i],t[r.charCodeAt(i)]=i;function a(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function o(t){return e[t>>18&63]+e[t>>12&63]+e[t>>6&63]+e[63&t]}function s(e,t,n){for(var r,i=[],a=t;a>1,c=-7,h=n?i-1:0,d=n?-1:1,f=e[t+h];for(h+=d,a=f&(1<<-c)-1,f>>=-c,c+=s;c>0;a=256*a+e[t+h],h+=d,c-=8);for(o=a&(1<<-c)-1,a>>=-c,c+=r;c>0;o=256*o+e[t+h],h+=d,c-=8);if(0===a)a=1-l;else{if(a===u)return o?NaN:1/0*(f?-1:1);o+=Math.pow(2,r),a-=l}return(f?-1:1)*o*Math.pow(2,a-r)},ou.write=function(e,t,n,r,i,a){var o,s,u,l=8*a-i-1,c=(1<>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:a-1,p=r?1:-1,v=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,o=c):(o=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-o))<1&&(o--,u*=2),(t+=o+h>=1?d/u:d*Math.pow(2,1-h))*u>=2&&(o++,u/=2),o+h>=c?(s=0,o=c):o+h>=1?(s=(t*u-1)*Math.pow(2,i),o+=h):(s=t*Math.pow(2,h-1)*Math.pow(2,i),o=0));i>=8;e[n+f]=255&s,f+=p,s/=256,i-=8);for(o=o<0;e[n+f]=255&o,f+=p,o/=256,l-=8);e[n+f-p]|=128*v}),ou} /*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh * @license MIT */function uu(){return iu||(iu=1,function(e){var t=nu(),n=su(),r="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=o,e.SlowBuffer=function(e){+e!=e&&(e=0);return o.alloc(+e)},e.INSPECT_MAX_BYTES=50;var i=2147483647;function a(e){if(e>i)throw new RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return Object.setPrototypeOf(t,o.prototype),t}function o(e,t,n){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return l(e)}return s(e,t,n)}function s(e,t,n){if("string"==typeof e)return function(e,t){"string"==typeof t&&""!==t||(t="utf8");if(!o.isEncoding(t))throw new TypeError("Unknown encoding: "+t);var n=0|f(e,t),r=a(n),i=r.write(e,t);i!==n&&(r=r.slice(0,i));return r}(e,t);if(ArrayBuffer.isView(e))return function(e){if(J(e,Uint8Array)){var t=new Uint8Array(e);return h(t.buffer,t.byteOffset,t.byteLength)}return c(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+P(e));if(J(e,ArrayBuffer)||e&&J(e.buffer,ArrayBuffer))return h(e,t,n);if("undefined"!=typeof SharedArrayBuffer&&(J(e,SharedArrayBuffer)||e&&J(e.buffer,SharedArrayBuffer)))return h(e,t,n);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');var r=e.valueOf&&e.valueOf();if(null!=r&&r!==e)return o.from(r,t,n);var i=function(e){if(o.isBuffer(e)){var t=0|d(e.length),n=a(t);return 0===n.length||e.copy(n,0,0,t),n}if(void 0!==e.length)return"number"!=typeof e.length||$(e.length)?a(0):c(e);if("Buffer"===e.type&&Array.isArray(e.data))return c(e.data)}(e);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return o.from(e[Symbol.toPrimitive]("string"),t,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+P(e))}function u(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function l(e){return u(e),a(e<0?0:0|d(e))}function c(e){for(var t=e.length<0?0:0|d(e.length),n=a(t),r=0;r=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return 0|e}function f(e,t){if(o.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||J(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+P(e));var n=e.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;for(var i=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return Y(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return K(e).length;default:if(i)return r?-1:Y(e).length;t=(""+t).toLowerCase(),i=!0}}function p(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return N(this,t,n);case"utf8":case"utf-8":return C(this,t,n);case"ascii":return R(this,t,n);case"latin1":case"binary":return I(this,t,n);case"base64":return E(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return L(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function v(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function m(e,t,n,r,i){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),$(n=+n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof t&&(t=o.from(t,r)),o.isBuffer(t))return 0===t.length?-1:g(e,t,n,r,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):g(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function g(e,t,n,r,i){var a,o=1,s=e.length,u=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;o=2,s/=2,u/=2,n/=2}function l(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i){var c=-1;for(a=n;as&&(n=s-u),a=n;a>=0;a--){for(var h=!0,d=0;di&&(r=i):r=i;var a,o=t.length;for(r>o/2&&(r=o/2),a=0;a>8,i=n%256,a.push(i),a.push(r);return a}(t,e.length-n),e,n,r)}function E(e,n,r){return 0===n&&r===e.length?t.fromByteArray(e):t.fromByteArray(e.slice(n,r))}function C(e,t,n){n=Math.min(e.length,n);for(var r=[],i=t;i239?4:a>223?3:a>191?2:1;if(i+s<=n){var u=void 0,l=void 0,c=void 0,h=void 0;switch(s){case 1:a<128&&(o=a);break;case 2:128==(192&(u=e[i+1]))&&(h=(31&a)<<6|63&u)>127&&(o=h);break;case 3:u=e[i+1],l=e[i+2],128==(192&u)&&128==(192&l)&&(h=(15&a)<<12|(63&u)<<6|63&l)>2047&&(h<55296||h>57343)&&(o=h);break;case 4:u=e[i+1],l=e[i+2],c=e[i+3],128==(192&u)&&128==(192&l)&&128==(192&c)&&(h=(15&a)<<18|(63&u)<<12|(63&l)<<6|63&c)>65535&&h<1114112&&(o=h)}}null===o?(o=65533,s=1):o>65535&&(o-=65536,r.push(o>>>10&1023|55296),o=56320|1023&o),r.push(o),i+=s}return function(e){var t=e.length;if(t<=k)return String.fromCharCode.apply(String,e);var n="",r=0;for(;rr.length?(o.isBuffer(a)||(a=o.from(a)),a.copy(r,i)):Uint8Array.prototype.set.call(r,a,i);else{if(!o.isBuffer(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(r,i)}i+=a.length}return r},o.byteLength=f,o.prototype._isBuffer=!0,o.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;tn&&(t+=" ... "),""},r&&(o.prototype[r]=o.prototype.inspect),o.prototype.compare=function(e,t,n,r,i){if(J(e,Uint8Array)&&(e=o.from(e,e.offset,e.byteLength)),!o.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+P(e));if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(this===e)return 0;for(var a=(i>>>=0)-(r>>>=0),s=(n>>>=0)-(t>>>=0),u=Math.min(a,s),l=this.slice(r,i),c=e.slice(t,n),h=0;h>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var i=this.length-t;if((void 0===n||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var a=!1;;)switch(r){case"hex":return _(this,e,t,n);case"utf8":case"utf-8":return b(this,e,t,n);case"ascii":case"latin1":case"binary":return S(this,e,t,n);case"base64":return w(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return M(this,e,t,n);default:if(a)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),a=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var k=4096;function R(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;ir)&&(n=r);for(var i="",a=t;an)throw new RangeError("Trying to access beyond buffer length")}function O(e,t,n,r,i,a){if(!o.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function F(e,t,n,r,i){j(t,r,i,e,n,7);var a=Number(t&BigInt(4294967295));e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a;var o=Number(t>>BigInt(32)&BigInt(4294967295));return e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,n}function B(e,t,n,r,i){j(t,r,i,e,n,7);var a=Number(t&BigInt(4294967295));e[n+7]=a,a>>=8,e[n+6]=a,a>>=8,e[n+5]=a,a>>=8,e[n+4]=a;var o=Number(t>>BigInt(32)&BigInt(4294967295));return e[n+3]=o,o>>=8,e[n+2]=o,o>>=8,e[n+1]=o,o>>=8,e[n]=o,n+8}function U(e,t,n,r,i,a){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function z(e,t,r,i,a){return t=+t,r>>>=0,a||U(e,0,r,4),n.write(e,t,r,i,23,4),r+4}function V(e,t,r,i,a){return t=+t,r>>>=0,a||U(e,0,r,8),n.write(e,t,r,i,52,8),r+8}o.prototype.slice=function(e,t){var n=this.length;(e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t>>=0,t>>>=0,n||D(e,t,this.length);for(var r=this[e],i=1,a=0;++a>>=0,t>>>=0,n||D(e,t,this.length);for(var r=this[e+--t],i=1;t>0&&(i*=256);)r+=this[e+--t]*i;return r},o.prototype.readUint8=o.prototype.readUInt8=function(e,t){return e>>>=0,t||D(e,1,this.length),this[e]},o.prototype.readUint16LE=o.prototype.readUInt16LE=function(e,t){return e>>>=0,t||D(e,2,this.length),this[e]|this[e+1]<<8},o.prototype.readUint16BE=o.prototype.readUInt16BE=function(e,t){return e>>>=0,t||D(e,2,this.length),this[e]<<8|this[e+1]},o.prototype.readUint32LE=o.prototype.readUInt32LE=function(e,t){return e>>>=0,t||D(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},o.prototype.readUint32BE=o.prototype.readUInt32BE=function(e,t){return e>>>=0,t||D(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},o.prototype.readBigUInt64LE=te(function(e){Q(e>>>=0,"offset");var t=this[e],n=this[e+7];void 0!==t&&void 0!==n||q(e,this.length-8);var r=t+this[++e]*Math.pow(2,8)+this[++e]*Math.pow(2,16)+this[++e]*Math.pow(2,24),i=this[++e]+this[++e]*Math.pow(2,8)+this[++e]*Math.pow(2,16)+n*Math.pow(2,24);return BigInt(r)+(BigInt(i)<>>=0,"offset");var t=this[e],n=this[e+7];void 0!==t&&void 0!==n||q(e,this.length-8);var r=t*Math.pow(2,24)+this[++e]*Math.pow(2,16)+this[++e]*Math.pow(2,8)+this[++e],i=this[++e]*Math.pow(2,24)+this[++e]*Math.pow(2,16)+this[++e]*Math.pow(2,8)+n;return(BigInt(r)<>>=0,t>>>=0,n||D(e,t,this.length);for(var r=this[e],i=1,a=0;++a=(i*=128)&&(r-=Math.pow(2,8*t)),r},o.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||D(e,t,this.length);for(var r=t,i=1,a=this[e+--r];r>0&&(i*=256);)a+=this[e+--r]*i;return a>=(i*=128)&&(a-=Math.pow(2,8*t)),a},o.prototype.readInt8=function(e,t){return e>>>=0,t||D(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},o.prototype.readInt16LE=function(e,t){e>>>=0,t||D(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},o.prototype.readInt16BE=function(e,t){e>>>=0,t||D(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},o.prototype.readInt32LE=function(e,t){return e>>>=0,t||D(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},o.prototype.readInt32BE=function(e,t){return e>>>=0,t||D(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},o.prototype.readBigInt64LE=te(function(e){Q(e>>>=0,"offset");var t=this[e],n=this[e+7];void 0!==t&&void 0!==n||q(e,this.length-8);var r=this[e+4]+this[e+5]*Math.pow(2,8)+this[e+6]*Math.pow(2,16)+(n<<24);return(BigInt(r)<>>=0,"offset");var t=this[e],n=this[e+7];void 0!==t&&void 0!==n||q(e,this.length-8);var r=(t<<24)+this[++e]*Math.pow(2,16)+this[++e]*Math.pow(2,8)+this[++e];return(BigInt(r)<>>=0,t||D(e,4,this.length),n.read(this,e,!0,23,4)},o.prototype.readFloatBE=function(e,t){return e>>>=0,t||D(e,4,this.length),n.read(this,e,!1,23,4)},o.prototype.readDoubleLE=function(e,t){return e>>>=0,t||D(e,8,this.length),n.read(this,e,!0,52,8)},o.prototype.readDoubleBE=function(e,t){return e>>>=0,t||D(e,8,this.length),n.read(this,e,!1,52,8)},o.prototype.writeUintLE=o.prototype.writeUIntLE=function(e,t,n,r){(e=+e,t>>>=0,n>>>=0,r)||O(this,e,t,n,Math.pow(2,8*n)-1,0);var i=1,a=0;for(this[t]=255&e;++a>>=0,n>>>=0,r)||O(this,e,t,n,Math.pow(2,8*n)-1,0);var i=n-1,a=1;for(this[t+i]=255&e;--i>=0&&(a*=256);)this[t+i]=e/a&255;return t+n},o.prototype.writeUint8=o.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||O(this,e,t,1,255,0),this[t]=255&e,t+1},o.prototype.writeUint16LE=o.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||O(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},o.prototype.writeUint16BE=o.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||O(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},o.prototype.writeUint32LE=o.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||O(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},o.prototype.writeUint32BE=o.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||O(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},o.prototype.writeBigUInt64LE=te(function(e){return F(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,BigInt(0),BigInt("0xffffffffffffffff"))}),o.prototype.writeBigUInt64BE=te(function(e){return B(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,BigInt(0),BigInt("0xffffffffffffffff"))}),o.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){var i=Math.pow(2,8*n-1);O(this,e,t,n,i-1,-i)}var a=0,o=1,s=0;for(this[t]=255&e;++a>>=0,!r){var i=Math.pow(2,8*n-1);O(this,e,t,n,i-1,-i)}var a=n-1,o=1,s=0;for(this[t+a]=255&e;--a>=0&&(o*=256);)e<0&&0===s&&0!==this[t+a+1]&&(s=1),this[t+a]=(e/o|0)-s&255;return t+n},o.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||O(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},o.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||O(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},o.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||O(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},o.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||O(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},o.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||O(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},o.prototype.writeBigInt64LE=te(function(e){return F(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),o.prototype.writeBigInt64BE=te(function(e){return B(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),o.prototype.writeFloatLE=function(e,t,n){return z(this,e,t,!0,n)},o.prototype.writeFloatBE=function(e,t,n){return z(this,e,t,!1,n)},o.prototype.writeDoubleLE=function(e,t,n){return V(this,e,t,!0,n)},o.prototype.writeDoubleBE=function(e,t,n){return V(this,e,t,!1,n)},o.prototype.copy=function(e,t,n,r){if(!o.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(a=t;a=r+4;n-=3)t="_".concat(e.slice(n-3,n)).concat(t);return"".concat(e.slice(0,n)).concat(t)}function j(e,t,n,r,i,a){if(e>n||e= 0".concat(s," and < 2").concat(s," ** ").concat(8*(a+1)).concat(s):">= -(2".concat(s," ** ").concat(8*(a+1)-1).concat(s,") and < 2 ** ")+"".concat(8*(a+1)-1).concat(s),new H.ERR_OUT_OF_RANGE("value",o,e)}!function(e,t,n){Q(t,"offset"),void 0!==e[t]&&void 0!==e[t+n]||q(t,e.length-(n+1))}(r,i,a)}function Q(e,t){if("number"!=typeof e)throw new H.ERR_INVALID_ARG_TYPE(t,"number",e)}function q(e,t,n){if(Math.floor(e)!==e)throw Q(e,n),new H.ERR_OUT_OF_RANGE("offset","an integer",e);if(t<0)throw new H.ERR_BUFFER_OUT_OF_BOUNDS;throw new H.ERR_OUT_OF_RANGE("offset",">= ".concat(0," and <= ",t),e)}W("ERR_BUFFER_OUT_OF_BOUNDS",function(e){return e?"".concat(e," is outside of buffer bounds"):"Attempt to access memory outside buffer bounds"},RangeError),W("ERR_INVALID_ARG_TYPE",function(e,t){return'The "'.concat(e,'" argument must be of type number. Received type ').concat(P(t))},TypeError),W("ERR_OUT_OF_RANGE",function(e,t,n){var r='The value of "'.concat(e,'" is out of range.'),i=n;return Number.isInteger(n)&&Math.abs(n)>Math.pow(2,32)?i=G(String(n)):"bigint"==typeof n&&(i=String(n),(n>Math.pow(BigInt(2),BigInt(32))||n<-Math.pow(BigInt(2),BigInt(32)))&&(i=G(i)),i+="n"),r+=" It must be ".concat(t,". Received ").concat(i)},RangeError);var X=/[^+/0-9A-Za-z-_]/g;function Y(e,t){var n;t=t||1/0;for(var r=e.length,i=null,a=[],o=0;o55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&a.push(239,191,189);continue}if(o+1===r){(t-=3)>-1&&a.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&a.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;a.push(n)}else if(n<2048){if((t-=2)<0)break;a.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;a.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;a.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return a}function K(e){return t.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(X,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function Z(e,t,n,r){var i;for(i=0;i=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function J(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function $(e){return e!=e}var ee=function(){for(var e="0123456789abcdef",t=new Array(256),n=0;n<16;++n)for(var r=16*n,i=0;i<16;++i)t[r+i]=e[n]+e[i];return t}();function te(e){return"undefined"==typeof BigInt?ne:e}function ne(){throw new Error("BigInt not supported")}}(au)),au}var lu,cu,hu,du,fu,pu,vu,mu,gu=uu();function yu(){if(pu)return fu;pu=1;var e=function(){if(du)return hu;du=1,hu=t;var e=null;try{e=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch(HJ){}function t(e,t,n){this.low=0|e,this.high=0|t,this.unsigned=!!n}function n(e){return!0===(e&&e.__isLong__)}t.prototype.__isLong__,Object.defineProperty(t.prototype,"__isLong__",{value:!0}),t.isLong=n;var r={},i={};function a(e,t){var n,a,o;return t?(o=0<=(e>>>=0)&&e<256)&&(a=i[e])?a:(n=s(e,(0|e)<0?-1:0,!0),o&&(i[e]=n),n):(o=-128<=(e|=0)&&e<128)&&(a=r[e])?a:(n=s(e,e<0?-1:0,!1),o&&(r[e]=n),n)}function o(e,t){if(isNaN(e))return t?m:v;if(t){if(e<0)return m;if(e>=d)return x}else{if(e<=-f)return S;if(e+1>=f)return b}return e<0?o(-e,t).neg():s(e%h|0,e/h|0,t)}function s(e,n,r){return new t(e,n,r)}t.fromInt=a,t.fromNumber=o,t.fromBits=s;var u=Math.pow;function l(e,t,n){if(0===e.length)throw Error("empty string");if("NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return v;if("number"==typeof t?(n=t,t=!1):t=!!t,(n=n||10)<2||360)throw Error("interior hyphen");if(0===r)return l(e.substring(1),t,n).neg();for(var i=o(u(n,8)),a=v,s=0;s>>0:this.low},A.toNumber=function(){return this.unsigned?(this.high>>>0)*h+(this.low>>>0):this.high*h+(this.low>>>0)},A.toString=function(e){if((e=e||10)<2||36>>0).toString(e);if((a=l).isZero())return c+s;for(;c.length<6;)c="0"+c;s=""+c+s}},A.getHighBits=function(){return this.high},A.getHighBitsUnsigned=function(){return this.high>>>0},A.getLowBits=function(){return this.low},A.getLowBitsUnsigned=function(){return this.low>>>0},A.getNumBitsAbs=function(){if(this.isNegative())return this.eq(S)?64:this.neg().getNumBitsAbs();for(var e=0!=this.high?this.high:this.low,t=31;t>0&&!(e&1<=0},A.isOdd=function(){return!(1&~this.low)},A.isEven=function(){return!(1&this.low)},A.equals=function(e){return n(e)||(e=c(e)),(this.unsigned===e.unsigned||this.high>>>31!=1||e.high>>>31!=1)&&this.high===e.high&&this.low===e.low},A.eq=A.equals,A.notEquals=function(e){return!this.eq(e)},A.neq=A.notEquals,A.ne=A.notEquals,A.lessThan=function(e){return this.comp(e)<0},A.lt=A.lessThan,A.lessThanOrEqual=function(e){return this.comp(e)<=0},A.lte=A.lessThanOrEqual,A.le=A.lessThanOrEqual,A.greaterThan=function(e){return this.comp(e)>0},A.gt=A.greaterThan,A.greaterThanOrEqual=function(e){return this.comp(e)>=0},A.gte=A.greaterThanOrEqual,A.ge=A.greaterThanOrEqual,A.compare=function(e){if(n(e)||(e=c(e)),this.eq(e))return 0;var t=this.isNegative(),r=e.isNegative();return t&&!r?-1:!t&&r?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1},A.comp=A.compare,A.negate=function(){return!this.unsigned&&this.eq(S)?S:this.not().add(g)},A.neg=A.negate,A.add=function(e){n(e)||(e=c(e));var t=this.high>>>16,r=65535&this.high,i=this.low>>>16,a=65535&this.low,o=e.high>>>16,u=65535&e.high,l=e.low>>>16,h=0,d=0,f=0,p=0;return f+=(p+=a+(65535&e.low))>>>16,d+=(f+=i+l)>>>16,h+=(d+=r+u)>>>16,h+=t+o,s((f&=65535)<<16|(p&=65535),(h&=65535)<<16|(d&=65535),this.unsigned)},A.subtract=function(e){return n(e)||(e=c(e)),this.add(e.neg())},A.sub=A.subtract,A.multiply=function(t){if(this.isZero())return v;if(n(t)||(t=c(t)),e)return s(e.mul(this.low,this.high,t.low,t.high),e.get_high(),this.unsigned);if(t.isZero())return v;if(this.eq(S))return t.isOdd()?S:v;if(t.eq(S))return this.isOdd()?S:v;if(this.isNegative())return t.isNegative()?this.neg().mul(t.neg()):this.neg().mul(t).neg();if(t.isNegative())return this.mul(t.neg()).neg();if(this.lt(p)&&t.lt(p))return o(this.toNumber()*t.toNumber(),this.unsigned);var r=this.high>>>16,i=65535&this.high,a=this.low>>>16,u=65535&this.low,l=t.high>>>16,h=65535&t.high,d=t.low>>>16,f=65535&t.low,m=0,g=0,y=0,_=0;return y+=(_+=u*f)>>>16,g+=(y+=a*f)>>>16,y&=65535,g+=(y+=u*d)>>>16,m+=(g+=i*f)>>>16,g&=65535,m+=(g+=a*d)>>>16,g&=65535,m+=(g+=u*h)>>>16,m+=r*f+i*d+a*h+u*l,s((y&=65535)<<16|(_&=65535),(m&=65535)<<16|(g&=65535),this.unsigned)},A.mul=A.multiply,A.divide=function(t){if(n(t)||(t=c(t)),t.isZero())throw Error("division by zero");var r,i,a;if(e)return this.unsigned||-2147483648!==this.high||-1!==t.low||-1!==t.high?s((this.unsigned?e.div_u:e.div_s)(this.low,this.high,t.low,t.high),e.get_high(),this.unsigned):this;if(this.isZero())return this.unsigned?m:v;if(this.unsigned){if(t.unsigned||(t=t.toUnsigned()),t.gt(this))return m;if(t.gt(this.shru(1)))return y;a=m}else{if(this.eq(S))return t.eq(g)||t.eq(_)?S:t.eq(S)?g:(r=this.shr(1).div(t).shl(1)).eq(v)?t.isNegative()?g:_:(i=this.sub(t.mul(r)),a=r.add(i.div(t)));if(t.eq(S))return this.unsigned?m:v;if(this.isNegative())return t.isNegative()?this.neg().div(t.neg()):this.neg().div(t).neg();if(t.isNegative())return this.div(t.neg()).neg();a=v}for(i=this;i.gte(t);){r=Math.max(1,Math.floor(i.toNumber()/t.toNumber()));for(var l=Math.ceil(Math.log(r)/Math.LN2),h=l<=48?1:u(2,l-48),d=o(r),f=d.mul(t);f.isNegative()||f.gt(i);)f=(d=o(r-=h,this.unsigned)).mul(t);d.isZero()&&(d=g),a=a.add(d),i=i.sub(f)}return a},A.div=A.divide,A.modulo=function(t){return n(t)||(t=c(t)),e?s((this.unsigned?e.rem_u:e.rem_s)(this.low,this.high,t.low,t.high),e.get_high(),this.unsigned):this.sub(this.div(t).mul(t))},A.mod=A.modulo,A.rem=A.modulo,A.not=function(){return s(~this.low,~this.high,this.unsigned)},A.and=function(e){return n(e)||(e=c(e)),s(this.low&e.low,this.high&e.high,this.unsigned)},A.or=function(e){return n(e)||(e=c(e)),s(this.low|e.low,this.high|e.high,this.unsigned)},A.xor=function(e){return n(e)||(e=c(e)),s(this.low^e.low,this.high^e.high,this.unsigned)},A.shiftLeft=function(e){return n(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?s(this.low<>>32-e,this.unsigned):s(0,this.low<>>e|this.high<<32-e,this.high>>e,this.unsigned):s(this.high>>e-32,this.high>=0?0:-1,this.unsigned)},A.shr=A.shiftRight,A.shiftRightUnsigned=function(e){if(n(e)&&(e=e.toInt()),0==(e&=63))return this;var t=this.high;return e<32?s(this.low>>>e|t<<32-e,t>>>e,this.unsigned):s(32===e?t:t>>>e-32,0,this.unsigned)},A.shru=A.shiftRightUnsigned,A.shr_u=A.shiftRightUnsigned,A.toSigned=function(){return this.unsigned?s(this.low,this.high,!1):this},A.toUnsigned=function(){return this.unsigned?this:s(this.low,this.high,!0)},A.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},A.toBytesLE=function(){var e=this.high,t=this.low;return[255&t,t>>>8&255,t>>>16&255,t>>>24,255&e,e>>>8&255,e>>>16&255,e>>>24]},A.toBytesBE=function(){var e=this.high,t=this.low;return[e>>>24,e>>>16&255,e>>>8&255,255&e,t>>>24,t>>>16&255,t>>>8&255,255&t]},t.fromBytes=function(e,n,r){return r?t.fromBytesLE(e,n):t.fromBytesBE(e,n)},t.fromBytesLE=function(e,n){return new t(e[0]|e[1]<<8|e[2]<<16|e[3]<<24,e[4]|e[5]<<8|e[6]<<16|e[7]<<24,n)},t.fromBytesBE=function(e,n){return new t(e[4]<<24|e[5]<<16|e[6]<<8|e[7],e[0]<<24|e[1]<<16|e[2]<<8|e[3],n)},hu}(),t=function(t,n,r){t instanceof e||(t="number"==typeof t?e.fromNumber(t):e.fromString(t||"")),n.writeInt32LE(t.getLowBits(),r,!0),n.writeInt32LE(t.getHighBits(),r+4,!0)},n=function(t,n,r){t instanceof e||(t="number"==typeof t?e.fromNumber(t):e.fromString(t||"")),n.writeInt32BE(t.getHighBits(),r,!0),n.writeInt32BE(t.getLowBits(),r+4,!0)};return fu={unpackUInt64LE:function(t,n){return e.fromBits(t.readInt32LE(n),t.readInt32LE(n+4),!0)},unpackUInt64BE:function(t,n){return e.fromBits(t.readInt32BE(n+4),t.readInt32BE(n),!0)},unpackInt64LE:function(t,n){return e.fromBits(t.readInt32LE(n),t.readInt32LE(n+4),!1)},unpackInt64BE:function(t,n){return e.fromBits(t.readInt32BE(n+4),t.readInt32BE(n),!1)},packUInt64LE:t,packUInt64BE:n,packInt64LE:t,packInt64BE:n}}var _u=(mu||(mu=1,vu=function(){if(cu)return lu;cu=1;var e=function(e,t,n){var r=e.indexOf(0,t),i=Math.min(t+n,-1===r?e.length:r);return e.slice(t,i).toString("utf8")},t=function(e,t,n,r){var i=t.write(e,n,r,"utf8");i=n&&(r=n-1),t++,e.slice(t,t+r).toString("utf8")},r=function(e,t,n,r){var i=Buffer.alloc(e,"utf8"),a=i.length;a>=r&&(a=r-1),a>255&&(a=255),i[n]=a,i.copy(t,n+1,0,a),t.fill(0,n+1+a,n+r)},i=function(e,t){return e.readUInt32LE(t,!0)},a=function(e,t){return e.readUInt32BE(t,!0)},o=function(e,t){return e.readInt32LE(t,!0)},s=function(e,t){return e.readInt32BE(t,!0)},u=function(e,t,n){t.writeUInt32LE(e,n,!0)},l=function(e,t,n){t.writeUInt32BE(e,n,!0)},c=function(e,t,n){t.writeInt32LE(e,n,!0)},h=function(e,t,n){t.writeInt32BE(e,n,!0)};return lu=function(d){var f=d.Buffer,p=void 0===d.isLittleEndian||!!d.isLittleEndian,v=void 0===d.is64bit||!!d.is64bit,m=d.unpackUInt64LE,g=d.unpackUInt64BE,y=d.unpackInt64LE,_=d.unpackInt64BE,b=d.packUInt64LE,x=d.packUInt64BE,S=d.packInt64LE,w=d.packInt64BE,M={x:[1,1,null,null],c:[1,1,function(e,t){return String.fromCharCode(e[t])},function(e,t,n){t[n]=e.charCodeAt(0)}],b:[1,1,function(e,t){return e.readInt8(t)},function(e,t,n){t.writeInt8(e,n,!0)}],B:[1,1,function(e,t){return e[t]},function(e,t,n){t[n]=e}],h:[2,2,p?function(e,t){return e.readInt16LE(t)}:function(e,t){return e.readInt16BE(t)},p?function(e,t,n){return t.writeInt16LE(e,n,!0)}:function(e,t,n){return t.writeInt16BE(e,n,!0)}],H:[2,2,p?function(e,t){return e.readUInt16LE(t)}:function(e,t){return e.readUInt16BE(t)},p?function(e,t,n){return t.writeUInt16LE(e,n,!0)}:function(e,t,n){return t.writeUInt16BE(e,n,!0)}],i:[4,4,p?o:s,p?c:h],I:[4,4,p?i:a,p?u:l],l:[4,4,p?o:s,p?c:h],L:[4,4,p?i:a,p?u:l],f:[4,4,p?function(e,t){return e.readFloatLE(t)}:function(e,t){return e.readFloatBE(t)},p?function(e,t,n){return t.writeFloatLE(e,n,!0)}:function(e,t,n){return t.writeFloatBE(e,n,!0)}],d:[8,8,p?function(e,t){return e.readDoubleLE(t)}:function(e,t){return e.readDoubleBE(t)},p?function(e,t,n){return t.writeDoubleLE(e,n,!0)}:function(e,t,n){return t.writeDoubleBE(e,n,!0)}],s:[1,1,e,t],p:[1,1,n,r],P:[v?8:4,v?8:4,p?v?m:i:v?g:a,p?v?b:u:v?x:l],q:[8,8,p?y:_,p?S:w],Q:[8,8,p?m:g,p?b:x],"?":[1,1,function(e,t){return 0!==e[t]},function(e,t,n){t[n]=e?1:0}]},E={x:[1,1,null,null],c:[1,1,function(e,t){return String.fromCharCode(e[t])},function(e,t,n){t[n]=e.charCodeAt(0)}],b:[1,1,function(e,t){return e.readInt8(t)},function(e,t,n){t.writeInt8(e,n,!0)}],B:[1,1,function(e,t){return e[t]},function(e,t,n){t[n]=e}],h:[2,1,function(e,t){return e.readInt16LE(t)},function(e,t,n){return t.writeInt16LE(e,n,!0)}],H:[2,1,function(e,t){return e.readUInt16LE(t)},function(e,t,n){return t.writeUInt16LE(e,n,!0)}],i:[4,1,o,c],I:[4,1,i,u],l:[4,1,o,c],L:[4,1,i,u],f:[4,1,function(e,t){return e.readFloatLE(t)},function(e,t,n){return t.writeFloatLE(e,n,!0)}],d:[8,1,function(e,t){return e.readDoubleLE(t)},function(e,t,n){return t.writeDoubleLE(e,n,!0)}],s:[1,1,e,t],p:[1,1,n,r],P:[v?8:4,1,v?m:i,v?b:u],q:[8,1,y,S],Q:[8,1,m,b],"?":[1,1,function(e,t){return 0!==e[t]},function(e,t,n){t[n]=e?1:0}]},C={x:[1,1,null,null],c:[1,1,function(e,t){return String.fromCharCode(e[t])},function(e,t,n){t[n]=e.charCodeAt(0)}],b:[1,1,function(e,t){return e.readInt8(t)},function(e,t,n){t.writeInt8(e,n,!0)}],B:[1,1,function(e,t){return e[t]},function(e,t,n){t[n]=e}],h:[2,1,function(e,t){return e.readInt16BE(t)},function(e,t,n){return t.writeInt16BE(e,n,!0)}],H:[2,1,function(e,t){return e.readUInt16BE(t)},function(e,t,n){return t.writeUInt16BE(e,n,!0)}],i:[4,1,s,h],I:[4,1,a,l],l:[4,1,s,h],L:[4,1,a,l],f:[4,1,function(e,t){return e.readFloatBE(t)},function(e,t,n){return t.writeFloatBE(e,n,!0)}],d:[8,1,function(e,t){return e.readDoubleBE(t)},function(e,t,n){return t.writeDoubleBE(e,n,!0)}],s:[1,1,e,t],p:[1,1,n,r],P:[v?8:4,1,v?g:a,v?x:l],q:[8,1,_,w],Q:[8,1,g,x],"?":[1,1,function(e,t){return 0!==e[t]},function(e,t,n){t[n]=e?1:0}]},k=function(e){var t=e[0],n=!0,r=M;switch(t){case"<":r=E;break;case">":case"!":r=C;break;case"=":r=p?E:C;break;default:n=!1;case"@":r=M}return{map:r,skipFirst:n}},R=function(){function e(){A(this,e)}return T(e,null,[{key:"sizeOf",value:function(e){var t,n,r,i,a=0,o=null,s=0,u=k(e),l=u.map;for(u.skipFirst&&s++,n=e.length;s="0"&&t<="9"?o=null===o?t:o+t:(r=l[t])&&((i=r[1])>1&&(a=Math.ceil(a/i)*i),o=o?parseInt(o,10):0,a+="s"===t?o||0:"p"===t?o||1:r[0]*(o||1),o=null);return a}},{key:"unpack",value:function(t,n,r){return e.unpackFrom(t,n,r,0)}},{key:"unpackFrom",value:function(e,t,n,r){var i=[],a=null,o=0,s=k(e),u=s.map;s.skipFirst&&o++;for(var l=e.length;o="0"&&c<="9")a=null===a?c:a+c;else{var h=u[c];if(h){var d=h[0],f=h[1];f>1&&(r=Math.ceil(r/f)*f),a=a?parseInt(a,10):0;var p=void 0;"s"===c?(p=1,d=a):"p"===c?(p=1,d=a||1):p=a||1;for(var v=h[2];p>0;){if(v){if(n&&r+d>=t.length)throw new Error("Reached end of buffer, can't unpack anymore data.");i.push(v(t,r,a))}r+=d,p--}a=null}}}return i}},{key:"pack",value:function(t,n,r){Array.isArray(n)||(n=Array.prototype.slice.call(arguments,1),r=!0);var i=f.alloc(e.sizeOf(t)),a=0,o=null,s=0,u=0,l=k(t),c=l.map;l.skipFirst&&s++;for(var h=t.length;s="0"&&d<="9")o=null===o?d:o+d;else{var p=c[d];if(p){var v=p[0],m=p[1];m>1&&(a=Math.ceil(a/m)*m),o=o?parseInt(o,10):0;var g=void 0;"s"===d?(g=1,v=o):"p"===d?(g=1,v=o||1):g=o||1;for(var y=p[3];g>0;){if(y){if(r&&u>=n.length)throw new Error("Reached end of data, no more elements to pack.");y(n[u],i,a,o),u++}a+=v,g--}o=null}}}return i}}])}();return R},lu}()(Object.assign({Buffer:uu().Buffer,isLittleEndian:void 0===("undefined"==typeof Uint8Array?"undefined":P(Uint8Array))||120===new Uint8Array(new Uint32Array([305419896]).buffer)[0],is64bit:void 0===("undefined"==typeof navigator?"undefined":P(navigator))||/WOW64|Win64|arm64|ia64|x64;|Mac OS X/i.test(navigator.userAgent)},yu()))),vu),bu=as(_u),xu=function(){var e=v(d().m(function e(t){var n,r,i,a,o,s,u,l,c=arguments;return d().w(function(e){for(;;)switch(e.n){case 0:return n=c.length>1&&void 0!==c[1]?c[1]:"0&&void 0!==arguments[0]?arguments[0]:21,t="",n=crypto.getRandomValues(new Uint8Array(e|=0));e--;)t+="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[63&n[e]];return t}()),M(this,"analyserNode",void 0),M(this,"audioCtx",void 0),M(this,"autoPlay",!0),M(this,"bufferSource",void 0),M(this,"convertValue",32768),M(this,"ee",void 0),M(this,"gainNode",void 0),M(this,"option",{inputCodec:"Int16",channels:1,sampleRate:8e3,fftSize:2048,onended:function(){},isMute:!1}),M(this,"samplesList",[]),M(this,"startTime",void 0),M(this,"typedArray",void 0),M(this,"_firstStartRelativeTime",void 0),M(this,"_firstStartAbsoluteTime",void 0),this.ee=n,this.init(t)}return T(e,[{key:"continue",value:(r=v(d().m(function e(){return d().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this.audioCtx.resume();case 1:return e.a(2)}},e,this)})),function(){return r.apply(this,arguments)})},{key:"destroy",value:function(){var e;this.samplesList=[],null===(e=this.audioCtx)||void 0===e||e.close(),this.audioCtx=void 0}},{key:"feed",value:function(e){var t=e.audio,n=e.end_of_batch;if(t){this._isSupported(t),t=this._getFormattedValue(t);var r=new Float32Array(t.length);r.set(t,0);var i={data:r,end_of_batch:n};this.samplesList.push(i),this.flush(i,this.samplesList.length-1)}}},{key:"flush",value:function(e,t){var n=this;if(e&&this.autoPlay&&this.audioCtx){var r=e.data,i=e.end_of_batch;this.bufferSource&&(this.bufferSource.onended=function(){}),this.bufferSource=this.audioCtx.createBufferSource(),"function"==typeof this.option.onended&&(this.bufferSource.onended=function(){i||t!==n.samplesList.length-1||n.ee.emit(ds.Player_WaitNextAudioClip),n.option.onended()});for(var a=r.length/this.option.channels,o=this.audioCtx.createBuffer(this.option.channels,a,this.option.sampleRate),s=0;s=a-51&&(u[h]=u[h]*c--/50),l+=this.option.channels;this.startTime0&&this._arkitFaceShape&&this._arkit_face_sample_rate){var r,i=Date.now()-n._firstStartAbsoluteTime,a=0;n.samplesList.forEach(function(e,t){void 0===r&&void 0!==e.startTime&&(r=e.startTime),void 0!==e.startTime&&e.startTime-r<=i/1e3&&(a=t)});var o=n.samplesList[a],s=i-1e3*o.startTime,u=Math.floor(s/1e3*this._arkit_face_sample_rate),l=new Float32Array(t[a]),c=null==l?void 0:l.slice(u*this._arkitFaceShape,u*this._arkitFaceShape+this._arkitFaceShape);if(null!=c&&c.length){var h={};return(this._arkit_face_channel_names||[]).forEach(function(e,t){Object.assign(h,M({},e,c[t]))}),h}return null}return null}},{key:"_getTts2FaceFrame",value:function(){if(!this._motionDataGroups.length)return null;var e=this._motionDataGroups.find(function(e){return e.player});if(!e)return null;var t=e.tts2faceArrayBufferArray,n=e.player;if(n&&n._firstStartAbsoluteTime&&t&&t.length>0&&this._tts2FaceShape&&this._tts2face_sample_rate){var r,i=Date.now()-n._firstStartAbsoluteTime,a=0;n.samplesList.forEach(function(e,t){void 0===r&&void 0!==e.startTime&&(r=e.startTime),void 0!==e.startTime&&e.startTime-r<=i/1e3&&(a=t)});var o=n.samplesList[a],s=i-1e3*o.startTime,u=Math.floor(s/1e3*this._tts2face_sample_rate),l=new Float32Array(t[a]),c=null==l?void 0:l.slice(u*this._tts2FaceShape,u*this._tts2FaceShape+this._tts2FaceShape);return null!=c&&c.length?c:null}return null}},{key:"_motionDataGroupHandler",value:(r=v(d().m(function e(t){var n,r,i,a,o,s,u,l,c,h,f,p,v,m,g,y;return d().w(function(e){for(;;)switch(e.n){case 0:if(e.p=0,n=t.first_package,r=t.motion_data_slice,i=t.segment_num,a=t.binary_size,o=t.use_binary_frame,s=t.is_audio_mute,!n){e.n=1;break}(u=this._motionDataGroups[this._motionDataGroups.length-1])&&u.segment_num!==u.motion_data_slices.length&&this.ee.emit(cs.ErrorReceived,"lost data packets"),this._motionDataGroups.push({first_package:n,binary_size:a,segment_num:i,use_binary_frame:o,motion_data_slices:[],merged_motion_data:new Uint8Array(a)}),e.n=8;break;case 1:if(0!==this._motionDataGroups.length){e.n=2;break}return e.a(2);case 2:if(r){e.n=3;break}return e.a(2);case 3:if(l=this._motionDataGroups[this._motionDataGroups.length-1],c=this._motionDataGroups[this._motionDataGroups.length-2],l.motion_data_slices.push(r),l.motion_data_slices.length!==l.segment_num){e.n=8;break}return h=l.motion_data_slices[0],e.n=4,xu(h);case 4:if(f=e.v,p=f.parsedData,v=f.jsonSize,m=f.binSize,l.jsonSize=v,l.binSize=m,(g=h.slice(12+l.jsonSize)).size!==l.binSize&&this.ee.emit(fs.Chat_BinsizeError),this._connectBatch(p,l,c)){e.n=5;break}return e.a(2);case 5:return e.n=6,this._handleArkitFaceConfig(p,l,c,g);case 6:return e.n=7,this._handleAudioConfig(p,l,c,g,s||!1);case 7:this._handleEvents(p);case 8:e.n=10;break;case 9:e.p=9,y=e.v,console.error("err",y),this.ee.emit(cs.ErrorReceived,y.message);case 10:return e.a(2)}},e,this,[[0,9]])})),function(e){return r.apply(this,arguments)})},{key:"_handleAudioConfig",value:(n=v(d().m(function e(t,n,r,i,a){var o,s,u,l,c,h,f,p,v,m,g,y,_,b,x,S,A,w=this;return d().w(function(e){for(;;)switch(e.n){case 0:if(o=t.data_records,s=void 0===o?{}:o,u=t.end_of_batch,!(l=s.audio)){e.n=2;break}return c=l.sample_rate,h=l.shape,f=l.data_offset,p=l.data_type,v=Au[p],m=wu[p],void 0===n.player&&(r&&r.player&&r.batch_id===n.batch_id?n.player=r.player:c&&(n.player=new Su({inputCodec:v,channels:1,sampleRate:c,fftSize:1024,isMute:a,onended:function(e){if(e){var t=e.end_of_batch,n=e.lastMotionGroup;if(t){var r=n.batch_id,i=n.player;w.ee.emit(ds.Player_EndSpeaking,i),w._motionDataGroups=w._motionDataGroups.filter(function(e){return e.batch_id>r}),w._motionDataGroups.length&&w._motionDataGroups[0].player?w._motionDataGroups[0].player.updateAutoPlay(!0):w.ee.emit(ds.Player_NoLegacy)}}}},this.ee)),u&&(g=n.player.option.onended,n.player.option.onended=function(){g({end_of_batch:u,lastMotionGroup:n})})),y=h.reduce(function(e,t){return e*t},"Int16"===v?2:4),_=f,b=f+y,x=i.slice(_,b),e.n=1,x.arrayBuffer();case 1:S=e.v,A=this._motionDataGroups.find(function(e){return e.player}),this._motionDataGroups.length&&n.player&&A&&A.player!==n.player&&(n.player.autoPlay=!1),n.player&&n.player.feed({audio:new m(S),end_of_batch:u}),e.n=3;break;case 2:r&&r.player&&n.batch_id===r.batch_id&&(n.player=r.player);case 3:return e.a(2)}},e,this)})),function(e,t,r,i,a){return n.apply(this,arguments)})},{key:"_handleArkitFaceConfig",value:(t=v(d().m(function e(t,n,r,i){var a,o,s,u,l,c,h,f,p;return d().w(function(e){for(;;)switch(e.n){case 0:if(a=t.data_records,!(o=(void 0===a?{}:a).arkit_face)){e.n=3;break}if(s=o.channel_names,u=o.shape,l=o.data_offset,c=o.sample_rate,s&&!this._arkit_face_channel_names&&(this._arkit_face_channel_names=s,this._arkit_face_sample_rate=c),void 0!==n.arkitFaceArrayBufferArray){e.n=2;break}return r&&r.arkitFaceArrayBufferArray&&r.batch_id===n.batch_id?n.arkitFaceArrayBufferArray=r.arkitFaceArrayBufferArray:n.arkitFaceArrayBufferArray=[],h=u.reduce(function(e,t){return e*t},4),this._arkitFaceShape=u[1],f=i.slice(l,l+h),e.n=1,f.arrayBuffer();case 1:p=e.v,n.arkitFaceArrayBufferArray.push(p);case 2:e.n=4;break;case 3:r&&r.arkitFaceArrayBufferArray&&n.batch_id===r.batch_id&&(n.arkitFaceArrayBufferArray=r.arkitFaceArrayBufferArray);case 4:return e.a(2)}},e,this)})),function(e,n,r,i){return t.apply(this,arguments)})},{key:"_handletts2faceConfig",value:(e=v(d().m(function e(t,n,r,i){var a,o,s,u,l,c,h,f,p;return d().w(function(e){for(;;)switch(e.n){case 0:if(a=t.data_records,!(o=(void 0===a?{}:a).tts2face)){e.n=3;break}if(s=o.channel_names,u=o.shape,l=o.data_offset,c=o.sample_rate,s&&!this._tts2face_channel_names&&(this._tts2face_channel_names=s,this._tts2face_sample_rate=c),void 0!==n.tts2faceArrayBufferArray){e.n=2;break}return r&&r.tts2faceArrayBufferArray&&r.batch_id===n.batch_id?n.tts2faceArrayBufferArray=r.tts2faceArrayBufferArray:n.tts2faceArrayBufferArray=[],h=u.reduce(function(e,t){return e*t},4),this._tts2FaceShape=u[1],f=i.slice(l,l+h),e.n=1,f.arrayBuffer();case 1:p=e.v,n.tts2faceArrayBufferArray.push(p);case 2:e.n=4;break;case 3:r&&r.tts2faceArrayBufferArray&&n.batch_id===r.batch_id&&(n.tts2faceArrayBufferArray=r.tts2faceArrayBufferArray);case 4:return e.a(2)}},e,this)})),function(t,n,r,i){return e.apply(this,arguments)})},{key:"_handleEvents",value:function(e){var t=this,n=e.events;n&&n.length&&n.forEach(function(e){switch(e.event_type){case"interrupt_speech":break;case"change_status":t.ee.emit(fs.Change_Status,e)}})}},{key:"_connectBatch",value:function(e,t,n){var r=!0;return e.batch_id&&void 0===t.batch_id&&(t.batch_id=e.batch_id),!t.batch_id&&n&&n.batch_id&&(t.batch_id=n.batch_id),e.batch_name&&void 0===t.batch_name&&(t.batch_name=e.batch_name),this._maxBatchId&&t.batch_id&&t.batch_id<=this._maxBatchId&&(this.clear(),r=!1),r}}]);var e,t,n,r}(),Mu=function(){function e(t,n){var r,i;A(this,e),this.promise=new Promise(function(e,t){r=e,i=t});var a=r.bind(this),o=i.bind(this);t(function(){a.apply(void 0,arguments)}.bind(this),function(e){o(e)}.bind(this)),this.abortHandler=n,this.id=e.idGen++}return T(e,[{key:"then",value:function(t){var n=this;return new e(function(r,i){n.promise=n.promise.then(function(){var n=t.apply(void 0,arguments);n instanceof Promise||n instanceof e?n.then(function(){r.apply(void 0,arguments)}):r(n)}).catch(function(e){i(e)})},this.abortHandler)}},{key:"catch",value:function(t){var n=this;return new e(function(e){n.promise=n.promise.then(function(){e.apply(void 0,arguments)}).catch(t)},this.abortHandler)}},{key:"abort",value:function(e){this.abortHandler&&this.abortHandler(e)}}])}();M(Mu,"idGen",0);var Eu,Cu=function(e){function t(e){return A(this,t),y(this,t,[e])}return x(t,e),T(t)}(m(Error));Eu=new Float32Array(1),new Int32Array(Eu.buffer);var ku=function(){var e=new Float32Array(1),t=new Int32Array(e.buffer);return function(n){return e[0]=n,t[0]}}(),Ru=function(e,t){return e[t]+(e[t+1]<<8)+(e[t+2]<<16)+(e[t+3]<<24)},Iu=function(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=arguments.length>3?arguments[3]:void 0,i=new AbortController,a=i.signal,o=!1;return new Mu(function(i,s){var u={signal:a};r&&(u.headers=r),fetch(e,u).then(function(){var e=v(d().m(function e(r){var a,u,l,c,h,f,p,v,m,g,y,_;return d().w(function(e){for(;;)switch(e.n){case 0:if(r.ok){e.n=2;break}return e.n=1,r.text();case 1:return a=e.v,s(new Error("Fetch failed: ".concat(r.status," ").concat(r.statusText," ").concat(a))),e.a(2);case 2:u=r.body.getReader(),l=0,c=r.headers.get("Content-Length"),h=c?parseInt(c):void 0,f=[];case 3:if(o){e.n=9;break}return e.p=4,e.n=5,u.read();case 5:if(p=e.v,v=p.value,!p.done){e.n=6;break}return t&&t(100,"100%",v,h),n?(m=new Blob(f).arrayBuffer(),i(m)):i(),e.a(3,9);case 6:l+=v.length,g=void 0,y=void 0,void 0!==h&&(y="".concat((g=l/h*100).toFixed(2),"%")),n&&f.push(v),t&&t(g,y,v,h),e.n=8;break;case 7:return e.p=7,_=e.v,s(_),e.a(2);case 8:e.n=3;break;case 9:return e.a(2)}},e,null,[[4,7]])}));return function(t){return e.apply(this,arguments)}}()).catch(function(e){s(new Cu(e))})},function(e){i.abort(e),o=!0})},Nu=function(e,t,n){return Math.max(Math.min(e,n),t)},Pu=function(){return performance.now()/1e3},Lu=function(e){if(e.geometry&&(e.geometry.dispose(),e.geometry=null),e.material&&(e.material.dispose(),e.material=null),e.children){var t,n=L(e.children);try{for(n.s();!(t=n.n()).done;){var r=t.value;Lu(r)}}catch(i){n.e(i)}finally{n.f()}}},Du=function(e,t){return new Promise(function(n){window.setTimeout(function(){n(e())},t?1:50)})},Ou=function(){switch(arguments.length>0&&void 0!==arguments[0]?arguments[0]:0){case 1:return 9;case 2:return 24}return 0},Fu=function(){var e,t,n=new Promise(function(n,r){e=n,t=r});return{promise:n,resolve:e,reject:t}},Bu=function(e){var t,n;e||(e=function(){});var r=new Mu(function(e,r){t=e,n=r},e);return{promise:r,resolve:t,reject:n}},Uu=function(){return T(function e(t,n,r){A(this,e),this.major=t,this.minor=n,this.patch=r},[{key:"toString",value:function(){return"".concat(this.major,"_").concat(this.minor,"_").concat(this.patch)}}])}();function zu(){var e=navigator.userAgent;return e.indexOf("iPhone")>0||e.indexOf("iPad")>0}function Vu(){if(zu()){var e=navigator.userAgent.match(/OS (\d+)_(\d+)_?(\d+)?/);return new Uu(parseInt(e[1]||0,10),parseInt(e[2]||0,10),parseInt(e[3]||0,10))}return null}var Hu=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;A(this,e),this.sphericalHarmonicsDegree=t,this.sphericalHarmonicsCount=Ou(this.sphericalHarmonicsDegree),this.componentCount=this.sphericalHarmonicsCount+14,this.defaultSphericalHarmonics=new Array(this.sphericalHarmonicsCount).fill(0),this.splats=[],this.splatCount=0}return T(e,[{key:"addSplat",value:function(e){this.splats.push(e),this.splatCount++}},{key:"getSplat",value:function(e){return this.splats[e]}},{key:"addDefaultSplat",value:function(){var t=e.createSplat(this.sphericalHarmonicsDegree);return this.addSplat(t),t}},{key:"addSplatFromComonents",value:function(e,t,n,r,i,a,o,s,u,l,c,h,d,f){for(var p=[e,t,n,r,i,a,o,s,u,l,c,h,d,f].concat(I(this.defaultSphericalHarmonics)),v=0;v<(arguments.length<=14?0:arguments.length-14)&&v0&&void 0!==arguments[0]?arguments[0]:0),n=0;n>8&255]+Rc[e>>16&255]+Rc[e>>24&255]+"-"+Rc[255&t]+Rc[t>>8&255]+"-"+Rc[t>>16&15|64]+Rc[t>>24&255]+"-"+Rc[63&n|128]+Rc[n>>8&255]+"-"+Rc[n>>16&255]+Rc[n>>24&255]+Rc[255&r]+Rc[r>>8&255]+Rc[r>>16&255]+Rc[r>>24&255]).toLowerCase()}function Dc(e,t,n){return Math.max(t,Math.min(n,e))}function Oc(e,t){return(e%t+t)%t}function Fc(e,t,n){return(1-n)*e+n*t}function Bc(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return e/4294967295;case Uint16Array:return e/65535;case Uint8Array:return e/255;case Int32Array:return Math.max(e/2147483647,-1);case Int16Array:return Math.max(e/32767,-1);case Int8Array:return Math.max(e/127,-1);default:throw new Error("Invalid component type.")}}function Uc(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return Math.round(4294967295*e);case Uint16Array:return Math.round(65535*e);case Uint8Array:return Math.round(255*e);case Int32Array:return Math.round(2147483647*e);case Int16Array:return Math.round(32767*e);case Int8Array:return Math.round(127*e);default:throw new Error("Invalid component type.")}}var zc={DEG2RAD:Nc,RAD2DEG:Pc,generateUUID:Lc,clamp:Dc,euclideanModulo:Oc,mapLinear:function(e,t,n,r,i){return r+(e-t)*(i-r)/(n-t)},inverseLerp:function(e,t,n){return e!==t?(n-e)/(t-e):0},lerp:Fc,damp:function(e,t,n,r){return Fc(e,t,1-Math.exp(-n*r))},pingpong:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return t-Math.abs(Oc(e,2*t)-t)},smoothstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*(3-2*e)},smootherstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*e*(e*(6*e-15)+10)},randInt:function(e,t){return e+Math.floor(Math.random()*(t-e+1))},randFloat:function(e,t){return e+Math.random()*(t-e)},randFloatSpread:function(e){return e*(.5-Math.random())},seededRandom:function(e){void 0!==e&&(Ic=e);var t=Ic+=1831565813;return t=Math.imul(t^t>>>15,1|t),(((t^=t+Math.imul(t^t>>>7,61|t))^t>>>14)>>>0)/4294967296},degToRad:function(e){return e*Nc},radToDeg:function(e){return e*Pc},isPowerOfTwo:function(e){return!(e&e-1)&&0!==e},ceilPowerOfTwo:function(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))},floorPowerOfTwo:function(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))},setQuaternionFromProperEuler:function(e,t,n,r,i){var a=Math.cos,o=Math.sin,s=a(n/2),u=o(n/2),l=a((t+r)/2),c=o((t+r)/2),h=a((t-r)/2),d=o((t-r)/2),f=a((r-t)/2),p=o((r-t)/2);switch(i){case"XYX":e.set(s*c,u*h,u*d,s*l);break;case"YZY":e.set(u*d,s*c,u*h,s*l);break;case"ZXZ":e.set(u*h,u*d,s*c,s*l);break;case"XZX":e.set(s*c,u*p,u*f,s*l);break;case"YXY":e.set(u*f,s*c,u*p,s*l);break;case"ZYZ":e.set(u*p,u*f,s*c,s*l);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}},normalize:Uc,denormalize:Bc},Vc=function(){return T(function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;A(this,e),e.prototype.isVector2=!0,this.x=t,this.y=n},[{key:"width",get:function(){return this.x},set:function(e){this.x=e}},{key:"height",get:function(){return this.y},set:function(e){this.y=e}},{key:"set",value:function(e,t){return this.x=e,this.y=t,this}},{key:"setScalar",value:function(e){return this.x=e,this.y=e,this}},{key:"setX",value:function(e){return this.x=e,this}},{key:"setY",value:function(e){return this.y=e,this}},{key:"setComponent",value:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}},{key:"getComponent",value:function(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}},{key:"clone",value:function(){return new this.constructor(this.x,this.y)}},{key:"copy",value:function(e){return this.x=e.x,this.y=e.y,this}},{key:"add",value:function(e){return this.x+=e.x,this.y+=e.y,this}},{key:"addScalar",value:function(e){return this.x+=e,this.y+=e,this}},{key:"addVectors",value:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}},{key:"addScaledVector",value:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}},{key:"sub",value:function(e){return this.x-=e.x,this.y-=e.y,this}},{key:"subScalar",value:function(e){return this.x-=e,this.y-=e,this}},{key:"subVectors",value:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}},{key:"multiply",value:function(e){return this.x*=e.x,this.y*=e.y,this}},{key:"multiplyScalar",value:function(e){return this.x*=e,this.y*=e,this}},{key:"divide",value:function(e){return this.x/=e.x,this.y/=e.y,this}},{key:"divideScalar",value:function(e){return this.multiplyScalar(1/e)}},{key:"applyMatrix3",value:function(e){var t=this.x,n=this.y,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6],this.y=r[1]*t+r[4]*n+r[7],this}},{key:"min",value:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}},{key:"max",value:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}},{key:"clamp",value:function(e,t){return this.x=Dc(this.x,e.x,t.x),this.y=Dc(this.y,e.y,t.y),this}},{key:"clampScalar",value:function(e,t){return this.x=Dc(this.x,e,t),this.y=Dc(this.y,e,t),this}},{key:"clampLength",value:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Dc(n,e,t))}},{key:"floor",value:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}},{key:"ceil",value:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}},{key:"round",value:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},{key:"roundToZero",value:function(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}},{key:"negate",value:function(){return this.x=-this.x,this.y=-this.y,this}},{key:"dot",value:function(e){return this.x*e.x+this.y*e.y}},{key:"cross",value:function(e){return this.x*e.y-this.y*e.x}},{key:"lengthSq",value:function(){return this.x*this.x+this.y*this.y}},{key:"length",value:function(){return Math.sqrt(this.x*this.x+this.y*this.y)}},{key:"manhattanLength",value:function(){return Math.abs(this.x)+Math.abs(this.y)}},{key:"normalize",value:function(){return this.divideScalar(this.length()||1)}},{key:"angle",value:function(){var e=Math.atan2(-this.y,-this.x)+Math.PI;return e}},{key:"angleTo",value:function(e){var t=Math.sqrt(this.lengthSq()*e.lengthSq());if(0===t)return Math.PI/2;var n=this.dot(e)/t;return Math.acos(Dc(n,-1,1))}},{key:"distanceTo",value:function(e){return Math.sqrt(this.distanceToSquared(e))}},{key:"distanceToSquared",value:function(e){var t=this.x-e.x,n=this.y-e.y;return t*t+n*n}},{key:"manhattanDistanceTo",value:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}},{key:"setLength",value:function(e){return this.normalize().multiplyScalar(e)}},{key:"lerp",value:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}},{key:"lerpVectors",value:function(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}},{key:"equals",value:function(e){return e.x===this.x&&e.y===this.y}},{key:"fromArray",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x=e[t],this.y=e[t+1],this}},{key:"toArray",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this.x,e[t+1]=this.y,e}},{key:"fromBufferAttribute",value:function(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}},{key:"rotateAround",value:function(e,t){var n=Math.cos(t),r=Math.sin(t),i=this.x-e.x,a=this.y-e.y;return this.x=i*n-a*r+e.x,this.y=i*r+a*n+e.y,this}},{key:"random",value:function(){return this.x=Math.random(),this.y=Math.random(),this}},{key:Symbol.iterator,value:d().m(function e(){return d().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this.x;case 1:return e.n=2,this.y;case 2:return e.a(2)}},e,this)})}])}(),Hc=function(){return T(function e(t,n,r,i,a,o,s,u,l){A(this,e),e.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],void 0!==t&&this.set(t,n,r,i,a,o,s,u,l)},[{key:"set",value:function(e,t,n,r,i,a,o,s,u){var l=this.elements;return l[0]=e,l[1]=r,l[2]=o,l[3]=t,l[4]=i,l[5]=s,l[6]=n,l[7]=a,l[8]=u,this}},{key:"identity",value:function(){return this.set(1,0,0,0,1,0,0,0,1),this}},{key:"copy",value:function(e){var t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}},{key:"extractBasis",value:function(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}},{key:"setFromMatrix4",value:function(e){var t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}},{key:"multiply",value:function(e){return this.multiplyMatrices(this,e)}},{key:"premultiply",value:function(e){return this.multiplyMatrices(e,this)}},{key:"multiplyMatrices",value:function(e,t){var n=e.elements,r=t.elements,i=this.elements,a=n[0],o=n[3],s=n[6],u=n[1],l=n[4],c=n[7],h=n[2],d=n[5],f=n[8],p=r[0],v=r[3],m=r[6],g=r[1],y=r[4],_=r[7],b=r[2],x=r[5],S=r[8];return i[0]=a*p+o*g+s*b,i[3]=a*v+o*y+s*x,i[6]=a*m+o*_+s*S,i[1]=u*p+l*g+c*b,i[4]=u*v+l*y+c*x,i[7]=u*m+l*_+c*S,i[2]=h*p+d*g+f*b,i[5]=h*v+d*y+f*x,i[8]=h*m+d*_+f*S,this}},{key:"multiplyScalar",value:function(e){var t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}},{key:"determinant",value:function(){var e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],o=e[5],s=e[6],u=e[7],l=e[8];return t*a*l-t*o*u-n*i*l+n*o*s+r*i*u-r*a*s}},{key:"invert",value:function(){var e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],o=e[5],s=e[6],u=e[7],l=e[8],c=l*a-o*u,h=o*s-l*i,d=u*i-a*s,f=t*c+n*h+r*d;if(0===f)return this.set(0,0,0,0,0,0,0,0,0);var p=1/f;return e[0]=c*p,e[1]=(r*u-l*n)*p,e[2]=(o*n-r*a)*p,e[3]=h*p,e[4]=(l*t-r*s)*p,e[5]=(r*i-o*t)*p,e[6]=d*p,e[7]=(n*s-u*t)*p,e[8]=(a*t-n*i)*p,this}},{key:"transpose",value:function(){var e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}},{key:"getNormalMatrix",value:function(e){return this.setFromMatrix4(e).invert().transpose()}},{key:"transposeIntoArray",value:function(e){var t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}},{key:"setUvTransform",value:function(e,t,n,r,i,a,o){var s=Math.cos(i),u=Math.sin(i);return this.set(n*s,n*u,-n*(s*a+u*o)+a+e,-r*u,r*s,-r*(-u*a+s*o)+o+t,0,0,1),this}},{key:"scale",value:function(e,t){return this.premultiply(Wc.makeScale(e,t)),this}},{key:"rotate",value:function(e){return this.premultiply(Wc.makeRotation(-e)),this}},{key:"translate",value:function(e,t){return this.premultiply(Wc.makeTranslation(e,t)),this}},{key:"makeTranslation",value:function(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}},{key:"makeRotation",value:function(e){var t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}},{key:"makeScale",value:function(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}},{key:"equals",value:function(e){for(var t=this.elements,n=e.elements,r=0;r<9;r++)if(t[r]!==n[r])return!1;return!0}},{key:"fromArray",value:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=0;n<9;n++)this.elements[n]=e[n+t];return this}},{key:"toArray",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}},{key:"clone",value:function(){return(new this.constructor).fromArray(this.elements)}}])}(),Wc=new Hc;function Gc(e){for(var t=e.length-1;t>=0;--t)if(e[t]>=65535)return!0;return!1}function jc(e){return document.createElementNS("http://www.w3.org/1999/xhtml",e)}var Qc={};function qc(e){e in Qc||(Qc[e]=!0,console.warn(e))}function Xc(e,t,n){return new Promise(function(r,i){setTimeout(function a(){switch(e.clientWaitSync(t,e.SYNC_FLUSH_COMMANDS_BIT,0)){case e.WAIT_FAILED:i();break;case e.TIMEOUT_EXPIRED:setTimeout(a,n);break;default:r()}},n)})}var Yc=(new Hc).set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),Kc=(new Hc).set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function Zc(){var e={enabled:!0,workingColorSpace:bc,spaces:{},convert:function(e,t,n){return!1!==this.enabled&&t!==n&&t&&n?(this.spaces[t].transfer===Sc&&(e.r=eh(e.r),e.g=eh(e.g),e.b=eh(e.b)),this.spaces[t].primaries!==this.spaces[n].primaries&&(e.applyMatrix3(this.spaces[t].toXYZ),e.applyMatrix3(this.spaces[n].fromXYZ)),this.spaces[n].transfer===Sc&&(e.r=th(e.r),e.g=th(e.g),e.b=th(e.b)),e):e},fromWorkingColorSpace:function(e,t){return this.convert(e,this.workingColorSpace,t)},toWorkingColorSpace:function(e,t){return this.convert(e,t,this.workingColorSpace)},getPrimaries:function(e){return this.spaces[e].primaries},getTransfer:function(e){return e===yc?xc:this.spaces[e].transfer},getLuminanceCoefficients:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.workingColorSpace;return e.fromArray(this.spaces[t].luminanceCoefficients)},define:function(e){Object.assign(this.spaces,e)},_getMatrix:function(e,t,n){return e.copy(this.spaces[t].toXYZ).multiply(this.spaces[n].fromXYZ)},_getDrawingBufferColorSpace:function(e){return this.spaces[e].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.workingColorSpace;return this.spaces[e].workingColorSpaceConfig.unpackColorSpace}},t=[.64,.33,.3,.6,.15,.06],n=[.2126,.7152,.0722],r=[.3127,.329];return e.define(M(M({},bc,{primaries:t,whitePoint:r,transfer:xc,toXYZ:Yc,fromXYZ:Kc,luminanceCoefficients:n,workingColorSpaceConfig:{unpackColorSpace:_c},outputColorSpaceConfig:{drawingBufferColorSpace:_c}}),_c,{primaries:t,whitePoint:r,transfer:Sc,toXYZ:Yc,fromXYZ:Kc,luminanceCoefficients:n,outputColorSpaceConfig:{drawingBufferColorSpace:_c}})),e}var Jc,$c=Zc();function eh(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}function th(e){return e<.0031308?12.92*e:1.055*Math.pow(e,.41666)-.055}var nh=function(){return T(function e(){A(this,e)},null,[{key:"getDataURL",value:function(e){if(/^data:/i.test(e.src))return e.src;if("undefined"==typeof HTMLCanvasElement)return e.src;var t;if(e instanceof HTMLCanvasElement)t=e;else{void 0===Jc&&(Jc=jc("canvas")),Jc.width=e.width,Jc.height=e.height;var n=Jc.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=Jc}return t.toDataURL("image/png")}},{key:"sRGBToLinear",value:function(e){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){var t=jc("canvas");t.width=e.width,t.height=e.height;var n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);for(var r=n.getImageData(0,0,e.width,e.height),i=r.data,a=0;a0&&void 0!==arguments[0]?arguments[0]:null;A(this,e),this.isSource=!0,Object.defineProperty(this,"id",{value:rh++}),this.uuid=Lc(),this.data=t,this.dataReady=!0,this.version=0},[{key:"needsUpdate",set:function(e){!0===e&&this.version++}},{key:"toJSON",value:function(e){var t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.images[this.uuid])return e.images[this.uuid];var n={uuid:this.uuid,url:""},r=this.data;if(null!==r){var i;if(Array.isArray(r)){i=[];for(var a=0,o=r.length;a0&&void 0!==arguments[0]?arguments[0]:t.DEFAULT_IMAGE,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.DEFAULT_MAPPING,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:al,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:al,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:ll,s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:hl,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:wl,l=arguments.length>7&&void 0!==arguments[7]?arguments[7]:dl,c=arguments.length>8&&void 0!==arguments[8]?arguments[8]:t.DEFAULT_ANISOTROPY,h=arguments.length>9&&void 0!==arguments[9]?arguments[9]:yc;return A(this,t),(e=y(this,t)).isTexture=!0,Object.defineProperty(e,"id",{value:oh++}),e.uuid=Lc(),e.name="",e.source=new ih(n),e.mipmaps=[],e.mapping=r,e.channel=0,e.wrapS=i,e.wrapT=a,e.magFilter=o,e.minFilter=s,e.anisotropy=c,e.format=u,e.internalFormat=null,e.type=l,e.offset=new Vc(0,0),e.repeat=new Vc(1,1),e.center=new Vc(0,0),e.rotation=0,e.matrixAutoUpdate=!0,e.matrix=new Hc,e.generateMipmaps=!0,e.premultiplyAlpha=!1,e.flipY=!0,e.unpackAlignment=4,e.colorSpace=h,e.userData={},e.version=0,e.onUpdate=null,e.renderTarget=null,e.isRenderTargetTexture=!1,e.pmremVersion=0,e}return x(t,e),T(t,[{key:"image",get:function(){return this.source.data},set:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;this.source.data=e}},{key:"updateMatrix",value:function(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"copy",value:function(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}},{key:"toJSON",value:function(e){var t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.textures[this.uuid])return e.textures[this.uuid];var n={metadata:{version:4.6,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,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,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}},{key:"dispose",value:function(){this.dispatchEvent({type:"dispose"})}},{key:"transformUv",value:function(e){if(300!==this.mapping)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case il:e.x=e.x-Math.floor(e.x);break;case al:e.x=e.x<0?0:1;break;case ol:1===Math.abs(Math.floor(e.x)%2)?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x)}if(e.y<0||e.y>1)switch(this.wrapT){case il:e.y=e.y-Math.floor(e.y);break;case al:e.y=e.y<0?0:1;break;case ol:1===Math.abs(Math.floor(e.y)%2)?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y)}return this.flipY&&(e.y=1-e.y),e}},{key:"needsUpdate",set:function(e){!0===e&&(this.version++,this.source.needsUpdate=!0)}},{key:"needsPMREMUpdate",set:function(e){!0===e&&this.pmremVersion++}}])}(kc);sh.DEFAULT_IMAGE=null,sh.DEFAULT_MAPPING=300,sh.DEFAULT_ANISOTROPY=1;var uh=function(){return T(function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;A(this,e),e.prototype.isVector4=!0,this.x=t,this.y=n,this.z=r,this.w=i},[{key:"width",get:function(){return this.z},set:function(e){this.z=e}},{key:"height",get:function(){return this.w},set:function(e){this.w=e}},{key:"set",value:function(e,t,n,r){return this.x=e,this.y=t,this.z=n,this.w=r,this}},{key:"setScalar",value:function(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}},{key:"setX",value:function(e){return this.x=e,this}},{key:"setY",value:function(e){return this.y=e,this}},{key:"setZ",value:function(e){return this.z=e,this}},{key:"setW",value:function(e){return this.w=e,this}},{key:"setComponent",value:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}},{key:"getComponent",value:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}},{key:"clone",value:function(){return new this.constructor(this.x,this.y,this.z,this.w)}},{key:"copy",value:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=void 0!==e.w?e.w:1,this}},{key:"add",value:function(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}},{key:"addScalar",value:function(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}},{key:"addVectors",value:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}},{key:"addScaledVector",value:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}},{key:"sub",value:function(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}},{key:"subScalar",value:function(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}},{key:"subVectors",value:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}},{key:"multiply",value:function(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}},{key:"multiplyScalar",value:function(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}},{key:"applyMatrix4",value:function(e){var t=this.x,n=this.y,r=this.z,i=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*r+a[12]*i,this.y=a[1]*t+a[5]*n+a[9]*r+a[13]*i,this.z=a[2]*t+a[6]*n+a[10]*r+a[14]*i,this.w=a[3]*t+a[7]*n+a[11]*r+a[15]*i,this}},{key:"divide",value:function(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}},{key:"divideScalar",value:function(e){return this.multiplyScalar(1/e)}},{key:"setAxisAngleFromQuaternion",value:function(e){this.w=2*Math.acos(e.w);var t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}},{key:"setAxisAngleFromRotationMatrix",value:function(e){var t,n,r,i,a=.01,o=.1,s=e.elements,u=s[0],l=s[4],c=s[8],h=s[1],d=s[5],f=s[9],p=s[2],v=s[6],m=s[10];if(Math.abs(l-h)y&&g>_?g_?y1&&void 0!==arguments[1]?arguments[1]:0;return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}},{key:"toArray",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}},{key:"fromBufferAttribute",value:function(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}},{key:"random",value:function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}},{key:Symbol.iterator,value:d().m(function e(){return d().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this.x;case 1:return e.n=2,this.y;case 2:return e.n=3,this.z;case 3:return e.n=4,this.w;case 4:return e.a(2)}},e,this)})}])}(),lh=function(e){function t(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};A(this,t),(e=y(this,t)).isRenderTarget=!0,e.width=n,e.height=r,e.depth=1,e.scissor=new uh(0,0,n,r),e.scissorTest=!1,e.viewport=new uh(0,0,n,r);var a={width:n,height:r,depth:1};i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:ll,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1},i);var o=new sh(a,i.mapping,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.colorSpace);o.flipY=!1,o.generateMipmaps=i.generateMipmaps,o.internalFormat=i.internalFormat,e.textures=[];for(var s=i.count,u=0;u2&&void 0!==arguments[2]?arguments[2]:1;if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(var r=0,i=this.textures.length;r0&&void 0!==arguments[0]?arguments[0]:1,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return A(this,t),(e=y(this,t,[n,r,i])).isWebGLRenderTarget=!0,e}return x(t,e),T(t)}(lh),hh=function(e){function t(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;return A(this,t),(e=y(this,t,[null])).isDataArrayTexture=!0,e.image={data:n,width:r,height:i,depth:a},e.magFilter=sl,e.minFilter=sl,e.wrapR=al,e.generateMipmaps=!1,e.flipY=!1,e.unpackAlignment=1,e.layerUpdates=new Set,e}return x(t,e),T(t,[{key:"addLayerUpdate",value:function(e){this.layerUpdates.add(e)}},{key:"clearLayerUpdates",value:function(){this.layerUpdates.clear()}}])}(sh),dh=function(e){function t(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;return A(this,t),(e=y(this,t,[null])).isData3DTexture=!0,e.image={data:n,width:r,height:i,depth:a},e.magFilter=sl,e.minFilter=sl,e.wrapR=al,e.generateMipmaps=!1,e.flipY=!1,e.unpackAlignment=1,e}return x(t,e),T(t)}(sh),fh=function(){return T(function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;A(this,e),this.isQuaternion=!0,this._x=t,this._y=n,this._z=r,this._w=i},[{key:"x",get:function(){return this._x},set:function(e){this._x=e,this._onChangeCallback()}},{key:"y",get:function(){return this._y},set:function(e){this._y=e,this._onChangeCallback()}},{key:"z",get:function(){return this._z},set:function(e){this._z=e,this._onChangeCallback()}},{key:"w",get:function(){return this._w},set:function(e){this._w=e,this._onChangeCallback()}},{key:"set",value:function(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._w=r,this._onChangeCallback(),this}},{key:"clone",value:function(){return new this.constructor(this._x,this._y,this._z,this._w)}},{key:"copy",value:function(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}},{key:"setFromEuler",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=e._x,r=e._y,i=e._z,a=e._order,o=Math.cos,s=Math.sin,u=o(n/2),l=o(r/2),c=o(i/2),h=s(n/2),d=s(r/2),f=s(i/2);switch(a){case"XYZ":this._x=h*l*c+u*d*f,this._y=u*d*c-h*l*f,this._z=u*l*f+h*d*c,this._w=u*l*c-h*d*f;break;case"YXZ":this._x=h*l*c+u*d*f,this._y=u*d*c-h*l*f,this._z=u*l*f-h*d*c,this._w=u*l*c+h*d*f;break;case"ZXY":this._x=h*l*c-u*d*f,this._y=u*d*c+h*l*f,this._z=u*l*f+h*d*c,this._w=u*l*c-h*d*f;break;case"ZYX":this._x=h*l*c-u*d*f,this._y=u*d*c+h*l*f,this._z=u*l*f-h*d*c,this._w=u*l*c+h*d*f;break;case"YZX":this._x=h*l*c+u*d*f,this._y=u*d*c+h*l*f,this._z=u*l*f-h*d*c,this._w=u*l*c-h*d*f;break;case"XZY":this._x=h*l*c-u*d*f,this._y=u*d*c-h*l*f,this._z=u*l*f+h*d*c,this._w=u*l*c+h*d*f;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return!0===t&&this._onChangeCallback(),this}},{key:"setFromAxisAngle",value:function(e,t){var n=t/2,r=Math.sin(n);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(n),this._onChangeCallback(),this}},{key:"setFromRotationMatrix",value:function(e){var t=e.elements,n=t[0],r=t[4],i=t[8],a=t[1],o=t[5],s=t[9],u=t[2],l=t[6],c=t[10],h=n+o+c;if(h>0){var d=.5/Math.sqrt(h+1);this._w=.25/d,this._x=(l-s)*d,this._y=(i-u)*d,this._z=(a-r)*d}else if(n>o&&n>c){var f=2*Math.sqrt(1+n-o-c);this._w=(l-s)/f,this._x=.25*f,this._y=(r+a)/f,this._z=(i+u)/f}else if(o>c){var p=2*Math.sqrt(1+o-n-c);this._w=(i-u)/p,this._x=(r+a)/p,this._y=.25*p,this._z=(s+l)/p}else{var v=2*Math.sqrt(1+c-n-o);this._w=(a-r)/v,this._x=(i+u)/v,this._y=(s+l)/v,this._z=.25*v}return this._onChangeCallback(),this}},{key:"setFromUnitVectors",value:function(e,t){var n=e.dot(t)+1;return nMath.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}},{key:"angleTo",value:function(e){return 2*Math.acos(Math.abs(Dc(this.dot(e),-1,1)))}},{key:"rotateTowards",value:function(e,t){var n=this.angleTo(e);if(0===n)return this;var r=Math.min(1,t/n);return this.slerp(e,r),this}},{key:"identity",value:function(){return this.set(0,0,0,1)}},{key:"invert",value:function(){return this.conjugate()}},{key:"conjugate",value:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}},{key:"dot",value:function(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}},{key:"lengthSq",value:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}},{key:"length",value:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}},{key:"normalize",value:function(){var e=this.length();return 0===e?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}},{key:"multiply",value:function(e){return this.multiplyQuaternions(this,e)}},{key:"premultiply",value:function(e){return this.multiplyQuaternions(e,this)}},{key:"multiplyQuaternions",value:function(e,t){var n=e._x,r=e._y,i=e._z,a=e._w,o=t._x,s=t._y,u=t._z,l=t._w;return this._x=n*l+a*o+r*u-i*s,this._y=r*l+a*s+i*o-n*u,this._z=i*l+a*u+n*s-r*o,this._w=a*l-n*o-r*s-i*u,this._onChangeCallback(),this}},{key:"slerp",value:function(e,t){if(0===t)return this;if(1===t)return this.copy(e);var n=this._x,r=this._y,i=this._z,a=this._w,o=a*e._w+n*e._x+r*e._y+i*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),o>=1)return this._w=a,this._x=n,this._y=r,this._z=i,this;var s=1-o*o;if(s<=Number.EPSILON){var u=1-t;return this._w=u*a+t*this._w,this._x=u*n+t*this._x,this._y=u*r+t*this._y,this._z=u*i+t*this._z,this.normalize(),this}var l=Math.sqrt(s),c=Math.atan2(l,o),h=Math.sin((1-t)*c)/l,d=Math.sin(t*c)/l;return this._w=a*h+this._w*d,this._x=n*h+this._x*d,this._y=r*h+this._y*d,this._z=i*h+this._z*d,this._onChangeCallback(),this}},{key:"slerpQuaternions",value:function(e,t,n){return this.copy(e).slerp(t,n)}},{key:"random",value:function(){var e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),r=Math.sqrt(1-n),i=Math.sqrt(n);return this.set(r*Math.sin(e),r*Math.cos(e),i*Math.sin(t),i*Math.cos(t))}},{key:"equals",value:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}},{key:"fromArray",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}},{key:"toArray",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}},{key:"fromBufferAttribute",value:function(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}},{key:"toJSON",value:function(){return this.toArray()}},{key:"_onChange",value:function(e){return this._onChangeCallback=e,this}},{key:"_onChangeCallback",value:function(){}},{key:Symbol.iterator,value:d().m(function e(){return d().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._x;case 1:return e.n=2,this._y;case 2:return e.n=3,this._z;case 3:return e.n=4,this._w;case 4:return e.a(2)}},e,this)})}],[{key:"slerpFlat",value:function(e,t,n,r,i,a,o){var s=n[r+0],u=n[r+1],l=n[r+2],c=n[r+3],h=i[a+0],d=i[a+1],f=i[a+2],p=i[a+3];if(0===o)return e[t+0]=s,e[t+1]=u,e[t+2]=l,void(e[t+3]=c);if(1===o)return e[t+0]=h,e[t+1]=d,e[t+2]=f,void(e[t+3]=p);if(c!==p||s!==h||u!==d||l!==f){var v=1-o,m=s*h+u*d+l*f+c*p,g=m>=0?1:-1,y=1-m*m;if(y>Number.EPSILON){var _=Math.sqrt(y),b=Math.atan2(_,m*g);v=Math.sin(v*b)/_,o=Math.sin(o*b)/_}var x=o*g;if(s=s*v+h*x,u=u*v+d*x,l=l*v+f*x,c=c*v+p*x,v===1-o){var S=1/Math.sqrt(s*s+u*u+l*l+c*c);s*=S,u*=S,l*=S,c*=S}}e[t]=s,e[t+1]=u,e[t+2]=l,e[t+3]=c}},{key:"multiplyQuaternionsFlat",value:function(e,t,n,r,i,a){var o=n[r],s=n[r+1],u=n[r+2],l=n[r+3],c=i[a],h=i[a+1],d=i[a+2],f=i[a+3];return e[t]=o*f+l*c+s*d-u*h,e[t+1]=s*f+l*h+u*c-o*d,e[t+2]=u*f+l*d+o*h-s*c,e[t+3]=l*f-o*c-s*h-u*d,e}}])}(),ph=function(){return T(function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;A(this,e),e.prototype.isVector3=!0,this.x=t,this.y=n,this.z=r},[{key:"set",value:function(e,t,n){return void 0===n&&(n=this.z),this.x=e,this.y=t,this.z=n,this}},{key:"setScalar",value:function(e){return this.x=e,this.y=e,this.z=e,this}},{key:"setX",value:function(e){return this.x=e,this}},{key:"setY",value:function(e){return this.y=e,this}},{key:"setZ",value:function(e){return this.z=e,this}},{key:"setComponent",value:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}},{key:"getComponent",value:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}},{key:"clone",value:function(){return new this.constructor(this.x,this.y,this.z)}},{key:"copy",value:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}},{key:"add",value:function(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}},{key:"addScalar",value:function(e){return this.x+=e,this.y+=e,this.z+=e,this}},{key:"addVectors",value:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}},{key:"addScaledVector",value:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}},{key:"sub",value:function(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}},{key:"subScalar",value:function(e){return this.x-=e,this.y-=e,this.z-=e,this}},{key:"subVectors",value:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}},{key:"multiply",value:function(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}},{key:"multiplyScalar",value:function(e){return this.x*=e,this.y*=e,this.z*=e,this}},{key:"multiplyVectors",value:function(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}},{key:"applyEuler",value:function(e){return this.applyQuaternion(mh.setFromEuler(e))}},{key:"applyAxisAngle",value:function(e,t){return this.applyQuaternion(mh.setFromAxisAngle(e,t))}},{key:"applyMatrix3",value:function(e){var t=this.x,n=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6]*r,this.y=i[1]*t+i[4]*n+i[7]*r,this.z=i[2]*t+i[5]*n+i[8]*r,this}},{key:"applyNormalMatrix",value:function(e){return this.applyMatrix3(e).normalize()}},{key:"applyMatrix4",value:function(e){var t=this.x,n=this.y,r=this.z,i=e.elements,a=1/(i[3]*t+i[7]*n+i[11]*r+i[15]);return this.x=(i[0]*t+i[4]*n+i[8]*r+i[12])*a,this.y=(i[1]*t+i[5]*n+i[9]*r+i[13])*a,this.z=(i[2]*t+i[6]*n+i[10]*r+i[14])*a,this}},{key:"applyQuaternion",value:function(e){var t=this.x,n=this.y,r=this.z,i=e.x,a=e.y,o=e.z,s=e.w,u=2*(a*r-o*n),l=2*(o*t-i*r),c=2*(i*n-a*t);return this.x=t+s*u+a*c-o*l,this.y=n+s*l+o*u-i*c,this.z=r+s*c+i*l-a*u,this}},{key:"project",value:function(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}},{key:"unproject",value:function(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}},{key:"transformDirection",value:function(e){var t=this.x,n=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[4]*n+i[8]*r,this.y=i[1]*t+i[5]*n+i[9]*r,this.z=i[2]*t+i[6]*n+i[10]*r,this.normalize()}},{key:"divide",value:function(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}},{key:"divideScalar",value:function(e){return this.multiplyScalar(1/e)}},{key:"min",value:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}},{key:"max",value:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}},{key:"clamp",value:function(e,t){return this.x=Dc(this.x,e.x,t.x),this.y=Dc(this.y,e.y,t.y),this.z=Dc(this.z,e.z,t.z),this}},{key:"clampScalar",value:function(e,t){return this.x=Dc(this.x,e,t),this.y=Dc(this.y,e,t),this.z=Dc(this.z,e,t),this}},{key:"clampLength",value:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Dc(n,e,t))}},{key:"floor",value:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}},{key:"ceil",value:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}},{key:"round",value:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}},{key:"roundToZero",value:function(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}},{key:"negate",value:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}},{key:"dot",value:function(e){return this.x*e.x+this.y*e.y+this.z*e.z}},{key:"lengthSq",value:function(){return this.x*this.x+this.y*this.y+this.z*this.z}},{key:"length",value:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}},{key:"manhattanLength",value:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}},{key:"normalize",value:function(){return this.divideScalar(this.length()||1)}},{key:"setLength",value:function(e){return this.normalize().multiplyScalar(e)}},{key:"lerp",value:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}},{key:"lerpVectors",value:function(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}},{key:"cross",value:function(e){return this.crossVectors(this,e)}},{key:"crossVectors",value:function(e,t){var n=e.x,r=e.y,i=e.z,a=t.x,o=t.y,s=t.z;return this.x=r*s-i*o,this.y=i*a-n*s,this.z=n*o-r*a,this}},{key:"projectOnVector",value:function(e){var t=e.lengthSq();if(0===t)return this.set(0,0,0);var n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}},{key:"projectOnPlane",value:function(e){return vh.copy(this).projectOnVector(e),this.sub(vh)}},{key:"reflect",value:function(e){return this.sub(vh.copy(e).multiplyScalar(2*this.dot(e)))}},{key:"angleTo",value:function(e){var t=Math.sqrt(this.lengthSq()*e.lengthSq());if(0===t)return Math.PI/2;var n=this.dot(e)/t;return Math.acos(Dc(n,-1,1))}},{key:"distanceTo",value:function(e){return Math.sqrt(this.distanceToSquared(e))}},{key:"distanceToSquared",value:function(e){var t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r}},{key:"manhattanDistanceTo",value:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}},{key:"setFromSpherical",value:function(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}},{key:"setFromSphericalCoords",value:function(e,t,n){var r=Math.sin(t)*e;return this.x=r*Math.sin(n),this.y=Math.cos(t)*e,this.z=r*Math.cos(n),this}},{key:"setFromCylindrical",value:function(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}},{key:"setFromCylindricalCoords",value:function(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}},{key:"setFromMatrixPosition",value:function(e){var t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}},{key:"setFromMatrixScale",value:function(e){var t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=r,this}},{key:"setFromMatrixColumn",value:function(e,t){return this.fromArray(e.elements,4*t)}},{key:"setFromMatrix3Column",value:function(e,t){return this.fromArray(e.elements,3*t)}},{key:"setFromEuler",value:function(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}},{key:"setFromColor",value:function(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}},{key:"equals",value:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}},{key:"fromArray",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}},{key:"toArray",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}},{key:"fromBufferAttribute",value:function(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}},{key:"random",value:function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}},{key:"randomDirection",value:function(){var e=Math.random()*Math.PI*2,t=2*Math.random()-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}},{key:Symbol.iterator,value:d().m(function e(){return d().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this.x;case 1:return e.n=2,this.y;case 2:return e.n=3,this.z;case 3:return e.a(2)}},e,this)})}])}(),vh=new ph,mh=new fh,gh=function(){return T(function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new ph(1/0,1/0,1/0),n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new ph(-1/0,-1/0,-1/0);A(this,e),this.isBox3=!0,this.min=t,this.max=n},[{key:"set",value:function(e,t){return this.min.copy(e),this.max.copy(t),this}},{key:"setFromArray",value:function(e){this.makeEmpty();for(var t=0,n=e.length;t1&&void 0!==arguments[1]&&arguments[1];return this.makeEmpty(),this.expandByObject(e,t)}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"copy",value:function(e){return this.min.copy(e.min),this.max.copy(e.max),this}},{key:"makeEmpty",value:function(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}},{key:"isEmpty",value:function(){return this.max.x1&&void 0!==arguments[1]&&arguments[1];e.updateWorldMatrix(!1,!1);var n=e.geometry;if(void 0!==n){var r=n.getAttribute("position");if(!0===t&&void 0!==r&&!0!==e.isInstancedMesh)for(var i=0,a=r.count;i=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}},{key:"containsBox",value:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}},{key:"getParameter",value:function(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}},{key:"intersectsBox",value:function(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}},{key:"intersectsSphere",value:function(e){return this.clampPoint(e.center,_h),_h.distanceToSquared(e.center)<=e.radius*e.radius}},{key:"intersectsPlane",value:function(e){var t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}},{key:"intersectsTriangle",value:function(e){if(this.isEmpty())return!1;this.getCenter(Eh),Ch.subVectors(this.max,Eh),xh.subVectors(e.a,Eh),Sh.subVectors(e.b,Eh),Ah.subVectors(e.c,Eh),wh.subVectors(Sh,xh),Th.subVectors(Ah,Sh),Mh.subVectors(xh,Ah);var t=[0,-wh.z,wh.y,0,-Th.z,Th.y,0,-Mh.z,Mh.y,wh.z,0,-wh.x,Th.z,0,-Th.x,Mh.z,0,-Mh.x,-wh.y,wh.x,0,-Th.y,Th.x,0,-Mh.y,Mh.x,0];return!!Ih(t,xh,Sh,Ah,Ch)&&(!!Ih(t=[1,0,0,0,1,0,0,0,1],xh,Sh,Ah,Ch)&&(kh.crossVectors(wh,Th),Ih(t=[kh.x,kh.y,kh.z],xh,Sh,Ah,Ch)))}},{key:"clampPoint",value:function(e,t){return t.copy(e).clamp(this.min,this.max)}},{key:"distanceToPoint",value:function(e){return this.clampPoint(e,_h).distanceTo(e)}},{key:"getBoundingSphere",value:function(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=.5*this.getSize(_h).length()),e}},{key:"intersect",value:function(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}},{key:"union",value:function(e){return this.min.min(e.min),this.max.max(e.max),this}},{key:"applyMatrix4",value:function(e){return this.isEmpty()||(yh[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),yh[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),yh[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),yh[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),yh[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),yh[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),yh[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),yh[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(yh)),this}},{key:"translate",value:function(e){return this.min.add(e),this.max.add(e),this}},{key:"equals",value:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}])}(),yh=[new ph,new ph,new ph,new ph,new ph,new ph,new ph,new ph],_h=new ph,bh=new gh,xh=new ph,Sh=new ph,Ah=new ph,wh=new ph,Th=new ph,Mh=new ph,Eh=new ph,Ch=new ph,kh=new ph,Rh=new ph;function Ih(e,t,n,r,i){for(var a=0,o=e.length-3;a<=o;a+=3){Rh.fromArray(e,a);var s=i.x*Math.abs(Rh.x)+i.y*Math.abs(Rh.y)+i.z*Math.abs(Rh.z),u=t.dot(Rh),l=n.dot(Rh),c=r.dot(Rh);if(Math.max(-Math.max(u,l,c),Math.min(u,l,c))>s)return!1}return!0}var Nh=new gh,Ph=new ph,Lh=new ph,Dh=function(){return T(function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new ph,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;A(this,e),this.isSphere=!0,this.center=t,this.radius=n},[{key:"set",value:function(e,t){return this.center.copy(e),this.radius=t,this}},{key:"setFromPoints",value:function(e,t){var n=this.center;void 0!==t?n.copy(t):Nh.setFromPoints(e).getCenter(n);for(var r=0,i=0,a=e.length;ithis.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}},{key:"getBoundingBox",value:function(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}},{key:"applyMatrix4",value:function(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}},{key:"translate",value:function(e){return this.center.add(e),this}},{key:"expandByPoint",value:function(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;Ph.subVectors(e,this.center);var t=Ph.lengthSq();if(t>this.radius*this.radius){var n=Math.sqrt(t),r=.5*(n-this.radius);this.center.addScaledVector(Ph,r/n),this.radius+=r}return this}},{key:"union",value:function(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(!0===this.center.equals(e.center)?this.radius=Math.max(this.radius,e.radius):(Lh.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Ph.copy(e.center).add(Lh)),this.expandByPoint(Ph.copy(e.center).sub(Lh))),this)}},{key:"equals",value:function(e){return e.center.equals(this.center)&&e.radius===this.radius}},{key:"clone",value:function(){return(new this.constructor).copy(this)}}])}(),Oh=new ph,Fh=new ph,Bh=new ph,Uh=new ph,zh=new ph,Vh=new ph,Hh=new ph,Wh=function(){return T(function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new ph,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new ph(0,0,-1);A(this,e),this.origin=t,this.direction=n},[{key:"set",value:function(e,t){return this.origin.copy(e),this.direction.copy(t),this}},{key:"copy",value:function(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}},{key:"at",value:function(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}},{key:"lookAt",value:function(e){return this.direction.copy(e).sub(this.origin).normalize(),this}},{key:"recast",value:function(e){return this.origin.copy(this.at(e,Oh)),this}},{key:"closestPointToPoint",value:function(e,t){t.subVectors(e,this.origin);var n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}},{key:"distanceToPoint",value:function(e){return Math.sqrt(this.distanceSqToPoint(e))}},{key:"distanceSqToPoint",value:function(e){var t=Oh.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Oh.copy(this.origin).addScaledVector(this.direction,t),Oh.distanceToSquared(e))}},{key:"distanceSqToSegment",value:function(e,t,n,r){Fh.copy(e).add(t).multiplyScalar(.5),Bh.copy(t).sub(e).normalize(),Uh.copy(this.origin).sub(Fh);var i,a,o,s,u=.5*e.distanceTo(t),l=-this.direction.dot(Bh),c=Uh.dot(this.direction),h=-Uh.dot(Bh),d=Uh.lengthSq(),f=Math.abs(1-l*l);if(f>0)if(a=l*c-h,s=u*f,(i=l*h-c)>=0)if(a>=-s)if(a<=s){var p=1/f;o=(i*=p)*(i+l*(a*=p)+2*c)+a*(l*i+a+2*h)+d}else a=u,o=-(i=Math.max(0,-(l*a+c)))*i+a*(a+2*h)+d;else a=-u,o=-(i=Math.max(0,-(l*a+c)))*i+a*(a+2*h)+d;else a<=-s?o=-(i=Math.max(0,-(-l*u+c)))*i+(a=i>0?-u:Math.min(Math.max(-u,-h),u))*(a+2*h)+d:a<=s?(i=0,o=(a=Math.min(Math.max(-u,-h),u))*(a+2*h)+d):o=-(i=Math.max(0,-(l*u+c)))*i+(a=i>0?u:Math.min(Math.max(-u,-h),u))*(a+2*h)+d;else a=l>0?-u:u,o=-(i=Math.max(0,-(l*a+c)))*i+a*(a+2*h)+d;return n&&n.copy(this.origin).addScaledVector(this.direction,i),r&&r.copy(Fh).addScaledVector(Bh,a),o}},{key:"intersectSphere",value:function(e,t){Oh.subVectors(e.center,this.origin);var n=Oh.dot(this.direction),r=Oh.dot(Oh)-n*n,i=e.radius*e.radius;if(r>i)return null;var a=Math.sqrt(i-r),o=n-a,s=n+a;return s<0?null:o<0?this.at(s,t):this.at(o,t)}},{key:"intersectsSphere",value:function(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}},{key:"distanceToPlane",value:function(e){var t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?0:null;var n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}},{key:"intersectPlane",value:function(e,t){var n=this.distanceToPlane(e);return null===n?null:this.at(n,t)}},{key:"intersectsPlane",value:function(e){var t=e.distanceToPoint(this.origin);return 0===t||e.normal.dot(this.direction)*t<0}},{key:"intersectBox",value:function(e,t){var n,r,i,a,o,s,u=1/this.direction.x,l=1/this.direction.y,c=1/this.direction.z,h=this.origin;return u>=0?(n=(e.min.x-h.x)*u,r=(e.max.x-h.x)*u):(n=(e.max.x-h.x)*u,r=(e.min.x-h.x)*u),l>=0?(i=(e.min.y-h.y)*l,a=(e.max.y-h.y)*l):(i=(e.max.y-h.y)*l,a=(e.min.y-h.y)*l),n>a||i>r?null:((i>n||isNaN(n))&&(n=i),(a=0?(o=(e.min.z-h.z)*c,s=(e.max.z-h.z)*c):(o=(e.max.z-h.z)*c,s=(e.min.z-h.z)*c),n>s||o>r?null:((o>n||n!=n)&&(n=o),(s=0?n:r,t)))}},{key:"intersectsBox",value:function(e){return null!==this.intersectBox(e,Oh)}},{key:"intersectTriangle",value:function(e,t,n,r,i){zh.subVectors(t,e),Vh.subVectors(n,e),Hh.crossVectors(zh,Vh);var a,o=this.direction.dot(Hh);if(o>0){if(r)return null;a=1}else{if(!(o<0))return null;a=-1,o=-o}Uh.subVectors(this.origin,e);var s=a*this.direction.dot(Vh.crossVectors(Uh,Vh));if(s<0)return null;var u=a*this.direction.dot(zh.cross(Uh));if(u<0)return null;if(s+u>o)return null;var l=-a*Uh.dot(Hh);return l<0?null:this.at(l/o,i)}},{key:"applyMatrix4",value:function(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}},{key:"equals",value:function(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}},{key:"clone",value:function(){return(new this.constructor).copy(this)}}])}(),Gh=function(){function e(t,n,r,i,a,o,s,u,l,c,h,d,f,p,v,m){A(this,e),e.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],void 0!==t&&this.set(t,n,r,i,a,o,s,u,l,c,h,d,f,p,v,m)}return T(e,[{key:"set",value:function(e,t,n,r,i,a,o,s,u,l,c,h,d,f,p,v){var m=this.elements;return m[0]=e,m[4]=t,m[8]=n,m[12]=r,m[1]=i,m[5]=a,m[9]=o,m[13]=s,m[2]=u,m[6]=l,m[10]=c,m[14]=h,m[3]=d,m[7]=f,m[11]=p,m[15]=v,this}},{key:"identity",value:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}},{key:"clone",value:function(){return(new e).fromArray(this.elements)}},{key:"copy",value:function(e){var t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}},{key:"copyPosition",value:function(e){var t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}},{key:"setFromMatrix3",value:function(e){var t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}},{key:"extractBasis",value:function(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}},{key:"makeBasis",value:function(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}},{key:"extractRotation",value:function(e){var t=this.elements,n=e.elements,r=1/jh.setFromMatrixColumn(e,0).length(),i=1/jh.setFromMatrixColumn(e,1).length(),a=1/jh.setFromMatrixColumn(e,2).length();return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t[3]=0,t[4]=n[4]*i,t[5]=n[5]*i,t[6]=n[6]*i,t[7]=0,t[8]=n[8]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}},{key:"makeRotationFromEuler",value:function(e){var t=this.elements,n=e.x,r=e.y,i=e.z,a=Math.cos(n),o=Math.sin(n),s=Math.cos(r),u=Math.sin(r),l=Math.cos(i),c=Math.sin(i);if("XYZ"===e.order){var h=a*l,d=a*c,f=o*l,p=o*c;t[0]=s*l,t[4]=-s*c,t[8]=u,t[1]=d+f*u,t[5]=h-p*u,t[9]=-o*s,t[2]=p-h*u,t[6]=f+d*u,t[10]=a*s}else if("YXZ"===e.order){var v=s*l,m=s*c,g=u*l,y=u*c;t[0]=v+y*o,t[4]=g*o-m,t[8]=a*u,t[1]=a*c,t[5]=a*l,t[9]=-o,t[2]=m*o-g,t[6]=y+v*o,t[10]=a*s}else if("ZXY"===e.order){var _=s*l,b=s*c,x=u*l,S=u*c;t[0]=_-S*o,t[4]=-a*c,t[8]=x+b*o,t[1]=b+x*o,t[5]=a*l,t[9]=S-_*o,t[2]=-a*u,t[6]=o,t[10]=a*s}else if("ZYX"===e.order){var A=a*l,w=a*c,T=o*l,M=o*c;t[0]=s*l,t[4]=T*u-w,t[8]=A*u+M,t[1]=s*c,t[5]=M*u+A,t[9]=w*u-T,t[2]=-u,t[6]=o*s,t[10]=a*s}else if("YZX"===e.order){var E=a*s,C=a*u,k=o*s,R=o*u;t[0]=s*l,t[4]=R-E*c,t[8]=k*c+C,t[1]=c,t[5]=a*l,t[9]=-o*l,t[2]=-u*l,t[6]=C*c+k,t[10]=E-R*c}else if("XZY"===e.order){var I=a*s,N=a*u,P=o*s,L=o*u;t[0]=s*l,t[4]=-c,t[8]=u*l,t[1]=I*c+L,t[5]=a*l,t[9]=N*c-P,t[2]=P*c-N,t[6]=o*l,t[10]=L*c+I}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}},{key:"makeRotationFromQuaternion",value:function(e){return this.compose(qh,e,Xh)}},{key:"lookAt",value:function(e,t,n){var r=this.elements;return Zh.subVectors(e,t),0===Zh.lengthSq()&&(Zh.z=1),Zh.normalize(),Yh.crossVectors(n,Zh),0===Yh.lengthSq()&&(1===Math.abs(n.z)?Zh.x+=1e-4:Zh.z+=1e-4,Zh.normalize(),Yh.crossVectors(n,Zh)),Yh.normalize(),Kh.crossVectors(Zh,Yh),r[0]=Yh.x,r[4]=Kh.x,r[8]=Zh.x,r[1]=Yh.y,r[5]=Kh.y,r[9]=Zh.y,r[2]=Yh.z,r[6]=Kh.z,r[10]=Zh.z,this}},{key:"multiply",value:function(e){return this.multiplyMatrices(this,e)}},{key:"premultiply",value:function(e){return this.multiplyMatrices(e,this)}},{key:"multiplyMatrices",value:function(e,t){var n=e.elements,r=t.elements,i=this.elements,a=n[0],o=n[4],s=n[8],u=n[12],l=n[1],c=n[5],h=n[9],d=n[13],f=n[2],p=n[6],v=n[10],m=n[14],g=n[3],y=n[7],_=n[11],b=n[15],x=r[0],S=r[4],A=r[8],w=r[12],T=r[1],M=r[5],E=r[9],C=r[13],k=r[2],R=r[6],I=r[10],N=r[14],P=r[3],L=r[7],D=r[11],O=r[15];return i[0]=a*x+o*T+s*k+u*P,i[4]=a*S+o*M+s*R+u*L,i[8]=a*A+o*E+s*I+u*D,i[12]=a*w+o*C+s*N+u*O,i[1]=l*x+c*T+h*k+d*P,i[5]=l*S+c*M+h*R+d*L,i[9]=l*A+c*E+h*I+d*D,i[13]=l*w+c*C+h*N+d*O,i[2]=f*x+p*T+v*k+m*P,i[6]=f*S+p*M+v*R+m*L,i[10]=f*A+p*E+v*I+m*D,i[14]=f*w+p*C+v*N+m*O,i[3]=g*x+y*T+_*k+b*P,i[7]=g*S+y*M+_*R+b*L,i[11]=g*A+y*E+_*I+b*D,i[15]=g*w+y*C+_*N+b*O,this}},{key:"multiplyScalar",value:function(e){var t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}},{key:"determinant",value:function(){var e=this.elements,t=e[0],n=e[4],r=e[8],i=e[12],a=e[1],o=e[5],s=e[9],u=e[13],l=e[2],c=e[6],h=e[10],d=e[14];return e[3]*(+i*s*c-r*u*c-i*o*h+n*u*h+r*o*d-n*s*d)+e[7]*(+t*s*d-t*u*h+i*a*h-r*a*d+r*u*l-i*s*l)+e[11]*(+t*u*c-t*o*d-i*a*c+n*a*d+i*o*l-n*u*l)+e[15]*(-r*o*l-t*s*c+t*o*h+r*a*c-n*a*h+n*s*l)}},{key:"transpose",value:function(){var e,t=this.elements;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}},{key:"setPosition",value:function(e,t,n){var r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=n),this}},{key:"invert",value:function(){var e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],o=e[5],s=e[6],u=e[7],l=e[8],c=e[9],h=e[10],d=e[11],f=e[12],p=e[13],v=e[14],m=e[15],g=c*v*u-p*h*u+p*s*d-o*v*d-c*s*m+o*h*m,y=f*h*u-l*v*u-f*s*d+a*v*d+l*s*m-a*h*m,_=l*p*u-f*c*u+f*o*d-a*p*d-l*o*m+a*c*m,b=f*c*s-l*p*s-f*o*h+a*p*h+l*o*v-a*c*v,x=t*g+n*y+r*_+i*b;if(0===x)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);var S=1/x;return e[0]=g*S,e[1]=(p*h*i-c*v*i-p*r*d+n*v*d+c*r*m-n*h*m)*S,e[2]=(o*v*i-p*s*i+p*r*u-n*v*u-o*r*m+n*s*m)*S,e[3]=(c*s*i-o*h*i-c*r*u+n*h*u+o*r*d-n*s*d)*S,e[4]=y*S,e[5]=(l*v*i-f*h*i+f*r*d-t*v*d-l*r*m+t*h*m)*S,e[6]=(f*s*i-a*v*i-f*r*u+t*v*u+a*r*m-t*s*m)*S,e[7]=(a*h*i-l*s*i+l*r*u-t*h*u-a*r*d+t*s*d)*S,e[8]=_*S,e[9]=(f*c*i-l*p*i-f*n*d+t*p*d+l*n*m-t*c*m)*S,e[10]=(a*p*i-f*o*i+f*n*u-t*p*u-a*n*m+t*o*m)*S,e[11]=(l*o*i-a*c*i-l*n*u+t*c*u+a*n*d-t*o*d)*S,e[12]=b*S,e[13]=(l*p*r-f*c*r+f*n*h-t*p*h-l*n*v+t*c*v)*S,e[14]=(f*o*r-a*p*r-f*n*s+t*p*s+a*n*v-t*o*v)*S,e[15]=(a*c*r-l*o*r+l*n*s-t*c*s-a*n*h+t*o*h)*S,this}},{key:"scale",value:function(e){var t=this.elements,n=e.x,r=e.y,i=e.z;return t[0]*=n,t[4]*=r,t[8]*=i,t[1]*=n,t[5]*=r,t[9]*=i,t[2]*=n,t[6]*=r,t[10]*=i,t[3]*=n,t[7]*=r,t[11]*=i,this}},{key:"getMaxScaleOnAxis",value:function(){var e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,r))}},{key:"makeTranslation",value:function(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}},{key:"makeRotationX",value:function(e){var t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}},{key:"makeRotationY",value:function(e){var t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}},{key:"makeRotationZ",value:function(e){var t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}},{key:"makeRotationAxis",value:function(e,t){var n=Math.cos(t),r=Math.sin(t),i=1-n,a=e.x,o=e.y,s=e.z,u=i*a,l=i*o;return this.set(u*a+n,u*o-r*s,u*s+r*o,0,u*o+r*s,l*o+n,l*s-r*a,0,u*s-r*o,l*s+r*a,i*s*s+n,0,0,0,0,1),this}},{key:"makeScale",value:function(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}},{key:"makeShear",value:function(e,t,n,r,i,a){return this.set(1,n,i,0,e,1,a,0,t,r,1,0,0,0,0,1),this}},{key:"compose",value:function(e,t,n){var r=this.elements,i=t._x,a=t._y,o=t._z,s=t._w,u=i+i,l=a+a,c=o+o,h=i*u,d=i*l,f=i*c,p=a*l,v=a*c,m=o*c,g=s*u,y=s*l,_=s*c,b=n.x,x=n.y,S=n.z;return r[0]=(1-(p+m))*b,r[1]=(d+_)*b,r[2]=(f-y)*b,r[3]=0,r[4]=(d-_)*x,r[5]=(1-(h+m))*x,r[6]=(v+g)*x,r[7]=0,r[8]=(f+y)*S,r[9]=(v-g)*S,r[10]=(1-(h+p))*S,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}},{key:"decompose",value:function(e,t,n){var r=this.elements,i=jh.set(r[0],r[1],r[2]).length(),a=jh.set(r[4],r[5],r[6]).length(),o=jh.set(r[8],r[9],r[10]).length();this.determinant()<0&&(i=-i),e.x=r[12],e.y=r[13],e.z=r[14],Qh.copy(this);var s=1/i,u=1/a,l=1/o;return Qh.elements[0]*=s,Qh.elements[1]*=s,Qh.elements[2]*=s,Qh.elements[4]*=u,Qh.elements[5]*=u,Qh.elements[6]*=u,Qh.elements[8]*=l,Qh.elements[9]*=l,Qh.elements[10]*=l,t.setFromRotationMatrix(Qh),n.x=i,n.y=a,n.z=o,this}},{key:"makePerspective",value:function(e,t,n,r,i,a){var o,s,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:Ec,l=this.elements,c=2*i/(t-e),h=2*i/(n-r),d=(t+e)/(t-e),f=(n+r)/(n-r);if(u===Ec)o=-(a+i)/(a-i),s=-2*a*i/(a-i);else{if(u!==Cc)throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+u);o=-a/(a-i),s=-a*i/(a-i)}return l[0]=c,l[4]=0,l[8]=d,l[12]=0,l[1]=0,l[5]=h,l[9]=f,l[13]=0,l[2]=0,l[6]=0,l[10]=o,l[14]=s,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}},{key:"makeOrthographic",value:function(e,t,n,r,i,a){var o,s,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:Ec,l=this.elements,c=1/(t-e),h=1/(n-r),d=1/(a-i),f=(t+e)*c,p=(n+r)*h;if(u===Ec)o=(a+i)*d,s=-2*d;else{if(u!==Cc)throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+u);o=i*d,s=-1*d}return l[0]=2*c,l[4]=0,l[8]=0,l[12]=-f,l[1]=0,l[5]=2*h,l[9]=0,l[13]=-p,l[2]=0,l[6]=0,l[10]=s,l[14]=-o,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}},{key:"equals",value:function(e){for(var t=this.elements,n=e.elements,r=0;r<16;r++)if(t[r]!==n[r])return!1;return!0}},{key:"fromArray",value:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=0;n<16;n++)this.elements[n]=e[n+t];return this}},{key:"toArray",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}}])}(),jh=new ph,Qh=new Gh,qh=new ph(0,0,0),Xh=new ph(1,1,1),Yh=new ph,Kh=new ph,Zh=new ph,Jh=new Gh,$h=new fh,ed=function(){return T(function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:e.DEFAULT_ORDER;A(this,e),this.isEuler=!0,this._x=t,this._y=n,this._z=r,this._order=i},[{key:"x",get:function(){return this._x},set:function(e){this._x=e,this._onChangeCallback()}},{key:"y",get:function(){return this._y},set:function(e){this._y=e,this._onChangeCallback()}},{key:"z",get:function(){return this._z},set:function(e){this._z=e,this._onChangeCallback()}},{key:"order",get:function(){return this._order},set:function(e){this._order=e,this._onChangeCallback()}},{key:"set",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:this._order;return this._x=e,this._y=t,this._z=n,this._order=r,this._onChangeCallback(),this}},{key:"clone",value:function(){return new this.constructor(this._x,this._y,this._z,this._order)}},{key:"copy",value:function(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}},{key:"setFromRotationMatrix",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this._order,n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=e.elements,i=r[0],a=r[4],o=r[8],s=r[1],u=r[5],l=r[9],c=r[2],h=r[6],d=r[10];switch(t){case"XYZ":this._y=Math.asin(Dc(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-l,d),this._z=Math.atan2(-a,i)):(this._x=Math.atan2(h,u),this._z=0);break;case"YXZ":this._x=Math.asin(-Dc(l,-1,1)),Math.abs(l)<.9999999?(this._y=Math.atan2(o,d),this._z=Math.atan2(s,u)):(this._y=Math.atan2(-c,i),this._z=0);break;case"ZXY":this._x=Math.asin(Dc(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(-c,d),this._z=Math.atan2(-a,u)):(this._y=0,this._z=Math.atan2(s,i));break;case"ZYX":this._y=Math.asin(-Dc(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(h,d),this._z=Math.atan2(s,i)):(this._x=0,this._z=Math.atan2(-a,u));break;case"YZX":this._z=Math.asin(Dc(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(-l,u),this._y=Math.atan2(-c,i)):(this._x=0,this._y=Math.atan2(o,d));break;case"XZY":this._z=Math.asin(-Dc(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(h,u),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: "+t)}return this._order=t,!0===n&&this._onChangeCallback(),this}},{key:"setFromQuaternion",value:function(e,t,n){return Jh.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Jh,t,n)}},{key:"setFromVector3",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this._order;return this.set(e.x,e.y,e.z,t)}},{key:"reorder",value:function(e){return $h.setFromEuler(this),this.setFromQuaternion($h,e)}},{key:"equals",value:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}},{key:"fromArray",value:function(e){return this._x=e[0],this._y=e[1],this._z=e[2],void 0!==e[3]&&(this._order=e[3]),this._onChangeCallback(),this}},{key:"toArray",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}},{key:"_onChange",value:function(e){return this._onChangeCallback=e,this}},{key:"_onChangeCallback",value:function(){}},{key:Symbol.iterator,value:d().m(function e(){return d().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this._x;case 1:return e.n=2,this._y;case 2:return e.n=3,this._z;case 3:return e.n=4,this._order;case 4:return e.a(2)}},e,this)})}])}();ed.DEFAULT_ORDER="XYZ";var td=function(){return T(function e(){A(this,e),this.mask=1},[{key:"set",value:function(e){this.mask=1<>>0}},{key:"enable",value:function(e){this.mask|=1<1){for(var t=0;t1){for(var t=0;t2&&void 0!==arguments[2]?arguments[2]:[];this[e]===t&&n.push(this);for(var r=this.children,i=0,a=r.length;i0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.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.isBatchedMesh&&(r.type="BatchedMesh",r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.visibility=this._visibility,r.active=this._active,r.bounds=this._bounds.map(function(e){return{boxInitialized:e.boxInitialized,boxMin:e.box.min.toArray(),boxMax:e.box.max.toArray(),sphereInitialized:e.sphereInitialized,sphereRadius:e.sphere.radius,sphereCenter:e.sphere.center.toArray()}}),r.maxInstanceCount=this._maxInstanceCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.geometryCount=this._geometryCount,r.matricesTexture=this._matricesTexture.toJSON(e),null!==this._colorsTexture&&(r.colorsTexture=this._colorsTexture.toJSON(e)),null!==this.boundingSphere&&(r.boundingSphere={center:r.boundingSphere.center.toArray(),radius:r.boundingSphere.radius}),null!==this.boundingBox&&(r.boundingBox={min:r.boundingBox.min.toArray(),max:r.boundingBox.max.toArray()})),this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&!0!==this.environment.isRenderTargetTexture&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=i(e.geometries,this.geometry);var a=this.geometry.parameters;if(void 0!==a&&void 0!==a.shapes){var o=a.shapes;if(Array.isArray(o))for(var s=0,u=o.length;s0){r.children=[];for(var f=0;f0){r.animations=[];for(var p=0;p0&&(n.geometries=m),g.length>0&&(n.materials=g),y.length>0&&(n.textures=y),_.length>0&&(n.images=_),b.length>0&&(n.shapes=b),x.length>0&&(n.skeletons=x),S.length>0&&(n.animations=S),A.length>0&&(n.nodes=A)}return n.object=r,n;function w(e){var t=[];for(var n in e){var r=e[n];delete r.metadata,t.push(r)}return t}}},{key:"clone",value:function(e){return(new this.constructor).copy(this,e)}},{key:"copy",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),!0===t)for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:new ph,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new ph,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new ph;A(this,e),this.a=t,this.b=n,this.c=r}return T(e,[{key:"set",value:function(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}},{key:"setFromPointsAndIndices",value:function(e,t,n,r){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[r]),this}},{key:"setFromAttributeAndIndices",value:function(e,t,n,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,r),this}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"copy",value:function(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}},{key:"getArea",value:function(){return yd.subVectors(this.c,this.b),_d.subVectors(this.a,this.b),.5*yd.cross(_d).length()}},{key:"getMidpoint",value:function(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}},{key:"getNormal",value:function(t){return e.getNormal(this.a,this.b,this.c,t)}},{key:"getPlane",value:function(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}},{key:"getBarycoord",value:function(t,n){return e.getBarycoord(t,this.a,this.b,this.c,n)}},{key:"getInterpolation",value:function(t,n,r,i,a){return e.getInterpolation(t,this.a,this.b,this.c,n,r,i,a)}},{key:"containsPoint",value:function(t){return e.containsPoint(t,this.a,this.b,this.c)}},{key:"isFrontFacing",value:function(t){return e.isFrontFacing(this.a,this.b,this.c,t)}},{key:"intersectsBox",value:function(e){return e.intersectsTriangle(this)}},{key:"closestPointToPoint",value:function(e,t){var n,r,i=this.a,a=this.b,o=this.c;Sd.subVectors(a,i),Ad.subVectors(o,i),Td.subVectors(e,i);var s=Sd.dot(Td),u=Ad.dot(Td);if(s<=0&&u<=0)return t.copy(i);Md.subVectors(e,a);var l=Sd.dot(Md),c=Ad.dot(Md);if(l>=0&&c<=l)return t.copy(a);var h=s*c-l*u;if(h<=0&&s>=0&&l<=0)return n=s/(s-l),t.copy(i).addScaledVector(Sd,n);Ed.subVectors(e,o);var d=Sd.dot(Ed),f=Ad.dot(Ed);if(f>=0&&d<=f)return t.copy(o);var p=d*u-s*f;if(p<=0&&u>=0&&f<=0)return r=u/(u-f),t.copy(i).addScaledVector(Ad,r);var v=l*f-d*c;if(v<=0&&c-l>=0&&d-f>=0)return wd.subVectors(o,a),r=(c-l)/(c-l+(d-f)),t.copy(a).addScaledVector(wd,r);var m=1/(v+p+h);return n=p*m,r=h*m,t.copy(i).addScaledVector(Sd,n).addScaledVector(Ad,r)}},{key:"equals",value:function(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}],[{key:"getNormal",value:function(e,t,n,r){r.subVectors(n,t),yd.subVectors(e,t),r.cross(yd);var i=r.lengthSq();return i>0?r.multiplyScalar(1/Math.sqrt(i)):r.set(0,0,0)}},{key:"getBarycoord",value:function(e,t,n,r,i){yd.subVectors(r,t),_d.subVectors(n,t),bd.subVectors(e,t);var a=yd.dot(yd),o=yd.dot(_d),s=yd.dot(bd),u=_d.dot(_d),l=_d.dot(bd),c=a*u-o*o;if(0===c)return i.set(0,0,0),null;var h=1/c,d=(u*s-o*l)*h,f=(a*l-o*s)*h;return i.set(1-d-f,f,d)}},{key:"containsPoint",value:function(e,t,n,r){return null!==this.getBarycoord(e,t,n,r,xd)&&(xd.x>=0&&xd.y>=0&&xd.x+xd.y<=1)}},{key:"getInterpolation",value:function(e,t,n,r,i,a,o,s){return null===this.getBarycoord(e,t,n,r,xd)?(s.x=0,s.y=0,"z"in s&&(s.z=0),"w"in s&&(s.w=0),null):(s.setScalar(0),s.addScaledVector(i,xd.x),s.addScaledVector(a,xd.y),s.addScaledVector(o,xd.z),s)}},{key:"getInterpolatedAttribute",value:function(e,t,n,r,i,a){return Cd.setScalar(0),kd.setScalar(0),Rd.setScalar(0),Cd.fromBufferAttribute(e,t),kd.fromBufferAttribute(e,n),Rd.fromBufferAttribute(e,r),a.setScalar(0),a.addScaledVector(Cd,i.x),a.addScaledVector(kd,i.y),a.addScaledVector(Rd,i.z),a}},{key:"isFrontFacing",value:function(e,t,n,r){return yd.subVectors(n,t),_d.subVectors(e,t),yd.cross(_d).dot(r)<0}}])}(),Nd={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},Pd={h:0,s:0,l:0},Ld={h:0,s:0,l:0};function Dd(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+6*(t-e)*(2/3-n):e}var Od=function(){return T(function e(t,n,r){return A(this,e),this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(t,n,r)},[{key:"set",value:function(e,t,n){if(void 0===t&&void 0===n){var r=e;r&&r.isColor?this.copy(r):"number"==typeof r?this.setHex(r):"string"==typeof r&&this.setStyle(r)}else this.setRGB(e,t,n);return this}},{key:"setScalar",value:function(e){return this.r=e,this.g=e,this.b=e,this}},{key:"setHex",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:_c;return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,$c.toWorkingColorSpace(this,t),this}},{key:"setRGB",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:$c.workingColorSpace;return this.r=e,this.g=t,this.b=n,$c.toWorkingColorSpace(this,r),this}},{key:"setHSL",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:$c.workingColorSpace;if(e=Oc(e,1),t=Dc(t,0,1),n=Dc(n,0,1),0===t)this.r=this.g=this.b=n;else{var i=n<=.5?n*(1+t):n+t-n*t,a=2*n-i;this.r=Dd(a,i,e+1/3),this.g=Dd(a,i,e),this.b=Dd(a,i,e-1/3)}return $c.toWorkingColorSpace(this,r),this}},{key:"setStyle",value:function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:_c;function r(t){void 0!==t&&parseFloat(t)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}if(t=/^(\w+)\(([^\)]*)\)/.exec(e)){var i,a=t[1],o=t[2];switch(a){case"rgb":case"rgba":if(i=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return r(i[4]),this.setRGB(Math.min(255,parseInt(i[1],10))/255,Math.min(255,parseInt(i[2],10))/255,Math.min(255,parseInt(i[3],10))/255,n);if(i=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return r(i[4]),this.setRGB(Math.min(100,parseInt(i[1],10))/100,Math.min(100,parseInt(i[2],10))/100,Math.min(100,parseInt(i[3],10))/100,n);break;case"hsl":case"hsla":if(i=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return r(i[4]),this.setHSL(parseFloat(i[1])/360,parseFloat(i[2])/100,parseFloat(i[3])/100,n);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(t=/^\#([A-Fa-f\d]+)$/.exec(e)){var s=t[1],u=s.length;if(3===u)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,n);if(6===u)return this.setHex(parseInt(s,16),n);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,n);return this}},{key:"setColorName",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:_c,n=Nd[e.toLowerCase()];return void 0!==n?this.setHex(n,t):console.warn("THREE.Color: Unknown color "+e),this}},{key:"clone",value:function(){return new this.constructor(this.r,this.g,this.b)}},{key:"copy",value:function(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}},{key:"copySRGBToLinear",value:function(e){return this.r=eh(e.r),this.g=eh(e.g),this.b=eh(e.b),this}},{key:"copyLinearToSRGB",value:function(e){return this.r=th(e.r),this.g=th(e.g),this.b=th(e.b),this}},{key:"convertSRGBToLinear",value:function(){return this.copySRGBToLinear(this),this}},{key:"convertLinearToSRGB",value:function(){return this.copyLinearToSRGB(this),this}},{key:"getHex",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:_c;return $c.fromWorkingColorSpace(Fd.copy(this),e),65536*Math.round(Dc(255*Fd.r,0,255))+256*Math.round(Dc(255*Fd.g,0,255))+Math.round(Dc(255*Fd.b,0,255))}},{key:"getHexString",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:_c;return("000000"+this.getHex(e).toString(16)).slice(-6)}},{key:"getHSL",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:$c.workingColorSpace;$c.fromWorkingColorSpace(Fd.copy(this),t);var n,r,i=Fd.r,a=Fd.g,o=Fd.b,s=Math.max(i,a,o),u=Math.min(i,a,o),l=(u+s)/2;if(u===s)n=0,r=0;else{var c=s-u;switch(r=l<=.5?c/(s+u):c/(2-s-u),s){case i:n=(a-o)/c+(a1&&void 0!==arguments[1]?arguments[1]:$c.workingColorSpace;return $c.fromWorkingColorSpace(Fd.copy(this),t),e.r=Fd.r,e.g=Fd.g,e.b=Fd.b,e}},{key:"getStyle",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:_c;$c.fromWorkingColorSpace(Fd.copy(this),e);var t=Fd.r,n=Fd.g,r=Fd.b;return e!==_c?"color(".concat(e," ").concat(t.toFixed(3)," ").concat(n.toFixed(3)," ").concat(r.toFixed(3),")"):"rgb(".concat(Math.round(255*t),",").concat(Math.round(255*n),",").concat(Math.round(255*r),")")}},{key:"offsetHSL",value:function(e,t,n){return this.getHSL(Pd),this.setHSL(Pd.h+e,Pd.s+t,Pd.l+n)}},{key:"add",value:function(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}},{key:"addColors",value:function(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}},{key:"addScalar",value:function(e){return this.r+=e,this.g+=e,this.b+=e,this}},{key:"sub",value:function(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}},{key:"multiply",value:function(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}},{key:"multiplyScalar",value:function(e){return this.r*=e,this.g*=e,this.b*=e,this}},{key:"lerp",value:function(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}},{key:"lerpColors",value:function(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}},{key:"lerpHSL",value:function(e,t){this.getHSL(Pd),e.getHSL(Ld);var n=Fc(Pd.h,Ld.h,t),r=Fc(Pd.s,Ld.s,t),i=Fc(Pd.l,Ld.l,t);return this.setHSL(n,r,i),this}},{key:"setFromVector3",value:function(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}},{key:"applyMatrix3",value:function(e){var t=this.r,n=this.g,r=this.b,i=e.elements;return this.r=i[0]*t+i[3]*n+i[6]*r,this.g=i[1]*t+i[4]*n+i[7]*r,this.b=i[2]*t+i[5]*n+i[8]*r,this}},{key:"equals",value:function(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}},{key:"fromArray",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}},{key:"toArray",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}},{key:"fromBufferAttribute",value:function(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}},{key:"toJSON",value:function(){return this.getHex()}},{key:Symbol.iterator,value:d().m(function e(){return d().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this.r;case 1:return e.n=2,this.g;case 2:return e.n=3,this.b;case 3:return e.a(2)}},e,this)})}])}(),Fd=new Od;Od.NAMES=Nd;var Bd=0,Ud=function(e){function t(){var e;return A(this,t),(e=y(this,t)).isMaterial=!0,Object.defineProperty(e,"id",{value:Bd++}),e.uuid=Lc(),e.name="",e.type="Material",e.blending=1,e.side=0,e.vertexColors=!1,e.opacity=1,e.transparent=!1,e.alphaHash=!1,e.blendSrc=Ju,e.blendDst=$u,e.blendEquation=Zu,e.blendSrcAlpha=null,e.blendDstAlpha=null,e.blendEquationAlpha=null,e.blendColor=new Od(0,0,0),e.blendAlpha=0,e.depthFunc=3,e.depthTest=!0,e.depthWrite=!0,e.stencilWriteMask=255,e.stencilFunc=519,e.stencilRef=0,e.stencilFuncMask=255,e.stencilFail=Ac,e.stencilZFail=Ac,e.stencilZPass=Ac,e.stencilWrite=!1,e.clippingPlanes=null,e.clipIntersection=!1,e.clipShadows=!1,e.shadowSide=null,e.colorWrite=!0,e.precision=null,e.polygonOffset=!1,e.polygonOffsetFactor=0,e.polygonOffsetUnits=0,e.dithering=!1,e.alphaToCoverage=!1,e.premultipliedAlpha=!1,e.forceSinglePass=!1,e.visible=!0,e.toneMapped=!0,e.userData={},e.version=0,e._alphaTest=0,e}return x(t,e),T(t,[{key:"alphaTest",get:function(){return this._alphaTest},set:function(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}},{key:"onBeforeRender",value:function(){}},{key:"onBeforeCompile",value:function(){}},{key:"customProgramCacheKey",value:function(){return this.onBeforeCompile.toString()}},{key:"setValues",value:function(e){if(void 0!==e)for(var t in e){var n=e[t];if(void 0!==n){var r=this[t];void 0!==r?r&&r.isColor?r.set(n):r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[t]=n:console.warn("THREE.Material: '".concat(t,"' is not a property of THREE.").concat(this.type,"."))}else console.warn("THREE.Material: parameter '".concat(t,"' has value of undefined."))}}},{key:"toJSON",value:function(e){var t=void 0===e||"string"==typeof e;t&&(e={textures:{},images:{}});var n={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};function r(e){var t=[];for(var n in e){var r=e[n];delete r.metadata,t.push(r)}return t}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),void 0!==this.roughness&&(n.roughness=this.roughness),void 0!==this.metalness&&(n.metalness=this.metalness),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()),void 0!==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(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),void 0!==this.dispersion&&(n.dispersion=this.dispersion),void 0!==this.iridescence&&(n.iridescence=this.iridescence),void 0!==this.iridescenceIOR&&(n.iridescenceIOR=this.iridescenceIOR),void 0!==this.iridescenceThicknessRange&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),void 0!==this.anisotropy&&(n.anisotropy=this.anisotropy),void 0!==this.anisotropyRotation&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,void 0!==this.combine&&(n.combine=this.combine)),void 0!==this.envMapRotation&&(n.envMapRotation=this.envMapRotation.toArray()),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(e).uuid),void 0!==this.transmission&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),void 0!==this.thickness&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),void 0!==this.attenuationDistance&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(n.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(n.size=this.size),null!==this.shadowSide&&(n.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(n.blending=this.blending),0!==this.side&&(n.side=this.side),!0===this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),!0===this.transparent&&(n.transparent=!0),this.blendSrc!==Ju&&(n.blendSrc=this.blendSrc),this.blendDst!==$u&&(n.blendDst=this.blendDst),this.blendEquation!==Zu&&(n.blendEquation=this.blendEquation),null!==this.blendSrcAlpha&&(n.blendSrcAlpha=this.blendSrcAlpha),null!==this.blendDstAlpha&&(n.blendDstAlpha=this.blendDstAlpha),null!==this.blendEquationAlpha&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),0!==this.blendAlpha&&(n.blendAlpha=this.blendAlpha),3!==this.depthFunc&&(n.depthFunc=this.depthFunc),!1===this.depthTest&&(n.depthTest=this.depthTest),!1===this.depthWrite&&(n.depthWrite=this.depthWrite),!1===this.colorWrite&&(n.colorWrite=this.colorWrite),255!==this.stencilWriteMask&&(n.stencilWriteMask=this.stencilWriteMask),519!==this.stencilFunc&&(n.stencilFunc=this.stencilFunc),0!==this.stencilRef&&(n.stencilRef=this.stencilRef),255!==this.stencilFuncMask&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Ac&&(n.stencilFail=this.stencilFail),this.stencilZFail!==Ac&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==Ac&&(n.stencilZPass=this.stencilZPass),!0===this.stencilWrite&&(n.stencilWrite=this.stencilWrite),void 0!==this.rotation&&0!==this.rotation&&(n.rotation=this.rotation),!0===this.polygonOffset&&(n.polygonOffset=!0),0!==this.polygonOffsetFactor&&(n.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(n.polygonOffsetUnits=this.polygonOffsetUnits),void 0!==this.linewidth&&1!==this.linewidth&&(n.linewidth=this.linewidth),void 0!==this.dashSize&&(n.dashSize=this.dashSize),void 0!==this.gapSize&&(n.gapSize=this.gapSize),void 0!==this.scale&&(n.scale=this.scale),!0===this.dithering&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),!0===this.alphaHash&&(n.alphaHash=!0),!0===this.alphaToCoverage&&(n.alphaToCoverage=!0),!0===this.premultipliedAlpha&&(n.premultipliedAlpha=!0),!0===this.forceSinglePass&&(n.forceSinglePass=!0),!0===this.wireframe&&(n.wireframe=!0),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=!0),!1===this.visible&&(n.visible=!1),!1===this.toneMapped&&(n.toneMapped=!1),!1===this.fog&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData),t){var i=r(e.textures),a=r(e.images);i.length>0&&(n.textures=i),a.length>0&&(n.images=a)}return n}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"copy",value:function(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;var t=e.clippingPlanes,n=null;if(null!==t){var r=t.length;n=new Array(r);for(var i=0;i!==r;++i)n[i]=t[i].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}},{key:"dispose",value:function(){this.dispatchEvent({type:"dispose"})}},{key:"needsUpdate",set:function(e){!0===e&&this.version++}},{key:"onBuild",value:function(){console.warn("Material: onBuild() has been removed.")}}])}(kc),zd=function(e){function t(e){var n;return A(this,t),(n=y(this,t)).isMeshBasicMaterial=!0,n.type="MeshBasicMaterial",n.color=new Od(16777215),n.map=null,n.lightMap=null,n.lightMapIntensity=1,n.aoMap=null,n.aoMapIntensity=1,n.specularMap=null,n.alphaMap=null,n.envMap=null,n.envMapRotation=new ed,n.combine=0,n.reflectivity=1,n.refractionRatio=.98,n.wireframe=!1,n.wireframeLinewidth=1,n.wireframeLinecap="round",n.wireframeLinejoin="round",n.fog=!0,n.setValues(e),n}return x(t,e),T(t,[{key:"copy",value:function(e){return n(t,"copy",this,3)([e]),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}])}(Ud),Vd=Hd();function Hd(){for(var e=new ArrayBuffer(4),t=new Float32Array(e),n=new Uint32Array(e),r=new Uint32Array(512),i=new Uint32Array(512),a=0;a<256;++a){var o=a-127;o<-27?(r[a]=0,r[256|a]=32768,i[a]=24,i[256|a]=24):o<-14?(r[a]=1024>>-o-14,r[256|a]=1024>>-o-14|32768,i[a]=-o-1,i[256|a]=-o-1):o<=15?(r[a]=o+15<<10,r[256|a]=o+15<<10|32768,i[a]=13,i[256|a]=13):o<128?(r[a]=31744,r[256|a]=64512,i[a]=24,i[256|a]=24):(r[a]=31744,r[256|a]=64512,i[a]=13,i[256|a]=13)}for(var s=new Uint32Array(2048),u=new Uint32Array(64),l=new Uint32Array(64),c=1;c<1024;++c){for(var h=c<<13,d=0;!(8388608&h);)h<<=1,d-=8388608;h&=-8388609,d+=947912704,s[c]=h|d}for(var f=1024;f<2048;++f)s[f]=939524096+(f-1024<<13);for(var p=1;p<31;++p)u[p]=p<<23;u[31]=1199570944,u[32]=2147483648;for(var v=33;v<63;++v)u[v]=2147483648+(v-32<<23);u[63]=3347054592;for(var m=1;m<64;++m)32!==m&&(l[m]=1024);return{floatView:t,uint32View:n,baseTable:r,shiftTable:i,mantissaTable:s,exponentTable:u,offsetTable:l}}var Wd={toHalfFloat:function(e){Math.abs(e)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),e=Dc(e,-65504,65504),Vd.floatView[0]=e;var t=Vd.uint32View[0],n=t>>23&511;return Vd.baseTable[n]+((8388607&t)>>Vd.shiftTable[n])},fromHalfFloat:function(e){var t=e>>10;return Vd.uint32View[0]=Vd.mantissaTable[Vd.offsetTable[t]+(1023&e)]+Vd.exponentTable[t],Vd.floatView[0]}},Gd=new ph,jd=new Vc,Qd=0,qd=function(){return T(function e(t,n){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(A(this,e),Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:Qd++}),this.name="",this.array=t,this.itemSize=n,this.count=void 0!==t?t.length/n:0,this.normalized=r,this.usage=wc,this.updateRanges=[],this.gpuType=yl,this.version=0},[{key:"onUploadCallback",value:function(){}},{key:"needsUpdate",set:function(e){!0===e&&this.version++}},{key:"setUsage",value:function(e){return this.usage=e,this}},{key:"addUpdateRange",value:function(e,t){this.updateRanges.push({start:e,count:t})}},{key:"clearUpdateRanges",value:function(){this.updateRanges.length=0}},{key:"copy",value:function(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}},{key:"copyAt",value:function(e,t,n){e*=this.itemSize,n*=t.itemSize;for(var r=0,i=this.itemSize;r1&&void 0!==arguments[1]?arguments[1]:0;return this.array.set(e,t),this}},{key:"getComponent",value:function(e,t){var n=this.array[e*this.itemSize+t];return this.normalized&&(n=Bc(n,this.array)),n}},{key:"setComponent",value:function(e,t,n){return this.normalized&&(n=Uc(n,this.array)),this.array[e*this.itemSize+t]=n,this}},{key:"getX",value:function(e){var t=this.array[e*this.itemSize];return this.normalized&&(t=Bc(t,this.array)),t}},{key:"setX",value:function(e,t){return this.normalized&&(t=Uc(t,this.array)),this.array[e*this.itemSize]=t,this}},{key:"getY",value:function(e){var t=this.array[e*this.itemSize+1];return this.normalized&&(t=Bc(t,this.array)),t}},{key:"setY",value:function(e,t){return this.normalized&&(t=Uc(t,this.array)),this.array[e*this.itemSize+1]=t,this}},{key:"getZ",value:function(e){var t=this.array[e*this.itemSize+2];return this.normalized&&(t=Bc(t,this.array)),t}},{key:"setZ",value:function(e,t){return this.normalized&&(t=Uc(t,this.array)),this.array[e*this.itemSize+2]=t,this}},{key:"getW",value:function(e){var t=this.array[e*this.itemSize+3];return this.normalized&&(t=Bc(t,this.array)),t}},{key:"setW",value:function(e,t){return this.normalized&&(t=Uc(t,this.array)),this.array[e*this.itemSize+3]=t,this}},{key:"setXY",value:function(e,t,n){return e*=this.itemSize,this.normalized&&(t=Uc(t,this.array),n=Uc(n,this.array)),this.array[e+0]=t,this.array[e+1]=n,this}},{key:"setXYZ",value:function(e,t,n,r){return e*=this.itemSize,this.normalized&&(t=Uc(t,this.array),n=Uc(n,this.array),r=Uc(r,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this}},{key:"setXYZW",value:function(e,t,n,r,i){return e*=this.itemSize,this.normalized&&(t=Uc(t,this.array),n=Uc(n,this.array),r=Uc(r,this.array),i=Uc(i,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this.array[e+3]=i,this}},{key:"onUpload",value:function(e){return this.onUploadCallback=e,this}},{key:"clone",value:function(){return new this.constructor(this.array,this.itemSize).copy(this)}},{key:"toJSON",value:function(){var e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return""!==this.name&&(e.name=this.name),this.usage!==wc&&(e.usage=this.usage),e}}])}(),Xd=function(e){function t(e,n,r){return A(this,t),y(this,t,[new Uint16Array(e),n,r])}return x(t,e),T(t)}(qd),Yd=function(e){function t(e,n,r){return A(this,t),y(this,t,[new Uint32Array(e),n,r])}return x(t,e),T(t)}(qd),Kd=function(e){function t(e,n,r){return A(this,t),y(this,t,[new Float32Array(e),n,r])}return x(t,e),T(t)}(qd),Zd=0,Jd=new Gh,$d=new gd,ef=new ph,tf=new gh,nf=new gh,rf=new ph,af=function(e){function t(){var e;return A(this,t),(e=y(this,t)).isBufferGeometry=!0,Object.defineProperty(e,"id",{value:Zd++}),e.uuid=Lc(),e.name="",e.type="BufferGeometry",e.index=null,e.indirect=null,e.attributes={},e.morphAttributes={},e.morphTargetsRelative=!1,e.groups=[],e.boundingBox=null,e.boundingSphere=null,e.drawRange={start:0,count:1/0},e.userData={},e}return x(t,e),T(t,[{key:"getIndex",value:function(){return this.index}},{key:"setIndex",value:function(e){return Array.isArray(e)?this.index=new(Gc(e)?Yd:Xd)(e,1):this.index=e,this}},{key:"setIndirect",value:function(e){return this.indirect=e,this}},{key:"getIndirect",value:function(){return this.indirect}},{key:"getAttribute",value:function(e){return this.attributes[e]}},{key:"setAttribute",value:function(e,t){return this.attributes[e]=t,this}},{key:"deleteAttribute",value:function(e){return delete this.attributes[e],this}},{key:"hasAttribute",value:function(e){return void 0!==this.attributes[e]}},{key:"addGroup",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;this.groups.push({start:e,count:t,materialIndex:n})}},{key:"clearGroups",value:function(){this.groups=[]}},{key:"setDrawRange",value:function(e,t){this.drawRange.start=e,this.drawRange.count=t}},{key:"applyMatrix4",value:function(e){var t=this.attributes.position;void 0!==t&&(t.applyMatrix4(e),t.needsUpdate=!0);var n=this.attributes.normal;if(void 0!==n){var r=(new Hc).getNormalMatrix(e);n.applyNormalMatrix(r),n.needsUpdate=!0}var i=this.attributes.tangent;return void 0!==i&&(i.transformDirection(e),i.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}},{key:"applyQuaternion",value:function(e){return Jd.makeRotationFromQuaternion(e),this.applyMatrix4(Jd),this}},{key:"rotateX",value:function(e){return Jd.makeRotationX(e),this.applyMatrix4(Jd),this}},{key:"rotateY",value:function(e){return Jd.makeRotationY(e),this.applyMatrix4(Jd),this}},{key:"rotateZ",value:function(e){return Jd.makeRotationZ(e),this.applyMatrix4(Jd),this}},{key:"translate",value:function(e,t,n){return Jd.makeTranslation(e,t,n),this.applyMatrix4(Jd),this}},{key:"scale",value:function(e,t,n){return Jd.makeScale(e,t,n),this.applyMatrix4(Jd),this}},{key:"lookAt",value:function(e){return $d.lookAt(e),$d.updateMatrix(),this.applyMatrix4($d.matrix),this}},{key:"center",value:function(){return this.computeBoundingBox(),this.boundingBox.getCenter(ef).negate(),this.translate(ef.x,ef.y,ef.z),this}},{key:"setFromPoints",value:function(e){var t=this.getAttribute("position");if(void 0===t){for(var n=[],r=0,i=e.length;rt.count&&console.warn("THREE.BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}},{key:"computeBoundingBox",value:function(){null===this.boundingBox&&(this.boundingBox=new gh);var e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute)return console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),void this.boundingBox.set(new ph(-1/0,-1/0,-1/0),new ph(1/0,1/0,1/0));if(void 0!==e){if(this.boundingBox.setFromBufferAttribute(e),t)for(var n=0,r=t.length;n0&&(e.userData=this.userData),void 0!==this.parameters){var t=this.parameters;for(var n in t)void 0!==t[n]&&(e[n]=t[n]);return e}e.data={attributes:{}};var r=this.index;null!==r&&(e.data.index={type:r.array.constructor.name,array:Array.prototype.slice.call(r.array)});var i=this.attributes;for(var a in i){var o=i[a];e.data.attributes[a]=o.toJSON(e.data)}var s={},u=!1;for(var l in this.morphAttributes){for(var c=this.morphAttributes[l],h=[],d=0,f=c.length;d0&&(s[l]=h,u=!0)}u&&(e.data.morphAttributes=s,e.data.morphTargetsRelative=this.morphTargetsRelative);var v=this.groups;v.length>0&&(e.data.groups=JSON.parse(JSON.stringify(v)));var m=this.boundingSphere;return null!==m&&(e.data.boundingSphere={center:m.center.toArray(),radius:m.radius}),e}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"copy",value:function(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;var t={};this.name=e.name;var n=e.index;null!==n&&this.setIndex(n.clone(t));var r=e.attributes;for(var i in r){var a=r[i];this.setAttribute(i,a.clone(t))}var o=e.morphAttributes;for(var s in o){for(var u=[],l=o[s],c=0,h=l.length;c0&&void 0!==arguments[0]?arguments[0]:new af,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new zd;return A(this,t),(e=y(this,t)).isMesh=!0,e.type="Mesh",e.geometry=n,e.material=r,e.updateMorphTargets(),e}return x(t,e),T(t,[{key:"copy",value:function(e,r){return n(t,"copy",this,3)([e,r]),void 0!==e.morphTargetInfluences&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),void 0!==e.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}},{key:"updateMorphTargets",value:function(){var e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){var n=e[t[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var r=0,i=n.length;rMath.pow(e.far-e.near,2))return}of.copy(i).invert(),sf.copy(e.ray).applyMatrix4(of),null!==n.boundingBox&&!1===sf.intersectsBox(n.boundingBox)||this._computeIntersections(e,t,sf)}}},{key:"_computeIntersections",value:function(e,t,n){var r,i=this.geometry,a=this.material,o=i.index,s=i.attributes.position,u=i.attributes.uv,l=i.attributes.uv1,c=i.attributes.normal,h=i.groups,d=i.drawRange;if(null!==o)if(Array.isArray(a))for(var f=0,p=h.length;fn.far?null:{distance:u,point:mf.clone(),object:e}}(e,t,n,r,cf,hf,df,vf);if(c){var h=new ph;Id.getBarycoord(vf,cf,hf,df,h),i&&(c.uv=Id.getInterpolatedAttribute(i,s,u,l,h,new Vc)),a&&(c.uv1=Id.getInterpolatedAttribute(a,s,u,l,h,new Vc)),o&&(c.normal=Id.getInterpolatedAttribute(o,s,u,l,h,new ph),c.normal.dot(r.direction)>0&&c.normal.multiplyScalar(-1));var d={a:s,b:u,c:l,normal:new ph,materialIndex:0};Id.getNormal(cf,hf,df,d.normal),c.face=d,c.barycoord=h}return c}var _f=function(e){function t(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1;A(this,t),(e=y(this,t)).type="BoxGeometry",e.parameters={width:n,height:r,depth:i,widthSegments:a,heightSegments:o,depthSegments:s};var u=e;a=Math.floor(a),o=Math.floor(o),s=Math.floor(s);var l=[],c=[],h=[],d=[],f=0,p=0;function v(e,t,n,r,i,a,o,s,v,m,g){for(var y=a/v,_=o/m,b=a/2,x=o/2,S=s/2,A=v+1,w=m+1,T=0,M=0,E=new ph,C=0;C0?1:-1,h.push(E.x,E.y,E.z),d.push(R/v),d.push(1-C/m),T+=1}for(var N=0;N0&&(r.defines=this.defines),r.vertexShader=this.vertexShader,r.fragmentShader=this.fragmentShader,r.lights=this.lights,r.clipping=this.clipping;var o={};for(var s in this.extensions)!0===this.extensions[s]&&(o[s]=!0);return Object.keys(o).length>0&&(r.extensions=o),r}}])}(Ud),Tf=function(e){function t(){var e;return A(this,t),(e=y(this,t)).isCamera=!0,e.type="Camera",e.matrixWorldInverse=new Gh,e.projectionMatrix=new Gh,e.projectionMatrixInverse=new Gh,e.coordinateSystem=Ec,e}return x(t,e),T(t,[{key:"copy",value:function(e,r){return n(t,"copy",this,3)([e,r]),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}},{key:"getWorldDirection",value:function(e){return n(t,"getWorldDirection",this,3)([e]).negate()}},{key:"updateMatrixWorld",value:function(e){n(t,"updateMatrixWorld",this,3)([e]),this.matrixWorldInverse.copy(this.matrixWorld).invert()}},{key:"updateWorldMatrix",value:function(e,r){n(t,"updateWorldMatrix",this,3)([e,r]),this.matrixWorldInverse.copy(this.matrixWorld).invert()}},{key:"clone",value:function(){return(new this.constructor).copy(this)}}])}(gd),Mf=new ph,Ef=new Vc,Cf=new Vc,kf=function(e){function t(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:50,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.1,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:2e3;return A(this,t),(e=y(this,t)).isPerspectiveCamera=!0,e.type="PerspectiveCamera",e.fov=n,e.zoom=1,e.near=i,e.far=a,e.focus=10,e.aspect=r,e.view=null,e.filmGauge=35,e.filmOffset=0,e.updateProjectionMatrix(),e}return x(t,e),T(t,[{key:"copy",value:function(e,r){return n(t,"copy",this,3)([e,r]),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=null===e.view?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}},{key:"setFocalLength",value:function(e){var t=.5*this.getFilmHeight()/e;this.fov=2*Pc*Math.atan(t),this.updateProjectionMatrix()}},{key:"getFocalLength",value:function(){var e=Math.tan(.5*Nc*this.fov);return.5*this.getFilmHeight()/e}},{key:"getEffectiveFOV",value:function(){return 2*Pc*Math.atan(Math.tan(.5*Nc*this.fov)/this.zoom)}},{key:"getFilmWidth",value:function(){return this.filmGauge*Math.min(this.aspect,1)}},{key:"getFilmHeight",value:function(){return this.filmGauge/Math.max(this.aspect,1)}},{key:"getViewBounds",value:function(e,t,n){Mf.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(Mf.x,Mf.y).multiplyScalar(-e/Mf.z),Mf.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(Mf.x,Mf.y).multiplyScalar(-e/Mf.z)}},{key:"getViewSize",value:function(e,t){return this.getViewBounds(e,Ef,Cf),t.subVectors(Cf,Ef)}},{key:"setViewOffset",value:function(e,t,n,r,i,a){this.aspect=e/t,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=i,this.view.height=a,this.updateProjectionMatrix()}},{key:"clearViewOffset",value:function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}},{key:"updateProjectionMatrix",value:function(){var e=this.near,t=e*Math.tan(.5*Nc*this.fov)/this.zoom,n=2*t,r=this.aspect*n,i=-.5*r,a=this.view;if(null!==this.view&&this.view.enabled){var o=a.fullWidth,s=a.fullHeight;i+=a.offsetX*r/o,t-=a.offsetY*n/s,r*=a.width/o,n*=a.height/s}var u=this.filmOffset;0!==u&&(i+=e*u/this.getFilmWidth()),this.projectionMatrix.makePerspective(i,i+r,t,t-n,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}},{key:"toJSON",value:function(e){var r=n(t,"toJSON",this,3)([e]);return r.object.fov=this.fov,r.object.zoom=this.zoom,r.object.near=this.near,r.object.far=this.far,r.object.focus=this.focus,r.object.aspect=this.aspect,null!==this.view&&(r.object.view=Object.assign({},this.view)),r.object.filmGauge=this.filmGauge,r.object.filmOffset=this.filmOffset,r}}])}(Tf),Rf=-90,If=function(e){function t(e,n,r){var i;A(this,t),(i=y(this,t)).type="CubeCamera",i.renderTarget=r,i.coordinateSystem=null,i.activeMipmapLevel=0;var a=new kf(Rf,1,e,n);a.layers=i.layers,i.add(a);var o=new kf(Rf,1,e,n);o.layers=i.layers,i.add(o);var s=new kf(Rf,1,e,n);s.layers=i.layers,i.add(s);var u=new kf(Rf,1,e,n);u.layers=i.layers,i.add(u);var l=new kf(Rf,1,e,n);l.layers=i.layers,i.add(l);var c=new kf(Rf,1,e,n);return c.layers=i.layers,i.add(c),i}return x(t,e),T(t,[{key:"updateCoordinateSystem",value:function(){var e,t=this.coordinateSystem,n=this.children.concat(),r=C(n,6),i=r[0],a=r[1],o=r[2],s=r[3],u=r[4],l=r[5],c=L(n);try{for(c.s();!(e=c.n()).done;){var h=e.value;this.remove(h)}}catch(v){c.e(v)}finally{c.f()}if(t===Ec)i.up.set(0,1,0),i.lookAt(1,0,0),a.up.set(0,1,0),a.lookAt(-1,0,0),o.up.set(0,0,-1),o.lookAt(0,1,0),s.up.set(0,0,1),s.lookAt(0,-1,0),u.up.set(0,1,0),u.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else{if(t!==Cc)throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+t);i.up.set(0,-1,0),i.lookAt(-1,0,0),a.up.set(0,-1,0),a.lookAt(1,0,0),o.up.set(0,0,1),o.lookAt(0,1,0),s.up.set(0,0,-1),s.lookAt(0,-1,0),u.up.set(0,-1,0),u.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1)}var d,f=L(n);try{for(f.s();!(d=f.n()).done;){var p=d.value;this.add(p),p.updateMatrixWorld()}}catch(v){f.e(v)}finally{f.f()}}},{key:"update",value:function(e,t){null===this.parent&&this.updateMatrixWorld();var n=this.renderTarget,r=this.activeMipmapLevel;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());var i=C(this.children,6),a=i[0],o=i[1],s=i[2],u=i[3],l=i[4],c=i[5],h=e.getRenderTarget(),d=e.getActiveCubeFace(),f=e.getActiveMipmapLevel(),p=e.xr.enabled;e.xr.enabled=!1;var v=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0,r),e.render(t,a),e.setRenderTarget(n,1,r),e.render(t,o),e.setRenderTarget(n,2,r),e.render(t,s),e.setRenderTarget(n,3,r),e.render(t,u),e.setRenderTarget(n,4,r),e.render(t,l),n.texture.generateMipmaps=v,e.setRenderTarget(n,5,r),e.render(t,c),e.setRenderTarget(h,d,f),e.xr.enabled=p,n.texture.needsPMREMUpdate=!0}}])}(gd),Nf=function(e){function t(e,n,r,i,a,o,s,u,l,c){var h;return A(this,t),(h=y(this,t,[e=void 0!==e?e:[],n=void 0!==n?n:tl,r,i,a,o,s,u,l,c])).isCubeTexture=!0,h.flipY=!1,h}return x(t,e),T(t,[{key:"images",get:function(){return this.image},set:function(e){this.image=e}}])}(sh),Pf=function(e){function t(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};A(this,t),(e=y(this,t,[n,n,r])).isWebGLCubeRenderTarget=!0;var i={width:n,height:n,depth:1},a=[i,i,i,i,i,i];return e.texture=new Nf(a,r.mapping,r.wrapS,r.wrapT,r.magFilter,r.minFilter,r.format,r.type,r.anisotropy,r.colorSpace),e.texture.isRenderTargetTexture=!0,e.texture.generateMipmaps=void 0!==r.generateMipmaps&&r.generateMipmaps,e.texture.minFilter=void 0!==r.minFilter?r.minFilter:ll,e}return x(t,e),T(t,[{key:"fromEquirectangularTexture",value:function(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;var n={tEquirect:{value:null}},r="\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t\t#include \n\t\t\t\t\t#include \n\n\t\t\t\t}\n\t\t\t",i="\n\n\t\t\t\tuniform sampler2D tEquirect;\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\t#include \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",a=new _f(5,5,5),o=new wf({name:"CubemapFromEquirect",uniforms:bf(n),vertexShader:r,fragmentShader:i,side:1,blending:0});o.uniforms.tEquirect.value=t;var s=new gf(a,o),u=t.minFilter;return t.minFilter===hl&&(t.minFilter=ll),new If(1,10,this).update(e,s),t.minFilter=u,s.geometry.dispose(),s.material.dispose(),this}},{key:"clear",value:function(e,t,n,r){for(var i=e.getRenderTarget(),a=0;a<6;a++)e.setRenderTarget(this,a),e.clear(t,n,r);e.setRenderTarget(i)}}])}(ch),Lf=function(e){function t(){var e;return A(this,t),(e=y(this,t)).isGroup=!0,e.type="Group",e}return x(t,e),T(t)}(gd),Df={type:"move"},Of=function(){return T(function e(){A(this,e),this._targetRay=null,this._grip=null,this._hand=null},[{key:"getHandSpace",value:function(){return null===this._hand&&(this._hand=new Lf,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}},{key:"getTargetRaySpace",value:function(){return null===this._targetRay&&(this._targetRay=new Lf,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new ph,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new ph),this._targetRay}},{key:"getGripSpace",value:function(){return null===this._grip&&(this._grip=new Lf,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new ph,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new ph),this._grip}},{key:"dispatchEvent",value:function(e){return null!==this._targetRay&&this._targetRay.dispatchEvent(e),null!==this._grip&&this._grip.dispatchEvent(e),null!==this._hand&&this._hand.dispatchEvent(e),this}},{key:"connect",value:function(e){if(e&&e.hand){var t=this._hand;if(t){var n,r=L(e.hand.values());try{for(r.s();!(n=r.n()).done;){var i=n.value;this._getHandJoint(t,i)}}catch(a){r.e(a)}finally{r.f()}}}return this.dispatchEvent({type:"connected",data:e}),this}},{key:"disconnect",value:function(e){return this.dispatchEvent({type:"disconnected",data:e}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this}},{key:"update",value:function(e,t,n){var r=null,i=null,a=null,o=this._targetRay,s=this._grip,u=this._hand;if(e&&"visible-blurred"!==t.session.visibilityState){if(u&&e.hand){a=!0;var l,c=L(e.hand.values());try{for(c.s();!(l=c.n()).done;){var h=l.value,d=t.getJointPose(h,n),f=this._getHandJoint(u,h);null!==d&&(f.matrix.fromArray(d.transform.matrix),f.matrix.decompose(f.position,f.rotation,f.scale),f.matrixWorldNeedsUpdate=!0,f.jointRadius=d.radius),f.visible=null!==d}}catch(g){c.e(g)}finally{c.f()}var p=u.joints["index-finger-tip"],v=u.joints["thumb-tip"],m=p.position.distanceTo(v.position);u.inputState.pinching&&m>.025?(u.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!u.inputState.pinching&&m<=.015&&(u.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else null!==s&&e.gripSpace&&null!==(i=t.getPose(e.gripSpace,n))&&(s.matrix.fromArray(i.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale),s.matrixWorldNeedsUpdate=!0,i.linearVelocity?(s.hasLinearVelocity=!0,s.linearVelocity.copy(i.linearVelocity)):s.hasLinearVelocity=!1,i.angularVelocity?(s.hasAngularVelocity=!0,s.angularVelocity.copy(i.angularVelocity)):s.hasAngularVelocity=!1);null!==o&&(null===(r=t.getPose(e.targetRaySpace,n))&&null!==i&&(r=i),null!==r&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,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(Df)))}return null!==o&&(o.visible=null!==r),null!==s&&(s.visible=null!==i),null!==u&&(u.visible=null!==a),this}},{key:"_getHandJoint",value:function(e,t){if(void 0===e.joints[t.jointName]){var n=new Lf;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}])}(),Ff=function(e){function t(){var e;return A(this,t),(e=y(this,t)).isScene=!0,e.type="Scene",e.background=null,e.environment=null,e.fog=null,e.backgroundBlurriness=0,e.backgroundIntensity=1,e.backgroundRotation=new ed,e.environmentIntensity=1,e.environmentRotation=new ed,e.overrideMaterial=null,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:e})),e}return x(t,e),T(t,[{key:"copy",value:function(e,r){return n(t,"copy",this,3)([e,r]),null!==e.background&&(this.background=e.background.clone()),null!==e.environment&&(this.environment=e.environment.clone()),null!==e.fog&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),null!==e.overrideMaterial&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}},{key:"toJSON",value:function(e){var r=n(t,"toJSON",this,3)([e]);return null!==this.fog&&(r.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(r.object.backgroundBlurriness=this.backgroundBlurriness),1!==this.backgroundIntensity&&(r.object.backgroundIntensity=this.backgroundIntensity),r.object.backgroundRotation=this.backgroundRotation.toArray(),1!==this.environmentIntensity&&(r.object.environmentIntensity=this.environmentIntensity),r.object.environmentRotation=this.environmentRotation.toArray(),r}}])}(gd),Bf=function(){return T(function e(t,n){A(this,e),this.isInterleavedBuffer=!0,this.array=t,this.stride=n,this.count=void 0!==t?t.length/n:0,this.usage=wc,this.updateRanges=[],this.version=0,this.uuid=Lc()},[{key:"onUploadCallback",value:function(){}},{key:"needsUpdate",set:function(e){!0===e&&this.version++}},{key:"setUsage",value:function(e){return this.usage=e,this}},{key:"addUpdateRange",value:function(e,t){this.updateRanges.push({start:e,count:t})}},{key:"clearUpdateRanges",value:function(){this.updateRanges.length=0}},{key:"copy",value:function(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}},{key:"copyAt",value:function(e,t,n){e*=this.stride,n*=t.stride;for(var r=0,i=this.stride;r1&&void 0!==arguments[1]?arguments[1]:0;return this.array.set(e,t),this}},{key:"clone",value:function(e){void 0===e.arrayBuffers&&(e.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=Lc()),void 0===e.arrayBuffers[this.array.buffer._uuid]&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);var t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(t,this.stride);return n.setUsage(this.usage),n}},{key:"onUpload",value:function(e){return this.onUploadCallback=e,this}},{key:"toJSON",value:function(e){return void 0===e.arrayBuffers&&(e.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=Lc()),void 0===e.arrayBuffers[this.array.buffer._uuid]&&(e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}])}(),Uf=new ph,zf=function(){function e(t,n,r){var i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];A(this,e),this.isInterleavedBufferAttribute=!0,this.name="",this.data=t,this.itemSize=n,this.offset=r,this.normalized=i}return T(e,[{key:"count",get:function(){return this.data.count}},{key:"array",get:function(){return this.data.array}},{key:"needsUpdate",set:function(e){this.data.needsUpdate=e}},{key:"applyMatrix4",value:function(e){for(var t=0,n=this.data.count;t0&&void 0!==arguments[0]?arguments[0]:null,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,a=arguments.length>3?arguments[3]:void 0,o=arguments.length>4?arguments[4]:void 0,s=arguments.length>5?arguments[5]:void 0,u=arguments.length>6?arguments[6]:void 0,l=arguments.length>7?arguments[7]:void 0,c=arguments.length>8&&void 0!==arguments[8]?arguments[8]:sl,h=arguments.length>9&&void 0!==arguments[9]?arguments[9]:sl,d=arguments.length>10?arguments[10]:void 0,f=arguments.length>11?arguments[11]:void 0;return A(this,t),(e=y(this,t,[null,s,u,l,c,h,a,o,d,f])).isDataTexture=!0,e.image={data:n,width:r,height:i},e.generateMipmaps=!1,e.flipY=!1,e.unpackAlignment=1,e}return x(t,e),T(t)}(sh),$f=new Gh,ep=new Gh,tp=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];A(this,e),this.uuid=Lc(),this.bones=t.slice(0),this.boneInverses=n,this.boneMatrices=null,this.boneTexture=null,this.init()}return T(e,[{key:"init",value:function(){var e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(16*e.length),0===t.length)this.calculateInverses();else if(e.length!==t.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(var n=0,r=this.bones.length;n3&&void 0!==arguments[3]?arguments[3]:1;return A(this,t),(i=y(this,t,[e,n,r])).isInstancedBufferAttribute=!0,i.meshPerAttribute=a,i}return x(t,e),T(t,[{key:"copy",value:function(e){return n(t,"copy",this,3)([e]),this.meshPerAttribute=e.meshPerAttribute,this}},{key:"toJSON",value:function(){var e=n(t,"toJSON",this,3)([]);return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}])}(qd),rp=new Gh,ip=new Gh,ap=[],op=new gh,sp=new Gh,up=new gf,lp=new Dh,cp=function(e){function t(e,n,r){var i;A(this,t),(i=y(this,t,[e,n])).isInstancedMesh=!0,i.instanceMatrix=new np(new Float32Array(16*r),16),i.instanceColor=null,i.morphTexture=null,i.count=r,i.boundingBox=null,i.boundingSphere=null;for(var a=0;a0&&void 0!==arguments[0]?arguments[0]:new ph(1,0,0),n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;A(this,e),this.isPlane=!0,this.normal=t,this.constant=n},[{key:"set",value:function(e,t){return this.normal.copy(e),this.constant=t,this}},{key:"setComponents",value:function(e,t,n,r){return this.normal.set(e,t,n),this.constant=r,this}},{key:"setFromNormalAndCoplanarPoint",value:function(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}},{key:"setFromCoplanarPoints",value:function(e,t,n){var r=hp.subVectors(n,t).cross(dp.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this}},{key:"copy",value:function(e){return this.normal.copy(e.normal),this.constant=e.constant,this}},{key:"normalize",value:function(){var e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}},{key:"negate",value:function(){return this.constant*=-1,this.normal.negate(),this}},{key:"distanceToPoint",value:function(e){return this.normal.dot(e)+this.constant}},{key:"distanceToSphere",value:function(e){return this.distanceToPoint(e.center)-e.radius}},{key:"projectPoint",value:function(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}},{key:"intersectLine",value:function(e,t){var n=e.delta(hp),r=this.normal.dot(n);if(0===r)return 0===this.distanceToPoint(e.start)?t.copy(e.start):null;var i=-(e.start.dot(this.normal)+this.constant)/r;return i<0||i>1?null:t.copy(e.start).addScaledVector(n,i)}},{key:"intersectsLine",value:function(e){var t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}},{key:"intersectsBox",value:function(e){return e.intersectsPlane(this)}},{key:"intersectsSphere",value:function(e){return e.intersectsPlane(this)}},{key:"coplanarPoint",value:function(e){return e.copy(this.normal).multiplyScalar(-this.constant)}},{key:"applyMatrix4",value:function(e,t){var n=t||fp.getNormalMatrix(e),r=this.coplanarPoint(hp).applyMatrix4(e),i=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(i),this}},{key:"translate",value:function(e){return this.constant-=e.dot(this.normal),this}},{key:"equals",value:function(e){return e.normal.equals(this.normal)&&e.constant===this.constant}},{key:"clone",value:function(){return(new this.constructor).copy(this)}}])}(),vp=new Dh,mp=new ph,gp=function(){return T(function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new pp,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new pp,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new pp,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:new pp,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:new pp,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:new pp;A(this,e),this.planes=[t,n,r,i,a,o]},[{key:"set",value:function(e,t,n,r,i,a){var o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(r),o[4].copy(i),o[5].copy(a),this}},{key:"copy",value:function(e){for(var t=this.planes,n=0;n<6;n++)t[n].copy(e.planes[n]);return this}},{key:"setFromProjectionMatrix",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ec,n=this.planes,r=e.elements,i=r[0],a=r[1],o=r[2],s=r[3],u=r[4],l=r[5],c=r[6],h=r[7],d=r[8],f=r[9],p=r[10],v=r[11],m=r[12],g=r[13],y=r[14],_=r[15];if(n[0].setComponents(s-i,h-u,v-d,_-m).normalize(),n[1].setComponents(s+i,h+u,v+d,_+m).normalize(),n[2].setComponents(s+a,h+l,v+f,_+g).normalize(),n[3].setComponents(s-a,h-l,v-f,_-g).normalize(),n[4].setComponents(s-o,h-c,v-p,_-y).normalize(),t===Ec)n[5].setComponents(s+o,h+c,v+p,_+y).normalize();else{if(t!==Cc)throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);n[5].setComponents(o,c,p,y).normalize()}return this}},{key:"intersectsObject",value:function(e){if(void 0!==e.boundingSphere)null===e.boundingSphere&&e.computeBoundingSphere(),vp.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{var t=e.geometry;null===t.boundingSphere&&t.computeBoundingSphere(),vp.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(vp)}},{key:"intersectsSprite",value:function(e){return vp.center.set(0,0,0),vp.radius=.7071067811865476,vp.applyMatrix4(e.matrixWorld),this.intersectsSphere(vp)}},{key:"intersectsSphere",value:function(e){for(var t=this.planes,n=e.center,r=-e.radius,i=0;i<6;i++){if(t[i].distanceToPoint(n)0?e.max.x:e.min.x,mp.y=r.normal.y>0?e.max.y:e.min.y,mp.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(mp)<0)return!1}return!0}},{key:"containsPoint",value:function(e){for(var t=this.planes,n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}},{key:"clone",value:function(){return(new this.constructor).copy(this)}}])}(),yp=function(e){function t(e){var n;return A(this,t),(n=y(this,t)).isLineBasicMaterial=!0,n.type="LineBasicMaterial",n.color=new Od(16777215),n.map=null,n.linewidth=1,n.linecap="round",n.linejoin="round",n.fog=!0,n.setValues(e),n}return x(t,e),T(t,[{key:"copy",value:function(e){return n(t,"copy",this,3)([e]),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}])}(Ud),_p=new ph,bp=new ph,xp=new Gh,Sp=new Wh,Ap=new Dh,wp=new ph,Tp=new ph,Mp=function(e){function t(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new af,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new yp;return A(this,t),(e=y(this,t)).isLine=!0,e.type="Line",e.geometry=n,e.material=r,e.updateMorphTargets(),e}return x(t,e),T(t,[{key:"copy",value:function(e,r){return n(t,"copy",this,3)([e,r]),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}},{key:"computeLineDistances",value:function(){var e=this.geometry;if(null===e.index){for(var t=e.attributes.position,n=[0],r=1,i=t.count;r0){var n=e[t[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var r=0,i=n.length;rr)){wp.applyMatrix4(e.matrixWorld);var u=t.ray.origin.distanceTo(wp);if(!(ut.far))return{distance:u,point:Tp.clone().applyMatrix4(e.matrixWorld),index:o,face:null,faceIndex:null,barycoord:null,object:e}}}var Cp=new ph,kp=new ph,Rp=function(e){function t(e,n){var r;return A(this,t),(r=y(this,t,[e,n])).isLineSegments=!0,r.type="LineSegments",r}return x(t,e),T(t,[{key:"computeLineDistances",value:function(){var e=this.geometry;if(null===e.index){for(var t=e.attributes.position,n=[],r=0,i=t.count;r0&&void 0!==arguments[0]?arguments[0]:new af,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Np;return A(this,t),(e=y(this,t)).isPoints=!0,e.type="Points",e.geometry=n,e.material=r,e.updateMorphTargets(),e}return x(t,e),T(t,[{key:"copy",value:function(e,r){return n(t,"copy",this,3)([e,r]),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}},{key:"raycast",value:function(e,t){var n=this.geometry,r=this.matrixWorld,i=e.params.Points.threshold,a=n.drawRange;if(null===n.boundingSphere&&n.computeBoundingSphere(),Dp.copy(n.boundingSphere),Dp.applyMatrix4(r),Dp.radius+=i,!1!==e.ray.intersectsSphere(Dp)){Pp.copy(r).invert(),Lp.copy(e.ray).applyMatrix4(Pp);var o=i/((this.scale.x+this.scale.y+this.scale.z)/3),s=o*o,u=n.index,l=n.attributes.position;if(null!==u)for(var c=Math.max(0,a.start),h=Math.min(u.count,a.start+a.count);c0){var n=e[t[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var r=0,i=n.length;ri.far)return;a.push({distance:l,distanceToRay:Math.sqrt(s),point:u,index:t,face:null,faceIndex:null,barycoord:null,object:o})}}var Up=function(e){function t(e,n){var r;return A(this,t),(r=y(this,t,[{width:e,height:n}])).isFramebufferTexture=!0,r.magFilter=sl,r.minFilter=sl,r.generateMipmaps=!1,r.needsUpdate=!0,r}return x(t,e),T(t)}(sh),zp=function(e){function t(e,n,r,i,a,o,s,u,l){var c,h=arguments.length>9&&void 0!==arguments[9]?arguments[9]:Tl;if(A(this,t),h!==Tl&&h!==Ml)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");return void 0===r&&h===Tl&&(r=gl),void 0===r&&h===Ml&&(r=Sl),(c=y(this,t,[null,i,a,o,s,u,h,r,l])).isDepthTexture=!0,c.image={width:e,height:n},c.magFilter=void 0!==s?s:sl,c.minFilter=void 0!==u?u:sl,c.flipY=!1,c.generateMipmaps=!1,c.compareFunction=null,c}return x(t,e),T(t,[{key:"copy",value:function(e){return n(t,"copy",this,3)([e]),this.compareFunction=e.compareFunction,this}},{key:"toJSON",value:function(e){var r=n(t,"toJSON",this,3)([e]);return null!==this.compareFunction&&(r.compareFunction=this.compareFunction),r}}])}(sh),Vp=function(e){function t(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:32,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,s=arguments.length>5&&void 0!==arguments[5]&&arguments[5],u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,l=arguments.length>7&&void 0!==arguments[7]?arguments[7]:2*Math.PI;A(this,t),(e=y(this,t)).type="CylinderGeometry",e.parameters={radiusTop:n,radiusBottom:r,height:i,radialSegments:a,heightSegments:o,openEnded:s,thetaStart:u,thetaLength:l};var c=e;a=Math.floor(a),o=Math.floor(o);var h=[],d=[],f=[],p=[],v=0,m=[],g=i/2,_=0;function b(e){for(var t=v,i=new Vc,o=new ph,s=0,m=!0===e?n:r,y=!0===e?1:-1,b=1;b<=a;b++)d.push(0,g*y,0),f.push(0,y,0),p.push(.5,.5),v++;for(var x=v,S=0;S<=a;S++){var A=S/a*l+u,w=Math.cos(A),T=Math.sin(A);o.x=m*T,o.y=g*y,o.z=m*w,d.push(o.x,o.y,o.z),f.push(0,y,0),i.x=.5*w+.5,i.y=.5*T*y+.5,p.push(i.x,i.y),v++}for(var M=0;M0||0!==R)&&(h.push(I,N,L),s+=3),(r>0||R!==o-1)&&(h.push(N,P,L),s+=3)}c.addGroup(_,s,0),_+=s}(),!1===s&&(n>0&&b(!0),r>0&&b(!1)),e.setIndex(h),e.setAttribute("position",new Kd(d,3)),e.setAttribute("normal",new Kd(f,3)),e.setAttribute("uv",new Kd(p,2)),e}return x(t,e),T(t,[{key:"copy",value:function(e){return n(t,"copy",this,3)([e]),this.parameters=Object.assign({},e.parameters),this}}],[{key:"fromJSON",value:function(e){return new t(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}])}(af),Hp=function(e){function t(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:32,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,o=arguments.length>4&&void 0!==arguments[4]&&arguments[4],s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:2*Math.PI;return A(this,t),(e=y(this,t,[0,n,r,i,a,o,s,u])).type="ConeGeometry",e.parameters={radius:n,height:r,radialSegments:i,heightSegments:a,openEnded:o,thetaStart:s,thetaLength:u},e}return x(t,e),T(t,null,[{key:"fromJSON",value:function(e){return new t(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}])}(Vp),Wp=function(e){function t(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;A(this,t),(e=y(this,t)).type="PlaneGeometry",e.parameters={width:n,height:r,widthSegments:i,heightSegments:a};for(var o=n/2,s=r/2,u=Math.floor(i),l=Math.floor(a),c=u+1,h=l+1,d=n/u,f=r/l,p=[],v=[],m=[],g=[],_=0;_0&&void 0!==arguments[0]?arguments[0]:1,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:32,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:16,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:2*Math.PI,s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:Math.PI;A(this,t),(e=y(this,t)).type="SphereGeometry",e.parameters={radius:n,widthSegments:r,heightSegments:i,phiStart:a,phiLength:o,thetaStart:s,thetaLength:u},r=Math.max(3,Math.floor(r)),i=Math.max(2,Math.floor(i));for(var l=Math.min(s+u,Math.PI),c=0,h=[],d=new ph,f=new ph,p=[],v=[],m=[],g=[],_=0;_<=i;_++){var b=[],x=_/i,S=0;0===_&&0===s?S=.5/r:_===i&&l===Math.PI&&(S=-.5/r);for(var w=0;w<=r;w++){var T=w/r;d.x=-n*Math.cos(a+T*o)*Math.sin(s+x*u),d.y=n*Math.cos(s+x*u),d.z=n*Math.sin(a+T*o)*Math.sin(s+x*u),v.push(d.x,d.y,d.z),f.copy(d).normalize(),m.push(f.x,f.y,f.z),g.push(T+S,1-x),b.push(c++)}h.push(b)}for(var M=0;M0)&&p.push(C,k,I),(M!==i-1||l0!=e>0&&this.version++,this._anisotropy=e}},{key:"clearcoat",get:function(){return this._clearcoat},set:function(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}},{key:"iridescence",get:function(){return this._iridescence},set:function(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}},{key:"dispersion",get:function(){return this._dispersion},set:function(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}},{key:"sheen",get:function(){return this._sheen},set:function(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}},{key:"transmission",get:function(){return this._transmission},set:function(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}},{key:"copy",value:function(e){return n(t,"copy",this,3)([e]),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=I(e.iridescenceThicknessRange),this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}])}(jp),qp=function(e){function t(e){var n;return A(this,t),(n=y(this,t)).isMeshDepthMaterial=!0,n.type="MeshDepthMaterial",n.depthPacking=3200,n.map=null,n.alphaMap=null,n.displacementMap=null,n.displacementScale=1,n.displacementBias=0,n.wireframe=!1,n.wireframeLinewidth=1,n.setValues(e),n}return x(t,e),T(t,[{key:"copy",value:function(e){return n(t,"copy",this,3)([e]),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}])}(Ud),Xp=function(e){function t(e){var n;return A(this,t),(n=y(this,t)).isMeshDistanceMaterial=!0,n.type="MeshDistanceMaterial",n.map=null,n.alphaMap=null,n.displacementMap=null,n.displacementScale=1,n.displacementBias=0,n.setValues(e),n}return x(t,e),T(t,[{key:"copy",value:function(e){return n(t,"copy",this,3)([e]),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}])}(Ud);function Yp(e,t,n){return!e||!n&&e.constructor===t?e:"number"==typeof t.BYTES_PER_ELEMENT?new t(e):Array.prototype.slice.call(e)}function Kp(e){for(var t=e.length,n=new Array(t),r=0;r!==t;++r)n[r]=r;return n.sort(function(t,n){return e[t]-e[n]}),n}function Zp(e,t,n){for(var r=e.length,i=new e.constructor(r),a=0,o=0;o!==r;++a)for(var s=n[a]*t,u=0;u!==t;++u)i[o++]=e[s+u];return i}function Jp(e,t,n,r){for(var i=1,a=e[0];void 0!==a&&void 0===a[r];)a=e[i++];if(void 0!==a){var o=a[r];if(void 0!==o)if(Array.isArray(o))do{void 0!==(o=a[r])&&(t.push(a.time),n.push.apply(n,o)),a=e[i++]}while(void 0!==a);else if(void 0!==o.toArray)do{void 0!==(o=a[r])&&(t.push(a.time),o.toArray(n,n.length)),a=e[i++]}while(void 0!==a);else do{void 0!==(o=a[r])&&(t.push(a.time),n.push(o)),a=e[i++]}while(void 0!==a)}}var $p=function(){return T(function e(t,n,r,i){A(this,e),this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=void 0!==i?i:new n.constructor(r),this.sampleValues=n,this.valueSize=r,this.settings=null,this.DefaultSettings_={}},[{key:"evaluate",value:function(e){var t=this.parameterPositions,n=this._cachedIndex,r=t[n],i=t[n-1];e:{t:{var a;n:{r:if(!(e=i)break e;var s=t[1];e=(i=t[--n-1]))break t}a=n,n=0}for(;n>>1;et;)--a;if(++a,0!==i||a!==r){i>=a&&(i=(a=Math.max(a,1))-1);var o=this.getValueSize();this.times=n.slice(i,a),this.values=this.values.slice(i*o,a*o)}return this}},{key:"validate",value:function(){var e=!0,t=this.getValueSize();t-Math.floor(t)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);var n=this.times,r=this.values,i=n.length;0===i&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);for(var a,o=null,s=0;s!==i;s++){var u=n[s];if("number"==typeof u&&isNaN(u)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,s,u),e=!1;break}if(null!==o&&o>u){console.error("THREE.KeyframeTrack: Out of order keys.",this,s,u,o),e=!1;break}o=u}if(void 0!==r&&(a=r,ArrayBuffer.isView(a)&&!(a instanceof DataView)))for(var l=0,c=r.length;l!==c;++l){var h=r[l];if(isNaN(h)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,l,h),e=!1;break}}return e}},{key:"optimize",value:function(){for(var e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),r=this.getInterpolation()===fc,i=e.length-1,a=1,o=1;o0){e[a]=e[i];for(var g=i*n,y=a*n,_=0;_!==n;++_)t[y+_]=t[g+_];++a}return a!==e.length?(this.times=e.slice(0,a),this.values=t.slice(0,a*n)):(this.times=e,this.values=t),this}},{key:"clone",value:function(){var e=this.times.slice(),t=this.values.slice(),n=new(0,this.constructor)(this.name,e,t);return n.createInterpolant=this.createInterpolant,n}}],[{key:"toJSON",value:function(e){var t,n=e.constructor;if(n.toJSON!==this.toJSON)t=n.toJSON(e);else{t={name:e.name,times:Yp(e.times,Array),values:Yp(e.values,Array)};var r=e.getInterpolation();r!==e.DefaultInterpolation&&(t.interpolation=r)}return t.type=e.ValueTypeName,t}}])}();rv.prototype.TimeBufferType=Float32Array,rv.prototype.ValueBufferType=Float32Array,rv.prototype.DefaultInterpolation=dc;var iv=function(e){function t(e,n,r){return A(this,t),y(this,t,[e,n,r])}return x(t,e),T(t)}(rv);iv.prototype.ValueTypeName="bool",iv.prototype.ValueBufferType=Array,iv.prototype.DefaultInterpolation=hc,iv.prototype.InterpolantFactoryMethodLinear=void 0,iv.prototype.InterpolantFactoryMethodSmooth=void 0;var av=function(e){function t(){return A(this,t),y(this,t,arguments)}return x(t,e),T(t)}(rv);av.prototype.ValueTypeName="color";var ov=function(e){function t(){return A(this,t),y(this,t,arguments)}return x(t,e),T(t)}(rv);ov.prototype.ValueTypeName="number";var sv=function(e){function t(e,n,r,i){return A(this,t),y(this,t,[e,n,r,i])}return x(t,e),T(t,[{key:"interpolate_",value:function(e,t,n,r){for(var i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=(n-t)/(r-t),u=e*o,l=u+o;u!==l;u+=4)fh.slerpFlat(i,0,a,u-o,a,u,s);return i}}])}($p),uv=function(e){function t(){return A(this,t),y(this,t,arguments)}return x(t,e),T(t,[{key:"InterpolantFactoryMethodLinear",value:function(e){return new sv(this.times,this.values,this.getValueSize(),e)}}])}(rv);uv.prototype.ValueTypeName="quaternion",uv.prototype.InterpolantFactoryMethodSmooth=void 0;var lv=function(e){function t(e,n,r){return A(this,t),y(this,t,[e,n,r])}return x(t,e),T(t)}(rv);lv.prototype.ValueTypeName="string",lv.prototype.ValueBufferType=Array,lv.prototype.DefaultInterpolation=hc,lv.prototype.InterpolantFactoryMethodLinear=void 0,lv.prototype.InterpolantFactoryMethodSmooth=void 0;var cv=function(e){function t(){return A(this,t),y(this,t,arguments)}return x(t,e),T(t)}(rv);cv.prototype.ValueTypeName="vector";var hv=function(){return T(function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:gc;A(this,e),this.name=t,this.tracks=r,this.duration=n,this.blendMode=i,this.uuid=Lc(),this.duration<0&&this.resetDuration()},[{key:"resetDuration",value:function(){for(var e=0,t=0,n=this.tracks.length;t!==n;++t){var r=this.tracks[t];e=Math.max(e,r.times[r.times.length-1])}return this.duration=e,this}},{key:"trim",value:function(){for(var e=0;e1){var l=u[1],c=r[l];c||(r[l]=c=[]),c.push(s)}}var h=[];for(var d in r)h.push(this.CreateFromMorphTargetSequence(d,r[d],t,n));return h}},{key:"parseAnimation",value:function(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;for(var n=function(e,t,n,r,i){if(0!==n.length){var a=[],o=[];Jp(n,a,o,r),0!==a.length&&i.push(new e(t,a,o))}},r=[],i=e.name||"default",a=e.fps||30,o=e.blendMode,s=e.length||-1,u=e.hierarchy||[],l=0;l1&&void 0!==arguments[1]?arguments[1]:1;return A(this,t),(n=y(this,t)).isLight=!0,n.type="Light",n.color=new Od(e),n.intensity=r,n}return x(t,e),T(t,[{key:"dispose",value:function(){}},{key:"copy",value:function(e,r){return n(t,"copy",this,3)([e,r]),this.color.copy(e.color),this.intensity=e.intensity,this}},{key:"toJSON",value:function(e){var r=n(t,"toJSON",this,3)([e]);return r.object.color=this.color.getHex(),r.object.intensity=this.intensity,void 0!==this.groundColor&&(r.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(r.object.distance=this.distance),void 0!==this.angle&&(r.object.angle=this.angle),void 0!==this.decay&&(r.object.decay=this.decay),void 0!==this.penumbra&&(r.object.penumbra=this.penumbra),void 0!==this.shadow&&(r.object.shadow=this.shadow.toJSON()),void 0!==this.target&&(r.object.target=this.target.uuid),r}}])}(gd),Av=new Gh,wv=new ph,Tv=new ph,Mv=function(){return T(function e(t){A(this,e),this.camera=t,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Vc(512,512),this.map=null,this.mapPass=null,this.matrix=new Gh,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new gp,this._frameExtents=new Vc(1,1),this._viewportCount=1,this._viewports=[new uh(0,0,1,1)]},[{key:"getViewportCount",value:function(){return this._viewportCount}},{key:"getFrustum",value:function(){return this._frustum}},{key:"updateMatrices",value:function(e){var t=this.camera,n=this.matrix;wv.setFromMatrixPosition(e.matrixWorld),t.position.copy(wv),Tv.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(Tv),t.updateMatrixWorld(),Av.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Av),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(Av)}},{key:"getViewport",value:function(e){return this._viewports[e]}},{key:"getFrameExtents",value:function(){return this._frameExtents}},{key:"dispose",value:function(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}},{key:"copy",value:function(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"toJSON",value:function(){var e={};return 1!==this.intensity&&(e.intensity=this.intensity),0!==this.bias&&(e.bias=this.bias),0!==this.normalBias&&(e.normalBias=this.normalBias),1!==this.radius&&(e.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}])}(),Ev=function(e){function t(){var e;return A(this,t),(e=y(this,t,[new kf(50,1,.5,500)])).isSpotLightShadow=!0,e.focus=1,e}return x(t,e),T(t,[{key:"updateMatrices",value:function(e){var r=this.camera,i=2*Pc*e.angle*this.focus,a=this.mapSize.width/this.mapSize.height,o=e.distance||r.far;i===r.fov&&a===r.aspect&&o===r.far||(r.fov=i,r.aspect=a,r.far=o,r.updateProjectionMatrix()),n(t,"updateMatrices",this,3)([e])}},{key:"copy",value:function(e){return n(t,"copy",this,3)([e]),this.focus=e.focus,this}}])}(Mv),Cv=function(e){function t(e,n){var r,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Math.PI/3,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:2;return A(this,t),(r=y(this,t,[e,n])).isSpotLight=!0,r.type="SpotLight",r.position.copy(gd.DEFAULT_UP),r.updateMatrix(),r.target=new gd,r.distance=i,r.angle=a,r.penumbra=o,r.decay=s,r.map=null,r.shadow=new Ev,r}return x(t,e),T(t,[{key:"power",get:function(){return this.intensity*Math.PI},set:function(e){this.intensity=e/Math.PI}},{key:"dispose",value:function(){this.shadow.dispose()}},{key:"copy",value:function(e,r){return n(t,"copy",this,3)([e,r]),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}])}(Sv),kv=new Gh,Rv=new ph,Iv=new ph,Nv=function(e){function t(){var e;return A(this,t),(e=y(this,t,[new kf(90,1,.5,500)])).isPointLightShadow=!0,e._frameExtents=new Vc(4,2),e._viewportCount=6,e._viewports=[new uh(2,1,1,1),new uh(0,1,1,1),new uh(3,1,1,1),new uh(1,1,1,1),new uh(3,0,1,1),new uh(1,0,1,1)],e._cubeDirections=[new ph(1,0,0),new ph(-1,0,0),new ph(0,0,1),new ph(0,0,-1),new ph(0,1,0),new ph(0,-1,0)],e._cubeUps=[new ph(0,1,0),new ph(0,1,0),new ph(0,1,0),new ph(0,1,0),new ph(0,0,1),new ph(0,0,-1)],e}return x(t,e),T(t,[{key:"updateMatrices",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.camera,r=this.matrix,i=e.distance||n.far;i!==n.far&&(n.far=i,n.updateProjectionMatrix()),Rv.setFromMatrixPosition(e.matrixWorld),n.position.copy(Rv),Iv.copy(n.position),Iv.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt(Iv),n.updateMatrixWorld(),r.makeTranslation(-Rv.x,-Rv.y,-Rv.z),kv.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(kv)}}])}(Mv),Pv=function(e){function t(e,n){var r,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:2;return A(this,t),(r=y(this,t,[e,n])).isPointLight=!0,r.type="PointLight",r.distance=i,r.decay=a,r.shadow=new Nv,r}return x(t,e),T(t,[{key:"power",get:function(){return 4*this.intensity*Math.PI},set:function(e){this.intensity=e/(4*Math.PI)}},{key:"dispose",value:function(){this.shadow.dispose()}},{key:"copy",value:function(e,r){return n(t,"copy",this,3)([e,r]),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}])}(Sv),Lv=function(e){function t(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-1,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:.1,s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:2e3;return A(this,t),(e=y(this,t)).isOrthographicCamera=!0,e.type="OrthographicCamera",e.zoom=1,e.view=null,e.left=n,e.right=r,e.top=i,e.bottom=a,e.near=o,e.far=s,e.updateProjectionMatrix(),e}return x(t,e),T(t,[{key:"copy",value:function(e,r){return n(t,"copy",this,3)([e,r]),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=null===e.view?null:Object.assign({},e.view),this}},{key:"setViewOffset",value:function(e,t,n,r,i,a){null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=i,this.view.height=a,this.updateProjectionMatrix()}},{key:"clearViewOffset",value:function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}},{key:"updateProjectionMatrix",value:function(){var e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,r=(this.top+this.bottom)/2,i=n-e,a=n+e,o=r+t,s=r-t;if(null!==this.view&&this.view.enabled){var u=(this.right-this.left)/this.view.fullWidth/this.zoom,l=(this.top-this.bottom)/this.view.fullHeight/this.zoom;a=(i+=u*this.view.offsetX)+u*this.view.width,s=(o-=l*this.view.offsetY)-l*this.view.height}this.projectionMatrix.makeOrthographic(i,a,o,s,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}},{key:"toJSON",value:function(e){var r=n(t,"toJSON",this,3)([e]);return r.object.zoom=this.zoom,r.object.left=this.left,r.object.right=this.right,r.object.top=this.top,r.object.bottom=this.bottom,r.object.near=this.near,r.object.far=this.far,null!==this.view&&(r.object.view=Object.assign({},this.view)),r}}])}(Tf),Dv=function(e){function t(){var e;return A(this,t),(e=y(this,t,[new Lv(-5,5,5,-5,.5,500)])).isDirectionalLightShadow=!0,e}return x(t,e),T(t)}(Mv),Ov=function(e){function t(e,n){var r;return A(this,t),(r=y(this,t,[e,n])).isDirectionalLight=!0,r.type="DirectionalLight",r.position.copy(gd.DEFAULT_UP),r.updateMatrix(),r.target=new gd,r.shadow=new Dv,r}return x(t,e),T(t,[{key:"dispose",value:function(){this.shadow.dispose()}},{key:"copy",value:function(e){return n(t,"copy",this,3)([e]),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}])}(Sv),Fv=function(){return T(function e(){A(this,e)},null,[{key:"decodeText",value:function(e){if(console.warn("THREE.LoaderUtils: decodeText() has been deprecated with r165 and will be removed with r175. Use TextDecoder instead."),"undefined"!=typeof TextDecoder)return(new TextDecoder).decode(e);for(var t="",n=0,r=e.length;n0&&void 0!==arguments[0]?arguments[0]:[];return A(this,t),(e=y(this,t)).isArrayCamera=!0,e.cameras=n,e.index=0,e}return x(t,e),T(t)}(kf),Vv=function(){return T(function e(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];A(this,e),this.autoStart=t,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1},[{key:"start",value:function(){this.startTime=Hv(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}},{key:"stop",value:function(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}},{key:"getElapsedTime",value:function(){return this.getDelta(),this.elapsedTime}},{key:"getDelta",value:function(){var e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){var t=Hv();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}])}();function Hv(){return performance.now()}var Wv=function(){return T(function e(t,n,r){var i,a,o;switch(A(this,e),this.binding=t,this.valueSize=r,n){case"quaternion":i=this._slerp,a=this._slerpAdditive,o=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(6*r),this._workIndex=5;break;case"string":case"bool":i=this._select,a=this._select,o=this._setAdditiveIdentityOther,this.buffer=new Array(5*r);break;default:i=this._lerp,a=this._lerpAdditive,o=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(5*r)}this._mixBufferRegion=i,this._mixBufferRegionAdditive=a,this._setIdentity=o,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0},[{key:"accumulate",value:function(e,t){var n=this.buffer,r=this.valueSize,i=e*r+r,a=this.cumulativeWeight;if(0===a){for(var o=0;o!==r;++o)n[i+o]=n[o];a=t}else{var s=t/(a+=t);this._mixBufferRegion(n,i,0,s,r)}this.cumulativeWeight=a}},{key:"accumulateAdditive",value:function(e){var t=this.buffer,n=this.valueSize,r=n*this._addIndex;0===this.cumulativeWeightAdditive&&this._setIdentity(),this._mixBufferRegionAdditive(t,r,0,e,n),this.cumulativeWeightAdditive+=e}},{key:"apply",value:function(e){var t=this.valueSize,n=this.buffer,r=e*t+t,i=this.cumulativeWeight,a=this.cumulativeWeightAdditive,o=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,i<1){var s=t*this._origIndex;this._mixBufferRegion(n,r,s,1-i,t)}a>0&&this._mixBufferRegionAdditive(n,r,this._addIndex*t,1,t);for(var u=t,l=t+t;u!==l;++u)if(n[u]!==n[u+t]){o.setValue(n,r);break}}},{key:"saveOriginalState",value:function(){var e=this.binding,t=this.buffer,n=this.valueSize,r=n*this._origIndex;e.getValue(t,r);for(var i=n,a=r;i!==a;++i)t[i]=t[r+i%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}},{key:"restoreOriginalState",value:function(){var e=3*this.valueSize;this.binding.setValue(this.buffer,e)}},{key:"_setAdditiveIdentityNumeric",value:function(){for(var e=this._addIndex*this.valueSize,t=e+this.valueSize,n=e;n=.5)for(var a=0;a!==i;++a)e[t+a]=e[n+a]}},{key:"_slerp",value:function(e,t,n,r){fh.slerpFlat(e,t,e,t,e,n,r)}},{key:"_slerpAdditive",value:function(e,t,n,r,i){var a=this._workIndex*i;fh.multiplyQuaternionsFlat(e,a,e,t,e,n),fh.slerpFlat(e,t,e,t,e,a,r)}},{key:"_lerp",value:function(e,t,n,r,i){for(var a=1-r,o=0;o!==i;++o){var s=t+o;e[s]=e[s]*a+e[n+o]*r}}},{key:"_lerpAdditive",value:function(e,t,n,r,i){for(var a=0;a!==i;++a){var o=t+a;e[o]=e[o]+e[n+a]*r}}}])}(),Gv="\\[\\]\\.:\\/",jv=new RegExp("["+Gv+"]","g"),Qv="[^"+Gv+"]",qv="[^"+Gv.replace("\\.","")+"]",Xv=new RegExp("^"+/((?:WC+[\/:])*)/.source.replace("WC",Qv)+/(WCOD+)?/.source.replace("WCOD",qv)+/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Qv)+/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Qv)+"$"),Yv=["material","materials","bones","map"],Kv=function(){return T(function e(t,n,r){A(this,e);var i=r||Zv.parseTrackName(n);this._targetGroup=t,this._bindings=t.subscribe_(n,i)},[{key:"getValue",value:function(e,t){this.bind();var n=this._targetGroup.nCachedObjects_,r=this._bindings[n];void 0!==r&&r.getValue(e,t)}},{key:"setValue",value:function(e,t){for(var n=this._bindings,r=this._targetGroup.nCachedObjects_,i=n.length;r!==i;++r)n[r].setValue(e,t)}},{key:"bind",value:function(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}},{key:"unbind",value:function(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}}])}(),Zv=function(){function e(t,n,r){A(this,e),this.path=n,this.parsedPath=r||e.parseTrackName(n),this.node=e.findNode(t,this.parsedPath.nodeName),this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}return T(e,[{key:"_getValue_unavailable",value:function(){}},{key:"_setValue_unavailable",value:function(){}},{key:"_getValue_direct",value:function(e,t){e[t]=this.targetObject[this.propertyName]}},{key:"_getValue_array",value:function(e,t){for(var n=this.resolvedProperty,r=0,i=n.length;r!==i;++r)e[t++]=n[r]}},{key:"_getValue_arrayElement",value:function(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}},{key:"_getValue_toArray",value:function(e,t){this.resolvedProperty.toArray(e,t)}},{key:"_setValue_direct",value:function(e,t){this.targetObject[this.propertyName]=e[t]}},{key:"_setValue_direct_setNeedsUpdate",value:function(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}},{key:"_setValue_direct_setMatrixWorldNeedsUpdate",value:function(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}},{key:"_setValue_array",value:function(e,t){for(var n=this.resolvedProperty,r=0,i=n.length;r!==i;++r)n[r]=e[t++]}},{key:"_setValue_array_setNeedsUpdate",value:function(e,t){for(var n=this.resolvedProperty,r=0,i=n.length;r!==i;++r)n[r]=e[t++];this.targetObject.needsUpdate=!0}},{key:"_setValue_array_setMatrixWorldNeedsUpdate",value:function(e,t){for(var n=this.resolvedProperty,r=0,i=n.length;r!==i;++r)n[r]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}},{key:"_setValue_arrayElement",value:function(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}},{key:"_setValue_arrayElement_setNeedsUpdate",value:function(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}},{key:"_setValue_arrayElement_setMatrixWorldNeedsUpdate",value:function(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}},{key:"_setValue_fromArray",value:function(e,t){this.resolvedProperty.fromArray(e,t)}},{key:"_setValue_fromArray_setNeedsUpdate",value:function(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}},{key:"_setValue_fromArray_setMatrixWorldNeedsUpdate",value:function(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}},{key:"_getValue_unbound",value:function(e,t){this.bind(),this.getValue(e,t)}},{key:"_setValue_unbound",value:function(e,t){this.bind(),this.setValue(e,t)}},{key:"bind",value:function(){var t=this.node,n=this.parsedPath,r=n.objectName,i=n.propertyName,a=n.propertyIndex;if(t||(t=e.findNode(this.rootNode,n.nodeName),this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,t){if(r){var o=n.objectIndex;switch(r){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(var s=0;s2&&void 0!==arguments[2]?arguments[2]:null,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:n.blendMode;A(this,e),this._mixer=t,this._clip=n,this._localRoot=r,this.blendMode=i;for(var a=n.tracks,o=a.length,s=new Array(o),u={endingStart:pc,endingEnd:pc},l=0;l!==o;++l){var c=a[l].createInterpolant(null);s[l]=c,c.settings=u}this._interpolantSettings=u,this._interpolants=s,this._propertyBindings=new Array(o),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=cc,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},[{key:"play",value:function(){return this._mixer._activateAction(this),this}},{key:"stop",value:function(){return this._mixer._deactivateAction(this),this.reset()}},{key:"reset",value:function(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}},{key:"isRunning",value:function(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)}},{key:"isScheduled",value:function(){return this._mixer._isActiveAction(this)}},{key:"startAt",value:function(e){return this._startTime=e,this}},{key:"setLoop",value:function(e,t){return this.loop=e,this.repetitions=t,this}},{key:"setEffectiveWeight",value:function(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}},{key:"getEffectiveWeight",value:function(){return this._effectiveWeight}},{key:"fadeIn",value:function(e){return this._scheduleFading(e,0,1)}},{key:"fadeOut",value:function(e){return this._scheduleFading(e,1,0)}},{key:"crossFadeFrom",value:function(e,t,n){if(e.fadeOut(t),this.fadeIn(t),n){var r=this._clip.duration,i=e._clip.duration,a=i/r,o=r/i;e.warp(1,a,t),this.warp(o,1,t)}return this}},{key:"crossFadeTo",value:function(e,t,n){return e.crossFadeFrom(this,t,n)}},{key:"stopFading",value:function(){var e=this._weightInterpolant;return null!==e&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}},{key:"setEffectiveTimeScale",value:function(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}},{key:"getEffectiveTimeScale",value:function(){return this._effectiveTimeScale}},{key:"setDuration",value:function(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}},{key:"syncWith",value:function(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}},{key:"halt",value:function(e){return this.warp(this._effectiveTimeScale,0,e)}},{key:"warp",value:function(e,t,n){var r=this._mixer,i=r.time,a=this.timeScale,o=this._timeScaleInterpolant;null===o&&(o=r._lendControlInterpolant(),this._timeScaleInterpolant=o);var s=o.parameterPositions,u=o.sampleValues;return s[0]=i,s[1]=i+n,u[0]=e/a,u[1]=t/a,this}},{key:"stopWarping",value:function(){var e=this._timeScaleInterpolant;return null!==e&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}},{key:"getMixer",value:function(){return this._mixer}},{key:"getClip",value:function(){return this._clip}},{key:"getRoot",value:function(){return this._localRoot||this._mixer._root}},{key:"_update",value:function(e,t,n,r){if(this.enabled){var i=this._startTime;if(null!==i){var a=(e-i)*n;a<0||0===n?t=0:(this._startTime=null,t=n*a)}t*=this._updateTimeScale(e);var o=this._updateTime(t),s=this._updateWeight(e);if(s>0){var u=this._interpolants,l=this._propertyBindings;if(2501===this.blendMode)for(var c=0,h=u.length;c!==h;++c)u[c].evaluate(o),l[c].accumulateAdditive(s);else for(var d=0,f=u.length;d!==f;++d)u[d].evaluate(o),l[d].accumulate(r,s)}}else this._updateWeight(e)}},{key:"_updateWeight",value:function(e){var t=0;if(this.enabled){t=this.weight;var n=this._weightInterpolant;if(null!==n){var r=n.evaluate(e)[0];t*=r,e>n.parameterPositions[1]&&(this.stopFading(),0===r&&(this.enabled=!1))}}return this._effectiveWeight=t,t}},{key:"_updateTimeScale",value:function(e){var t=0;if(!this.paused){t=this.timeScale;var n=this._timeScaleInterpolant;if(null!==n)t*=n.evaluate(e)[0],e>n.parameterPositions[1]&&(this.stopWarping(),0===t?this.paused=!0:this.timeScale=t)}return this._effectiveTimeScale=t,t}},{key:"_updateTime",value:function(e){var t=this._clip.duration,n=this.loop,r=this.time+e,i=this._loopCount,a=2202===n;if(0===e)return-1===i||!a||1&~i?r:t-r;if(n===lc){-1===i&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(r>=t)r=t;else{if(!(r<0)){this.time=r;break e}r=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(-1===i&&(e>=0?(i=0,this._setEndings(!0,0===this.repetitions,a)):this._setEndings(0===this.repetitions,!0,a)),r>=t||r<0){var o=Math.floor(r/t);r-=t*o,i+=Math.abs(o);var s=this.repetitions-i;if(s<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,r=e>0?t:0,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(1===s){var u=e<0;this._setEndings(u,!u,a)}else this._setEndings(!1,!1,a);this._loopCount=i,this.time=r,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:o})}}else this.time=r;if(a&&!(1&~i))return t-r}return r}},{key:"_setEndings",value:function(e,t,n){var r=this._interpolantSettings;n?(r.endingStart=vc,r.endingEnd=vc):(r.endingStart=e?this.zeroSlopeAtStart?vc:pc:mc,r.endingEnd=t?this.zeroSlopeAtEnd?vc:pc:mc)}},{key:"_scheduleFading",value:function(e,t,n){var r=this._mixer,i=r.time,a=this._weightInterpolant;null===a&&(a=r._lendControlInterpolant(),this._weightInterpolant=a);var o=a.parameterPositions,s=a.sampleValues;return o[0]=i,s[0]=t,o[1]=i+e,s[1]=n,this}}])}(),$v=new Float32Array(1),em=function(e){function t(e){var n;return A(this,t),(n=y(this,t))._root=e,n._initMemoryManager(),n._accuIndex=0,n.time=0,n.timeScale=1,n}return x(t,e),T(t,[{key:"_bindAction",value:function(e,t){var n=e._localRoot||this._root,r=e._clip.tracks,i=r.length,a=e._propertyBindings,o=e._interpolants,s=n.uuid,u=this._bindingsByRootAndName,l=u[s];void 0===l&&(l={},u[s]=l);for(var c=0;c!==i;++c){var h=r[c],d=h.name,f=l[d];if(void 0!==f)++f.referenceCount,a[c]=f;else{if(void 0!==(f=a[c])){null===f._cacheIndex&&(++f.referenceCount,this._addInactiveBinding(f,s,d));continue}var p=t&&t._propertyBindings[c].binding.parsedPath;++(f=new Wv(Zv.create(n,d,p),h.ValueTypeName,h.getValueSize())).referenceCount,this._addInactiveBinding(f,s,d),a[c]=f}o[c].resultBuffer=f.buffer}}},{key:"_activateAction",value:function(e){if(!this._isActiveAction(e)){if(null===e._cacheIndex){var t=(e._localRoot||this._root).uuid,n=e._clip.uuid,r=this._actionsByClip[n];this._bindAction(e,r&&r.knownActions[0]),this._addInactiveAction(e,n,t)}for(var i=e._propertyBindings,a=0,o=i.length;a!==o;++a){var s=i[a];0===s.useCount++&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}}},{key:"_deactivateAction",value:function(e){if(this._isActiveAction(e)){for(var t=e._propertyBindings,n=0,r=t.length;n!==r;++n){var i=t[n];0===--i.useCount&&(i.restoreOriginalState(),this._takeBackBinding(i))}this._takeBackAction(e)}}},{key:"_initMemoryManager",value:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;var e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}},{key:"_isActiveAction",value:function(e){var t=e._cacheIndex;return null!==t&&t=0;--t)e[t].stop();return this}},{key:"update",value:function(e){e*=this.timeScale;for(var t=this._actions,n=this._nActiveActions,r=this.time+=e,i=Math.sign(e),a=this._accuIndex^=1,o=0;o!==n;++o){t[o]._update(r,e,i,a)}for(var s=this._bindings,u=this._nActiveBindings,l=0;l!==u;++l)s[l].apply(a);return this}},{key:"setTime",value:function(e){this.time=0;for(var t=0;t2&&void 0!==arguments[2]?arguments[2]:1;return A(this,t),(r=y(this,t,[e,n])).isInstancedInterleavedBuffer=!0,r.meshPerAttribute=i,r}return x(t,e),T(t,[{key:"copy",value:function(e){return n(t,"copy",this,3)([e]),this.meshPerAttribute=e.meshPerAttribute,this}},{key:"clone",value:function(e){var r=n(t,"clone",this,3)([e]);return r.meshPerAttribute=this.meshPerAttribute,r}},{key:"toJSON",value:function(e){var r=n(t,"toJSON",this,3)([e]);return r.isInstancedInterleavedBuffer=!0,r.meshPerAttribute=this.meshPerAttribute,r}}])}(Bf),nm=function(){return T(function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return A(this,e),this.radius=t,this.phi=n,this.theta=r,this},[{key:"set",value:function(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this}},{key:"copy",value:function(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}},{key:"makeSafe",value:function(){var e=1e-6;return this.phi=Dc(this.phi,e,Math.PI-e),this}},{key:"setFromVector3",value:function(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}},{key:"setFromCartesianCoords",value:function(e,t,n){return this.radius=Math.sqrt(e*e+t*t+n*n),0===this.radius?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,n),this.phi=Math.acos(Dc(t/this.radius,-1,1))),this}},{key:"clone",value:function(){return(new this.constructor).copy(this)}}])}(),rm=function(){return T(function e(t,n,r,i){A(this,e),e.prototype.isMatrix2=!0,this.elements=[1,0,0,1],void 0!==t&&this.set(t,n,r,i)},[{key:"identity",value:function(){return this.set(1,0,0,1),this}},{key:"fromArray",value:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=0;n<4;n++)this.elements[n]=e[n+t];return this}},{key:"set",value:function(e,t,n,r){var i=this.elements;return i[0]=e,i[2]=t,i[1]=n,i[3]=r,this}}])}();function im(e,t,n,r){var i=function(e){switch(e){case dl:case fl:return{byteLength:1,components:1};case vl:case pl:case _l:return{byteLength:2,components:1};case bl:case xl:return{byteLength:2,components:4};case gl:case ml:case yl:return{byteLength:4,components:1};case Al:return{byteLength:4,components:3}}throw new Error("Unknown texture type ".concat(e,"."))}(r);switch(n){case 1021:case 1024:return e*t;case 1025:return e*t*2;case El:case Cl:return e*t/i.components*i.byteLength;case kl:case Rl:return e*t*2/i.components*i.byteLength;case 1022:return e*t*3/i.components*i.byteLength;case wl:case Il:return e*t*4/i.components*i.byteLength;case Nl:case Pl:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*8;case Ll:case Dl:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*16;case Fl:case Ul:return Math.max(e,16)*Math.max(t,8)/4;case Ol:case Bl:return Math.max(e,8)*Math.max(t,8)/2;case zl:case Vl:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*8;case Hl:case Wl:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*16;case Gl:return Math.floor((e+4)/5)*Math.floor((t+3)/4)*16;case jl:return Math.floor((e+4)/5)*Math.floor((t+4)/5)*16;case Ql:return Math.floor((e+5)/6)*Math.floor((t+4)/5)*16;case ql:return Math.floor((e+5)/6)*Math.floor((t+5)/6)*16;case Xl:return Math.floor((e+7)/8)*Math.floor((t+4)/5)*16;case Yl:return Math.floor((e+7)/8)*Math.floor((t+5)/6)*16;case Kl:return Math.floor((e+7)/8)*Math.floor((t+7)/8)*16;case Zl:return Math.floor((e+9)/10)*Math.floor((t+4)/5)*16;case Jl:return Math.floor((e+9)/10)*Math.floor((t+5)/6)*16;case $l:return Math.floor((e+9)/10)*Math.floor((t+7)/8)*16;case ec:return Math.floor((e+9)/10)*Math.floor((t+9)/10)*16;case tc:return Math.floor((e+11)/12)*Math.floor((t+9)/10)*16;case nc:return Math.floor((e+11)/12)*Math.floor((t+11)/12)*16;case rc:case ic:case ac:return Math.ceil(e/4)*Math.ceil(t/4)*16;case 36283:case oc:return Math.ceil(e/4)*Math.ceil(t/4)*8;case sc:case uc:return Math.ceil(e/4)*Math.ceil(t/4)*16}throw new Error("Unable to determine texture byte length for ".concat(n," format."))} /** * @license * Copyright 2010-2025 Three.js Authors * SPDX-License-Identifier: MIT */ function am(){var e=null,t=!1,n=null,r=null;function i(t,a){n(t,a),r=e.requestAnimationFrame(i)}return{start:function(){!0!==t&&null!==n&&(r=e.requestAnimationFrame(i),t=!0)},stop:function(){e.cancelAnimationFrame(r),t=!1},setAnimationLoop:function(e){n=e},setContext:function(t){e=t}}}function om(e){var t=new WeakMap;return{get:function(e){return e.isInterleavedBufferAttribute&&(e=e.data),t.get(e)},remove:function(n){n.isInterleavedBufferAttribute&&(n=n.data);var r=t.get(n);r&&(e.deleteBuffer(r.buffer),t.delete(n))},update:function(n,r){if(n.isInterleavedBufferAttribute&&(n=n.data),n.isGLBufferAttribute){var i=t.get(n);(!i||i.version 0\n\tvec4 plane;\n\t#ifdef ALPHA_TO_COVERAGE\n\t\tfloat distanceToPlane, distanceGradient;\n\t\tfloat clipOpacity = 1.0;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tdistanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n\t\t\tdistanceGradient = fwidth( distanceToPlane ) / 2.0;\n\t\t\tclipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n\t\t\tif ( clipOpacity == 0.0 ) discard;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\t\tfloat unionClipOpacity = 1.0;\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\t\tplane = clippingPlanes[ i ];\n\t\t\t\tdistanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n\t\t\t\tdistanceGradient = fwidth( distanceToPlane ) / 2.0;\n\t\t\t\tunionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\t\t\tclipOpacity *= 1.0 - unionClipOpacity;\n\t\t#endif\n\t\tdiffuseColor.a *= clipOpacity;\n\t\tif ( diffuseColor.a == 0.0 ) discard;\n\t#else\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\t\tbool clipped = true;\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\t\tplane = clippingPlanes[ i ];\n\t\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\t\t\tif ( clipped ) discard;\n\t\t#endif\n\t#endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#if defined( USE_COLOR_ALPHA )\n\tdiffuseColor *= vColor;\n#elif defined( USE_COLOR )\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR )\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n\tvarying vec3 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_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\n#ifdef USE_BATCHING_COLOR\n\tvec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) );\n\tvColor.xyz *= batchingColor.xyz;\n#endif",common:"#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nvec3 pow2( const in vec3 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 v ) { return dot( v, vec3( 0.3333333 ) ); }\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};\n#ifdef USE_ALPHAHASH\n\tvarying vec3 vPosition;\n#endif\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}\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}\nvec3 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 F_Schlick( const in float 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} // validated",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\thighp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tuv.x += filterInt * 3.0 * cubeUV_minTileSize;\n\t\tuv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n\t\tuv.x *= CUBEUV_TEXEL_WIDTH;\n\t\tuv.y *= CUBEUV_TEXEL_HEIGHT;\n\t\t#ifdef texture2DGradEXT\n\t\t\treturn texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n\t\t#else\n\t\t\treturn texture2D( envMap, uv ).rgb;\n\t\t#endif\n\t}\n\t#define cubeUV_r0 1.0\n\t#define cubeUV_m0 - 2.0\n\t#define cubeUV_r1 0.8\n\t#define cubeUV_m1 - 1.0\n\t#define cubeUV_r4 0.4\n\t#define cubeUV_m4 2.0\n\t#define cubeUV_r5 0.305\n\t#define cubeUV_m5 3.0\n\t#define cubeUV_r6 0.21\n\t#define cubeUV_m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= cubeUV_r1 ) {\n\t\t\tmip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\n\t\t} else if ( roughness >= cubeUV_r4 ) {\n\t\t\tmip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\n\t\t} else if ( roughness >= cubeUV_r5 ) {\n\t\t\tmip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\n\t\t} else if ( roughness >= cubeUV_r6 ) {\n\t\t\tmip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_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 ), cubeUV_m0, CUBEUV_MAX_MIP );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = objectTangent;\n#endif\n#ifdef USE_BATCHING\n\tmat3 bm = mat3( batchingMatrix );\n\ttransformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );\n\ttransformedNormal = bm * transformedNormal;\n\t#ifdef USE_TANGENT\n\t\ttransformedTangent = bm * transformedTangent;\n\t#endif\n#endif\n#ifdef USE_INSTANCING\n\tmat3 im = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );\n\ttransformedNormal = im * transformedNormal;\n\t#ifdef USE_TANGENT\n\t\ttransformedTangent = im * transformedTangent;\n\t#endif\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\ttransformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );\n\t#ifdef DECODE_VIDEO_TEXTURE_EMISSIVE\n\t\temissiveColor = sRGBTransferEOTF( emissiveColor );\n\t#endif\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",colorspace_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",colorspace_pars_fragment:"vec4 LinearTransferOETF( in vec4 value ) {\n\treturn value;\n}\nvec4 sRGBTransferEOTF( 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 sRGBTransferOETF( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\tuniform mat3 envMapRotation;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",envmap_physical_pars_fragment:"#ifdef USE_ENVMAP\n\tvec3 getIBLIrradiance( const in vec3 normal ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, envMapRotation * 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#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 reflectVec = reflect( - viewDir, normal );\n\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, envMapRotation * 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\t#ifdef USE_ANISOTROPY\n\t\tvec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {\n\t\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\t\tvec3 bentNormal = cross( bitangent, viewDir );\n\t\t\t\tbentNormal = normalize( cross( bentNormal, bitangent ) );\n\t\t\t\tbentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );\n\t\t\t\treturn getIBLRadiance( viewDir, bentNormal, roughness );\n\t\t\t#else\n\t\t\t\treturn vec3( 0.0 );\n\t\t\t#endif\n\t\t}\n\t#endif\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif",fog_vertex:"#ifdef USE_FOG\n\tvFogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float vFogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float vFogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn vec3( texture2D( gradientMap, coord ).r );\n\t#else\n\t\tvec2 fw = fwidth( coord ) * 0.5;\n\t\treturn mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\n\t#endif\n}",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_fragment:"LambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;",lights_lambert_pars_fragment:"varying vec3 vViewPosition;\nstruct LambertMaterial {\n\tvec3 diffuseColor;\n\tfloat specularStrength;\n};\nvoid RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Lambert\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Lambert",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\n#if defined( USE_LIGHT_PROBES )\n\tuniform vec3 lightProbe[ 9 ];\n#endif\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\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\tif ( cutoffDistance > 0.0 ) {\n\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t}\n\treturn distanceFalloff;\n}\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, 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 vec3 geometryPosition, out IncidentLight light ) {\n\t\tvec3 lVector = pointLight.position - geometryPosition;\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 vec3 geometryPosition, out IncidentLight light ) {\n\t\tvec3 lVector = spotLight.position - geometryPosition;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat angleCos = dot( light.direction, spotLight.direction );\n\t\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\tif ( spotAttenuation > 0.0 ) {\n\t\t\tfloat lightDistance = length( lVector );\n\t\t\tlight.color = spotLight.color * spotAttenuation;\n\t\t\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t\t} else {\n\t\t\tlight.color = vec3( 0.0 );\n\t\t\tlight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n\t\tfloat dotNL = dot( normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\treturn irradiance;\n\t}\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\nstruct ToonMaterial {\n\tvec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, 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",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, 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",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );\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\tmaterial.ior = ior;\n\t#ifdef USE_SPECULAR\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularColorFactor = specularColor;\n\t\t#ifdef USE_SPECULAR_COLORMAP\n\t\t\tspecularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\n\t\t#endif\n\t\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\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( ( material.ior - 1.0 ) / ( material.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, vClearcoatMapUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).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_DISPERSION\n\tmaterial.dispersion = dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n\tmaterial.iridescence = iridescence;\n\tmaterial.iridescenceIOR = iridescenceIOR;\n\t#ifdef USE_IRIDESCENCEMAP\n\t\tmaterial.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\n\t#endif\n\t#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\t\tmaterial.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\n\t#else\n\t\tmaterial.iridescenceThickness = iridescenceThicknessMaximum;\n\t#endif\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheenColor;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tmaterial.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\n\t#endif\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\t#ifdef USE_ANISOTROPYMAP\n\t\tmat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\n\t\tvec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\n\t\tvec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\n\t#else\n\t\tvec2 anisotropyV = anisotropyVector;\n\t#endif\n\tmaterial.anisotropy = length( anisotropyV );\n\tif( material.anisotropy == 0.0 ) {\n\t\tanisotropyV = vec2( 1.0, 0.0 );\n\t} else {\n\t\tanisotropyV /= material.anisotropy;\n\t\tmaterial.anisotropy = saturate( material.anisotropy );\n\t}\n\tmaterial.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\n\tmaterial.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;\n\tmaterial.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat roughness;\n\tvec3 specularColor;\n\tfloat specularF90;\n\tfloat dispersion;\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_IRIDESCENCE\n\t\tfloat iridescence;\n\t\tfloat iridescenceIOR;\n\t\tfloat iridescenceThickness;\n\t\tvec3 iridescenceFresnel;\n\t\tvec3 iridescenceF0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n\t#ifdef IOR\n\t\tfloat ior;\n\t#endif\n\t#ifdef USE_TRANSMISSION\n\t\tfloat transmission;\n\t\tfloat transmissionAlpha;\n\t\tfloat thickness;\n\t\tfloat attenuationDistance;\n\t\tvec3 attenuationColor;\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat anisotropy;\n\t\tfloat alphaT;\n\t\tvec3 anisotropyT;\n\t\tvec3 anisotropyB;\n\t#endif\n};\nvec3 clearcoatSpecularDirect = vec3( 0.0 );\nvec3 clearcoatSpecularIndirect = vec3( 0.0 );\nvec3 sheenSpecularDirect = vec3( 0.0 );\nvec3 sheenSpecularIndirect = vec3(0.0 );\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n float x2 = x * x;\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\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}\n#ifdef USE_ANISOTROPY\n\tfloat V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {\n\t\tfloat gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\n\t\tfloat gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\n\t\tfloat v = 0.5 / ( gv + gl );\n\t\treturn saturate(v);\n\t}\n\tfloat D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\n\t\tfloat a2 = alphaT * alphaB;\n\t\thighp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\n\t\thighp float v2 = dot( v, v );\n\t\tfloat w2 = a2 / v2;\n\t\treturn RECIPROCAL_PI * a2 * pow2 ( w2 );\n\t}\n#endif\n#ifdef USE_CLEARCOAT\n\tvec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n\t\tvec3 f0 = material.clearcoatF0;\n\t\tfloat f90 = material.clearcoatF90;\n\t\tfloat roughness = material.clearcoatRoughness;\n\t\tfloat alpha = pow2( roughness );\n\t\tvec3 halfDir = normalize( lightDir + viewDir );\n\t\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\t\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\t\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\t\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\t\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t\treturn F * ( V * D );\n\t}\n#endif\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n\tvec3 f0 = material.specularColor;\n\tfloat f90 = material.specularF90;\n\tfloat roughness = material.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\t#ifdef USE_IRIDESCENCE\n\t\tF = mix( F, material.iridescenceFresnel, material.iridescence );\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat dotTL = dot( material.anisotropyT, lightDir );\n\t\tfloat dotTV = dot( material.anisotropyT, viewDir );\n\t\tfloat dotTH = dot( material.anisotropyT, halfDir );\n\t\tfloat dotBL = dot( material.anisotropyB, lightDir );\n\t\tfloat dotBV = dot( material.anisotropyB, viewDir );\n\t\tfloat dotBH = dot( material.anisotropyB, halfDir );\n\t\tfloat V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\n\t\tfloat D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\n\t#else\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t#endif\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}\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\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat r2 = roughness * roughness;\n\tfloat a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n\tfloat b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n\tfloat DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n\treturn saturate( DG * RECIPROCAL_PI );\n}\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n\treturn fab;\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\treturn specularColor * fab.x + specularF90 * fab.y;\n}\n#ifdef USE_IRIDESCENCE\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#else\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#endif\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\t#ifdef USE_IRIDESCENCE\n\t\tvec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n\t#else\n\t\tvec3 Fr = specularColor;\n\t#endif\n\tvec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = Fr + ( 1.0 - Fr ) * 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 vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometryNormal;\n\t\tvec3 viewDir = geometryViewDir;\n\t\tvec3 position = geometryPosition;\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 vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\t\tclearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );\n\t#endif\n\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, 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 vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n\t#endif\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\t#ifdef USE_IRIDESCENCE\n\t\tcomputeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\n\t#else\n\t\tcomputeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n\t#endif\n\tvec3 totalScattering = singleScattering + multiScattering;\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );\n\treflectedLight.indirectSpecular += radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nvec3 geometryPosition = - vViewPosition;\nvec3 geometryNormal = normal;\nvec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\nvec3 geometryClearcoatNormal = vec3( 0.0 );\n#ifdef USE_CLEARCOAT\n\tgeometryClearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n\tfloat dotNVi = saturate( dot( normal, geometryViewDir ) );\n\tif ( material.iridescenceThickness == 0.0 ) {\n\t\tmaterial.iridescence = 0.0;\n\t} else {\n\t\tmaterial.iridescence = saturate( material.iridescence );\n\t}\n\tif ( material.iridescence > 0.0 ) {\n\t\tmaterial.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n\t\tmaterial.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n\t}\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, geometryPosition, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, 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\tvec4 spotColor;\n\tvec3 spotLightCoord;\n\tbool inSpotLightMap;\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, geometryPosition, directLight );\n\t\t#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n\t\t#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n\t\t#else\n\t\t#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#endif\n\t\t#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n\t\t\tspotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n\t\t\tinSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n\t\t\tspotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n\t\t\tdirectLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n\t\t#endif\n\t\t#undef SPOT_LIGHT_MAP_INDEX\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, 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, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, 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, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, 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\t#if defined( USE_LIGHT_PROBES )\n\t\tirradiance += getLightProbeIrradiance( lightProbe, geometryNormal );\n\t#endif\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 ], geometryNormal );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getIBLIrradiance( geometryNormal );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\t#ifdef USE_ANISOTROPY\n\t\tradiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );\n\t#else\n\t\tradiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );\n\t#endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF )\n\tgl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\tvFragDepth = 1.0 + gl_Position.w;\n\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n#endif",map_fragment:"#ifdef USE_MAP\n\tvec4 sampledDiffuseColor = texture2D( map, vMapUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\tsampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );\n\t#endif\n\tdiffuseColor *= sampledDiffuseColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\t#if defined( USE_POINTS_UV )\n\t\tvec2 uv = vUv;\n\t#else\n\t\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n\t#endif\n#endif\n#ifdef USE_MAP\n\tdiffuseColor *= texture2D( map, uv );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_POINTS_UV )\n\tvarying vec2 vUv;\n#else\n\t#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\t\tuniform mat3 uvTransform;\n\t#endif\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphinstance_vertex:"#ifdef USE_INSTANCING_MORPH\n\tfloat morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\tfloat morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tmorphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;\n\t}\n#endif",morphcolor_vertex:"#if defined( USE_MORPHCOLORS )\n\tvColor *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t#if defined( USE_COLOR_ALPHA )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\n\t\t#elif defined( USE_COLOR )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\n\t\t#endif\n\t}\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tif ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\n\t}\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\t#ifndef USE_INSTANCING_MORPH\n\t\tuniform float morphTargetBaseInfluence;\n\t\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\t#endif\n\tuniform sampler2DArray morphTargetsTexture;\n\tuniform ivec2 morphTargetsTextureSize;\n\tvec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n\t\tint texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n\t\tint y = texelIndex / morphTargetsTextureSize.x;\n\t\tint x = texelIndex - y * morphTargetsTextureSize.x;\n\t\tivec3 morphUV = ivec3( x, y, morphTargetIndex );\n\t\treturn texelFetch( morphTargetsTexture, morphUV, 0 );\n\t}\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n\t}\n#endif",normal_fragment_begin:"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n\tvec3 fdx = dFdx( vViewPosition );\n\tvec3 fdy = dFdy( vViewPosition );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal *= faceDirection;\n\t#endif\n#endif\n#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn = getTangentFrame( - vViewPosition, normal,\n\t\t#if defined( USE_NORMALMAP )\n\t\t\tvNormalMapUv\n\t\t#elif defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tvClearcoatNormalMapUv\n\t\t#else\n\t\t\tvUv\n\t\t#endif\n\t\t);\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn[0] *= faceDirection;\n\t\ttbn[1] *= faceDirection;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn2[0] *= faceDirection;\n\t\ttbn2[1] *= faceDirection;\n\t#endif\n#endif\nvec3 nonPerturbedNormal = normal;",normal_fragment_maps:"#ifdef USE_NORMALMAP_OBJECTSPACE\n\tnormal = texture2D( normalMap, vNormalMapUv ).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( USE_NORMALMAP_TANGENTSPACE )\n\tvec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\tnormal = normalize( tbn * mapN );\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",normal_pars_fragment:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_pars_vertex:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_vertex:"#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef USE_NORMALMAP_OBJECTSPACE\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )\n\tmat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\n\t\tvec2 st0 = dFdx( uv.st );\n\t\tvec2 st1 = dFdy( uv.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 : inversesqrt( det );\n\t\treturn mat3( T * scale, B * scale, N );\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal = nonPerturbedNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\tclearcoatNormal = normalize( tbn2 * clearcoatMapN );\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif",iridescence_pars_fragment:"#ifdef USE_IRIDESCENCEMAP\n\tuniform sampler2D iridescenceMap;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform sampler2D iridescenceThicknessMap;\n#endif",opaque_fragment:"#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= material.transmissionAlpha;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.;\nconst float Inv255 = 1. / 255.;\nconst vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 );\nconst vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g );\nconst vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b );\nconst vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a );\nvec4 packDepthToRGBA( const in float v ) {\n\tif( v <= 0.0 )\n\t\treturn vec4( 0., 0., 0., 0. );\n\tif( v >= 1.0 )\n\t\treturn vec4( 1., 1., 1., 1. );\n\tfloat vuf;\n\tfloat af = modf( v * PackFactors.a, vuf );\n\tfloat bf = modf( vuf * ShiftRight8, vuf );\n\tfloat gf = modf( vuf * ShiftRight8, vuf );\n\treturn vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af );\n}\nvec3 packDepthToRGB( const in float v ) {\n\tif( v <= 0.0 )\n\t\treturn vec3( 0., 0., 0. );\n\tif( v >= 1.0 )\n\t\treturn vec3( 1., 1., 1. );\n\tfloat vuf;\n\tfloat bf = modf( v * PackFactors.b, vuf );\n\tfloat gf = modf( vuf * ShiftRight8, vuf );\n\treturn vec3( vuf * Inv255, gf * PackUpscale, bf );\n}\nvec2 packDepthToRG( const in float v ) {\n\tif( v <= 0.0 )\n\t\treturn vec2( 0., 0. );\n\tif( v >= 1.0 )\n\t\treturn vec2( 1., 1. );\n\tfloat vuf;\n\tfloat gf = modf( v * 256., vuf );\n\treturn vec2( vuf * Inv255, gf );\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors4 );\n}\nfloat unpackRGBToDepth( const in vec3 v ) {\n\treturn dot( v, UnpackFactors3 );\n}\nfloat unpackRGToDepth( const in vec2 v ) {\n\treturn v.r * UnpackFactors2.r + v.g * UnpackFactors2.g;\n}\nvec4 pack2HalfToRGBA( const in 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( const in 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 depth, const in float near, const in float far ) {\n\treturn depth * ( 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 depth, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * depth - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_BATCHING\n\tmvPosition = batchingMatrix * mvPosition;\n#endif\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#if NUM_SPOT_LIGHT_COORDS > 0\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n\tuniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#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 shadowIntensity;\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\tstruct SpotLightShadow {\n\t\t\tfloat shadowIntensity;\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 shadowIntensity;\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 shadowIntensity, 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\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n\t\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\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 mix( 1.0, shadow, shadowIntensity );\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 shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tfloat shadow = 1.0;\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\t\n\t\tfloat lightToPositionLength = length( lightToPosition );\n\t\tif ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) {\n\t\t\tfloat dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\t\tdp += shadowBias;\n\t\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\t\tshadow = (\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t\t) * ( 1.0 / 9.0 );\n\t\t\t#else\n\t\t\t\tshadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t\t#endif\n\t\t}\n\t\treturn mix( 1.0, shadow, shadowIntensity );\n\t}\n#endif",shadowmap_pars_vertex:"#if NUM_SPOT_LIGHT_COORDS > 0\n\tuniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#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 shadowIntensity;\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\tstruct SpotLightShadow {\n\t\t\tfloat shadowIntensity;\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 shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif",shadowmap_vertex:"#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\n\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\tvec4 shadowWorldPosition;\n#endif\n#if defined( USE_SHADOWMAP )\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if NUM_SPOT_LIGHT_COORDS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition;\n\t\t#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t\tshadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\n\t\t#endif\n\t\tvSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, 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.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ 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.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\tuniform highp sampler2D boneTexture;\n\tmat4 getBoneMatrix( const in float i ) {\n\t\tint size = textureSize( boneTexture, 0 ).x;\n\t\tint j = int( i ) * 4;\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\tvec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );\n\t\tvec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );\n\t\tvec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );\n\t\tvec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );\n\t\treturn mat4( v1, v2, v3, v4 );\n\t}\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn saturate( toneMappingExposure * color );\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 CineonToneMapping( 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}\nconst mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(\n\tvec3( 1.6605, - 0.1246, - 0.0182 ),\n\tvec3( - 0.5876, 1.1329, - 0.1006 ),\n\tvec3( - 0.0728, - 0.0083, 1.1187 )\n);\nconst mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(\n\tvec3( 0.6274, 0.0691, 0.0164 ),\n\tvec3( 0.3293, 0.9195, 0.0880 ),\n\tvec3( 0.0433, 0.0113, 0.8956 )\n);\nvec3 agxDefaultContrastApprox( vec3 x ) {\n\tvec3 x2 = x * x;\n\tvec3 x4 = x2 * x2;\n\treturn + 15.5 * x4 * x2\n\t\t- 40.14 * x4 * x\n\t\t+ 31.96 * x4\n\t\t- 6.868 * x2 * x\n\t\t+ 0.4298 * x2\n\t\t+ 0.1191 * x\n\t\t- 0.00232;\n}\nvec3 AgXToneMapping( vec3 color ) {\n\tconst mat3 AgXInsetMatrix = mat3(\n\t\tvec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),\n\t\tvec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),\n\t\tvec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )\n\t);\n\tconst mat3 AgXOutsetMatrix = mat3(\n\t\tvec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),\n\t\tvec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),\n\t\tvec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )\n\t);\n\tconst float AgxMinEv = - 12.47393;\tconst float AgxMaxEv = 4.026069;\n\tcolor *= toneMappingExposure;\n\tcolor = LINEAR_SRGB_TO_LINEAR_REC2020 * color;\n\tcolor = AgXInsetMatrix * color;\n\tcolor = max( color, 1e-10 );\tcolor = log2( color );\n\tcolor = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );\n\tcolor = clamp( color, 0.0, 1.0 );\n\tcolor = agxDefaultContrastApprox( color );\n\tcolor = AgXOutsetMatrix * color;\n\tcolor = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );\n\tcolor = LINEAR_REC2020_TO_LINEAR_SRGB * color;\n\tcolor = clamp( color, 0.0, 1.0 );\n\treturn color;\n}\nvec3 NeutralToneMapping( vec3 color ) {\n\tconst float StartCompression = 0.8 - 0.04;\n\tconst float Desaturation = 0.15;\n\tcolor *= toneMappingExposure;\n\tfloat x = min( color.r, min( color.g, color.b ) );\n\tfloat offset = x < 0.08 ? x - 6.25 * x * x : 0.04;\n\tcolor -= offset;\n\tfloat peak = max( color.r, max( color.g, color.b ) );\n\tif ( peak < StartCompression ) return color;\n\tfloat d = 1. - StartCompression;\n\tfloat newPeak = 1. - d * d / ( peak + d - StartCompression );\n\tcolor *= newPeak / peak;\n\tfloat g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );\n\treturn mix( color, vec3( newPeak ), g );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmission_fragment:"#ifdef USE_TRANSMISSION\n\tmaterial.transmission = transmission;\n\tmaterial.transmissionAlpha = 1.0;\n\tmaterial.thickness = thickness;\n\tmaterial.attenuationDistance = attenuationDistance;\n\tmaterial.attenuationColor = attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tmaterial.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tmaterial.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\n\tvec4 transmitted = getIBLVolumeRefraction(\n\t\tn, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,\n\t\tmaterial.attenuationColor, material.attenuationDistance );\n\tmaterial.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );\n\ttotalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );\n#endif",transmission_pars_fragment:"#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tuniform sampler2D transmissionMap;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tuniform sampler2D thicknessMap;\n\t#endif\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\tvarying vec3 vWorldPosition;\n\tfloat w0( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\n\t}\n\tfloat w1( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );\n\t}\n\tfloat w2( float a ){\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\n\t}\n\tfloat w3( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * a );\n\t}\n\tfloat g0( float a ) {\n\t\treturn w0( a ) + w1( a );\n\t}\n\tfloat g1( float a ) {\n\t\treturn w2( a ) + w3( a );\n\t}\n\tfloat h0( float a ) {\n\t\treturn - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\n\t}\n\tfloat h1( float a ) {\n\t\treturn 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\n\t}\n\tvec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {\n\t\tuv = uv * texelSize.zw + 0.5;\n\t\tvec2 iuv = floor( uv );\n\t\tvec2 fuv = fract( uv );\n\t\tfloat g0x = g0( fuv.x );\n\t\tfloat g1x = g1( fuv.x );\n\t\tfloat h0x = h0( fuv.x );\n\t\tfloat h1x = h1( fuv.x );\n\t\tfloat h0y = h0( fuv.y );\n\t\tfloat h1y = h1( fuv.y );\n\t\tvec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\treturn g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\n\t\t\tg1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\n\t}\n\tvec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\n\t\tvec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\n\t\tvec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\n\t\tvec2 fLodSizeInv = 1.0 / fLodSize;\n\t\tvec2 cLodSizeInv = 1.0 / cLodSize;\n\t\tvec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );\n\t\tvec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );\n\t\treturn mix( fSample, cSample, fract( lod ) );\n\t}\n\tvec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n\t\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n\t\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n\t\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n\t\treturn normalize( refractionVector ) * thickness * modelScale;\n\t}\n\tfloat applyIorToRoughness( const in float roughness, const in float ior ) {\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\t}\n\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n\t\tfloat lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\treturn textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\n\t}\n\tvec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tif ( isinf( attenuationDistance ) ) {\n\t\t\treturn vec3( 1.0 );\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\t\t\treturn transmittance;\n\t\t}\n\t}\n\tvec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n\t\tconst in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n\t\tconst in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,\n\t\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tvec4 transmittedLight;\n\t\tvec3 transmittance;\n\t\t#ifdef USE_DISPERSION\n\t\t\tfloat halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;\n\t\t\tvec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );\n\t\t\tfor ( int i = 0; i < 3; i ++ ) {\n\t\t\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );\n\t\t\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\t\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\t\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\t\t\trefractionCoords += 1.0;\n\t\t\t\trefractionCoords /= 2.0;\n\t\t\t\tvec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );\n\t\t\t\ttransmittedLight[ i ] = transmissionSample[ i ];\n\t\t\t\ttransmittedLight.a += transmissionSample.a;\n\t\t\t\ttransmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];\n\t\t\t}\n\t\t\ttransmittedLight.a /= 3.0;\n\t\t#else\n\t\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n\t\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\t\trefractionCoords += 1.0;\n\t\t\trefractionCoords /= 2.0;\n\t\t\ttransmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n\t\t\ttransmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );\n\t\t#endif\n\t\tvec3 attenuatedColor = transmittance * transmittedLight.rgb;\n\t\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n\t\tfloat transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;\n\t\treturn vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );\n\t}\n#endif",uv_pars_fragment:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif",uv_pars_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tuniform mat3 mapTransform;\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform mat3 alphaMapTransform;\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tuniform mat3 lightMapTransform;\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tuniform mat3 aoMapTransform;\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tuniform mat3 bumpMapTransform;\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tuniform mat3 normalMapTransform;\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tuniform mat3 displacementMapTransform;\n\tvarying vec2 vDisplacementMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tuniform mat3 emissiveMapTransform;\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tuniform mat3 metalnessMapTransform;\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tuniform mat3 roughnessMapTransform;\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tuniform mat3 anisotropyMapTransform;\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tuniform mat3 clearcoatMapTransform;\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform mat3 clearcoatNormalMapTransform;\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform mat3 clearcoatRoughnessMapTransform;\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tuniform mat3 sheenColorMapTransform;\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tuniform mat3 sheenRoughnessMapTransform;\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tuniform mat3 iridescenceMapTransform;\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform mat3 iridescenceThicknessMapTransform;\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tuniform mat3 specularMapTransform;\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tuniform mat3 specularColorMapTransform;\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tuniform mat3 specularIntensityMapTransform;\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif",uv_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvUv = vec3( uv, 1 ).xy;\n#endif\n#ifdef USE_MAP\n\tvMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ALPHAMAP\n\tvAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_LIGHTMAP\n\tvLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_AOMAP\n\tvAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_BUMPMAP\n\tvBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_NORMALMAP\n\tvNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tvDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_METALNESSMAP\n\tvMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULARMAP\n\tvSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tvTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_THICKNESSMAP\n\tvThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_BATCHING\n\t\tworldPosition = batchingMatrix * worldPosition;\n\t#endif\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}",background_frag:"uniform sampler2D t2D;\nuniform float backgroundIntensity;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\ttexColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include \n\t#include \n}",backgroundCube_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n\tgl_Position.z = gl_Position.w;\n}",backgroundCube_frag:"#ifdef ENVMAP_TYPE_CUBE\n\tuniform samplerCube envMap;\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n\tuniform sampler2D envMap;\n#endif\nuniform float flipEnvMap;\nuniform float backgroundBlurriness;\nuniform float backgroundIntensity;\nuniform mat3 backgroundRotation;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );\n\t#else\n\t\tvec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include \n\t#include \n}",cube_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n\tgl_Position.z = gl_Position.w;\n}",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n\tvec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n\tgl_FragColor = texColor;\n\tgl_FragColor.a *= opacity;\n\t#include \n\t#include \n}",depth_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvHighPrecisionZW = gl_Position.zw;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include \n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \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#elif DEPTH_PACKING == 3202\n\t\tgl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );\n\t#elif DEPTH_PACKING == 3203\n\t\tgl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );\n\t#endif\n}",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvWorldPosition = worldPosition.xyz;\n}",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main () {\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\t#include \n\t#include \n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshbasic_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\t\t#include \n\t\t#include \n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\treflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include \n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n\t#include \n}",meshlambert_frag:"#define LAMBERT\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t#else\n\t\tvec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshnormal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}",meshnormal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\tgl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a );\n\t#ifdef OPAQUE\n\t\tgl_FragColor.a = 1.0;\n\t#endif\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n\t#include \n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n\tvarying vec3 vWorldPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n#ifdef USE_TRANSMISSION\n\tvWorldPosition = worldPosition.xyz;\n#endif\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n\t#define IOR\n\t#define USE_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 USE_SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\t#ifdef USE_SPECULAR_COLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_DISPERSION\n\tuniform float dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n\tuniform float iridescence;\n\tuniform float iridescenceIOR;\n\tuniform float iridescenceThicknessMinimum;\n\tuniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\tuniform vec2 anisotropyVector;\n\t#ifdef USE_ANISOTROPYMAP\n\t\tuniform sampler2D anisotropyMap;\n\t#endif\n#endif\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include \n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\t#ifdef USE_SHEEN\n\t\tfloat sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n\t\toutgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect;\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",points_vert:"uniform float size;\nuniform float scale;\n#include \n#include \n#include \n#include \n#include \n#include \n#ifdef USE_POINTS_UV\n\tvarying vec2 vUv;\n\tuniform mat3 uvTransform;\n#endif\nvoid main() {\n\t#ifdef USE_POINTS_UV\n\t\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \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 \n\t#include \n\t#include \n\t#include \n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",shadow_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include \n\t#include \n\t#include \n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 mvPosition = modelViewMatrix[ 3 ];\n\tvec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) );\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 \n\t#include \n\t#include \n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n}"},um={common:{diffuse:{value:new Od(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Hc},alphaMap:{value:null},alphaMapTransform:{value:new Hc},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Hc}},envmap:{envMap:{value:null},envMapRotation:{value:new Hc},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Hc}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Hc}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Hc},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Hc},normalScale:{value:new Vc(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Hc},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Hc}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Hc}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Hc}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Od(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,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 Od(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Hc},alphaTest:{value:0},uvTransform:{value:new Hc}},sprite:{diffuse:{value:new Od(16777215)},opacity:{value:1},center:{value:new Vc(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Hc},alphaMap:{value:null},alphaMapTransform:{value:new Hc},alphaTest:{value:0}}},lm={basic:{uniforms:xf([um.common,um.specularmap,um.envmap,um.aomap,um.lightmap,um.fog]),vertexShader:sm.meshbasic_vert,fragmentShader:sm.meshbasic_frag},lambert:{uniforms:xf([um.common,um.specularmap,um.envmap,um.aomap,um.lightmap,um.emissivemap,um.bumpmap,um.normalmap,um.displacementmap,um.fog,um.lights,{emissive:{value:new Od(0)}}]),vertexShader:sm.meshlambert_vert,fragmentShader:sm.meshlambert_frag},phong:{uniforms:xf([um.common,um.specularmap,um.envmap,um.aomap,um.lightmap,um.emissivemap,um.bumpmap,um.normalmap,um.displacementmap,um.fog,um.lights,{emissive:{value:new Od(0)},specular:{value:new Od(1118481)},shininess:{value:30}}]),vertexShader:sm.meshphong_vert,fragmentShader:sm.meshphong_frag},standard:{uniforms:xf([um.common,um.envmap,um.aomap,um.lightmap,um.emissivemap,um.bumpmap,um.normalmap,um.displacementmap,um.roughnessmap,um.metalnessmap,um.fog,um.lights,{emissive:{value:new Od(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:sm.meshphysical_vert,fragmentShader:sm.meshphysical_frag},toon:{uniforms:xf([um.common,um.aomap,um.lightmap,um.emissivemap,um.bumpmap,um.normalmap,um.displacementmap,um.gradientmap,um.fog,um.lights,{emissive:{value:new Od(0)}}]),vertexShader:sm.meshtoon_vert,fragmentShader:sm.meshtoon_frag},matcap:{uniforms:xf([um.common,um.bumpmap,um.normalmap,um.displacementmap,um.fog,{matcap:{value:null}}]),vertexShader:sm.meshmatcap_vert,fragmentShader:sm.meshmatcap_frag},points:{uniforms:xf([um.points,um.fog]),vertexShader:sm.points_vert,fragmentShader:sm.points_frag},dashed:{uniforms:xf([um.common,um.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:sm.linedashed_vert,fragmentShader:sm.linedashed_frag},depth:{uniforms:xf([um.common,um.displacementmap]),vertexShader:sm.depth_vert,fragmentShader:sm.depth_frag},normal:{uniforms:xf([um.common,um.bumpmap,um.normalmap,um.displacementmap,{opacity:{value:1}}]),vertexShader:sm.meshnormal_vert,fragmentShader:sm.meshnormal_frag},sprite:{uniforms:xf([um.sprite,um.fog]),vertexShader:sm.sprite_vert,fragmentShader:sm.sprite_frag},background:{uniforms:{uvTransform:{value:new Hc},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:sm.background_vert,fragmentShader:sm.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Hc}},vertexShader:sm.backgroundCube_vert,fragmentShader:sm.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:sm.cube_vert,fragmentShader:sm.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:sm.equirect_vert,fragmentShader:sm.equirect_frag},distanceRGBA:{uniforms:xf([um.common,um.displacementmap,{referencePosition:{value:new ph},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:sm.distanceRGBA_vert,fragmentShader:sm.distanceRGBA_frag},shadow:{uniforms:xf([um.lights,um.fog,{color:{value:new Od(0)},opacity:{value:1}}]),vertexShader:sm.shadow_vert,fragmentShader:sm.shadow_frag}};lm.physical={uniforms:xf([lm.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Hc},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Hc},clearcoatNormalScale:{value:new Vc(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Hc},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Hc},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Hc},sheen:{value:0},sheenColor:{value:new Od(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Hc},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Hc},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Hc},transmissionSamplerSize:{value:new Vc},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Hc},attenuationDistance:{value:0},attenuationColor:{value:new Od(0)},specularColor:{value:new Od(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Hc},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Hc},anisotropyVector:{value:new Vc},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Hc}}]),vertexShader:sm.meshphysical_vert,fragmentShader:sm.meshphysical_frag};var cm={r:0,b:0,g:0},hm=new ed,dm=new Gh;function fm(e,t,n,r,i,a,o){var s,u,l=new Od(0),c=!0===a?0:1,h=null,d=0,f=null;function p(e){var r=!0===e.isScene?e.background:null;r&&r.isTexture&&(r=(e.backgroundBlurriness>0?n:t).get(r));return r}function v(t,n){t.getRGB(cm,Sf(e)),r.buffers.color.setClear(cm.r,cm.g,cm.b,n,o)}return{getClearColor:function(){return l},setClearColor:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;l.set(e),v(l,c=t)},getClearAlpha:function(){return c},setClearAlpha:function(e){v(l,c=e)},render:function(t){var n=!1,i=p(t);null===i?v(l,c):i&&i.isColor&&(v(i,1),n=!0);var a=e.xr.getEnvironmentBlendMode();"additive"===a?r.buffers.color.setClear(0,0,0,1,o):"alpha-blend"===a&&r.buffers.color.setClear(0,0,0,0,o),(e.autoClear||n)&&(r.buffers.depth.setTest(!0),r.buffers.depth.setMask(!0),r.buffers.color.setMask(!0),e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil))},addToRenderList:function(t,n){var r=p(n);r&&(r.isCubeTexture||r.mapping===rl)?(void 0===u&&((u=new gf(new _f(1,1,1),new wf({name:"BackgroundCubeMaterial",uniforms:bf(lm.backgroundCube.uniforms),vertexShader:lm.backgroundCube.vertexShader,fragmentShader:lm.backgroundCube.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.deleteAttribute("normal"),u.geometry.deleteAttribute("uv"),u.onBeforeRender=function(e,t,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(u.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(u)),hm.copy(n.backgroundRotation),hm.x*=-1,hm.y*=-1,hm.z*=-1,r.isCubeTexture&&!1===r.isRenderTargetTexture&&(hm.y*=-1,hm.z*=-1),u.material.uniforms.envMap.value=r,u.material.uniforms.flipEnvMap.value=r.isCubeTexture&&!1===r.isRenderTargetTexture?-1:1,u.material.uniforms.backgroundBlurriness.value=n.backgroundBlurriness,u.material.uniforms.backgroundIntensity.value=n.backgroundIntensity,u.material.uniforms.backgroundRotation.value.setFromMatrix4(dm.makeRotationFromEuler(hm)),u.material.toneMapped=$c.getTransfer(r.colorSpace)!==Sc,h===r&&d===r.version&&f===e.toneMapping||(u.material.needsUpdate=!0,h=r,d=r.version,f=e.toneMapping),u.layers.enableAll(),t.unshift(u,u.geometry,u.material,0,0,null)):r&&r.isTexture&&(void 0===s&&((s=new gf(new Wp(2,2),new wf({name:"BackgroundMaterial",uniforms:bf(lm.background.uniforms),vertexShader:lm.background.vertexShader,fragmentShader:lm.background.fragmentShader,side:0,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.deleteAttribute("normal"),Object.defineProperty(s.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(s)),s.material.uniforms.t2D.value=r,s.material.uniforms.backgroundIntensity.value=n.backgroundIntensity,s.material.toneMapped=$c.getTransfer(r.colorSpace)!==Sc,!0===r.matrixAutoUpdate&&r.updateMatrix(),s.material.uniforms.uvTransform.value.copy(r.matrix),h===r&&d===r.version&&f===e.toneMapping||(s.material.needsUpdate=!0,h=r,d=r.version,f=e.toneMapping),s.layers.enableAll(),t.unshift(s,s.geometry,s.material,0,0,null))},dispose:function(){void 0!==u&&(u.geometry.dispose(),u.material.dispose(),u=void 0),void 0!==s&&(s.geometry.dispose(),s.material.dispose(),s=void 0)}}}function pm(e,t){var n=e.getParameter(e.MAX_VERTEX_ATTRIBS),r={},i=l(null),a=i,o=!1;function s(t){return e.bindVertexArray(t)}function u(t){return e.deleteVertexArray(t)}function l(e){for(var t=[],r=[],i=[],a=0;a=0){var c=i[l],h=o[l];if(void 0===h&&("instanceMatrix"===l&&e.instanceMatrix&&(h=e.instanceMatrix),"instanceColor"===l&&e.instanceColor&&(h=e.instanceColor)),void 0===c)return!0;if(c.attribute!==h)return!0;if(h&&c.data!==h.data)return!0;s++}}return a.attributesNum!==s||a.index!==r}(n,v,u,m))&&function(e,t,n,r){var i={},o=t.attributes,s=0,u=n.getAttributes();for(var l in u){if(u[l].location>=0){var c=o[l];void 0===c&&("instanceMatrix"===l&&e.instanceMatrix&&(c=e.instanceMatrix),"instanceColor"===l&&e.instanceColor&&(c=e.instanceColor));var h={};h.attribute=c,c&&c.data&&(h.data=c.data),i[l]=h,s++}}a.attributes=i,a.attributesNum=s,a.index=r}(n,v,u,m),null!==m&&t.update(m,e.ELEMENT_ARRAY_BUFFER),(g||o)&&(o=!1,function(n,r,i,a){c();var o=a.attributes,s=i.getAttributes(),u=r.defaultAttributeValues;for(var l in s){var v=s[l];if(v.location>=0){var m=o[l];if(void 0===m&&("instanceMatrix"===l&&n.instanceMatrix&&(m=n.instanceMatrix),"instanceColor"===l&&n.instanceColor&&(m=n.instanceColor)),void 0!==m){var g=m.normalized,y=m.itemSize,_=t.get(m);if(void 0===_)continue;var b=_.buffer,x=_.type,S=_.bytesPerElement,A=x===e.INT||x===e.UNSIGNED_INT||m.gpuType===ml;if(m.isInterleavedBufferAttribute){var w=m.data,T=w.stride,M=m.offset;if(w.isInstancedInterleavedBuffer){for(var E=0;E0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).precision>0)return"highp";t="mediump"}return"mediump"===t&&e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}var o=void 0!==n.precision?n.precision:"highp",s=a(o);s!==o&&(console.warn("THREE.WebGLRenderer:",o,"not supported, using",s,"instead."),o=s);var u=!0===n.logarithmicDepthBuffer,l=!0===n.reverseDepthBuffer&&t.has("EXT_clip_control"),c=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),h=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS);return{isWebGL2:!0,getMaxAnisotropy:function(){if(void 0!==i)return i;if(!0===t.has("EXT_texture_filter_anisotropic")){var n=t.get("EXT_texture_filter_anisotropic");i=e.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i},getMaxPrecision:a,textureFormatReadable:function(t){return t===wl||r.convert(t)===e.getParameter(e.IMPLEMENTATION_COLOR_READ_FORMAT)},textureTypeReadable:function(n){var i=n===_l&&(t.has("EXT_color_buffer_half_float")||t.has("EXT_color_buffer_float"));return!(n!==dl&&r.convert(n)!==e.getParameter(e.IMPLEMENTATION_COLOR_READ_TYPE)&&n!==yl&&!i)},precision:o,logarithmicDepthBuffer:u,reverseDepthBuffer:l,maxTextures:c,maxVertexTextures:h,maxTextureSize:e.getParameter(e.MAX_TEXTURE_SIZE),maxCubemapSize:e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),maxAttributes:e.getParameter(e.MAX_VERTEX_ATTRIBS),maxVertexUniforms:e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),maxVaryings:e.getParameter(e.MAX_VARYING_VECTORS),maxFragmentUniforms:e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),vertexTextures:h>0,maxSamples:e.getParameter(e.MAX_SAMPLES)}}function gm(e){var t=this,n=null,r=0,i=!1,a=!1,o=new pp,s=new Hc,u={value:null,needsUpdate:!1};function l(e,n,r,i){var a=null!==e?e.length:0,l=null;if(0!==a){if(l=u.value,!0!==i||null===l){var c=r+4*a,h=n.matrixWorldInverse;s.getNormalMatrix(h),(null===l||l.length0);t.numPlanes=r,t.numIntersection=0}();else{var v=a?0:r,m=4*v,g=p.clippingState||null;u.value=g,g=l(h,s,m,c);for(var y=0;y!==m;++y)g[y]=n[y];p.clippingState=g,this.numIntersection=d?this.numPlanes:0,this.numPlanes+=v}}}function ym(e){var t=new WeakMap;function n(e,t){return 303===t?e.mapping=tl:304===t&&(e.mapping=nl),e}function r(e){var n=e.target;n.removeEventListener("dispose",r);var i=t.get(n);void 0!==i&&(t.delete(n),i.dispose())}return{get:function(i){if(i&&i.isTexture){var a=i.mapping;if(303===a||304===a){if(t.has(i))return n(t.get(i).texture,i.mapping);var o=i.image;if(o&&o.height>0){var s=new Pf(o.height);return s.fromEquirectangularTexture(e,i),t.set(i,s),i.addEventListener("dispose",r),n(s.texture,i.mapping)}return null}}return i},dispose:function(){t=new WeakMap}}}var _m=[.125,.215,.35,.446,.526,.582],bm=20,xm=new Lv,Sm=new Od,Am=null,wm=0,Tm=0,Mm=!1,Em=(1+Math.sqrt(5))/2,Cm=1/Em,km=[new ph(-Em,Cm,0),new ph(Em,Cm,0),new ph(-Cm,0,Em),new ph(Cm,0,Em),new ph(0,Em,-Cm),new ph(0,Em,Cm),new ph(-1,1,-1),new ph(1,1,-1),new ph(-1,1,1),new ph(1,1,1)],Rm=function(){return T(function e(t){A(this,e),this._renderer=t,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)},[{key:"fromScene",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.1,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:100;Am=this._renderer.getRenderTarget(),wm=this._renderer.getActiveCubeFace(),Tm=this._renderer.getActiveMipmapLevel(),Mm=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(256);var i=this._allocateTargets();return i.depthBuffer=!0,this._sceneToCubeUV(e,n,r,i),t>0&&this._blur(i,0,0,t),this._applyPMREM(i),this._cleanup(i),i}},{key:"fromEquirectangular",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return this._fromTexture(e,t)}},{key:"fromCubemap",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return this._fromTexture(e,t)}},{key:"compileCubemapShader",value:function(){null===this._cubemapMaterial&&(this._cubemapMaterial=Lm(),this._compileMaterial(this._cubemapMaterial))}},{key:"compileEquirectangularShader",value:function(){null===this._equirectMaterial&&(this._equirectMaterial=Pm(),this._compileMaterial(this._equirectMaterial))}},{key:"dispose",value:function(){this._dispose(),null!==this._cubemapMaterial&&this._cubemapMaterial.dispose(),null!==this._equirectMaterial&&this._equirectMaterial.dispose()}},{key:"_setSize",value:function(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}},{key:"_dispose",value:function(){null!==this._blurMaterial&&this._blurMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(var e=0;ee-4?u=_m[o-e+4-1]:0===o&&(u=0),r.push(u);for(var l=1/(s-2),c=-l,h=1+l,d=[c,c,h,c,h,h,c,c,h,h,c,h],f=6,p=6,v=3,m=2,g=1,y=new Float32Array(v*p*f),_=new Float32Array(m*p*f),b=new Float32Array(g*p*f),x=0;x2?0:-1,w=[S,A,0,S+2/3,A,0,S+2/3,A+1,0,S,A,0,S+2/3,A+1,0,S,A+1,0];y.set(w,v*p*x),_.set(d,m*p*x);var T=[x,x,x,x,x,x];b.set(T,g*p*x)}var M=new af;M.setAttribute("position",new qd(y,v)),M.setAttribute("uv",new qd(_,m)),M.setAttribute("faceIndex",new qd(b,g)),t.push(M),i>4&&i--}return{lodPlanes:t,sizeLods:n,sigmas:r}}(i);this._sizeLods=a.sizeLods,this._lodPlanes=a.lodPlanes,this._sigmas=a.sigmas,this._blurMaterial=function(e,t,n){var r=new Float32Array(bm),i=new ph(0,1,0),a=new wf({name:"SphericalGaussianBlur",defines:{n:bm,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:"".concat(e,".0")},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:r},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform int samples;\n\t\t\tuniform float weights[ n ];\n\t\t\tuniform bool latitudinal;\n\t\t\tuniform float dTheta;\n\t\t\tuniform float mipInt;\n\t\t\tuniform vec3 poleAxis;\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include \n\n\t\t\tvec3 getSample( float theta, vec3 axis ) {\n\n\t\t\t\tfloat cosTheta = cos( theta );\n\t\t\t\t// Rodrigues' axis-angle rotation\n\t\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t\t\t\t+ cross( axis, vOutputDirection ) * sin( theta )\n\t\t\t\t\t+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n\t\t\t\treturn bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n\t\t\t\tif ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n\t\t\t\t\taxis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n\t\t\t\t}\n\n\t\t\t\taxis = normalize( axis );\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n\t\t\t\tfor ( int i = 1; i < n; i++ ) {\n\n\t\t\t\t\tif ( i >= samples ) {\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfloat theta = dTheta * float( i );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n\t\t\t\t}\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1});return a}(i,e,t)}return r}},{key:"_compileMaterial",value:function(e){var t=new gf(this._lodPlanes[0],e);this._renderer.compile(t,xm)}},{key:"_sceneToCubeUV",value:function(e,t,n,r){var i=new kf(90,1,t,n),a=[1,-1,1,1,1,1],o=[1,1,1,-1,-1,-1],s=this._renderer,u=s.autoClear,l=s.toneMapping;s.getClearColor(Sm),s.toneMapping=0,s.autoClear=!1;var c=new zd({name:"PMREM.Background",side:1,depthWrite:!1,depthTest:!1}),h=new gf(new _f,c),d=!1,f=e.background;f?f.isColor&&(c.color.copy(f),e.background=null,d=!0):(c.color.copy(Sm),d=!0);for(var p=0;p<6;p++){var v=p%3;0===v?(i.up.set(0,a[p],0),i.lookAt(o[p],0,0)):1===v?(i.up.set(0,0,a[p]),i.lookAt(0,o[p],0)):(i.up.set(0,a[p],0),i.lookAt(0,0,o[p]));var m=this._cubeSize;Nm(r,v*m,p>2?m:0,m,m),s.setRenderTarget(r),d&&s.render(h,i),s.render(e,i)}h.geometry.dispose(),h.material.dispose(),s.toneMapping=l,s.autoClear=u,e.background=f}},{key:"_textureToCubeUV",value:function(e,t){var n=this._renderer,r=e.mapping===tl||e.mapping===nl;r?(null===this._cubemapMaterial&&(this._cubemapMaterial=Lm()),this._cubemapMaterial.uniforms.flipEnvMap.value=!1===e.isRenderTargetTexture?-1:1):null===this._equirectMaterial&&(this._equirectMaterial=Pm());var i=r?this._cubemapMaterial:this._equirectMaterial,a=new gf(this._lodPlanes[0],i);i.uniforms.envMap.value=e;var o=this._cubeSize;Nm(t,0,0,3*o,2*o),n.setRenderTarget(t),n.render(a,xm)}},{key:"_applyPMREM",value:function(e){var t=this._renderer,n=t.autoClear;t.autoClear=!1;for(var r=this._lodPlanes.length,i=1;ibm&&console.warn("sigmaRadians, ".concat(i,", is too large and will clip, as it requested ").concat(p," samples when the maximum is set to ").concat(bm));for(var v=[],m=0,g=0;gx-4?r-x+4:0),4*(this._cubeSize-S),3*S,2*S),s.setRenderTarget(t),s.render(l,xm)}}])}();function Im(e,t,n){var r=new ch(e,t,n);return r.texture.mapping=rl,r.texture.name="PMREM.cubeUv",r.scissorTest=!0,r}function Nm(e,t,n,r,i){e.viewport.set(t,n,r,i),e.scissor.set(t,n,r,i)}function Pm(){return new wf({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\n\t\t\t#include \n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tgl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}function Lm(){return new wf({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tuniform float flipEnvMap;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform samplerCube envMap;\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}function Dm(e){var t=new WeakMap,n=null;function r(e){var n=e.target;n.removeEventListener("dispose",r);var i=t.get(n);void 0!==i&&(t.delete(n),i.dispose())}return{get:function(i){if(i&&i.isTexture){var a=i.mapping,o=303===a||304===a,s=a===tl||a===nl;if(o||s){var u=t.get(i),l=void 0!==u?u.texture.pmremVersion:0;if(i.isRenderTargetTexture&&i.pmremVersion!==l)return null===n&&(n=new Rm(e)),(u=o?n.fromEquirectangular(i,u):n.fromCubemap(i,u)).texture.pmremVersion=i.pmremVersion,t.set(i,u),u.texture;if(void 0!==u)return u.texture;var c=i.image;return o&&c&&c.height>0||s&&c&&function(e){for(var t=0,n=6,r=0;rt.maxTextureSize&&(b=Math.ceil(_/t.maxTextureSize),_=t.maxTextureSize);var x=new Float32Array(_*b*4*c),S=new hh(x,_,b,c);S.type=yl,S.needsUpdate=!0;for(var A=4*y,w=0;w0)return e;var i=t*n,a=qm[i];if(void 0===a&&(a=new Float32Array(i),qm[i]=a),0!==t){r.toArray(a,0);for(var o=1,s=0;o!==t;++o)s+=n,e[o].toArray(a,s)}return a}function $m(e,t){if(e.length!==t.length)return!1;for(var n=0,r=e.length;n":" "," ").concat(s,": ").concat(n[o]))}return r.join("\n")}(e.getShaderSource(t),o)}return i}function Zg(e,t){var n=function(e){$c._getMatrix(Yg,$c.workingColorSpace,e);var t="mat3( ".concat(Yg.elements.map(function(e){return e.toFixed(4)})," )");switch($c.getTransfer(e)){case xc:return[t,"LinearTransferOETF"];case Sc:return[t,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space: ",e),[t,"LinearTransferOETF"]}}(t);return["vec4 ".concat(e,"( vec4 value ) {"),"\treturn ".concat(n[1],"( vec4( value.rgb * ").concat(n[0],", value.a ) );"),"}"].join("\n")}function Jg(e,t){var n;switch(t){case 1:n="Linear";break;case 2:n="Reinhard";break;case 3:n="Cineon";break;case 4:n="ACESFilmic";break;case 6:n="AgX";break;case 7:n="Neutral";break;case 5:n="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",t),n="Linear"}return"vec3 "+e+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}var $g=new ph;function ey(){$c.getLuminanceCoefficients($g);var e=$g.x.toFixed(4),t=$g.y.toFixed(4),n=$g.z.toFixed(4);return["float luminance( const in vec3 rgb ) {","\tconst vec3 weights = vec3( ".concat(e,", ").concat(t,", ").concat(n," );"),"\treturn dot( weights, rgb );","}"].join("\n")}function ty(e){return""!==e}function ny(e,t){var n=t.numSpotLightShadows+t.numSpotLightMaps-t.numSpotLightShadowsWithMaps;return e.replace(/NUM_DIR_LIGHTS/g,t.numDirLights).replace(/NUM_SPOT_LIGHTS/g,t.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,t.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,n).replace(/NUM_RECT_AREA_LIGHTS/g,t.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,t.numPointLights).replace(/NUM_HEMI_LIGHTS/g,t.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,t.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,t.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,t.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,t.numPointLightShadows)}function ry(e,t){return e.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}var iy=/^[ \t]*#include +<([\w\d./]+)>/gm;function ay(e){return e.replace(iy,sy)}var oy=new Map;function sy(e,t){var n=sm[t];if(void 0===n){var r=oy.get(t);if(void 0===r)throw new Error("Can not resolve #include <"+t+">");n=sm[r],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',t,r)}return ay(n)}var uy=/#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 ly(e){return e.replace(uy,cy)}function cy(e,t,n,r){for(var i="",a=parseInt(t);a0&&(i+="\n"),(a=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,m].filter(ty).join("\n")).length>0&&(a+="\n")):(i=[hy(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,m,n.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",n.batching?"#define USE_BATCHING":"",n.batchingColor?"#define USE_BATCHING_COLOR":"",n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.instancingMorph?"#define USE_INSTANCING_MORPH":"",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 "+d:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.displacementMap?"#define USE_DISPLACEMENTMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.mapUv?"#define MAP_UV "+n.mapUv:"",n.alphaMapUv?"#define ALPHAMAP_UV "+n.alphaMapUv:"",n.lightMapUv?"#define LIGHTMAP_UV "+n.lightMapUv:"",n.aoMapUv?"#define AOMAP_UV "+n.aoMapUv:"",n.emissiveMapUv?"#define EMISSIVEMAP_UV "+n.emissiveMapUv:"",n.bumpMapUv?"#define BUMPMAP_UV "+n.bumpMapUv:"",n.normalMapUv?"#define NORMALMAP_UV "+n.normalMapUv:"",n.displacementMapUv?"#define DISPLACEMENTMAP_UV "+n.displacementMapUv:"",n.metalnessMapUv?"#define METALNESSMAP_UV "+n.metalnessMapUv:"",n.roughnessMapUv?"#define ROUGHNESSMAP_UV "+n.roughnessMapUv:"",n.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+n.anisotropyMapUv:"",n.clearcoatMapUv?"#define CLEARCOATMAP_UV "+n.clearcoatMapUv:"",n.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+n.clearcoatNormalMapUv:"",n.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+n.clearcoatRoughnessMapUv:"",n.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+n.iridescenceMapUv:"",n.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+n.iridescenceThicknessMapUv:"",n.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+n.sheenColorMapUv:"",n.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+n.sheenRoughnessMapUv:"",n.specularMapUv?"#define SPECULARMAP_UV "+n.specularMapUv:"",n.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+n.specularColorMapUv:"",n.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+n.specularIntensityMapUv:"",n.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+n.transmissionMapUv:"",n.thicknessMapUv?"#define THICKNESSMAP_UV "+n.thicknessMapUv:"",n.vertexTangents&&!1===n.flatShading?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&!1===n.flatShading?"#define USE_MORPHNORMALS":"",n.morphColors?"#define USE_MORPHCOLORS":"",n.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+n.morphTextureStride:"",n.morphTargetsCount>0?"#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.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","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","#ifdef USE_INSTANCING_MORPH","\tuniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1","\tattribute vec2 uv1;","#endif","#ifdef USE_UV2","\tattribute vec2 uv2;","#endif","#ifdef USE_UV3","\tattribute vec2 uv3;","#endif","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","\tattribute vec4 color;","#elif defined( USE_COLOR )","\tattribute vec3 color;","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(ty).join("\n"),a=[hy(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,m,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+h:"",n.envMap?"#define "+d:"",n.envMap?"#define "+f:"",p?"#define CUBEUV_TEXEL_WIDTH "+p.texelWidth:"",p?"#define CUBEUV_TEXEL_HEIGHT "+p.texelHeight:"",p?"#define CUBEUV_MAX_MIP "+p.maxMip+".0":"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoat?"#define USE_CLEARCOAT":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.dispersion?"#define USE_DISPERSION":"",n.iridescence?"#define USE_IRIDESCENCE":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaTest?"#define USE_ALPHATEST":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.sheen?"#define USE_SHEEN":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.vertexTangents&&!1===n.flatShading?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor||n.batchingColor?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",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.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",n.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",0!==n.toneMapping?"#define TONE_MAPPING":"",0!==n.toneMapping?sm.tonemapping_pars_fragment:"",0!==n.toneMapping?Jg("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",sm.colorspace_pars_fragment,Zg("linearToOutputTexel",n.outputColorSpace),ey(),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(ty).join("\n")),u=ry(u=ny(u=ay(u),n),n),l=ry(l=ny(l=ay(l),n),n),u=ly(u),l=ly(l),!0!==n.isRawShaderMaterial&&(y="#version 300 es\n",i=[v,"#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+i,a=["#define varying in",n.glslVersion===Mc?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===Mc?"":"#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"+a);var _,b,x=y+i+u,S=y+a+l,A=qg(o,o.VERTEX_SHADER,x),w=qg(o,o.FRAGMENT_SHADER,S);function T(t){if(e.debug.checkShaderErrors){var n=o.getProgramInfoLog(g).trim(),r=o.getShaderInfoLog(A).trim(),s=o.getShaderInfoLog(w).trim(),u=!0,l=!0;if(!1===o.getProgramParameter(g,o.LINK_STATUS))if(u=!1,"function"==typeof e.debug.onShaderError)e.debug.onShaderError(o,g,A,w);else{var c=Kg(o,A,"vertex"),h=Kg(o,w,"fragment");console.error("THREE.WebGLProgram: Shader Error "+o.getError()+" - VALIDATE_STATUS "+o.getProgramParameter(g,o.VALIDATE_STATUS)+"\n\nMaterial Name: "+t.name+"\nMaterial Type: "+t.type+"\n\nProgram Info Log: "+n+"\n"+c+"\n"+h)}else""!==n?console.warn("THREE.WebGLProgram: Program Info Log:",n):""!==r&&""!==s||(l=!1);l&&(t.diagnostics={runnable:u,programLog:n,vertexShader:{log:r,prefix:i},fragmentShader:{log:s,prefix:a}})}o.deleteShader(A),o.deleteShader(w),_=new Qg(o,g),b=function(e,t){for(var n={},r=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES),i=0;i0,X=a.clearcoat>0,Y=a.dispersion>0,K=a.iridescence>0,Z=a.sheen>0,J=a.transmission>0,$=q&&!!a.anisotropyMap,ee=X&&!!a.clearcoatMap,te=X&&!!a.clearcoatNormalMap,ne=X&&!!a.clearcoatRoughnessMap,re=K&&!!a.iridescenceMap,ie=K&&!!a.iridescenceThicknessMap,ae=Z&&!!a.sheenColorMap,oe=Z&&!!a.sheenRoughnessMap,se=!!a.specularMap,ue=!!a.specularColorMap,le=!!a.specularIntensityMap,ce=J&&!!a.transmissionMap,he=J&&!!a.thicknessMap,de=!!a.gradientMap,fe=!!a.alphaMap,pe=a.alphaTest>0,ve=!!a.alphaHash,me=!!a.extensions,ge=0;a.toneMapped&&(null!==N&&!0!==N.isXRRenderTarget||(ge=e.toneMapping));var ye={shaderID:A,shaderType:a.type,shaderName:a.name,vertexShader:w,fragmentShader:T,defines:a.defines,customVertexShaderID:M,customFragmentShaderID:E,isRawShaderMaterial:!0===a.isRawShaderMaterial,glslVersion:a.glslVersion,precision:f,batching:D,batchingColor:D&&null!==g._colorsTexture,instancing:L,instancingColor:L&&null!==g.instanceColor,instancingMorph:L&&null!==g.morphTexture,supportsVertexTextures:d,outputColorSpace:null===N?e.outputColorSpace:!0===N.isXRRenderTarget?N.texture.colorSpace:bc,alphaToCoverage:!!a.alphaToCoverage,map:O,matcap:F,envMap:B,envMapMode:B&&x.mapping,envMapCubeUVHeight:S,aoMap:U,lightMap:z,bumpMap:V,normalMap:H,displacementMap:d&&W,emissiveMap:G,normalMapObjectSpace:H&&1===a.normalMapType,normalMapTangentSpace:H&&0===a.normalMapType,metalnessMap:j,roughnessMap:Q,anisotropy:q,anisotropyMap:$,clearcoat:X,clearcoatMap:ee,clearcoatNormalMap:te,clearcoatRoughnessMap:ne,dispersion:Y,iridescence:K,iridescenceMap:re,iridescenceThicknessMap:ie,sheen:Z,sheenColorMap:ae,sheenRoughnessMap:oe,specularMap:se,specularColorMap:ue,specularIntensityMap:le,transmission:J,transmissionMap:ce,thicknessMap:he,gradientMap:de,opaque:!1===a.transparent&&1===a.blending&&!1===a.alphaToCoverage,alphaMap:fe,alphaTest:pe,alphaHash:ve,combine:a.combine,mapUv:O&&v(a.map.channel),aoMapUv:U&&v(a.aoMap.channel),lightMapUv:z&&v(a.lightMap.channel),bumpMapUv:V&&v(a.bumpMap.channel),normalMapUv:H&&v(a.normalMap.channel),displacementMapUv:W&&v(a.displacementMap.channel),emissiveMapUv:G&&v(a.emissiveMap.channel),metalnessMapUv:j&&v(a.metalnessMap.channel),roughnessMapUv:Q&&v(a.roughnessMap.channel),anisotropyMapUv:$&&v(a.anisotropyMap.channel),clearcoatMapUv:ee&&v(a.clearcoatMap.channel),clearcoatNormalMapUv:te&&v(a.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:ne&&v(a.clearcoatRoughnessMap.channel),iridescenceMapUv:re&&v(a.iridescenceMap.channel),iridescenceThicknessMapUv:ie&&v(a.iridescenceThicknessMap.channel),sheenColorMapUv:ae&&v(a.sheenColorMap.channel),sheenRoughnessMapUv:oe&&v(a.sheenRoughnessMap.channel),specularMapUv:se&&v(a.specularMap.channel),specularColorMapUv:ue&&v(a.specularColorMap.channel),specularIntensityMapUv:le&&v(a.specularIntensityMap.channel),transmissionMapUv:ce&&v(a.transmissionMap.channel),thicknessMapUv:he&&v(a.thicknessMap.channel),alphaMapUv:fe&&v(a.alphaMap.channel),vertexTangents:!!_.attributes.tangent&&(H||q),vertexColors:a.vertexColors,vertexAlphas:!0===a.vertexColors&&!!_.attributes.color&&4===_.attributes.color.itemSize,pointsUvs:!0===g.isPoints&&!!_.attributes.uv&&(O||fe),fog:!!y,useFog:!0===a.fog,fogExp2:!!y&&y.isFogExp2,flatShading:!0===a.flatShading,sizeAttenuation:!0===a.sizeAttenuation,logarithmicDepthBuffer:h,reverseDepthBuffer:P,skinning:!0===g.isSkinnedMesh,morphTargets:void 0!==_.morphAttributes.position,morphNormals:void 0!==_.morphAttributes.normal,morphColors:void 0!==_.morphAttributes.color,morphTargetsCount:k,morphTextureStride:R,numDirLights:s.directional.length,numPointLights:s.point.length,numSpotLights:s.spot.length,numSpotLightMaps:s.spotLightMap.length,numRectAreaLights:s.rectArea.length,numHemiLights:s.hemi.length,numDirLightShadows:s.directionalShadowMap.length,numPointLightShadows:s.pointShadowMap.length,numSpotLightShadows:s.spotShadowMap.length,numSpotLightShadowsWithMaps:s.numSpotLightShadowsWithMaps,numLightProbes:s.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:a.dithering,shadowMapEnabled:e.shadowMap.enabled&&c.length>0,shadowMapType:e.shadowMap.type,toneMapping:ge,decodeVideoTexture:O&&!0===a.map.isVideoTexture&&$c.getTransfer(a.map.colorSpace)===Sc,decodeVideoTextureEmissive:G&&!0===a.emissiveMap.isVideoTexture&&$c.getTransfer(a.emissiveMap.colorSpace)===Sc,premultipliedAlpha:a.premultipliedAlpha,doubleSided:2===a.side,flipSided:1===a.side,useDepthPacking:a.depthPacking>=0,depthPacking:a.depthPacking||0,index0AttributeName:a.index0AttributeName,extensionClipCullDistance:me&&!0===a.extensions.clipCullDistance&&r.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(me&&!0===a.extensions.multiDraw||D)&&r.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:r.has("KHR_parallel_shader_compile"),customProgramCacheKey:a.customProgramCacheKey()};return ye.vertexUv1s=l.has(1),ye.vertexUv2s=l.has(2),ye.vertexUv3s=l.has(3),l.clear(),ye},getProgramCacheKey:function(t){var n=[];if(t.shaderID?n.push(t.shaderID):(n.push(t.customVertexShaderID),n.push(t.customFragmentShaderID)),void 0!==t.defines)for(var r in t.defines)n.push(r),n.push(t.defines[r]);return!1===t.isRawShaderMaterial&&(!function(e,t){e.push(t.precision),e.push(t.outputColorSpace),e.push(t.envMapMode),e.push(t.envMapCubeUVHeight),e.push(t.mapUv),e.push(t.alphaMapUv),e.push(t.lightMapUv),e.push(t.aoMapUv),e.push(t.bumpMapUv),e.push(t.normalMapUv),e.push(t.displacementMapUv),e.push(t.emissiveMapUv),e.push(t.metalnessMapUv),e.push(t.roughnessMapUv),e.push(t.anisotropyMapUv),e.push(t.clearcoatMapUv),e.push(t.clearcoatNormalMapUv),e.push(t.clearcoatRoughnessMapUv),e.push(t.iridescenceMapUv),e.push(t.iridescenceThicknessMapUv),e.push(t.sheenColorMapUv),e.push(t.sheenRoughnessMapUv),e.push(t.specularMapUv),e.push(t.specularColorMapUv),e.push(t.specularIntensityMapUv),e.push(t.transmissionMapUv),e.push(t.thicknessMapUv),e.push(t.combine),e.push(t.fogExp2),e.push(t.sizeAttenuation),e.push(t.morphTargetsCount),e.push(t.morphAttributeCount),e.push(t.numDirLights),e.push(t.numPointLights),e.push(t.numSpotLights),e.push(t.numSpotLightMaps),e.push(t.numHemiLights),e.push(t.numRectAreaLights),e.push(t.numDirLightShadows),e.push(t.numPointLightShadows),e.push(t.numSpotLightShadows),e.push(t.numSpotLightShadowsWithMaps),e.push(t.numLightProbes),e.push(t.shadowMapType),e.push(t.toneMapping),e.push(t.numClippingPlanes),e.push(t.numClipIntersection),e.push(t.depthPacking)}(n,t),function(e,t){s.disableAll(),t.supportsVertexTextures&&s.enable(0);t.instancing&&s.enable(1);t.instancingColor&&s.enable(2);t.instancingMorph&&s.enable(3);t.matcap&&s.enable(4);t.envMap&&s.enable(5);t.normalMapObjectSpace&&s.enable(6);t.normalMapTangentSpace&&s.enable(7);t.clearcoat&&s.enable(8);t.iridescence&&s.enable(9);t.alphaTest&&s.enable(10);t.vertexColors&&s.enable(11);t.vertexAlphas&&s.enable(12);t.vertexUv1s&&s.enable(13);t.vertexUv2s&&s.enable(14);t.vertexUv3s&&s.enable(15);t.vertexTangents&&s.enable(16);t.anisotropy&&s.enable(17);t.alphaHash&&s.enable(18);t.batching&&s.enable(19);t.dispersion&&s.enable(20);t.batchingColor&&s.enable(21);e.push(s.mask),s.disableAll(),t.fog&&s.enable(0);t.useFog&&s.enable(1);t.flatShading&&s.enable(2);t.logarithmicDepthBuffer&&s.enable(3);t.reverseDepthBuffer&&s.enable(4);t.skinning&&s.enable(5);t.morphTargets&&s.enable(6);t.morphNormals&&s.enable(7);t.morphColors&&s.enable(8);t.premultipliedAlpha&&s.enable(9);t.shadowMapEnabled&&s.enable(10);t.doubleSided&&s.enable(11);t.flipSided&&s.enable(12);t.useDepthPacking&&s.enable(13);t.dithering&&s.enable(14);t.transmission&&s.enable(15);t.sheen&&s.enable(16);t.opaque&&s.enable(17);t.pointsUvs&&s.enable(18);t.decodeVideoTexture&&s.enable(19);t.decodeVideoTextureEmissive&&s.enable(20);t.alphaToCoverage&&s.enable(21);e.push(s.mask)}(n,t),n.push(e.outputColorSpace)),n.push(t.customProgramCacheKey),n.join()},getUniforms:function(e){var t,n=p[e.type];if(n){var r=lm[n];t=Af.clone(r.uniforms)}else t=e.uniforms;return t},acquireProgram:function(t,n){for(var r,i=0,o=c.length;i0?r.push(c):!0===o.transparent?i.push(c):n.push(c)},unshift:function(e,t,o,s,u,l){var c=a(e,t,o,s,u,l);o.transmission>0?r.unshift(c):!0===o.transparent?i.unshift(c):n.unshift(c)},finish:function(){for(var n=t,r=e.length;n1&&n.sort(e||yy),r.length>1&&r.sort(t||_y),i.length>1&&i.sort(t||_y)}}}function xy(){var e=new WeakMap;return{get:function(t,n){var r,i=e.get(t);return void 0===i?(r=new by,e.set(t,[r])):n>=i.length?(r=new by,i.push(r)):r=i[n],r},dispose:function(){e=new WeakMap}}}function Sy(){var e={};return{get:function(t){if(void 0!==e[t.id])return e[t.id];var n;switch(t.type){case"DirectionalLight":n={direction:new ph,color:new Od};break;case"SpotLight":n={position:new ph,direction:new ph,color:new Od,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new ph,color:new Od,distance:0,decay:0};break;case"HemisphereLight":n={direction:new ph,skyColor:new Od,groundColor:new Od};break;case"RectAreaLight":n={color:new Od,position:new ph,halfWidth:new ph,halfHeight:new ph}}return e[t.id]=n,n}}}var Ay=0;function wy(e,t){return(t.castShadow?2:0)-(e.castShadow?2:0)+(t.map?1:0)-(e.map?1:0)}function Ty(e){for(var t,n=new Sy,r=(t={},{get:function(e){if(void 0!==t[e.id])return t[e.id];var n;switch(e.type){case"DirectionalLight":case"SpotLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Vc};break;case"PointLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Vc,shadowCameraNear:1,shadowCameraFar:1e3}}return t[e.id]=n,n}}),i={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0},a=0;a<9;a++)i.probe.push(new ph);var o=new ph,s=new Gh,u=new Gh;return{setup:function(t){for(var a=0,o=0,s=0,u=0;u<9;u++)i.probe[u].set(0,0,0);var l=0,c=0,h=0,d=0,f=0,p=0,v=0,m=0,g=0,y=0,_=0;t.sort(wy);for(var b=0,x=t.length;b0&&(!0===e.has("OES_texture_float_linear")?(i.rectAreaLTC1=um.LTC_FLOAT_1,i.rectAreaLTC2=um.LTC_FLOAT_2):(i.rectAreaLTC1=um.LTC_HALF_1,i.rectAreaLTC2=um.LTC_HALF_2)),i.ambient[0]=a,i.ambient[1]=o,i.ambient[2]=s;var U=i.hash;U.directionalLength===l&&U.pointLength===c&&U.spotLength===h&&U.rectAreaLength===d&&U.hemiLength===f&&U.numDirectionalShadows===p&&U.numPointShadows===v&&U.numSpotShadows===m&&U.numSpotMaps===g&&U.numLightProbes===_||(i.directional.length=l,i.spot.length=h,i.rectArea.length=d,i.point.length=c,i.hemi.length=f,i.directionalShadow.length=p,i.directionalShadowMap.length=p,i.pointShadow.length=v,i.pointShadowMap.length=v,i.spotShadow.length=m,i.spotShadowMap.length=m,i.directionalShadowMatrix.length=p,i.pointShadowMatrix.length=v,i.spotLightMatrix.length=m+g-y,i.spotLightMap.length=g,i.numSpotLightShadowsWithMaps=y,i.numLightProbes=_,U.directionalLength=l,U.pointLength=c,U.spotLength=h,U.rectAreaLength=d,U.hemiLength=f,U.numDirectionalShadows=p,U.numPointShadows=v,U.numSpotShadows=m,U.numSpotMaps=g,U.numLightProbes=_,i.version=Ay++)},setupView:function(e,t){for(var n=0,r=0,a=0,l=0,c=0,h=t.matrixWorldInverse,d=0,f=e.length;d1&&void 0!==arguments[1]?arguments[1]:0,a=t.get(n);return void 0===a?(r=new My(e),t.set(n,[r])):i>=a.length?(r=new My(e),a.push(r)):r=a[i],r},dispose:function(){t=new WeakMap}}}function Cy(e,t,n){var r=new gp,i=new Vc,a=new Vc,o=new uh,s=new qp({depthPacking:3201}),u=new Xp,l={},c=n.maxTextureSize,h=M(M(M({},0,1),1,0),2,2),d=new wf({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Vc},radius:{value:4}},vertexShader:"void main() {\n\tgl_Position = vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include \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}"}),f=d.clone();f.defines.HORIZONTAL_PASS=1;var p=new af;p.setAttribute("position",new qd(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));var v=new gf(p,d),m=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=1;var g=this.type;function y(n,r){var a=t.update(v);d.defines.VSM_SAMPLES!==n.blurSamples&&(d.defines.VSM_SAMPLES=n.blurSamples,f.defines.VSM_SAMPLES=n.blurSamples,d.needsUpdate=!0,f.needsUpdate=!0),null===n.mapPass&&(n.mapPass=new ch(i.x,i.y)),d.uniforms.shadow_pass.value=n.map.texture,d.uniforms.resolution.value=n.mapSize,d.uniforms.radius.value=n.radius,e.setRenderTarget(n.mapPass),e.clear(),e.renderBufferDirect(r,null,a,d,v,null),f.uniforms.shadow_pass.value=n.mapPass.texture,f.uniforms.resolution.value=n.mapSize,f.uniforms.radius.value=n.radius,e.setRenderTarget(n.map),e.clear(),e.renderBufferDirect(r,null,a,f,v,null)}function _(t,n,r,i){var a=null,o=!0===r.isPointLight?t.customDistanceMaterial:t.customDepthMaterial;if(void 0!==o)a=o;else if(a=!0===r.isPointLight?u:s,e.localClippingEnabled&&!0===n.clipShadows&&Array.isArray(n.clippingPlanes)&&0!==n.clippingPlanes.length||n.displacementMap&&0!==n.displacementScale||n.alphaMap&&n.alphaTest>0||n.map&&n.alphaTest>0){var c=a.uuid,d=n.uuid,f=l[c];void 0===f&&(f={},l[c]=f);var p=f[d];void 0===p&&(p=a.clone(),f[d]=p,n.addEventListener("dispose",x)),a=p}(a.visible=n.visible,a.wireframe=n.wireframe,a.side=3===i?null!==n.shadowSide?n.shadowSide:n.side:null!==n.shadowSide?n.shadowSide:h[n.side],a.alphaMap=n.alphaMap,a.alphaTest=n.alphaTest,a.map=n.map,a.clipShadows=n.clipShadows,a.clippingPlanes=n.clippingPlanes,a.clipIntersection=n.clipIntersection,a.displacementMap=n.displacementMap,a.displacementScale=n.displacementScale,a.displacementBias=n.displacementBias,a.wireframeLinewidth=n.wireframeLinewidth,a.linewidth=n.linewidth,!0===r.isPointLight&&!0===a.isMeshDistanceMaterial)&&(e.properties.get(a).light=r);return a}function b(n,i,a,o,s){if(!1!==n.visible){if(n.layers.test(i.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&3===s)&&(!n.frustumCulled||r.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(a.matrixWorldInverse,n.matrixWorld);var u=t.update(n),l=n.material;if(Array.isArray(l))for(var c=u.groups,h=0,d=c.length;hc||i.y>c)&&(i.x>c&&(a.x=Math.floor(c/A.x),i.x=a.x*A.x,S.mapSize.x=a.x),i.y>c&&(a.y=Math.floor(c/A.y),i.y=a.y*A.y,S.mapSize.y=a.y)),null===S.map||!0===f||!0===p){var w=3!==this.type?{minFilter:sl,magFilter:sl}:{};null!==S.map&&S.map.dispose(),S.map=new ch(i.x,i.y,w),S.map.texture.name=x.name+".shadowMap",S.camera.updateProjectionMatrix()}e.setRenderTarget(S.map),e.clear();for(var T=S.getViewportCount(),M=0;M=1):-1!==P.indexOf("OpenGL ES")&&(N=parseFloat(/^OpenGL ES (\d)/.exec(P)[1]),I=N>=2);var L=null,D={},O=e.getParameter(e.SCISSOR_BOX),F=e.getParameter(e.VIEWPORT),B=(new uh).fromArray(O),U=(new uh).fromArray(F);function z(t,n,r,i){var a=new Uint8Array(4),o=e.createTexture();e.bindTexture(t,o),e.texParameteri(t,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(t,e.TEXTURE_MAG_FILTER,e.NEAREST);for(var s=0;sn||i.height>n)&&(r=n/Math.max(i.width,i.height)),r<1){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap||"undefined"!=typeof VideoFrame&&e instanceof VideoFrame){var a=Math.floor(r*i.width),o=Math.floor(r*i.height);void 0===s&&(s=p(a,o));var u=t?p(a,o):s;return u.width=a,u.height=o,u.getContext("2d").drawImage(e,0,0,a,o),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+i.width+"x"+i.height+") to ("+a+"x"+o+")."),u}return"data"in e&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+i.width+"x"+i.height+")."),e}return e}function m(e){return e.generateMipmaps}function g(t){e.generateMipmap(t)}function y(t){return t.isWebGLCubeRenderTarget?e.TEXTURE_CUBE_MAP:t.isWebGL3DRenderTarget?e.TEXTURE_3D:t.isWebGLArrayRenderTarget||t.isCompressedArrayTexture?e.TEXTURE_2D_ARRAY:e.TEXTURE_2D}function _(n,r,i,a){var o=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(null!==n){if(void 0!==e[n])return e[n];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+n+"'")}var s=r;if(r===e.RED&&(i===e.FLOAT&&(s=e.R32F),i===e.HALF_FLOAT&&(s=e.R16F),i===e.UNSIGNED_BYTE&&(s=e.R8)),r===e.RED_INTEGER&&(i===e.UNSIGNED_BYTE&&(s=e.R8UI),i===e.UNSIGNED_SHORT&&(s=e.R16UI),i===e.UNSIGNED_INT&&(s=e.R32UI),i===e.BYTE&&(s=e.R8I),i===e.SHORT&&(s=e.R16I),i===e.INT&&(s=e.R32I)),r===e.RG&&(i===e.FLOAT&&(s=e.RG32F),i===e.HALF_FLOAT&&(s=e.RG16F),i===e.UNSIGNED_BYTE&&(s=e.RG8)),r===e.RG_INTEGER&&(i===e.UNSIGNED_BYTE&&(s=e.RG8UI),i===e.UNSIGNED_SHORT&&(s=e.RG16UI),i===e.UNSIGNED_INT&&(s=e.RG32UI),i===e.BYTE&&(s=e.RG8I),i===e.SHORT&&(s=e.RG16I),i===e.INT&&(s=e.RG32I)),r===e.RGB_INTEGER&&(i===e.UNSIGNED_BYTE&&(s=e.RGB8UI),i===e.UNSIGNED_SHORT&&(s=e.RGB16UI),i===e.UNSIGNED_INT&&(s=e.RGB32UI),i===e.BYTE&&(s=e.RGB8I),i===e.SHORT&&(s=e.RGB16I),i===e.INT&&(s=e.RGB32I)),r===e.RGBA_INTEGER&&(i===e.UNSIGNED_BYTE&&(s=e.RGBA8UI),i===e.UNSIGNED_SHORT&&(s=e.RGBA16UI),i===e.UNSIGNED_INT&&(s=e.RGBA32UI),i===e.BYTE&&(s=e.RGBA8I),i===e.SHORT&&(s=e.RGBA16I),i===e.INT&&(s=e.RGBA32I)),r===e.RGB&&i===e.UNSIGNED_INT_5_9_9_9_REV&&(s=e.RGB9_E5),r===e.RGBA){var u=o?xc:$c.getTransfer(a);i===e.FLOAT&&(s=e.RGBA32F),i===e.HALF_FLOAT&&(s=e.RGBA16F),i===e.UNSIGNED_BYTE&&(s=u===Sc?e.SRGB8_ALPHA8:e.RGBA8),i===e.UNSIGNED_SHORT_4_4_4_4&&(s=e.RGBA4),i===e.UNSIGNED_SHORT_5_5_5_1&&(s=e.RGB5_A1)}return s!==e.R16F&&s!==e.R32F&&s!==e.RG16F&&s!==e.RG32F&&s!==e.RGBA16F&&s!==e.RGBA32F||t.get("EXT_color_buffer_float"),s}function b(t,n){var r;return t?null===n||n===gl||n===Sl?r=e.DEPTH24_STENCIL8:n===yl?r=e.DEPTH32F_STENCIL8:n===vl&&(r=e.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):null===n||n===gl||n===Sl?r=e.DEPTH_COMPONENT24:n===yl?r=e.DEPTH_COMPONENT32F:n===vl&&(r=e.DEPTH_COMPONENT16),r}function x(e,t){return!0===m(e)||e.isFramebufferTexture&&e.minFilter!==sl&&e.minFilter!==ll?Math.log2(Math.max(t.width,t.height))+1:void 0!==e.mipmaps&&e.mipmaps.length>0?e.mipmaps.length:e.isCompressedTexture&&Array.isArray(e.image)?t.mipmaps.length:1}function S(e){var t=e.target;t.removeEventListener("dispose",S),function(e){var t=r.get(e);if(void 0===t.__webglInit)return;var n=e.source,i=d.get(n);if(i){var a=i[t.__cacheKey];a.usedTimes--,0===a.usedTimes&&w(e),0===Object.keys(i).length&&d.delete(n)}r.remove(e)}(t),t.isVideoTexture&&h.delete(t)}function A(t){var n=t.target;n.removeEventListener("dispose",A),function(t){var n=r.get(t);t.depthTexture&&(t.depthTexture.dispose(),r.remove(t.depthTexture));if(t.isWebGLCubeRenderTarget)for(var i=0;i<6;i++){if(Array.isArray(n.__webglFramebuffer[i]))for(var a=0;a0&&a.__version!==t.version){var s=t.image;if(null===s)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else{if(!1!==s.complete)return void P(a,t,i);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}n.bindTexture(e.TEXTURE_2D,a.__webglTexture,e.TEXTURE0+i)}var C=M(M(M({},il,e.REPEAT),al,e.CLAMP_TO_EDGE),ol,e.MIRRORED_REPEAT),k=M(M(M(M(M(M({},sl,e.NEAREST),1004,e.NEAREST_MIPMAP_NEAREST),ul,e.NEAREST_MIPMAP_LINEAR),ll,e.LINEAR),cl,e.LINEAR_MIPMAP_NEAREST),hl,e.LINEAR_MIPMAP_LINEAR),R=M(M(M(M(M(M(M(M({},512,e.NEVER),519,e.ALWAYS),513,e.LESS),515,e.LEQUAL),514,e.EQUAL),518,e.GEQUAL),516,e.GREATER),517,e.NOTEQUAL);function I(n,a){if(a.type!==yl||!1!==t.has("OES_texture_float_linear")||a.magFilter!==ll&&a.magFilter!==cl&&a.magFilter!==ul&&a.magFilter!==hl&&a.minFilter!==ll&&a.minFilter!==cl&&a.minFilter!==ul&&a.minFilter!==hl||console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),e.texParameteri(n,e.TEXTURE_WRAP_S,C[a.wrapS]),e.texParameteri(n,e.TEXTURE_WRAP_T,C[a.wrapT]),n!==e.TEXTURE_3D&&n!==e.TEXTURE_2D_ARRAY||e.texParameteri(n,e.TEXTURE_WRAP_R,C[a.wrapR]),e.texParameteri(n,e.TEXTURE_MAG_FILTER,k[a.magFilter]),e.texParameteri(n,e.TEXTURE_MIN_FILTER,k[a.minFilter]),a.compareFunction&&(e.texParameteri(n,e.TEXTURE_COMPARE_MODE,e.COMPARE_REF_TO_TEXTURE),e.texParameteri(n,e.TEXTURE_COMPARE_FUNC,R[a.compareFunction])),!0===t.has("EXT_texture_filter_anisotropic")){if(a.magFilter===sl)return;if(a.minFilter!==ul&&a.minFilter!==hl)return;if(a.type===yl&&!1===t.has("OES_texture_float_linear"))return;if(a.anisotropy>1||r.get(a).__currentAnisotropy){var o=t.get("EXT_texture_filter_anisotropic");e.texParameterf(n,o.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,i.getMaxAnisotropy())),r.get(a).__currentAnisotropy=a.anisotropy}}}function N(t,n){var r=!1;void 0===t.__webglInit&&(t.__webglInit=!0,n.addEventListener("dispose",S));var i=n.source,a=d.get(i);void 0===a&&(a={},d.set(i,a));var s=function(e){var t=[];return t.push(e.wrapS),t.push(e.wrapT),t.push(e.wrapR||0),t.push(e.magFilter),t.push(e.minFilter),t.push(e.anisotropy),t.push(e.internalFormat),t.push(e.format),t.push(e.type),t.push(e.generateMipmaps),t.push(e.premultiplyAlpha),t.push(e.flipY),t.push(e.unpackAlignment),t.push(e.colorSpace),t.join()}(n);if(s!==t.__cacheKey){void 0===a[s]&&(a[s]={texture:e.createTexture(),usedTimes:0},o.memory.textures++,r=!0),a[s].usedTimes++;var u=a[t.__cacheKey];void 0!==u&&(a[t.__cacheKey].usedTimes--,0===u.usedTimes&&w(n)),t.__cacheKey=s,t.__webglTexture=a[s].texture}return r}function P(t,o,s){var u=e.TEXTURE_2D;(o.isDataArrayTexture||o.isCompressedArrayTexture)&&(u=e.TEXTURE_2D_ARRAY),o.isData3DTexture&&(u=e.TEXTURE_3D);var l=N(t,o),c=o.source;n.bindTexture(u,t.__webglTexture,e.TEXTURE0+s);var h=r.get(c);if(c.version!==h.__version||!0===l){n.activeTexture(e.TEXTURE0+s);var d=$c.getPrimaries($c.workingColorSpace),f=o.colorSpace===yc?null:$c.getPrimaries(o.colorSpace),p=o.colorSpace===yc||d===f?e.NONE:e.BROWSER_DEFAULT_WEBGL;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,o.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,o.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,o.unpackAlignment),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,p);var y=v(o.image,!1,i.maxTextureSize);y=H(o,y);var S,A=a.convert(o.format,o.colorSpace),w=a.convert(o.type),T=_(o.internalFormat,A,w,o.colorSpace,o.isVideoTexture);I(u,o);var M=o.mipmaps,E=!0!==o.isVideoTexture,C=void 0===h.__version||!0===l,k=c.dataReady,R=x(o,y);if(o.isDepthTexture)T=b(o.format===Ml,o.type),C&&(E?n.texStorage2D(e.TEXTURE_2D,1,T,y.width,y.height):n.texImage2D(e.TEXTURE_2D,0,T,y.width,y.height,0,A,w,null));else if(o.isDataTexture)if(M.length>0){E&&C&&n.texStorage2D(e.TEXTURE_2D,R,T,M[0].width,M[0].height);for(var P=0,D=M.length;P0){var B,U=im(S.width,S.height,o.format,o.type),z=L(o.layerUpdates);try{for(z.s();!(B=z.n()).done;){var V=B.value,j=S.data.subarray(V*U/S.data.BYTES_PER_ELEMENT,(V+1)*U/S.data.BYTES_PER_ELEMENT);n.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,O,0,0,V,S.width,S.height,1,A,j)}}catch(G){z.e(G)}finally{z.f()}o.clearLayerUpdates()}else n.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,O,0,0,0,S.width,S.height,y.depth,A,S.data)}else n.compressedTexImage3D(e.TEXTURE_2D_ARRAY,O,T,S.width,S.height,y.depth,0,S.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else E?k&&n.texSubImage3D(e.TEXTURE_2D_ARRAY,O,0,0,0,S.width,S.height,y.depth,A,w,S.data):n.texImage3D(e.TEXTURE_2D_ARRAY,O,T,S.width,S.height,y.depth,0,A,w,S.data)}else{E&&C&&n.texStorage2D(e.TEXTURE_2D,R,T,M[0].width,M[0].height);for(var Q=0,q=M.length;Q0){var X,Y=im(y.width,y.height,o.format,o.type),K=L(o.layerUpdates);try{for(K.s();!(X=K.n()).done;){var Z=X.value,J=y.data.subarray(Z*Y/y.data.BYTES_PER_ELEMENT,(Z+1)*Y/y.data.BYTES_PER_ELEMENT);n.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,Z,y.width,y.height,1,A,w,J)}}catch(G){K.e(G)}finally{K.f()}o.clearLayerUpdates()}else n.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,0,y.width,y.height,y.depth,A,w,y.data)}else n.texImage3D(e.TEXTURE_2D_ARRAY,0,T,y.width,y.height,y.depth,0,A,w,y.data);else if(o.isData3DTexture)E?(C&&n.texStorage3D(e.TEXTURE_3D,R,T,y.width,y.height,y.depth),k&&n.texSubImage3D(e.TEXTURE_3D,0,0,0,0,y.width,y.height,y.depth,A,w,y.data)):n.texImage3D(e.TEXTURE_3D,0,T,y.width,y.height,y.depth,0,A,w,y.data);else if(o.isFramebufferTexture){if(C)if(E)n.texStorage2D(e.TEXTURE_2D,R,T,y.width,y.height);else for(var $=y.width,ee=y.height,te=0;te>=1,ee>>=1}else if(M.length>0){if(E&&C){var ne=W(M[0]);n.texStorage2D(e.TEXTURE_2D,R,T,ne.width,ne.height)}for(var re=0,ie=M.length;re>c),g=Math.max(1,i.height>>c);l===e.TEXTURE_3D||l===e.TEXTURE_2D_ARRAY?n.texImage3D(l,c,f,m,g,i.depth,0,h,d,null):n.texImage2D(l,c,f,m,g,0,h,d,null)}n.bindFramebuffer(e.FRAMEBUFFER,t),V(i)?u.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,s,l,v.__webglTexture,0,z(i)):(l===e.TEXTURE_2D||l>=e.TEXTURE_CUBE_MAP_POSITIVE_X&&l<=e.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&e.framebufferTexture2D(e.FRAMEBUFFER,s,l,v.__webglTexture,c),n.bindFramebuffer(e.FRAMEBUFFER,null)}function O(t,n,r){if(e.bindRenderbuffer(e.RENDERBUFFER,t),n.depthBuffer){var i=n.depthTexture,o=i&&i.isDepthTexture?i.type:null,s=b(n.stencilBuffer,o),l=n.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,c=z(n);V(n)?u.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,c,s,n.width,n.height):r?e.renderbufferStorageMultisample(e.RENDERBUFFER,c,s,n.width,n.height):e.renderbufferStorage(e.RENDERBUFFER,s,n.width,n.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,l,e.RENDERBUFFER,t)}else for(var h=n.textures,d=0;d0&&!0===t.has("WEBGL_multisampled_render_to_texture")&&!1!==n.__useRenderToTexture}function H(e,t){var n=e.colorSpace,r=e.format,i=e.type;return!0===e.isCompressedTexture||!0===e.isVideoTexture||n!==bc&&n!==yc&&($c.getTransfer(n)===Sc?r===wl&&i===dl||console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",n)),t}function W(e){return"undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement?(c.width=e.naturalWidth||e.width,c.height=e.naturalHeight||e.height):"undefined"!=typeof VideoFrame&&e instanceof VideoFrame?(c.width=e.displayWidth,c.height=e.displayHeight):(c.width=e.width,c.height=e.height),c}this.allocateTextureUnit=function(){var e=T;return e>=i.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+e+" texture units while this GPU supports only "+i.maxTextures),T+=1,e},this.resetTextureUnits=function(){T=0},this.setTexture2D=E,this.setTexture2DArray=function(t,i){var a=r.get(t);t.version>0&&a.__version!==t.version?P(a,t,i):n.bindTexture(e.TEXTURE_2D_ARRAY,a.__webglTexture,e.TEXTURE0+i)},this.setTexture3D=function(t,i){var a=r.get(t);t.version>0&&a.__version!==t.version?P(a,t,i):n.bindTexture(e.TEXTURE_3D,a.__webglTexture,e.TEXTURE0+i)},this.setTextureCube=function(t,o){var s=r.get(t);t.version>0&&s.__version!==t.version?function(t,o,s){if(6!==o.image.length)return;var u=N(t,o),l=o.source;n.bindTexture(e.TEXTURE_CUBE_MAP,t.__webglTexture,e.TEXTURE0+s);var c=r.get(l);if(l.version!==c.__version||!0===u){n.activeTexture(e.TEXTURE0+s);var h=$c.getPrimaries($c.workingColorSpace),d=o.colorSpace===yc?null:$c.getPrimaries(o.colorSpace),f=o.colorSpace===yc||h===d?e.NONE:e.BROWSER_DEFAULT_WEBGL;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,o.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,o.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,o.unpackAlignment),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,f);for(var p=o.isCompressedTexture||o.image[0].isCompressedTexture,y=o.image[0]&&o.image[0].isDataTexture,b=[],S=0;S<6;S++)b[S]=p||y?y?o.image[S].image:o.image[S]:v(o.image[S],!0,i.maxCubemapSize),b[S]=H(o,b[S]);var A,w=b[0],T=a.convert(o.format,o.colorSpace),M=a.convert(o.type),E=_(o.internalFormat,T,M,o.colorSpace),C=!0!==o.isVideoTexture,k=void 0===c.__version||!0===u,R=l.dataReady,P=x(o,w);if(I(e.TEXTURE_CUBE_MAP,o),p){C&&k&&n.texStorage2D(e.TEXTURE_CUBE_MAP,P,E,w.width,w.height);for(var L=0;L<6;L++){A=b[L].mipmaps;for(var D=0;D0&&P++;var F=W(b[0]);n.texStorage2D(e.TEXTURE_CUBE_MAP,P,E,F.width,F.height)}for(var B=0;B<6;B++)if(y){C?R&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+B,0,0,0,b[B].width,b[B].height,T,M,b[B].data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+B,0,E,b[B].width,b[B].height,0,T,M,b[B].data);for(var U=0;U1;if(h||(void 0===u.__webglTexture&&(u.__webglTexture=e.createTexture()),u.__version=i.version,o.memory.textures++),c){s.__webglFramebuffer=[];for(var d=0;d<6;d++)if(i.mipmaps&&i.mipmaps.length>0){s.__webglFramebuffer[d]=[];for(var f=0;f0){s.__webglFramebuffer=[];for(var p=0;p0&&!1===V(t)){s.__webglMultisampledFramebuffer=e.createFramebuffer(),s.__webglColorRenderbuffer=[],n.bindFramebuffer(e.FRAMEBUFFER,s.__webglMultisampledFramebuffer);for(var x=0;x0)for(var k=0;k0)for(var U=0;U0)if(!1===V(t)){var i=t.textures,a=t.width,o=t.height,s=e.COLOR_BUFFER_BIT,u=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,c=r.get(t),h=i.length>1;if(h)for(var d=0;d1&&void 0!==arguments[1]?arguments[1]:yc,a=$c.getTransfer(i);if(n===dl)return e.UNSIGNED_BYTE;if(n===bl)return e.UNSIGNED_SHORT_4_4_4_4;if(n===xl)return e.UNSIGNED_SHORT_5_5_5_1;if(n===Al)return e.UNSIGNED_INT_5_9_9_9_REV;if(n===fl)return e.BYTE;if(n===pl)return e.SHORT;if(n===vl)return e.UNSIGNED_SHORT;if(n===ml)return e.INT;if(n===gl)return e.UNSIGNED_INT;if(n===yl)return e.FLOAT;if(n===_l)return e.HALF_FLOAT;if(1021===n)return e.ALPHA;if(1022===n)return e.RGB;if(n===wl)return e.RGBA;if(1024===n)return e.LUMINANCE;if(1025===n)return e.LUMINANCE_ALPHA;if(n===Tl)return e.DEPTH_COMPONENT;if(n===Ml)return e.DEPTH_STENCIL;if(n===El)return e.RED;if(n===Cl)return e.RED_INTEGER;if(n===kl)return e.RG;if(n===Rl)return e.RG_INTEGER;if(n===Il)return e.RGBA_INTEGER;if(n===Nl||n===Pl||n===Ll||n===Dl)if(a===Sc){if(null===(r=t.get("WEBGL_compressed_texture_s3tc_srgb")))return null;if(n===Nl)return r.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===Pl)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===Ll)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===Dl)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else{if(null===(r=t.get("WEBGL_compressed_texture_s3tc")))return null;if(n===Nl)return r.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===Pl)return r.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===Ll)return r.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===Dl)return r.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(n===Ol||n===Fl||n===Bl||n===Ul){if(null===(r=t.get("WEBGL_compressed_texture_pvrtc")))return null;if(n===Ol)return r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===Fl)return r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===Bl)return r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===Ul)return r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(n===zl||n===Vl||n===Hl){if(null===(r=t.get("WEBGL_compressed_texture_etc")))return null;if(n===zl||n===Vl)return a===Sc?r.COMPRESSED_SRGB8_ETC2:r.COMPRESSED_RGB8_ETC2;if(n===Hl)return a===Sc?r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:r.COMPRESSED_RGBA8_ETC2_EAC}if(n===Wl||n===Gl||n===jl||n===Ql||n===ql||n===Xl||n===Yl||n===Kl||n===Zl||n===Jl||n===$l||n===ec||n===tc||n===nc){if(null===(r=t.get("WEBGL_compressed_texture_astc")))return null;if(n===Wl)return a===Sc?r.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:r.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===Gl)return a===Sc?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:r.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===jl)return a===Sc?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:r.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===Ql)return a===Sc?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:r.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===ql)return a===Sc?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:r.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===Xl)return a===Sc?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:r.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===Yl)return a===Sc?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:r.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===Kl)return a===Sc?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:r.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===Zl)return a===Sc?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:r.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===Jl)return a===Sc?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:r.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===$l)return a===Sc?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:r.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===ec)return a===Sc?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:r.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===tc)return a===Sc?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:r.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===nc)return a===Sc?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:r.COMPRESSED_RGBA_ASTC_12x12_KHR}if(n===rc||n===ic||n===ac){if(null===(r=t.get("EXT_texture_compression_bptc")))return null;if(n===rc)return a===Sc?r.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:r.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===ic)return r.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===ac)return r.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}if(36283===n||n===oc||n===sc||n===uc){if(null===(r=t.get("EXT_texture_compression_rgtc")))return null;if(n===rc)return r.COMPRESSED_RED_RGTC1_EXT;if(n===oc)return r.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===sc)return r.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===uc)return r.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}return n===Sl?e.UNSIGNED_INT_24_8:void 0!==e[n]?e[n]:null}}}var Py=function(){return T(function e(){A(this,e),this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0},[{key:"init",value:function(e,t,n){if(null===this.texture){var r=new sh;e.properties.get(r).__webglTexture=t.texture,t.depthNear===n.depthNear&&t.depthFar===n.depthFar||(this.depthNear=t.depthNear,this.depthFar=t.depthFar),this.texture=r}}},{key:"getMesh",value:function(e){if(null!==this.texture&&null===this.mesh){var t=e.cameras[0].viewport,n=new wf({vertexShader:"\nvoid main() {\n\n\tgl_Position = vec4( position, 1.0 );\n\n}",fragmentShader:"\nuniform sampler2DArray depthColor;\nuniform float depthWidth;\nuniform float depthHeight;\n\nvoid main() {\n\n\tvec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );\n\n\tif ( coord.x >= 1.0 ) {\n\n\t\tgl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;\n\n\t} else {\n\n\t\tgl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;\n\n\t}\n\n}",uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new gf(new Wp(20,20),n)}return this.mesh}},{key:"reset",value:function(){this.texture=null,this.mesh=null}},{key:"getDepthTexture",value:function(){return this.texture}}])}(),Ly=function(e){function t(e,n){var r;A(this,t);var i=r=y(this,t),a=null,o=1,s=null,u="local-floor",l=1,c=null,h=null,f=null,p=null,m=null,g=null,_=new Py,b=n.getContextAttributes(),x=null,S=null,w=[],T=[],M=new Vc,E=null,C=new kf;C.viewport=new uh;var k=new kf;k.viewport=new uh;var R=[C,k],I=new zv,N=null,P=null;function L(e){var t=T.indexOf(e.inputSource);if(-1!==t){var n=w[t];void 0!==n&&(n.update(e.inputSource,e.frame,c||s),n.dispatchEvent({type:e.type,data:e.inputSource}))}}function D(){a.removeEventListener("select",L),a.removeEventListener("selectstart",L),a.removeEventListener("selectend",L),a.removeEventListener("squeeze",L),a.removeEventListener("squeezestart",L),a.removeEventListener("squeezeend",L),a.removeEventListener("end",D),a.removeEventListener("inputsourceschange",O);for(var t=0;t=0&&(T[r]=null,w[r].disconnect(n))}for(var i=0;i=T.length){T.push(a),o=s;break}if(null===T[s]){T[s]=a,o=s;break}}if(-1===o)break}var u=w[o];u&&u.connect(a)}}r.cameraAutoUpdate=!0,r.enabled=!1,r.isPresenting=!1,r.getController=function(e){var t=w[e];return void 0===t&&(t=new Of,w[e]=t),t.getTargetRaySpace()},r.getControllerGrip=function(e){var t=w[e];return void 0===t&&(t=new Of,w[e]=t),t.getGripSpace()},r.getHand=function(e){var t=w[e];return void 0===t&&(t=new Of,w[e]=t),t.getHandSpace()},r.setFramebufferScaleFactor=function(e){o=e,!0===i.isPresenting&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},r.setReferenceSpaceType=function(e){u=e,!0===i.isPresenting&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},r.getReferenceSpace=function(){return c||s},r.setReferenceSpace=function(e){c=e},r.getBaseLayer=function(){return null!==p?p:m},r.getBinding=function(){return f},r.getFrame=function(){return g},r.getSession=function(){return a},r.setSession=function(){var t=v(d().m(function t(r){var h,v,g,y,_;return d().w(function(t){for(;;)switch(t.n){case 0:if(null===(a=r)){t.n=3;break}if(x=e.getRenderTarget(),a.addEventListener("select",L),a.addEventListener("selectstart",L),a.addEventListener("selectend",L),a.addEventListener("squeeze",L),a.addEventListener("squeezestart",L),a.addEventListener("squeezeend",L),a.addEventListener("end",D),a.addEventListener("inputsourceschange",O),!0===b.xrCompatible){t.n=1;break}return t.n=1,n.makeXRCompatible();case 1:return E=e.getPixelRatio(),e.getSize(M),"undefined"!=typeof XRWebGLBinding&&"createProjectionLayer"in XRWebGLBinding.prototype?(v=null,g=null,y=null,b.depth&&(y=b.stencil?n.DEPTH24_STENCIL8:n.DEPTH_COMPONENT24,v=b.stencil?Ml:Tl,g=b.stencil?Sl:gl),_={colorFormat:n.RGBA8,depthFormat:y,scaleFactor:o},f=new XRWebGLBinding(a,n),p=f.createProjectionLayer(_),a.updateRenderState({layers:[p]}),e.setPixelRatio(1),e.setSize(p.textureWidth,p.textureHeight,!1),S=new ch(p.textureWidth,p.textureHeight,{format:wl,type:dl,depthTexture:new zp(p.textureWidth,p.textureHeight,g,void 0,void 0,void 0,void 0,void 0,void 0,v),stencilBuffer:b.stencil,colorSpace:e.outputColorSpace,samples:b.antialias?4:0,resolveDepthBuffer:!1===p.ignoreDepthValues})):(h={antialias:b.antialias,alpha:!0,depth:b.depth,stencil:b.stencil,framebufferScaleFactor:o},m=new XRWebGLLayer(a,n,h),a.updateRenderState({baseLayer:m}),e.setPixelRatio(1),e.setSize(m.framebufferWidth,m.framebufferHeight,!1),S=new ch(m.framebufferWidth,m.framebufferHeight,{format:wl,type:dl,colorSpace:e.outputColorSpace,stencilBuffer:b.stencil})),S.isXRRenderTarget=!0,this.setFoveation(l),c=null,t.n=2,a.requestReferenceSpace(u);case 2:s=t.v,V.setContext(a),V.start(),i.isPresenting=!0,i.dispatchEvent({type:"sessionstart"});case 3:return t.a(2)}},t,this)}));return function(e){return t.apply(this,arguments)}}(),r.getEnvironmentBlendMode=function(){if(null!==a)return a.environmentBlendMode},r.getDepthTexture=function(){return _.getDepthTexture()};var F=new ph,B=new ph;function U(e,t){null===t?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.copy(e.matrixWorld).invert()}r.updateCamera=function(e){if(null!==a){var t=e.near,n=e.far;null!==_.texture&&(_.depthNear>0&&(t=_.depthNear),_.depthFar>0&&(n=_.depthFar)),I.near=k.near=C.near=t,I.far=k.far=C.far=n,N===I.near&&P===I.far||(a.updateRenderState({depthNear:I.near,depthFar:I.far}),N=I.near,P=I.far),C.layers.mask=2|e.layers.mask,k.layers.mask=4|e.layers.mask,I.layers.mask=C.layers.mask|k.layers.mask;var r=e.parent,i=I.cameras;U(I,r);for(var o=0;o0&&(e.alphaTest.value=r.alphaTest);var i=t.get(r),a=i.envMap,o=i.envMapRotation;a&&(e.envMap.value=a,Dy.copy(o),Dy.x*=-1,Dy.y*=-1,Dy.z*=-1,a.isCubeTexture&&!1===a.isRenderTargetTexture&&(Dy.y*=-1,Dy.z*=-1),e.envMapRotation.value.setFromMatrix4(Oy.makeRotationFromEuler(Dy)),e.flipEnvMap.value=a.isCubeTexture&&!1===a.isRenderTargetTexture?-1:1,e.reflectivity.value=r.reflectivity,e.ior.value=r.ior,e.refractionRatio.value=r.refractionRatio),r.lightMap&&(e.lightMap.value=r.lightMap,e.lightMapIntensity.value=r.lightMapIntensity,n(r.lightMap,e.lightMapTransform)),r.aoMap&&(e.aoMap.value=r.aoMap,e.aoMapIntensity.value=r.aoMapIntensity,n(r.aoMap,e.aoMapTransform))}return{refreshFogUniforms:function(t,n){n.color.getRGB(t.fogColor.value,Sf(e)),n.isFog?(t.fogNear.value=n.near,t.fogFar.value=n.far):n.isFogExp2&&(t.fogDensity.value=n.density)},refreshMaterialUniforms:function(e,i,a,o,s){i.isMeshBasicMaterial||i.isMeshLambertMaterial?r(e,i):i.isMeshToonMaterial?(r(e,i),function(e,t){t.gradientMap&&(e.gradientMap.value=t.gradientMap)}(e,i)):i.isMeshPhongMaterial?(r(e,i),function(e,t){e.specular.value.copy(t.specular),e.shininess.value=Math.max(t.shininess,1e-4)}(e,i)):i.isMeshStandardMaterial?(r(e,i),function(e,t){e.metalness.value=t.metalness,t.metalnessMap&&(e.metalnessMap.value=t.metalnessMap,n(t.metalnessMap,e.metalnessMapTransform));e.roughness.value=t.roughness,t.roughnessMap&&(e.roughnessMap.value=t.roughnessMap,n(t.roughnessMap,e.roughnessMapTransform));t.envMap&&(e.envMapIntensity.value=t.envMapIntensity)}(e,i),i.isMeshPhysicalMaterial&&function(e,t,r){e.ior.value=t.ior,t.sheen>0&&(e.sheenColor.value.copy(t.sheenColor).multiplyScalar(t.sheen),e.sheenRoughness.value=t.sheenRoughness,t.sheenColorMap&&(e.sheenColorMap.value=t.sheenColorMap,n(t.sheenColorMap,e.sheenColorMapTransform)),t.sheenRoughnessMap&&(e.sheenRoughnessMap.value=t.sheenRoughnessMap,n(t.sheenRoughnessMap,e.sheenRoughnessMapTransform)));t.clearcoat>0&&(e.clearcoat.value=t.clearcoat,e.clearcoatRoughness.value=t.clearcoatRoughness,t.clearcoatMap&&(e.clearcoatMap.value=t.clearcoatMap,n(t.clearcoatMap,e.clearcoatMapTransform)),t.clearcoatRoughnessMap&&(e.clearcoatRoughnessMap.value=t.clearcoatRoughnessMap,n(t.clearcoatRoughnessMap,e.clearcoatRoughnessMapTransform)),t.clearcoatNormalMap&&(e.clearcoatNormalMap.value=t.clearcoatNormalMap,n(t.clearcoatNormalMap,e.clearcoatNormalMapTransform),e.clearcoatNormalScale.value.copy(t.clearcoatNormalScale),1===t.side&&e.clearcoatNormalScale.value.negate()));t.dispersion>0&&(e.dispersion.value=t.dispersion);t.iridescence>0&&(e.iridescence.value=t.iridescence,e.iridescenceIOR.value=t.iridescenceIOR,e.iridescenceThicknessMinimum.value=t.iridescenceThicknessRange[0],e.iridescenceThicknessMaximum.value=t.iridescenceThicknessRange[1],t.iridescenceMap&&(e.iridescenceMap.value=t.iridescenceMap,n(t.iridescenceMap,e.iridescenceMapTransform)),t.iridescenceThicknessMap&&(e.iridescenceThicknessMap.value=t.iridescenceThicknessMap,n(t.iridescenceThicknessMap,e.iridescenceThicknessMapTransform)));t.transmission>0&&(e.transmission.value=t.transmission,e.transmissionSamplerMap.value=r.texture,e.transmissionSamplerSize.value.set(r.width,r.height),t.transmissionMap&&(e.transmissionMap.value=t.transmissionMap,n(t.transmissionMap,e.transmissionMapTransform)),e.thickness.value=t.thickness,t.thicknessMap&&(e.thicknessMap.value=t.thicknessMap,n(t.thicknessMap,e.thicknessMapTransform)),e.attenuationDistance.value=t.attenuationDistance,e.attenuationColor.value.copy(t.attenuationColor));t.anisotropy>0&&(e.anisotropyVector.value.set(t.anisotropy*Math.cos(t.anisotropyRotation),t.anisotropy*Math.sin(t.anisotropyRotation)),t.anisotropyMap&&(e.anisotropyMap.value=t.anisotropyMap,n(t.anisotropyMap,e.anisotropyMapTransform)));e.specularIntensity.value=t.specularIntensity,e.specularColor.value.copy(t.specularColor),t.specularColorMap&&(e.specularColorMap.value=t.specularColorMap,n(t.specularColorMap,e.specularColorMapTransform));t.specularIntensityMap&&(e.specularIntensityMap.value=t.specularIntensityMap,n(t.specularIntensityMap,e.specularIntensityMapTransform))}(e,i,s)):i.isMeshMatcapMaterial?(r(e,i),function(e,t){t.matcap&&(e.matcap.value=t.matcap)}(e,i)):i.isMeshDepthMaterial?r(e,i):i.isMeshDistanceMaterial?(r(e,i),function(e,n){var r=t.get(n).light;e.referencePosition.value.setFromMatrixPosition(r.matrixWorld),e.nearDistance.value=r.shadow.camera.near,e.farDistance.value=r.shadow.camera.far}(e,i)):i.isMeshNormalMaterial?r(e,i):i.isLineBasicMaterial?(function(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,t.map&&(e.map.value=t.map,n(t.map,e.mapTransform))}(e,i),i.isLineDashedMaterial&&function(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}(e,i)):i.isPointsMaterial?function(e,t,r,i){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.size.value=t.size*r,e.scale.value=.5*i,t.map&&(e.map.value=t.map,n(t.map,e.uvTransform));t.alphaMap&&(e.alphaMap.value=t.alphaMap,n(t.alphaMap,e.alphaMapTransform));t.alphaTest>0&&(e.alphaTest.value=t.alphaTest)}(e,i,a,o):i.isSpriteMaterial?function(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.rotation.value=t.rotation,t.map&&(e.map.value=t.map,n(t.map,e.mapTransform));t.alphaMap&&(e.alphaMap.value=t.alphaMap,n(t.alphaMap,e.alphaMapTransform));t.alphaTest>0&&(e.alphaTest.value=t.alphaTest)}(e,i):i.isShadowMaterial?(e.color.value.copy(i.color),e.opacity.value=i.opacity):i.isShaderMaterial&&(i.uniformsNeedUpdate=!1)}}}function By(e,t,n,r){var i={},a={},o=[],s=e.getParameter(e.MAX_UNIFORM_BUFFER_BINDINGS);function u(e,t,n,r){var i=e.value,a=t+"_"+n;if(void 0===r[a])return r[a]="number"==typeof i||"boolean"==typeof i?i:i.clone(),!0;var o=r[a];if("number"==typeof i||"boolean"==typeof i){if(o!==i)return r[a]=i,!0}else if(!1===o.equals(i))return o.copy(i),!0;return!1}function l(e){var t={boundary:0,storage:0};return"number"==typeof e||"boolean"==typeof e?(t.boundary=4,t.storage=4):e.isVector2?(t.boundary=8,t.storage=8):e.isVector3||e.isColor?(t.boundary=16,t.storage=12):e.isVector4?(t.boundary=16,t.storage=16):e.isMatrix3?(t.boundary=48,t.storage=48):e.isMatrix4?(t.boundary=64,t.storage=64):e.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",e),t}function c(t){var n=t.target;n.removeEventListener("dispose",c);var r=o.indexOf(n.__bindingPointIndex);o.splice(r,1),e.deleteBuffer(i[n.id]),delete i[n.id],delete a[n.id]}return{bind:function(e,t){var n=t.program;r.uniformBlockBinding(e,n)},update:function(n,h){var d=i[n.id];void 0===d&&(!function(e){for(var t=e.uniforms,n=0,r=16,i=0,a=t.length;i0&&(n+=r-y);e.__size=n,e.__cache={}}(n),d=function(t){var n=function(){for(var e=0;e0&&void 0!==arguments[0]?arguments[0]:{};A(this,e);var n,r=t.canvas,i=void 0===r?function(){var e=jc("canvas");return e.style.display="block",e}():r,a=t.context,o=void 0===a?null:a,s=t.depth,u=void 0===s||s,l=t.stencil,c=void 0!==l&&l,h=t.alpha,f=void 0!==h&&h,p=t.antialias,m=void 0!==p&&p,g=t.premultipliedAlpha,y=void 0===g||g,_=t.preserveDrawingBuffer,b=void 0!==_&&_,x=t.powerPreference,S=void 0===x?"default":x,w=t.failIfMajorPerformanceCaveat,T=void 0!==w&&w,M=t.reverseDepthBuffer,E=void 0!==M&&M;if(this.isWebGLRenderer=!0,null!==o){if("undefined"!=typeof WebGLRenderingContext&&o instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");n=o.getContextAttributes().alpha}else n=f;var C=new Uint32Array(4),k=new Int32Array(4),R=null,I=null,N=[],P=[];this.domElement=i,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=_c,this.toneMapping=0,this.toneMappingExposure=1;var L=this,D=!1,O=0,F=0,B=null,U=-1,z=null,V=new uh,H=new uh,W=null,G=new Od(0),j=0,Q=i.width,q=i.height,X=1,Y=null,K=null,Z=new uh(0,0,Q,q),J=new uh(0,0,Q,q),$=!1,ee=new gp,te=!1,ne=!1;this.transmissionResolutionScale=1;var re=new Gh,ie=new Gh,ae=new ph,oe=new uh,se={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0},ue=!1;function le(){return null===B?X:1}var ce,he,de,fe,pe,ve,me,ge,ye,_e,be,xe,Se,Ae,we,Te,Me,Ee,Ce,ke,Re,Ie,Ne,Pe,Le=o;function De(e,t){return i.getContext(e,t)}try{var Oe={alpha:!0,depth:u,stencil:c,antialias:m,premultipliedAlpha:y,preserveDrawingBuffer:b,powerPreference:S,failIfMajorPerformanceCaveat:T};if("setAttribute"in i&&i.setAttribute("data-engine","three.js r".concat(Wu)),i.addEventListener("webglcontextlost",ze,!1),i.addEventListener("webglcontextrestored",Ve,!1),i.addEventListener("webglcontextcreationerror",He,!1),null===Le){var Fe="webgl2";if(null===(Le=De(Fe,Oe)))throw De(Fe)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(ot){throw console.error("THREE.WebGLRenderer: "+ot.message),ot}function Be(){(ce=new Om(Le)).init(),Ie=new Ny(Le,ce),he=new mm(Le,ce,t,Ie),de=new Ry(Le,ce),he.reverseDepthBuffer&&E&&de.buffers.depth.setReversed(!0),fe=new Um(Le),pe=new gy,ve=new Iy(Le,ce,de,pe,he,Ie,fe),me=new ym(L),ge=new Dm(L),ye=new om(Le),Ne=new pm(Le,ye),_e=new Fm(Le,ye,fe,Ne),be=new Vm(Le,_e,ye,fe),Ce=new zm(Le,he,ve),Te=new gm(pe),xe=new my(L,me,ge,ce,he,Ne,Te),Se=new Fy(L,pe),Ae=new xy,we=new Ey(ce),Ee=new fm(L,me,ge,de,be,n,y),Me=new Cy(L,be,he),Pe=new By(Le,fe,he,de),ke=new vm(Le,ce,fe),Re=new Bm(Le,ce,fe),fe.programs=xe.programs,L.capabilities=he,L.extensions=ce,L.properties=pe,L.renderLists=Ae,L.shadowMap=Me,L.state=de,L.info=fe}Be();var Ue=new Ly(L,Le);function ze(e){e.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),D=!0}function Ve(){console.log("THREE.WebGLRenderer: Context Restored."),D=!1;var e=fe.autoReset,t=Me.enabled,n=Me.autoUpdate,r=Me.needsUpdate,i=Me.type;Be(),fe.autoReset=e,Me.enabled=t,Me.autoUpdate=n,Me.needsUpdate=r,Me.type=i}function He(e){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",e.statusMessage)}function We(e){var t=e.target;t.removeEventListener("dispose",We),function(e){(function(e){var t=pe.get(e).programs;void 0!==t&&(t.forEach(function(e){xe.releaseProgram(e)}),e.isShaderMaterial&&xe.releaseShaderCache(e))})(e),pe.remove(e)}(t)}function Ge(e,t,n){!0===e.transparent&&2===e.side&&!1===e.forceSinglePass?(e.side=1,e.needsUpdate=!0,et(e,t,n),e.side=0,e.needsUpdate=!0,et(e,t,n),e.side=2):et(e,t,n)}this.xr=Ue,this.getContext=function(){return Le},this.getContextAttributes=function(){return Le.getContextAttributes()},this.forceContextLoss=function(){var e=ce.get("WEBGL_lose_context");e&&e.loseContext()},this.forceContextRestore=function(){var e=ce.get("WEBGL_lose_context");e&&e.restoreContext()},this.getPixelRatio=function(){return X},this.setPixelRatio=function(e){void 0!==e&&(X=e,this.setSize(Q,q,!1))},this.getSize=function(e){return e.set(Q,q)},this.setSize=function(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];Ue.isPresenting?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(Q=e,q=t,i.width=Math.floor(e*X),i.height=Math.floor(t*X),!0===n&&(i.style.width=e+"px",i.style.height=t+"px"),this.setViewport(0,0,e,t))},this.getDrawingBufferSize=function(e){return e.set(Q*X,q*X).floor()},this.setDrawingBufferSize=function(e,t,n){Q=e,q=t,X=n,i.width=Math.floor(e*n),i.height=Math.floor(t*n),this.setViewport(0,0,e,t)},this.getCurrentViewport=function(e){return e.copy(V)},this.getViewport=function(e){return e.copy(Z)},this.setViewport=function(e,t,n,r){e.isVector4?Z.set(e.x,e.y,e.z,e.w):Z.set(e,t,n,r),de.viewport(V.copy(Z).multiplyScalar(X).round())},this.getScissor=function(e){return e.copy(J)},this.setScissor=function(e,t,n,r){e.isVector4?J.set(e.x,e.y,e.z,e.w):J.set(e,t,n,r),de.scissor(H.copy(J).multiplyScalar(X).round())},this.getScissorTest=function(){return $},this.setScissorTest=function(e){de.setScissorTest($=e)},this.setOpaqueSort=function(e){Y=e},this.setTransparentSort=function(e){K=e},this.getClearColor=function(e){return e.copy(Ee.getClearColor())},this.setClearColor=function(){Ee.setClearColor.apply(Ee,arguments)},this.getClearAlpha=function(){return Ee.getClearAlpha()},this.setClearAlpha=function(){Ee.setClearAlpha.apply(Ee,arguments)},this.clear=function(){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],t=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=0;if(!(arguments.length>0&&void 0!==arguments[0])||arguments[0]){var r=!1;if(null!==B){var i=B.texture.format;r=i===Il||i===Rl||i===Cl}if(r){var a=B.texture.type,o=a===dl||a===gl||a===vl||a===Sl||a===bl||a===xl,s=Ee.getClearColor(),u=Ee.getClearAlpha(),l=s.r,c=s.g,h=s.b;o?(C[0]=l,C[1]=c,C[2]=h,C[3]=u,Le.clearBufferuiv(Le.COLOR,0,C)):(k[0]=l,k[1]=c,k[2]=h,k[3]=u,Le.clearBufferiv(Le.COLOR,0,k))}else n|=Le.COLOR_BUFFER_BIT}e&&(n|=Le.DEPTH_BUFFER_BIT),t&&(n|=Le.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),Le.clear(n)},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(){i.removeEventListener("webglcontextlost",ze,!1),i.removeEventListener("webglcontextrestored",Ve,!1),i.removeEventListener("webglcontextcreationerror",He,!1),Ee.dispose(),Ae.dispose(),we.dispose(),pe.dispose(),me.dispose(),ge.dispose(),be.dispose(),Ne.dispose(),Pe.dispose(),xe.dispose(),Ue.dispose(),Ue.removeEventListener("sessionstart",Qe),Ue.removeEventListener("sessionend",qe),Xe.stop()},this.renderBufferDirect=function(e,t,n,r,i,a){null===t&&(t=se);var o=i.isMesh&&i.matrixWorld.determinant()<0,s=function(e,t,n,r,i){!0!==t.isScene&&(t=se);ve.resetTextureUnits();var a=t.fog,o=r.isMeshStandardMaterial?t.environment:null,s=null===B?L.outputColorSpace:!0===B.isXRRenderTarget?B.texture.colorSpace:bc,u=(r.isMeshStandardMaterial?ge:me).get(r.envMap||o),l=!0===r.vertexColors&&!!n.attributes.color&&4===n.attributes.color.itemSize,c=!!n.attributes.tangent&&(!!r.normalMap||r.anisotropy>0),h=!!n.morphAttributes.position,d=!!n.morphAttributes.normal,f=!!n.morphAttributes.color,p=0;r.toneMapped&&(null!==B&&!0!==B.isXRRenderTarget||(p=L.toneMapping));var v=n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color,m=void 0!==v?v.length:0,g=pe.get(r),y=I.state.lights;if(!0===te&&(!0===ne||e!==z)){var _=e===z&&r.id===U;Te.setState(r,e,_)}var b=!1;r.version===g.__version?g.needsLights&&g.lightsStateVersion!==y.state.version||g.outputColorSpace!==s||i.isBatchedMesh&&!1===g.batching?b=!0:i.isBatchedMesh||!0!==g.batching?i.isBatchedMesh&&!0===g.batchingColor&&null===i.colorTexture||i.isBatchedMesh&&!1===g.batchingColor&&null!==i.colorTexture||i.isInstancedMesh&&!1===g.instancing?b=!0:i.isInstancedMesh||!0!==g.instancing?i.isSkinnedMesh&&!1===g.skinning?b=!0:i.isSkinnedMesh||!0!==g.skinning?i.isInstancedMesh&&!0===g.instancingColor&&null===i.instanceColor||i.isInstancedMesh&&!1===g.instancingColor&&null!==i.instanceColor||i.isInstancedMesh&&!0===g.instancingMorph&&null===i.morphTexture||i.isInstancedMesh&&!1===g.instancingMorph&&null!==i.morphTexture||g.envMap!==u||!0===r.fog&&g.fog!==a?b=!0:void 0===g.numClippingPlanes||g.numClippingPlanes===Te.numPlanes&&g.numIntersection===Te.numIntersection?(g.vertexAlphas!==l||g.vertexTangents!==c||g.morphTargets!==h||g.morphNormals!==d||g.morphColors!==f||g.toneMapping!==p||g.morphTargetsCount!==m)&&(b=!0):b=!0:b=!0:b=!0:b=!0:(b=!0,g.__version=r.version);var x=g.currentProgram;!0===b&&(x=et(r,t,i));var S=!1,A=!1,w=!1,T=x.getUniforms(),M=g.uniforms;de.useProgram(x.program)&&(S=!0,A=!0,w=!0);r.id!==U&&(U=r.id,A=!0);if(S||z!==e){de.buffers.depth.getReversed()?(re.copy(e.projectionMatrix),function(e){var t=e.elements;t[2]=.5*t[2]+.5*t[3],t[6]=.5*t[6]+.5*t[7],t[10]=.5*t[10]+.5*t[11],t[14]=.5*t[14]+.5*t[15]}(re),function(e){var t=e.elements;-1===t[11]?(t[10]=-t[10]-1,t[14]=-t[14]):(t[10]=-t[10],t[14]=1-t[14])}(re),T.setValue(Le,"projectionMatrix",re)):T.setValue(Le,"projectionMatrix",e.projectionMatrix),T.setValue(Le,"viewMatrix",e.matrixWorldInverse);var E=T.map.cameraPosition;void 0!==E&&E.setValue(Le,ae.setFromMatrixPosition(e.matrixWorld)),he.logarithmicDepthBuffer&&T.setValue(Le,"logDepthBufFC",2/(Math.log(e.far+1)/Math.LN2)),(r.isMeshPhongMaterial||r.isMeshToonMaterial||r.isMeshLambertMaterial||r.isMeshBasicMaterial||r.isMeshStandardMaterial||r.isShaderMaterial)&&T.setValue(Le,"isOrthographic",!0===e.isOrthographicCamera),z!==e&&(z=e,A=!0,w=!0)}if(i.isSkinnedMesh){T.setOptional(Le,i,"bindMatrix"),T.setOptional(Le,i,"bindMatrixInverse");var C=i.skeleton;C&&(null===C.boneTexture&&C.computeBoneTexture(),T.setValue(Le,"boneTexture",C.boneTexture,ve))}i.isBatchedMesh&&(T.setOptional(Le,i,"batchingTexture"),T.setValue(Le,"batchingTexture",i._matricesTexture,ve),T.setOptional(Le,i,"batchingIdTexture"),T.setValue(Le,"batchingIdTexture",i._indirectTexture,ve),T.setOptional(Le,i,"batchingColorTexture"),null!==i._colorsTexture&&T.setValue(Le,"batchingColorTexture",i._colorsTexture,ve));var k=n.morphAttributes;void 0===k.position&&void 0===k.normal&&void 0===k.color||Ce.update(i,n,x);(A||g.receiveShadow!==i.receiveShadow)&&(g.receiveShadow=i.receiveShadow,T.setValue(Le,"receiveShadow",i.receiveShadow));r.isMeshGouraudMaterial&&null!==r.envMap&&(M.envMap.value=u,M.flipEnvMap.value=u.isCubeTexture&&!1===u.isRenderTargetTexture?-1:1);r.isMeshStandardMaterial&&null===r.envMap&&null!==t.environment&&(M.envMapIntensity.value=t.environmentIntensity);A&&(T.setValue(Le,"toneMappingExposure",L.toneMappingExposure),g.needsLights&&function(e,t){e.ambientLightColor.needsUpdate=t,e.lightProbe.needsUpdate=t,e.directionalLights.needsUpdate=t,e.directionalLightShadows.needsUpdate=t,e.pointLights.needsUpdate=t,e.pointLightShadows.needsUpdate=t,e.spotLights.needsUpdate=t,e.spotLightShadows.needsUpdate=t,e.rectAreaLights.needsUpdate=t,e.hemisphereLights.needsUpdate=t}(M,w),a&&!0===r.fog&&Se.refreshFogUniforms(M,a),Se.refreshMaterialUniforms(M,r,X,q,I.state.transmissionRenderTarget[e.id]),Qg.upload(Le,tt(g),M,ve));r.isShaderMaterial&&!0===r.uniformsNeedUpdate&&(Qg.upload(Le,tt(g),M,ve),r.uniformsNeedUpdate=!1);r.isSpriteMaterial&&T.setValue(Le,"center",i.center);if(T.setValue(Le,"modelViewMatrix",i.modelViewMatrix),T.setValue(Le,"normalMatrix",i.normalMatrix),T.setValue(Le,"modelMatrix",i.matrixWorld),r.isShaderMaterial||r.isRawShaderMaterial)for(var R=r.uniformsGroups,N=0,P=R.length;N2&&void 0!==arguments[2]?arguments[2]:null;null===n&&(n=e),(I=we.get(n)).init(t),P.push(I),n.traverseVisible(function(e){e.isLight&&e.layers.test(t.layers)&&(I.pushLight(e),e.castShadow&&I.pushShadow(e))}),e!==n&&e.traverseVisible(function(e){e.isLight&&e.layers.test(t.layers)&&(I.pushLight(e),e.castShadow&&I.pushShadow(e))}),I.setupLights();var r=new Set;return e.traverse(function(e){if(e.isMesh||e.isPoints||e.isLine||e.isSprite){var t=e.material;if(t)if(Array.isArray(t))for(var i=0;i2&&void 0!==arguments[2]?arguments[2]:null,r=this.compile(e,t,n);return new Promise(function(t){function n(){r.forEach(function(e){pe.get(e).currentProgram.isReady()&&r.delete(e)}),0!==r.size?setTimeout(n,10):t(e)}null!==ce.get("KHR_parallel_shader_compile")?n():setTimeout(n,10)})};var je=null;function Qe(){Xe.stop()}function qe(){Xe.start()}var Xe=new am;function Ye(e,t,n,r){if(!1!==e.visible){if(e.layers.test(t.layers))if(e.isGroup)n=e.renderOrder;else if(e.isLOD)!0===e.autoUpdate&&e.update(t);else if(e.isLight)I.pushLight(e),e.castShadow&&I.pushShadow(e);else if(e.isSprite){if(!e.frustumCulled||ee.intersectsSprite(e)){r&&oe.setFromMatrixPosition(e.matrixWorld).applyMatrix4(ie);var i=be.update(e),a=e.material;a.visible&&R.push(e,i,a,n,oe.z,null)}}else if((e.isMesh||e.isLine||e.isPoints)&&(!e.frustumCulled||ee.intersectsObject(e))){var o=be.update(e),s=e.material;if(r&&(void 0!==e.boundingSphere?(null===e.boundingSphere&&e.computeBoundingSphere(),oe.copy(e.boundingSphere.center)):(null===o.boundingSphere&&o.computeBoundingSphere(),oe.copy(o.boundingSphere.center)),oe.applyMatrix4(e.matrixWorld).applyMatrix4(ie)),Array.isArray(s))for(var u=o.groups,l=0,c=u.length;l0&&Je(i,t,n),a.length>0&&Je(a,t,n),o.length>0&&Je(o,t,n),de.buffers.depth.setTest(!0),de.buffers.depth.setMask(!0),de.buffers.color.setMask(!0),de.setPolygonOffset(!1)}function Ze(e,t,n,r){if(null===(!0===n.isScene?n.overrideMaterial:null)){void 0===I.state.transmissionRenderTarget[r.id]&&(I.state.transmissionRenderTarget[r.id]=new ch(1,1,{generateMipmaps:!0,type:ce.has("EXT_color_buffer_half_float")||ce.has("EXT_color_buffer_float")?_l:dl,minFilter:hl,samples:4,stencilBuffer:c,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:$c.workingColorSpace}));var i=I.state.transmissionRenderTarget[r.id],a=r.viewport||V;i.setSize(a.z*L.transmissionResolutionScale,a.w*L.transmissionResolutionScale);var o=L.getRenderTarget();L.setRenderTarget(i),L.getClearColor(G),(j=L.getClearAlpha())<1&&L.setClearColor(16777215,.5),L.clear(),ue&&Ee.render(n);var s=L.toneMapping;L.toneMapping=0;var u=r.viewport;if(void 0!==r.viewport&&(r.viewport=void 0),I.setupLightsView(r),!0===te&&Te.setGlobalState(L.clippingPlanes,r),Je(e,n,r),ve.updateMultisampleRenderTarget(i),ve.updateRenderTargetMipmap(i),!1===ce.has("WEBGL_multisampled_render_to_texture")){for(var l=!1,h=0,d=t.length;h0)for(var s=0,u=o.length;s0&&Ze(i,a,e,t),ue&&Ee.render(e),Ke(R,e,t);null!==B&&0===F&&(ve.updateMultisampleRenderTarget(B),ve.updateRenderTargetMipmap(B)),!0===e.isScene&&e.onAfterRender(L,e,t),Ne.resetDefaultState(),U=-1,z=null,P.pop(),P.length>0?(I=P[P.length-1],!0===te&&Te.setGlobalState(L.clippingPlanes,I.state.camera)):I=null,N.pop(),R=N.length>0?N[N.length-1]:null}}else console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.")},this.getActiveCubeFace=function(){return O},this.getActiveMipmapLevel=function(){return F},this.getRenderTarget=function(){return B},this.setRenderTargetTextures=function(e,t,n){pe.get(e.texture).__webglTexture=t,pe.get(e.depthTexture).__webglTexture=n;var r=pe.get(e);r.__hasExternalTextures=!0,r.__autoAllocateDepthBuffer=void 0===n,r.__autoAllocateDepthBuffer||!0===ce.has("WEBGL_multisampled_render_to_texture")&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),r.__useRenderToTexture=!1)},this.setRenderTargetFramebuffer=function(e,t){var n=pe.get(e);n.__webglFramebuffer=t,n.__useDefaultFramebuffer=void 0===t};var rt=Le.createFramebuffer();this.setRenderTarget=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;B=e,O=t,F=n;var r=!0,i=null,a=!1,o=!1;if(e){var s=pe.get(e);if(void 0!==s.__useDefaultFramebuffer)de.bindFramebuffer(Le.FRAMEBUFFER,null),r=!1;else if(void 0===s.__webglFramebuffer)ve.setupRenderTarget(e);else if(s.__hasExternalTextures)ve.rebindTextures(e,pe.get(e.texture).__webglTexture,pe.get(e.depthTexture).__webglTexture);else if(e.depthBuffer){var u=e.depthTexture;if(s.__boundDepthTexture!==u){if(null!==u&&pe.has(u)&&(e.width!==u.image.width||e.height!==u.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");ve.setupDepthRenderbuffer(e)}}var l=e.texture;(l.isData3DTexture||l.isDataArrayTexture||l.isCompressedArrayTexture)&&(o=!0);var c=pe.get(e).__webglFramebuffer;e.isWebGLCubeRenderTarget?(i=Array.isArray(c[t])?c[t][n]:c[t],a=!0):i=e.samples>0&&!1===ve.useMultisampledRTT(e)?pe.get(e).__webglMultisampledFramebuffer:Array.isArray(c)?c[n]:c,V.copy(e.viewport),H.copy(e.scissor),W=e.scissorTest}else V.copy(Z).multiplyScalar(X).floor(),H.copy(J).multiplyScalar(X).floor(),W=$;if(0!==n&&(i=rt),de.bindFramebuffer(Le.FRAMEBUFFER,i)&&r&&de.drawBuffers(e,i),de.viewport(V),de.scissor(H),de.setScissorTest(W),a){var h=pe.get(e.texture);Le.framebufferTexture2D(Le.FRAMEBUFFER,Le.COLOR_ATTACHMENT0,Le.TEXTURE_CUBE_MAP_POSITIVE_X+t,h.__webglTexture,n)}else if(o){var d=pe.get(e.texture),f=t;Le.framebufferTextureLayer(Le.FRAMEBUFFER,Le.COLOR_ATTACHMENT0,d.__webglTexture,n,f)}else if(null!==e&&0!==n){var p=pe.get(e.texture);Le.framebufferTexture2D(Le.FRAMEBUFFER,Le.COLOR_ATTACHMENT0,Le.TEXTURE_2D,p.__webglTexture,n)}U=-1},this.readRenderTargetPixels=function(e,t,n,r,i,a,o){if(e&&e.isWebGLRenderTarget){var s=pe.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==o&&(s=s[o]),s){de.bindFramebuffer(Le.FRAMEBUFFER,s);try{var u=e.texture,l=u.format,c=u.type;if(!he.textureFormatReadable(l))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!he.textureTypeReadable(c))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");t>=0&&t<=e.width-r&&n>=0&&n<=e.height-i&&Le.readPixels(t,n,r,i,Ie.convert(l),Ie.convert(c),a)}finally{var h=null!==B?pe.get(B).__webglFramebuffer:null;de.bindFramebuffer(Le.FRAMEBUFFER,h)}}}else console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.")},this.readRenderTargetPixelsAsync=function(){var e=v(d().m(function e(t,n,r,i,a,o,s){var u,l,c,h,f,p,v;return d().w(function(e){for(;;)switch(e.n){case 0:if(t&&t.isWebGLRenderTarget){e.n=1;break}throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");case 1:if(u=pe.get(t).__webglFramebuffer,t.isWebGLCubeRenderTarget&&void 0!==s&&(u=u[s]),!u){e.n=6;break}if(l=t.texture,c=l.format,h=l.type,he.textureFormatReadable(c)){e.n=2;break}throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");case 2:if(he.textureTypeReadable(h)){e.n=3;break}throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");case 3:if(!(n>=0&&n<=t.width-i&&r>=0&&r<=t.height-a)){e.n=5;break}return de.bindFramebuffer(Le.FRAMEBUFFER,u),f=Le.createBuffer(),Le.bindBuffer(Le.PIXEL_PACK_BUFFER,f),Le.bufferData(Le.PIXEL_PACK_BUFFER,o.byteLength,Le.STREAM_READ),Le.readPixels(n,r,i,a,Ie.convert(c),Ie.convert(h),0),p=null!==B?pe.get(B).__webglFramebuffer:null,de.bindFramebuffer(Le.FRAMEBUFFER,p),v=Le.fenceSync(Le.SYNC_GPU_COMMANDS_COMPLETE,0),Le.flush(),e.n=4,Xc(Le,v,4);case 4:return Le.bindBuffer(Le.PIXEL_PACK_BUFFER,f),Le.getBufferSubData(Le.PIXEL_PACK_BUFFER,0,o),Le.deleteBuffer(f),Le.deleteSync(v),e.a(2,o);case 5:throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.");case 6:return e.a(2)}},e)}));return function(t,n,r,i,a,o,s){return e.apply(this,arguments)}}(),this.copyFramebufferToTexture=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;!0!==e.isTexture&&(qc("WebGLRenderer: copyFramebufferToTexture function signature has changed."),t=arguments[0]||null,e=arguments[1]);var r=Math.pow(2,-n),i=Math.floor(e.image.width*r),a=Math.floor(e.image.height*r),o=null!==t?t.x:0,s=null!==t?t.y:0;ve.setTexture2D(e,0),Le.copyTexSubImage2D(Le.TEXTURE_2D,n,0,0,o,s,i,a),de.unbindTexture()};var it=Le.createFramebuffer(),at=Le.createFramebuffer();this.copyTextureToTexture=function(e,t){var n,r,i,a,o,s,u,l,c,h=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,d=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,f=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,p=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null;!0!==e.isTexture&&(qc("WebGLRenderer: copyTextureToTexture function signature has changed."),d=arguments[0]||null,e=arguments[1],t=arguments[2],p=arguments[3]||0,h=null),null===p&&(0!==f?(qc("WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels."),p=f,f=0):p=0);var v=e.isCompressedTexture?e.mipmaps[p]:e.image;if(null!==h)n=h.max.x-h.min.x,r=h.max.y-h.min.y,i=h.isBox3?h.max.z-h.min.z:1,a=h.min.x,o=h.min.y,s=h.isBox3?h.min.z:0;else{var m=Math.pow(2,-f);n=Math.floor(v.width*m),r=Math.floor(v.height*m),i=e.isDataArrayTexture?v.depth:e.isData3DTexture?Math.floor(v.depth*m):1,a=0,o=0,s=0}null!==d?(u=d.x,l=d.y,c=d.z):(u=0,l=0,c=0);var g,y=Ie.convert(t.format),_=Ie.convert(t.type);t.isData3DTexture?(ve.setTexture3D(t,0),g=Le.TEXTURE_3D):t.isDataArrayTexture||t.isCompressedArrayTexture?(ve.setTexture2DArray(t,0),g=Le.TEXTURE_2D_ARRAY):(ve.setTexture2D(t,0),g=Le.TEXTURE_2D),Le.pixelStorei(Le.UNPACK_FLIP_Y_WEBGL,t.flipY),Le.pixelStorei(Le.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),Le.pixelStorei(Le.UNPACK_ALIGNMENT,t.unpackAlignment);var b=Le.getParameter(Le.UNPACK_ROW_LENGTH),x=Le.getParameter(Le.UNPACK_IMAGE_HEIGHT),S=Le.getParameter(Le.UNPACK_SKIP_PIXELS),A=Le.getParameter(Le.UNPACK_SKIP_ROWS),w=Le.getParameter(Le.UNPACK_SKIP_IMAGES);Le.pixelStorei(Le.UNPACK_ROW_LENGTH,v.width),Le.pixelStorei(Le.UNPACK_IMAGE_HEIGHT,v.height),Le.pixelStorei(Le.UNPACK_SKIP_PIXELS,a),Le.pixelStorei(Le.UNPACK_SKIP_ROWS,o),Le.pixelStorei(Le.UNPACK_SKIP_IMAGES,s);var T=e.isDataArrayTexture||e.isData3DTexture,M=t.isDataArrayTexture||t.isData3DTexture;if(e.isDepthTexture){var E=pe.get(e),C=pe.get(t),k=pe.get(E.__renderTarget),R=pe.get(C.__renderTarget);de.bindFramebuffer(Le.READ_FRAMEBUFFER,k.__webglFramebuffer),de.bindFramebuffer(Le.DRAW_FRAMEBUFFER,R.__webglFramebuffer);for(var I=0;I2&&void 0!==arguments[2]?arguments[2]:null,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;return!0!==e.isTexture&&(qc("WebGLRenderer: copyTextureToTexture3D function signature has changed."),n=arguments[0]||null,r=arguments[1]||null,e=arguments[2],t=arguments[3],i=arguments[4]||0),qc('WebGLRenderer: copyTextureToTexture3D function has been deprecated. Use "copyTextureToTexture" instead.'),this.copyTextureToTexture(e,t,n,r,i)},this.initRenderTarget=function(e){void 0===pe.get(e).__webglFramebuffer&&ve.setupRenderTarget(e)},this.initTexture=function(e){e.isCubeTexture?ve.setTextureCube(e,0):e.isData3DTexture?ve.setTexture3D(e,0):e.isDataArrayTexture||e.isCompressedArrayTexture?ve.setTexture2DArray(e,0):ve.setTexture2D(e,0),de.unbindTexture()},this.resetState=function(){O=0,F=0,B=null,de.reset(),Ne.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))},[{key:"coordinateSystem",get:function(){return Ec}},{key:"outputColorSpace",get:function(){return this._outputColorSpace},set:function(e){this._outputColorSpace=e;var t=this.getContext();t.drawingBufferColorspace=$c._getDrawingBufferColorSpace(e),t.unpackColorSpace=$c._getUnpackColorSpace()}}])}(),zy=T(function e(){A(this,e)});M(zy,"DefaultSplatSortDistanceMapPrecision",16),M(zy,"MemoryPageSize",65536),M(zy,"BytesPerFloat",4),M(zy,"BytesPerInt",4),M(zy,"MaxScenes",32),M(zy,"ProgressiveLoadSectionSize",262144),M(zy,"ProgressiveLoadSectionDelayDuration",15),M(zy,"SphericalHarmonics8BitCompressionRange",3);var Vy,Hy,Wy,Gy,jy,Qy,qy,Xy,Yy,Ky,Zy,Jy,$y,e_,t_,n_,r_,i_,a_,o_,s_,u_,l_,c_,h_,d_,f_,p_,v_,m_,g_,y_,__,b_=zy.SphericalHarmonics8BitCompressionRange/2,x_=Wd.toHalfFloat.bind(Wd),S_=Wd.fromHalfFloat.bind(Wd),A_=function(e,t){var n=arguments.length>3?arguments[3]:void 0,r=arguments.length>4?arguments[4]:void 0;return 0===t?e:1===t||2===t&&!(arguments.length>2&&void 0!==arguments[2]&&arguments[2])?Wd.fromHalfFloat(e):2===t?T_(e,n,r):void 0},w_=function(e,t,n){e=Nu(e,t,n);var r=n-t;return Nu(Math.floor((e-t)/r*255),0,255)},T_=function(e,t,n){return e/255*(n-t)+t},M_=function(e,t,n){return w_(S_(e,t,n))},E_=function(e,t,n){return x_(T_(e,t,n))},C_=function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return 0===n?e.getFloat32(4*t,!0):1===n||2===n&&!r?e.getUint16(2*t,!0):e.getUint8(t,!0)},k_=function(){var e=function(e){return e};return function(t,n,r){var i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(n===r)return t;var a=e;return 2===n&&i?1===r?a=E_:0==r&&(a=T_):2===n||1===n?0===r?a=S_:2==r&&(a=i?M_:e):0===n&&(1===r?a=x_:2==r&&(a=i?w_:x_)),a(t)}}(),R_=function(e,t,n,r){for(var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,a=new Uint8Array(e,t),o=new Uint8Array(n,r),s=0;s1&&void 0!==arguments[1])||arguments[1];A(this,e),M(this,"getSplatScaleAndRotation",function(){var t=new Gh,n=new Gh,r=new Gh,i=new ph,a=new ph,o=new fh;return function(s,u,l,c,h){var d=this.globalSplatIndexToSectionMap[s],f=this.sections[d],p=s-f.splatCountOffset,v=f.bytesPerSplat*p+e.CompressionLevels[this.compressionLevel].ScaleOffsetBytes,m=new DataView(this.bufferData,f.dataBase+v);a.set(A_(C_(m,0,this.compressionLevel),this.compressionLevel),A_(C_(m,1,this.compressionLevel),this.compressionLevel),A_(C_(m,2,this.compressionLevel),this.compressionLevel)),h&&(void 0!==h.x&&(a.x=h.x),void 0!==h.y&&(a.y=h.y),void 0!==h.z&&(a.z=h.z)),o.set(A_(C_(m,4,this.compressionLevel),this.compressionLevel),A_(C_(m,5,this.compressionLevel),this.compressionLevel),A_(C_(m,6,this.compressionLevel),this.compressionLevel),A_(C_(m,3,this.compressionLevel),this.compressionLevel)),c?(t.makeScale(a.x,a.y,a.z),n.makeRotationFromQuaternion(o),r.copy(t).multiply(n).multiply(c),r.decompose(i,l,u)):(u.copy(a),l.copy(o))}}()),M(this,"fillSplatScaleRotationArray",function(){var t=new Gh,n=new Gh,r=new Gh,i=new ph,a=new fh,o=new ph,s=function(e){var t=e.w<0?-1:1;e.x*=t,e.y*=t,e.z*=t,e.w*=t};return function(u,l,c,h,d,f,p,v){var m=this.splatCount;h=h||0,d=d||m-1,void 0===f&&(f=h);for(var g=function(e,t){return k_(e,t,p)},y=h;y<=d;y++){var _=this.globalSplatIndexToSectionMap[y],b=this.sections[_],x=y-b.splatCountOffset,S=b.bytesPerSplat*x+e.CompressionLevels[this.compressionLevel].ScaleOffsetBytes,A=(y-h+f)*e.ScaleComponentCount,w=(y-h+f)*e.RotationComponentCount,T=new DataView(this.bufferData,b.dataBase+S),M=v&&void 0!==v.x?v.x:C_(T,0,this.compressionLevel),E=v&&void 0!==v.y?v.y:C_(T,1,this.compressionLevel),C=v&&void 0!==v.z?v.z:C_(T,2,this.compressionLevel),k=C_(T,3,this.compressionLevel),R=C_(T,4,this.compressionLevel),I=C_(T,5,this.compressionLevel),N=C_(T,6,this.compressionLevel);i.set(A_(M,this.compressionLevel),A_(E,this.compressionLevel),A_(C,this.compressionLevel)),a.set(A_(R,this.compressionLevel),A_(I,this.compressionLevel),A_(N,this.compressionLevel),A_(k,this.compressionLevel)).normalize(),c&&(o.set(0,0,0),t.makeScale(i.x,i.y,i.z),n.makeRotationFromQuaternion(a),r.identity().premultiply(t).premultiply(n),r.premultiply(c),r.decompose(o,a,i),a.normalize()),s(a),u&&(u[A]=g(i.x,0),u[A+1]=g(i.y,0),u[A+2]=g(i.z,0)),l&&(l[w]=g(a.x,0),l[w+1]=g(a.y,0),l[w+2]=g(a.z,0),l[w+3]=g(a.w,0))}}}()),M(this,"fillSphericalHarmonicsArray",function(){for(var t=0;t<15;t++)new ph;var n=new Hc,r=new Gh,i=new ph,a=new ph,o=new fh,s=[],u=[],l=[],c=[],h=[],d=[],f=[],p=[],v=[],m=[],g=[],y=[],_=[],b=[],x=[],S=[],A=[],w=[],T=function(e){return e},M=function(e,t,n,r){e[0]=t,e[1]=n,e[2]=r},E=function(e,t,n,r,i){e[0]=C_(t,r,i,!0),e[1]=C_(t,r+n,i,!0),e[2]=C_(t,r+n+n,i,!0)},C=function(e,t){t[0]=e[0],t[1]=e[1],t[2]=e[2]},k=function(e,t,n,r){t[n]=r(e[0]),t[n+1]=r(e[1]),t[n+2]=r(e[2])},R=function(e,t,n,r,i){return t[0]=A_(e[0],n,!0,r,i),t[1]=A_(e[1],n,!0,r,i),t[2]=A_(e[2],n,!0,r,i),t};return function(t,I,N,P,L,D,O){var F=this,B=this.splatCount;P=P||0,L=L||B-1,void 0===D&&(D=P),N&&I>=1&&(r.copy(N),r.decompose(i,o,a),o.normalize(),r.makeRotationFromQuaternion(o),n.setFromMatrix4(r),M(s,n.elements[4],-n.elements[7],n.elements[1]),M(u,-n.elements[5],n.elements[8],-n.elements[2]),M(l,n.elements[3],-n.elements[6],n.elements[0]));for(var U=function(e){return M_(e,F.minSphericalHarmonicsCoeff,F.maxSphericalHarmonicsCoeff)},z=function(e){return w_(e,F.minSphericalHarmonicsCoeff,F.maxSphericalHarmonicsCoeff)},V=P;V<=L;V++){var H=this.globalSplatIndexToSectionMap[V],W=this.sections[H];I=Math.min(I,W.sphericalHarmonicsDegree);var G=Ou(I),j=V-W.splatCountOffset,Q=W.bytesPerSplat*j+e.CompressionLevels[this.compressionLevel].SphericalHarmonicsOffsetBytes,q=new DataView(this.bufferData,W.dataBase+Q),X=(V-P+D)*G,Y=N?0:this.compressionLevel,K=T;Y!==O&&(1===Y?0===O?K=S_:2==O&&(K=U):0===Y&&(1===O?K=x_:2==O&&(K=z)));var Z=this.minSphericalHarmonicsCoeff,J=this.maxSphericalHarmonicsCoeff;I>=1&&(E(v,q,3,0,this.compressionLevel),E(m,q,3,1,this.compressionLevel),E(g,q,3,2,this.compressionLevel),N?(R(v,v,this.compressionLevel,Z,J),R(m,m,this.compressionLevel,Z,J),R(g,g,this.compressionLevel,Z,J),e.rotateSphericalHarmonics3(v,m,g,s,u,l,b,x,S)):(C(v,b),C(m,x),C(g,S)),k(b,t,X,K),k(x,t,X+3,K),k(S,t,X+6,K),I>=2&&(E(v,q,5,9,this.compressionLevel),E(m,q,5,10,this.compressionLevel),E(g,q,5,11,this.compressionLevel),E(y,q,5,12,this.compressionLevel),E(_,q,5,13,this.compressionLevel),N?(R(v,v,this.compressionLevel,Z,J),R(m,m,this.compressionLevel,Z,J),R(g,g,this.compressionLevel,Z,J),R(y,y,this.compressionLevel,Z,J),R(_,_,this.compressionLevel,Z,J),e.rotateSphericalHarmonics5(v,m,g,y,_,s,u,l,c,h,d,f,p,b,x,S,A,w)):(C(v,b),C(m,x),C(g,S),C(y,A),C(_,w)),k(b,t,X+9,K),k(x,t,X+12,K),k(S,t,X+15,K),k(A,t,X+18,K),k(w,t,X+21,K)))}}}()),this.constructFromBuffer(t,n)}return T(e,[{key:"getSplatCount",value:function(){return this.splatCount}},{key:"getMaxSplatCount",value:function(){return this.maxSplatCount}},{key:"getMinSphericalHarmonicsDegree",value:function(){for(var e=0,t=0;t=i&&t=1){var f=this.getBucketIndex(o,s)*e.BucketStorageSizeFloats,p=o.compressionScaleFactor,v=o.compressionScaleRange;r.x=(c-v)*p+o.bucketArray[f],r.y=(h-v)*p+o.bucketArray[f+1],r.z=(d-v)*p+o.bucketArray[f+2]}else r.x=c,r.y=h,r.z=d;r.x+=t[3*n+0],r.y+=t[3*n+1],r.z+=t[3*n+2],i&&r.applyMatrix4(i)}},{key:"getSplatColor",value:function(t,n){var r=this.globalSplatIndexToSectionMap[t],i=this.sections[r],a=t-i.splatCountOffset,o=i.bytesPerSplat*a+e.CompressionLevels[this.compressionLevel].ColorOffsetBytes,s=new Uint8Array(this.bufferData,i.dataBase+o,4);n.set(s[0],s[1],s[2],s[3])}},{key:"fillSplatCenterArray",value:function(t,n,r,i,a,o){var s=this.splatCount;i=i||0,a=a||s-1,void 0===o&&(o=i);for(var u=new ph,l=i;l<=a;l++){var c=this.globalSplatIndexToSectionMap[l],h=this.sections[c],d=l-h.splatCountOffset,f=(l-i+o)*e.CenterComponentCount,p=h.bytesPerSplat*d,v=new DataView(this.bufferData,h.dataBase+p),m=C_(v,0,this.compressionLevel),g=C_(v,1,this.compressionLevel),y=C_(v,2,this.compressionLevel);if(this.compressionLevel>=1){var _=this.getBucketIndex(h,d)*e.BucketStorageSizeFloats,b=h.compressionScaleFactor,x=h.compressionScaleRange;u.x=(m-x)*b+h.bucketArray[_],u.y=(g-x)*b+h.bucketArray[_+1],u.z=(y-x)*b+h.bucketArray[_+2]}else u.x=m,u.y=g,u.z=y;r&&u.applyMatrix4(r),n[f]=u.x+t[3*l+0],n[f+1]=u.y+t[3*l+1],n[f+2]=u.z+t[3*l+2]}}},{key:"fillSplatCovarianceArray",value:function(t,n,r,i,a,o){var s=this.splatCount,u=new ph,l=new fh;r=r||0,i=i||s-1,void 0===a&&(a=r);for(var c=r;c<=i;c++){var h=this.globalSplatIndexToSectionMap[c],d=this.sections[h],f=c-d.splatCountOffset,p=(c-r+a)*e.CovarianceComponentCount,v=d.bytesPerSplat*f+e.CompressionLevels[this.compressionLevel].ScaleOffsetBytes,m=new DataView(this.bufferData,d.dataBase+v);u.set(A_(C_(m,0,this.compressionLevel),this.compressionLevel),A_(C_(m,1,this.compressionLevel),this.compressionLevel),A_(C_(m,2,this.compressionLevel),this.compressionLevel)),l.set(A_(C_(m,4,this.compressionLevel),this.compressionLevel),A_(C_(m,5,this.compressionLevel),this.compressionLevel),A_(C_(m,6,this.compressionLevel),this.compressionLevel),A_(C_(m,3,this.compressionLevel),this.compressionLevel)),e.computeCovariance(u,l,n,t,p,o)}}},{key:"fillSplatColorArray",value:function(t,n,r,i,a){var o=this.splatCount;r=r||0,i=i||o-1,void 0===a&&(a=r);for(var s=r;s<=i;s++){var u=this.globalSplatIndexToSectionMap[s],l=this.sections[u],c=s-l.splatCountOffset,h=(s-r+a)*e.ColorComponentCount,d=l.bytesPerSplat*c+e.CompressionLevels[this.compressionLevel].ColorOffsetBytes,f=new Uint8Array(this.bufferData,l.dataBase+d),p=f[3];p=p>=n?p:0,t[h]=f[0],t[h+1]=f[1],t[h+2]=f[2],t[h+3]=p}}},{key:"constructFromBuffer",value:function(t,n){this.bufferData=t,this.globalSplatIndexToLocalSplatIndexMap=[],this.globalSplatIndexToSectionMap=[];var r=e.parseHeader(this.bufferData);this.versionMajor=r.versionMajor,this.versionMinor=r.versionMinor,this.maxSectionCount=r.maxSectionCount,this.sectionCount=n?r.maxSectionCount:0,this.maxSplatCount=r.maxSplatCount,this.splatCount=n?r.maxSplatCount:0,this.compressionLevel=r.compressionLevel,this.sceneCenter=(new ph).copy(r.sceneCenter),this.minSphericalHarmonicsCoeff=r.minSphericalHarmonicsCoeff,this.maxSphericalHarmonicsCoeff=r.maxSphericalHarmonicsCoeff,this.sections=e.parseSectionHeaders(r,this.bufferData,e.HeaderSizeBytes,n),this.linkBufferArrays(),this.buildMaps()}},{key:"linkBufferArrays",value:function(){for(var t=0;t0&&(n.partiallyFilledBucketLengths=new Uint32Array(this.bufferData,n.base,n.partiallyFilledBucketCount))}}},{key:"buildMaps",value:function(){for(var e=0,t=0;t2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3?arguments[3]:void 0,a=t.compressionLevel,o=t.maxSectionCount,s=new Uint16Array(n,r,o*e.SectionHeaderSizeBytes/2),u=new Uint32Array(n,r,o*e.SectionHeaderSizeBytes/4),l=new Float32Array(n,r,o*e.SectionHeaderSizeBytes/4),c=[],h=0,d=h/2,f=h/4,p=e.HeaderSizeBytes+t.maxSectionCount*e.SectionHeaderSizeBytes,v=0,m=0;m3&&void 0!==arguments[3]?arguments[3]:0,a=new Uint16Array(r,i,e.SectionHeaderSizeBytes/2),o=new Uint32Array(r,i,e.SectionHeaderSizeBytes/4),s=new Float32Array(r,i,e.SectionHeaderSizeBytes/4);o[0]=t.splatCount,o[1]=t.maxSplatCount,o[2]=n>=1?t.bucketSize:0,o[3]=n>=1?t.bucketCount:0,s[4]=n>=1?t.bucketBlockSize:0,a[10]=n>=1?e.BucketStorageSizeBytes:0,o[6]=n>=1?t.compressionScaleRange:0,o[7]=t.storageSizeBytes,o[8]=n>=1?t.fullBucketCount:0,o[9]=n>=1?t.partiallyFilledBucketCount:0,a[20]=t.sphericalHarmonicsDegree}},{key:"writeSectionHeaderSplatCountToBuffer",value:function(t,n){new Uint32Array(n,arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,e.SectionHeaderSizeBytes/4)[0]=t}},{key:"calculateComponentStorage",value:function(t,n){var r=e.CompressionLevels[t].BytesPerCenter,i=e.CompressionLevels[t].BytesPerScale,a=e.CompressionLevels[t].BytesPerRotation,o=e.CompressionLevels[t].BytesPerColor,s=Ou(n),u=e.CompressionLevels[t].BytesPerSphericalHarmonicsComponent*s;return{bytesPerCenter:r,bytesPerScale:i,bytesPerRotation:a,bytesPerColor:o,sphericalHarmonicsComponentsPerSplat:s,sphericalHarmonicsBytesPerSplat:u,bytesPerSplat:r+i+a+o+u}}},{key:"generateFromUncompressedSplatArrays",value:function(t,n,r,i,a,o){for(var s,u,l=arguments.length>6&&void 0!==arguments[6]?arguments[6]:[],c=0,h=0;hu)&&(u=m[g]);s=s||-b_,u=u||b_;for(var y=e.calculateComponentStorage(r,c).bytesPerSplat,_=e.CompressionLevels[r].ScaleRange,b=[],x=[],S=0,A=0;A=n&&T.addSplat(E)}for(var C=l[A]||{},k=(C.blockSizeFactor||1)*(a||e.BucketBlockSize),R=Math.ceil((C.bucketSizeFactor||1)*(o||e.BucketSize)),N=e.computeBucketsForUncompressedSplatArray(T,k,R),P=N.fullBuckets.length,L=N.partiallyFullBuckets.map(function(e){return e.splats.length}),D=L.length,O=[].concat(I(N.fullBuckets),I(N.partiallyFullBuckets)),F=T.splats.length*y,B=4*D,U=r>=1?O.length*e.BucketStorageSizeBytes+B:0,z=F+U,V=new ArrayBuffer(z),H=_/(.5*k),W=new ph,G=0,j=0;j=1){for(var Z=new Uint32Array(V,0,4*L.length),J=0;Jo.x)&&(o.x=l[0]),(0===s||l[1]o.y)&&(o.y=l[1]),(0===s||l[2]o.z)&&(o.z=l[2])}for(var c=(new ph).copy(o).sub(a),h=Math.ceil(c.y/t),d=Math.ceil(c.z/t),f=new ph,p=[],v={},m=0;m=n&&(p.push(A),v[S]=null)}var w=[];for(var T in v)if(v.hasOwnProperty(T)){var M=v[T];M&&w.push(M)}return{fullBuckets:p,partiallyFullBuckets:w}}}])}();f=I_,M(I_,"CurrentMajorVersion",0),M(I_,"CurrentMinorVersion",1),M(I_,"CenterComponentCount",3),M(I_,"ScaleComponentCount",3),M(I_,"RotationComponentCount",4),M(I_,"ColorComponentCount",4),M(I_,"CovarianceComponentCount",6),M(I_,"SplatScaleOffsetFloat",3),M(I_,"SplatRotationOffsetFloat",6),M(I_,"CompressionLevels",{0:{BytesPerCenter:12,BytesPerScale:12,BytesPerRotation:16,BytesPerColor:4,ScaleOffsetBytes:12,RotationffsetBytes:24,ColorOffsetBytes:40,SphericalHarmonicsOffsetBytes:44,ScaleRange:1,BytesPerSphericalHarmonicsComponent:4,SphericalHarmonicsOffsetFloat:11,SphericalHarmonicsDegrees:{0:{BytesPerSplat:44},1:{BytesPerSplat:80},2:{BytesPerSplat:140}}},1:{BytesPerCenter:6,BytesPerScale:6,BytesPerRotation:8,BytesPerColor:4,ScaleOffsetBytes:6,RotationffsetBytes:12,ColorOffsetBytes:20,SphericalHarmonicsOffsetBytes:24,ScaleRange:32767,BytesPerSphericalHarmonicsComponent:2,SphericalHarmonicsOffsetFloat:12,SphericalHarmonicsDegrees:{0:{BytesPerSplat:24},1:{BytesPerSplat:42},2:{BytesPerSplat:72}}},2:{BytesPerCenter:6,BytesPerScale:6,BytesPerRotation:8,BytesPerColor:4,ScaleOffsetBytes:6,RotationffsetBytes:12,ColorOffsetBytes:20,SphericalHarmonicsOffsetBytes:24,ScaleRange:32767,BytesPerSphericalHarmonicsComponent:1,SphericalHarmonicsOffsetFloat:12,SphericalHarmonicsDegrees:{0:{BytesPerSplat:24},1:{BytesPerSplat:33},2:{BytesPerSplat:48}}}}),M(I_,"CovarianceSizeFloats",6),M(I_,"HeaderSizeBytes",4096),M(I_,"SectionHeaderSizeBytes",1024),M(I_,"BucketStorageSizeBytes",12),M(I_,"BucketStorageSizeFloats",3),M(I_,"BucketBlockSize",5),M(I_,"BucketSize",256),M(I_,"computeCovariance",(Vy=new Gh,Hy=new Hc,Wy=new Hc,Gy=new Hc,jy=new Hc,Qy=new Hc,qy=new Hc,function(e,t,n,r){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,a=arguments.length>5?arguments[5]:void 0;Vy.makeScale(e.x,e.y,e.z),Hy.setFromMatrix4(Vy),Vy.makeRotationFromQuaternion(t),Wy.setFromMatrix4(Vy),Gy.copy(Wy).multiply(Hy),jy.copy(Gy).transpose().premultiply(Gy),n&&(Qy.setFromMatrix4(n),qy.copy(Qy).transpose(),jy.multiply(qy),jy.premultiply(Qy)),a>=1?(r[i]=x_(jy.elements[0]),r[i+1]=x_(jy.elements[3]),r[i+2]=x_(jy.elements[6]),r[i+3]=x_(jy.elements[4]),r[i+4]=x_(jy.elements[7]),r[i+5]=x_(jy.elements[8])):(r[i]=jy.elements[0],r[i+1]=jy.elements[3],r[i+2]=jy.elements[6],r[i+3]=jy.elements[4],r[i+4]=jy.elements[7],r[i+5]=jy.elements[8])})),M(I_,"dot3",function(e,t,n,r,i){i[0]=i[1]=i[2]=0;var a=r[0],o=r[1],s=r[2];f.addInto3(e[0]*a,e[1]*a,e[2]*a,i),f.addInto3(t[0]*o,t[1]*o,t[2]*o,i),f.addInto3(n[0]*s,n[1]*s,n[2]*s,i)}),M(I_,"addInto3",function(e,t,n,r){r[0]=r[0]+e,r[1]=r[1]+t,r[2]=r[2]+n}),M(I_,"dot5",function(e,t,n,r,i,a,o){o[0]=o[1]=o[2]=0;var s=a[0],u=a[1],l=a[2],c=a[3],h=a[4];f.addInto3(e[0]*s,e[1]*s,e[2]*s,o),f.addInto3(t[0]*u,t[1]*u,t[2]*u,o),f.addInto3(n[0]*l,n[1]*l,n[2]*l,o),f.addInto3(r[0]*c,r[1]*c,r[2]*c,o),f.addInto3(i[0]*h,i[1]*h,i[2]*h,o)}),M(I_,"rotateSphericalHarmonics3",function(e,t,n,r,i,a,o,s,u){f.dot3(e,t,n,r,o),f.dot3(e,t,n,i,s),f.dot3(e,t,n,a,u)}),M(I_,"rotateSphericalHarmonics5",function(e,t,n,r,i,a,o,s,u,l,c,h,d,p,v,m,g,y){var _=Math.sqrt(1/4),b=Math.sqrt(3/4),x=Math.sqrt(1/3),S=Math.sqrt(4/3),A=Math.sqrt(1/12);u[0]=_*(s[2]*a[0]+s[0]*a[2]+(a[2]*s[0]+a[0]*s[2])),u[1]=s[1]*a[0]+a[1]*s[0],u[2]=b*(s[1]*a[1]+a[1]*s[1]),u[3]=s[1]*a[2]+a[1]*s[2],u[4]=_*(s[2]*a[2]-s[0]*a[0]+(a[2]*s[2]-a[0]*s[0])),f.dot5(e,t,n,r,i,u,p),l[0]=_*(o[2]*a[0]+o[0]*a[2]+(a[2]*o[0]+a[0]*o[2])),l[1]=o[1]*a[0]+a[1]*o[0],l[2]=b*(o[1]*a[1]+a[1]*o[1]),l[3]=o[1]*a[2]+a[1]*o[2],l[4]=_*(o[2]*a[2]-o[0]*a[0]+(a[2]*o[2]-a[0]*o[0])),f.dot5(e,t,n,r,i,l,v),c[0]=x*(o[2]*o[0]+o[0]*o[2])+-A*(s[2]*s[0]+s[0]*s[2]+(a[2]*a[0]+a[0]*a[2])),c[1]=S*o[1]*o[0]+-x*(s[1]*s[0]+a[1]*a[0]),c[2]=o[1]*o[1]+-_*(s[1]*s[1]+a[1]*a[1]),c[3]=S*o[1]*o[2]+-x*(s[1]*s[2]+a[1]*a[2]),c[4]=x*(o[2]*o[2]-o[0]*o[0])+-A*(s[2]*s[2]-s[0]*s[0]+(a[2]*a[2]-a[0]*a[0])),f.dot5(e,t,n,r,i,c,m),h[0]=_*(o[2]*s[0]+o[0]*s[2]+(s[2]*o[0]+s[0]*o[2])),h[1]=o[1]*s[0]+s[1]*o[0],h[2]=b*(o[1]*s[1]+s[1]*o[1]),h[3]=o[1]*s[2]+s[1]*o[2],h[4]=_*(o[2]*s[2]-o[0]*s[0]+(s[2]*o[2]-s[0]*o[0])),f.dot5(e,t,n,r,i,h,g),d[0]=_*(s[2]*s[0]+s[0]*s[2]-(a[2]*a[0]+a[0]*a[2])),d[1]=s[1]*s[0]-a[1]*a[0],d[2]=b*(s[1]*s[1]-a[1]*a[1]),d[3]=s[1]*s[2]-a[1]*a[2],d[4]=_*(s[2]*s[2]-s[0]*s[0]-(a[2]*a[2]-a[0]*a[0])),f.dot5(e,t,n,r,i,d,y)}),M(I_,"writeSplatDataToSectionBuffer",(Xy=new ArrayBuffer(12),Yy=new ArrayBuffer(12),Ky=new ArrayBuffer(16),Zy=new ArrayBuffer(4),Jy=new ArrayBuffer(256),$y=new fh,e_=new ph,t_=new ph,n_=Hu.OFFSET,r_=n_.X,i_=n_.Y,a_=n_.Z,o_=n_.SCALE0,s_=n_.SCALE1,u_=n_.SCALE2,l_=n_.ROTATION0,c_=n_.ROTATION1,h_=n_.ROTATION2,d_=n_.ROTATION3,f_=n_.FDC0,p_=n_.FDC1,v_=n_.FDC2,m_=n_.OPACITY,g_=n_.FRC0,y_=n_.FRC9,__=function(e,t,n){var r=2*n+1;return e=Math.round(e*t)+n,Nu(e,0,r)},function(e,t,n,r,i,a,o,s){var u=arguments.length>8&&void 0!==arguments[8]?arguments[8]:-b_,l=arguments.length>9&&void 0!==arguments[9]?arguments[9]:b_,c=Ou(i),h=n,d=h+f.CompressionLevels[r].BytesPerCenter,p=d+f.CompressionLevels[r].BytesPerScale,v=p+f.CompressionLevels[r].BytesPerRotation,m=v+f.CompressionLevels[r].BytesPerColor;if(void 0!==e[l_]?($y.set(e[l_],e[c_],e[h_],e[d_]),$y.normalize()):$y.set(1,0,0,0),void 0!==e[o_]?e_.set(e[o_]||0,e[s_]||0,e[u_]||0):e_.set(0,0,0),0===r){var g=new Float32Array(t,h,f.CenterComponentCount),y=new Float32Array(t,p,f.RotationComponentCount),_=new Float32Array(t,d,f.ScaleComponentCount);if(y.set([$y.x,$y.y,$y.z,$y.w]),_.set([e_.x,e_.y,e_.z]),g.set([e[r_],e[i_],e[a_]]),i>0){var b=new Float32Array(t,m,c);if(i>=1){for(var x=0;x<9;x++)b[x]=e[g_+x]||0;if(i>=2)for(var S=0;S<15;S++)b[S+9]=e[y_+S]||0}}}else{var A=new Uint16Array(Xy,0,f.CenterComponentCount),w=new Uint16Array(Ky,0,f.RotationComponentCount),T=new Uint16Array(Yy,0,f.ScaleComponentCount);if(w.set([x_($y.x),x_($y.y),x_($y.z),x_($y.w)]),T.set([x_(e_.x),x_(e_.y),x_(e_.z)]),t_.set(e[r_],e[i_],e[a_]).sub(a),t_.x=__(t_.x,o,s),t_.y=__(t_.y,o,s),t_.z=__(t_.z,o,s),A.set([t_.x,t_.y,t_.z]),i>0){var M=1===r?2:1,E=new(1===r?Uint16Array:Uint8Array)(Jy,0,c);if(i>=1){for(var C=0;C<9;C++){var k=e[g_+C]||0;E[C]=1===r?x_(k):w_(k,u,l)}var R=9*M;if(R_(E.buffer,0,t,m,R),i>=2){for(var I=0;I<15;I++){var N=e[y_+I]||0;E[I+9]=1===r?x_(N):w_(N,u,l)}R_(E.buffer,R,t,m+R,15*M)}}}R_(A.buffer,0,t,h,6),R_(T.buffer,0,t,d,6),R_(w.buffer,0,t,p,8)}var P=new Uint8ClampedArray(Zy,0,4);P.set([e[f_]||0,e[p_]||0,e[v_]||0]),P[3]=e[m_]||0,R_(P.buffer,0,t,v,4)}));var N_=new Uint8Array([112,108,121,10]),P_=new Uint8Array([10,101,110,100,95,104,101,97,100,101,114,10]),L_="end_header",D_=new Map([["char",Int8Array],["uchar",Uint8Array],["short",Int16Array],["ushort",Uint16Array],["int",Int32Array],["uint",Uint32Array],["float",Float32Array],["double",Float64Array]]),O_=function(e,t){var n=(1<>>21,11),e.y=O_(t>>>11,10),e.z=O_(t,11)},B_=function(e,t,n){return e*(1-n)+t*n},U_=function(e,t){var n;return null===(n=e.properties.find(function(e){return e.name===t&&e.storage}))||void 0===n?void 0:n.storage},z_=function(){function e(){A(this,e)}return T(e,null,[{key:"decodeHeaderText",value:function(e){for(var t,n,r,i=e.split("\n").filter(function(e){return!e.startsWith("comment ")}),a=0,o=!1,s=1;s=N_.length&&!function(e,t){if(e.length5&&void 0!==arguments[5]?arguments[5]:null,o=t instanceof DataView?t:new DataView(t);r=r||0,i=i||e.count-1;for(var s=r;s<=i;++s)for(var u=0;u1&&void 0!==arguments[1]?arguments[1]:null,r=e.decodeHeader(t),i=e.readElementData(r.chunkElement,t,r.headerSizeBytes,null,null,n);return e.readElementData(r.vertexElement,t,i,null,null,n),{chunkElement:r.chunkElement,vertexElement:r.vertexElement}}},{key:"getElementStorageArrays",value:function(e,t){var n=U_(e,"min_x"),r=U_(e,"min_y"),i=U_(e,"min_z"),a=U_(e,"max_x"),o=U_(e,"max_y"),s=U_(e,"max_z"),u=U_(e,"min_scale_x"),l=U_(e,"min_scale_y"),c=U_(e,"min_scale_z");return{positionExtremes:{minX:n,maxX:a,minY:r,maxY:o,minZ:i,maxZ:s},scaleExtremes:{minScaleX:u,maxScaleX:U_(e,"max_scale_x"),minScaleY:l,maxScaleY:U_(e,"max_scale_y"),minScaleZ:c,maxScaleZ:U_(e,"max_scale_z")},position:U_(t,"packed_position"),rotation:U_(t,"packed_rotation"),scale:U_(t,"packed_scale"),color:U_(t,"packed_color")}}},{key:"parseToUncompressedSplatBufferSection",value:function(t,n,r,i,a,o,s,u,l){var c=arguments.length>9&&void 0!==arguments[9]?arguments[9]:null;e.readElementData(n,o,s,r,i,c);for(var h=I_.CompressionLevels[0].SphericalHarmonicsDegrees[0].BytesPerSplat,d=e.getElementStorageArrays(t,n),f=d.positionExtremes,p=d.scaleExtremes,v=d.position,m=d.rotation,g=d.scale,y=d.color,_=Hu.createSplat(),b=r;b<=i;++b){e.decompressSplat(b,a,v,f,g,p,m,y,_);var x=b*h+l;I_.writeSplatDataToSectionBuffer(_,u,x,0,0)}}},{key:"parseToUncompressedSplatArraySection",value:function(t,n,r,i,a,o,s,u){var l=arguments.length>8&&void 0!==arguments[8]?arguments[8]:null;e.readElementData(n,o,s,r,i,l);for(var c=e.getElementStorageArrays(t,n),h=c.positionExtremes,d=c.scaleExtremes,f=c.position,p=c.rotation,v=c.scale,m=c.color,g=r;g<=i;++g){var y=Hu.createSplat();e.decompressSplat(g,a,f,h,v,d,p,m,y),u.addSplat(y)}}},{key:"parseToUncompressedSplatArray",value:function(t){for(var n=e.readPly(t),r=n.chunkElement,i=n.vertexElement,a=new Hu,o=e.getElementStorageArrays(r,i),s=o.positionExtremes,u=o.scaleExtremes,l=o.position,c=o.rotation,h=o.scale,d=o.color,f=0;f>>20,10)-.5)*n,i=(O_(t>>>10,10)-.5)*n,a=(O_(t,10)-.5)*n,o=Math.sqrt(1-(r*r+i*i+a*a));switch(t>>>30){case 0:e.set(o,r,i,a);break;case 1:e.set(r,o,i,a);break;case 2:e.set(r,i,o,a);break;case 3:e.set(r,i,a,o)}}(t,h[a]),F_(n,l[a]),p=r,v=d[a],p.x=O_(v>>>24,8),p.y=O_(v>>>16,8),p.z=O_(v>>>8,8),p.w=O_(v,8),f[i.X]=B_(u.minX[m],u.maxX[m],e.x),f[i.Y]=B_(u.minY[m],u.maxY[m],e.y),f[i.Z]=B_(u.minZ[m],u.maxZ[m],e.z),f[i.ROTATION0]=t.x,f[i.ROTATION1]=t.y,f[i.ROTATION2]=t.z,f[i.ROTATION3]=t.w,f[i.SCALE0]=Math.exp(B_(c.minScaleX[m],c.maxScaleX[m],n.x)),f[i.SCALE1]=Math.exp(B_(c.minScaleY[m],c.maxScaleY[m],n.y)),f[i.SCALE2]=Math.exp(B_(c.minScaleZ[m],c.maxScaleZ[m],n.z)),f[i.FDC0]=Nu(Math.floor(255*r.x),0,255),f[i.FDC1]=Nu(Math.floor(255*r.y),0,255),f[i.FDC2]=Nu(Math.floor(255*r.z),0,255),f[i.OPACITY]=Nu(Math.floor(255*r.w),0,255),f}}());var V_=0,H_=1,W_=2,G_={double:0,int:1,uint:2,float:3,short:4,ushort:5,uchar:6},j_=M(M(M(M(M(M(M({},0,8),1,4),2,4),3,4),4,2),5,2),6,1),Q_=function(){function e(){A(this,e)}return T(e,[{key:"decodeSectionHeader",value:function(t,n){for(var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=[],a=!1,o=-1,s=0,u=!1,l=null,c=[],h=[],d=[],f={},p=r;p0&&(2===++g?l=_:3===g&&(s=parseInt(_)))}}catch(P){y.e(P)}finally{y.f()}}else if(v.startsWith("property")){var b=v.match(/(\w+)\s+(\w+)\s+(\w+)/);if(b){var x=b[2],S=b[3];d.push(S);var A=n[S];f[S]=x;var w=G_[x];void 0!==A&&(c.push(A),h[A]=w)}}if(v===e.HeaderEndToken){u=!0;break}a&&(i.push(v),o++)}for(var T=[],M=0,E=0,C=d;E=3&&(o=1),n>=8&&(o=2);for(var s=[],u=[],l=0;l<3;l++){if(o>=1)for(var c=0;c<3;c++)s.push(t["f_rest_"+(c+n*l)]);if(o>=2)for(var h=0;h<5;h++)u.push(t["f_rest_"+(h+n*l+3)])}return{degree:o,coefficientsPerChannel:n,degree1Fields:s,degree2Fields:u}}},{key:"readHeaderFromBuffer",value:function(t){for(var n=new TextDecoder,r=0,i="",a=100;;){if(r+a>=t.byteLength)throw new Error("End of file reached while searching for end of header");var o=new Uint8Array(t,r,a);if(i+=n.decode(o),r+=a,e.checkBufferForEndHeader(t,r,200,n))break}return i}}],[{key:"getHeaderSectionNames",value:function(e){var t,n=[],r=L(e);try{for(r.s();!(t=r.n()).done;){var i=t.value;if(i.startsWith("element")){var a,o=i.split(" "),s=0,u=L(o);try{for(u.s();!(a=u.n()).done;){var l=a.value.trim();l.length>0&&2===++s&&n.push(l)}}catch(c){u.e(c)}finally{u.f()}}}}catch(c){r.e(c)}finally{r.f()}return n}},{key:"checkTextForEndHeader",value:function(t){return!!t.includes(e.HeaderEndToken)}},{key:"checkBufferForEndHeader",value:function(t,n,r,i){var a=new Uint8Array(t,Math.max(0,n-r),r),o=i.decode(a);return e.checkTextForEndHeader(o)}},{key:"extractHeaderFromBufferToText",value:function(t){for(var n=new TextDecoder,r=0,i="",a=100;;){if(r+a>=t.byteLength)throw new Error("End of file reached while searching for end of header");var o=new Uint8Array(t,r,a);if(i+=n.decode(o),r+=a,e.checkBufferForEndHeader(t,r,200,n))break}return i}},{key:"convertHeaderTextToLines",value:function(t){for(var n=t.split("\n"),r=[],i=0;i6&&void 0!==arguments[6])||arguments[6],u=n*t.bytesPerVertex+r,l=t.fieldOffsets,c=t.fieldTypes,h=L(i);try{for(h.s();!(o=h.n()).done;){var d=o.value,f=c[d];3===f?a[d]=e.getFloat32(u+l[d],!0):4===f?a[d]=e.getInt16(u+l[d],!0):5===f?a[d]=e.getUint16(u+l[d],!0):1===f?a[d]=e.getInt32(u+l[d],!0):2===f?a[d]=e.getUint32(u+l[d],!0):6===f&&(a[d]=s?e.getUint8(u+l[d])/255:e.getUint8(u+l[d]))}}catch(p){h.e(p)}finally{h.f()}}}])}();M(Q_,"HeaderEndToken","end_header");var q_=["scale_0","scale_1","scale_2","rot_0","rot_1","rot_2","rot_3","x","y","z","f_dc_0","f_dc_1","f_dc_2","opacity","red","green","blue","f_rest_0"],X_=q_.map(function(e,t){return t}),Y_=C(X_,18),K_=Y_[0],Z_=Y_[1],J_=Y_[2],$_=Y_[3],eb=Y_[4],tb=Y_[5],nb=Y_[6],rb=Y_[7],ib=Y_[8],ab=Y_[9],ob=Y_[10],sb=Y_[11],ub=Y_[12],lb=Y_[13],cb=Y_[14],hb=Y_[15],db=Y_[16],fb=Y_[17],pb=function(){function e(){A(this,e),this.plyParserutils=new Q_}return T(e,[{key:"decodeHeaderLines",value:function(e){var t=0;e.forEach(function(e){e.includes("f_rest_")&&t++});var n=0;t>=45?n=45:t>=24?n=24:t>=9&&(n=9);var r=Array.from(Array(Math.max(n-1,0))).map(function(e,t){return"f_rest_".concat(t+1)}),i=[].concat(q_,I(r)),a=i.map(function(e,t){return t}),o=a.reduce(function(e,t){return e[i[t]]=t,e},{}),s=this.plyParserutils.decodeSectionHeader(e,o,0);return s.splatCount=s.vertexCount,s.bytesPerSplat=s.bytesPerVertex,s.fieldsToReadIndexes=a,s}},{key:"decodeHeaderText",value:function(e){var t=Q_.convertHeaderTextToLines(e),n=this.decodeHeaderLines(t);return n.headerText=e,n.headerSizeBytes=e.indexOf(Q_.HeaderEndToken)+Q_.HeaderEndToken.length+1,n}},{key:"decodeHeaderFromBuffer",value:function(e){var t=this.plyParserutils.readHeaderFromBuffer(e);return this.decodeHeaderText(t)}},{key:"findSplatData",value:function(e,t){return new DataView(e,t.headerSizeBytes)}},{key:"parseToUncompressedSplatBufferSection",value:function(t,n,r,i,a,o,s){var u=arguments.length>7&&void 0!==arguments[7]?arguments[7]:0;u=Math.min(u,t.sphericalHarmonicsDegree);for(var l=I_.CompressionLevels[0].SphericalHarmonicsDegrees[u].BytesPerSplat,c=n;c<=r;c++){var h=e.parseToUncompressedSplat(i,c,t,a,u),d=c*l+s;I_.writeSplatDataToSectionBuffer(h,o,d,0,u)}}},{key:"parseToUncompressedSplatArraySection",value:function(t,n,r,i,a,o){var s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0;s=Math.min(s,t.sphericalHarmonicsDegree);for(var u=n;u<=r;u++){var l=e.parseToUncompressedSplat(i,u,t,a,s);o.addSplat(l)}}},{key:"decodeSectionSplatData",value:function(t,n,r,i){i=Math.min(i,r.sphericalHarmonicsDegree);for(var a=new Hu(i),o=0;o1&&void 0!==arguments[1]?arguments[1]:0,n=this.decodeHeaderFromBuffer(e),r=n.splatCount,i=this.findSplatData(e,n);return this.decodeSectionSplatData(i,r,n,t)}}],[{key:"readSplat",value:function(e,t,n,r,i){return Q_.readVertex(e,t,n,r,t.fieldsToReadIndexes,i,!0)}}])}();p=pb,M(pb,"parseToUncompressedSplat",function(){for(var e=[],t=new fh,n=Hu.OFFSET.X,r=Hu.OFFSET.Y,i=Hu.OFFSET.Z,a=Hu.OFFSET.SCALE0,o=Hu.OFFSET.SCALE1,s=Hu.OFFSET.SCALE2,u=Hu.OFFSET.ROTATION0,l=Hu.OFFSET.ROTATION1,c=Hu.OFFSET.ROTATION2,h=Hu.OFFSET.ROTATION3,d=Hu.OFFSET.FDC0,f=Hu.OFFSET.FDC1,v=Hu.OFFSET.FDC2,m=Hu.OFFSET.OPACITY,g=[],y=0;y<45;y++)g[y]=Hu.OFFSET.FRC0+y;return function(y,_,b){var x=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,S=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;S=Math.min(S,b.sphericalHarmonicsDegree),p.readSplat(y,b,_,x,e);var A=Hu.createSplat(S);if(void 0!==e[K_]?(A[a]=Math.exp(e[K_]),A[o]=Math.exp(e[Z_]),A[s]=Math.exp(e[J_])):(A[a]=.01,A[o]=.01,A[s]=.01),void 0!==e[ob]?(A[d]=255*e[ob],A[f]=255*e[sb],A[v]=255*e[ub]):void 0!==e[cb]?(A[d]=255*e[cb],A[f]=255*e[hb],A[v]=255*e[db]):(A[d]=0,A[f]=0,A[v]=0),void 0!==e[lb]&&(A[m]=1/(1+Math.exp(-e[lb]))*255),A[d]=Nu(Math.floor(A[d]),0,255),A[f]=Nu(Math.floor(A[f]),0,255),A[v]=Nu(Math.floor(A[v]),0,255),A[m]=Nu(Math.floor(A[m]),0,255),S>=1&&void 0!==e[fb]){for(var w=0;w<9;w++)A[g[w]]=e[b.sphericalHarmonicsDegree1Fields[w]];if(S>=2)for(var T=0;T<15;T++)A[g[9+T]]=e[b.sphericalHarmonicsDegree2Fields[T]]}return t.set(e[$_],e[eb],e[tb],e[nb]),t.normalize(),A[u]=t.x,A[l]=t.y,A[c]=t.z,A[h]=t.w,A[n]=e[rb],A[r]=e[ib],A[i]=e[ab],A}}());var vb=["features_dc","features_rest_0","features_rest_1","features_rest_2","features_rest_3","features_rest_4","features_rest_5","features_rest_6","features_rest_7","features_rest_8","features_rest_9","features_rest_10","features_rest_11","features_rest_12","features_rest_13","features_rest_14","opacity","scaling","rotation_re","rotation_im"],mb=vb.map(function(e,t){return t}),gb=["scale_0","scale_1","scale_2","rot_0","rot_1","rot_2","rot_3","x","y","z","f_dc_0","f_dc_1","f_dc_2","opacity","red","green","blue","f_rest_0","f_rest_1","f_rest_2","f_rest_3","f_rest_4","f_rest_5","f_rest_6","f_rest_7","f_rest_8","f_rest_9","f_rest_10","f_rest_11","f_rest_12","f_rest_13","f_rest_14","f_rest_15","f_rest_16","f_rest_17","f_rest_18","f_rest_19","f_rest_20","f_rest_21","f_rest_22","f_rest_23","f_rest_24","f_rest_25","f_rest_26","f_rest_27","f_rest_28","f_rest_29","f_rest_30","f_rest_31","f_rest_32","f_rest_33","f_rest_34","f_rest_35","f_rest_36","f_rest_37","f_rest_38","f_rest_39","f_rest_40","f_rest_41","f_rest_42","f_rest_43","f_rest_44","f_rest_45"],yb=gb.map(function(e,t){return t}),_b=C(yb,14),bb=_b[0],xb=_b[1],Sb=_b[2],Ab=_b[3],wb=_b[4],Tb=_b[5],Mb=_b[6],Eb=_b[7],Cb=_b[8],kb=_b[9],Rb=_b[10],Ib=_b[11],Nb=_b[12],Pb=_b[13],Lb=Rb,Db=Ib,Ob=Nb,Fb=function(e){var t=(31744&e)>>10,n=1023&e;return(e>>15?-1:1)*(t?31===t?n?NaN:1/0:Math.pow(2,t-15)*(1+n/1024):n/1024*6103515625e-14)},Bb=function(){function e(){A(this,e),this.plyParserutils=new Q_}return T(e,[{key:"decodeSectionHeadersFromHeaderLines",value:function(e){for(var t,n=yb.reduce(function(e,t){return e[gb[t]]=t,e},{}),r=mb.reduce(function(e,t){return e[vb[t]]=t,e},{}),i=Q_.getHeaderSectionNames(e),a=0;a1&&void 0!==arguments[1]?arguments[1]:0,r=[],i=this.decodeHeaderFromBuffer(e,n),a=0;a4&&void 0!==arguments[4]?arguments[4]:0,A=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;A=Math.min(A,b.sphericalHarmonicsDegree),_.readSplat(g,b,y,S,e);var w=Hu.createSplat(A);if(void 0!==e[bb]?(w[a]=x[17][e[bb]],w[o]=x[17][e[xb]],w[s]=x[17][e[Sb]]):(w[a]=.01,w[o]=.01,w[s]=.01),void 0!==e[Rb]?(w[d]=x[0][e[Rb]],w[f]=x[0][e[Ib]],w[p]=x[0][e[Nb]]):void 0!==e[Lb]?(w[d]=255*e[Lb],w[f]=255*e[Db],w[p]=255*e[Ob]):(w[d]=0,w[f]=0,w[p]=0),void 0!==e[Pb]&&(w[v]=x[16][e[Pb]]),w[d]=Nu(Math.floor(w[d]),0,255),w[f]=Nu(Math.floor(w[f]),0,255),w[p]=Nu(Math.floor(w[p]),0,255),w[v]=Nu(Math.floor(w[v]),0,255),A>=1&&b.sphericalHarmonicsDegree>=1){for(var T=0;T<9;T++){var M=x[1+T%3];w[m[T]]=M[e[b.sphericalHarmonicsDegree1Fields[T]]]}if(A>=2&&b.sphericalHarmonicsDegree>=2)for(var E=0;E<15;E++){var C=x[4+E%5];w[m[9+E]]=C[e[b.sphericalHarmonicsDegree2Fields[E]]]}}var k=x[18][e[Ab]],R=x[19][e[wb]],I=x[19][e[Tb]],N=x[19][e[Mb]];return t.set(k,R,I,N),t.normalize(),w[u]=t.x,w[l]=t.y,w[c]=t.z,w[h]=t.w,w[n]=Fb(e[Eb]),w[r]=Fb(e[Cb]),w[i]=Fb(e[kb]),w}}());var Ub=function(){return T(function e(){A(this,e)},null,[{key:"parseToUncompressedSplatArray",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=Q_.determineHeaderFormatFromPlyBuffer(e);return n===W_?z_.parseToUncompressedSplatArray(e):n===V_?(new pb).parseToUncompressedSplatArray(e,t):n===H_?(new Bb).parseToUncompressedSplatArray(e,t):void 0}}])}(),zb=function(){function e(t,n,r,i){A(this,e),this.sectionCount=t,this.sectionFilters=n,this.groupingParameters=r,this.partitionGenerator=i}return T(e,[{key:"partitionUncompressedSplatArray",value:function(e){var t,n,r;if(this.partitionGenerator){var i=this.partitionGenerator(e);t=i.groupingParameters,n=i.sectionCount,r=i.sectionFilters}else t=this.groupingParameters,n=this.sectionCount,r=this.sectionFilters;for(var a=[],o=0;o0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new ph,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:I_.BucketBlockSize,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:I_.BucketSize;return new e(void 0,void 0,void 0,function(e){var a=Hu.OFFSET.X,o=Hu.OFFSET.Y,s=Hu.OFFSET.Z;t<=0&&(t=e.splatCount);var u=new ph,l=.5;e.splats.forEach(function(e){var t;u.set(e[a],e[o],e[s]).sub(n),(t=u).x=Math.floor(t.x/l)*l,t.y=Math.floor(t.y/l)*l,t.z=Math.floor(t.z/l)*l,e.centerDist=u.lengthSq()}),e.splats.sort(function(e,t){return e.centerDist>t.centerDist?1:-1});var c=[],h=[];t=Math.min(e.splatCount,t);for(var d=Math.ceil(e.splatCount/t),f=0,p=function(){var e=f;c.push(function(n){return n>=e&&n0&&void 0!==arguments[0]?arguments[0]:1,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:new ph,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:I_.BucketBlockSize,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:I_.BucketSize;return new e(zb.getStandardPartitioner(r,i,a,o),t,n,r,i,a,o)}}])}(),Hb=0,Wb=1,Gb=2,jb=function(e){function t(e){return A(this,t),y(this,t,[e])}return x(t,e),T(t)}(m(Error)),Qb=0,qb=1,Xb=2;function Yb(e,t){var n,r=0,i=L(e);try{for(i.s();!(n=i.n()).done;){r+=n.value.sizeBytes}}catch(l){i.e(l)}finally{i.f()}(!t||t.byteLength6&&void 0!==arguments[6])||arguments[6],u=arguments.length>7&&void 0!==arguments[7]?arguments[7]:0,l=arguments.length>8?arguments[8]:void 0,c=arguments.length>9?arguments[9]:void 0,h=arguments.length>10?arguments[10]:void 0,d=arguments.length>11?arguments[11]:void 0,f=arguments.length>12?arguments[12]:void 0,p=r?Qb:qb;s&&(p=qb);var v,m,g,y,_,b=zy.ProgressiveLoadSectionSize,x=I_.HeaderSizeBytes+I_.SectionHeaderSizeBytes,S=0,A=0,w=!1,T=!1,M=!1,E=Fu(),C=0,k=0,R=0,I="",N=null,P=[],L=new TextDecoder,D=new pb;return n&&n(0,"0%",Hb),Iu(t,function(e,t,a){var o=e>=100;if(a&&(P.push({data:a,sizeBytes:a.byteLength,startBytes:R,endBytes:R+a.byteLength}),R+=a.byteLength),p===Xb)o&&E.resolve(P);else{if(w){if(M&&!T){var s=N.headerSizeBytes+N.chunkElement.storageSizeBytes;(y=Yb(P,y)).byteLength>=s&&(z_.readElementData(N.chunkElement,y,N.headerSizeBytes),C=s,k=s,T=!0)}}else if(I+=L.decode(a),Q_.checkTextForEndHeader(I)){var l=Q_.determineHeaderFormatFromHeaderText(I);if(l===V_)N=D.decodeHeaderText(I),S=N.splatCount,T=!0,M=!1;else{if(l!==W_){if(r)throw new jb("PlyLoader.loadFromURL() -> Selected Ply format cannot be directly loaded.");return void(p=Xb)}N=z_.decodeHeaderText(I),S=N.vertexElement.count,M=!0}u=Math.min(u,N.sphericalHarmonicsDegree);var c=I_.CompressionLevels[0].SphericalHarmonicsDegrees[u],h=x+c.BytesPerSplat*S;p===Qb?(m=new ArrayBuffer(h),I_.writeHeaderToBuffer({versionMajor:I_.CurrentMajorVersion,versionMinor:I_.CurrentMinorVersion,maxSectionCount:1,sectionCount:1,maxSplatCount:S,splatCount:A,compressionLevel:0,sceneCenter:new ph},m)):_=new Hu(u),C=N.headerSizeBytes,k=N.headerSizeBytes,w=!0}if(w&&T){if(P.length>0)if(v=Yb(P,v),R-C>b||o){var d=R-k,f=Math.floor(d/N.bytesPerSplat),O=f*N.bytesPerSplat,F=d-O,B=A+f,U=k-P[0].startBytes,z=new DataView(v,U,O),V=I_.CompressionLevels[0].SphericalHarmonicsDegrees[u],H=A*V.BytesPerSplat+x;if(p===Qb?M?z_.parseToUncompressedSplatBufferSection(N.chunkElement,N.vertexElement,0,f-1,A,z,0,m,H):D.parseToUncompressedSplatBufferSection(N,0,f-1,z,0,m,H,u):M?z_.parseToUncompressedSplatArraySection(N.chunkElement,N.vertexElement,0,f-1,A,z,0,_):D.parseToUncompressedSplatArraySection(N,0,f-1,z,0,_,u),A=B,p===Qb&&(g||(I_.writeSectionHeaderToBuffer({maxSplatCount:S,splatCount:A,bucketSize:0,bucketCount:0,bucketBlockSize:0,compressionScaleRange:0,storageSizeBytes:0,fullBucketCount:0,partiallyFilledBucketCount:0,sphericalHarmonicsDegree:u},0,m,I_.HeaderSizeBytes),g=new I_(m,!1)),g.updateLoadedCounts(1,A),i&&i(g,o)),C+=b,k+=O,0===F)P=[];else{for(var W=[],G=0,j=P.length-1;j>=0;j--){var Q=P[j];if(G+=Q.sizeBytes,W.unshift(Q),G>=F)break}P=W}}o&&(p===Qb?E.resolve(g):E.resolve(_))}}n&&n(e,t,Hb)},!1,l).then(function(){return n&&n(0,"0%",Wb),E.promise.then(function(t){if(n&&n(100,"100%",Gb),p===Xb){var r=P.map(function(e){return e.data});return new Blob(r).arrayBuffer().then(function(t){return e.loadFromFileData(t,a,o,s,u,c,h,d,f)})}return p===Qb?t:Du(function(){return Kb(t,s,a,o,c,h,d,f)})})})}},{key:"loadFromFileData",value:function(e,t,n,r){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,a=arguments.length>5?arguments[5]:void 0,o=arguments.length>6?arguments[6]:void 0,s=arguments.length>7?arguments[7]:void 0,u=arguments.length>8?arguments[8]:void 0;return Du(function(){return Ub.parseToUncompressedSplatArray(e,i)}).then(function(e){return Kb(e,r,t,n,a,o,s,u)})}}])}(),Jb=function(){function e(){A(this,e)}return T(e,null,[{key:"parseToUncompressedSplatBufferSection",value:function(t,n,r,i,a,o){for(var s=I_.CompressionLevels[0].BytesPerCenter,u=I_.CompressionLevels[0].BytesPerScale,l=I_.CompressionLevels[0].BytesPerRotation,c=I_.CompressionLevels[0].SphericalHarmonicsDegrees[0].BytesPerSplat,h=t;h<=n;h++){var d=h*e.RowSizeBytes+i,f=new Float32Array(r,d,3),p=new Float32Array(r,d+e.CenterSizeBytes,3),v=new Uint8Array(r,d+e.CenterSizeBytes+e.ScaleSizeBytes,4),m=new Uint8Array(r,d+e.CenterSizeBytes+e.ScaleSizeBytes+e.RotationSizeBytes,4),g=new fh((m[1]-128)/128,(m[2]-128)/128,(m[3]-128)/128,(m[0]-128)/128);g.normalize();var y=h*c+o,_=new Float32Array(a,y,3),b=new Float32Array(a,y+s,3),x=new Float32Array(a,y+s+u,4),S=new Uint8Array(a,y+s+u+l,4);_[0]=f[0],_[1]=f[1],_[2]=f[2],b[0]=p[0],b[1]=p[1],b[2]=p[2],x[0]=g.w,x[1]=g.x,x[2]=g.y,x[3]=g.z,S[0]=v[0],S[1]=v[1],S[2]=v[2],S[3]=v[3]}}},{key:"parseToUncompressedSplatArraySection",value:function(t,n,r,i,a){for(var o=t;o<=n;o++){var s=o*e.RowSizeBytes+i,u=new Float32Array(r,s,3),l=new Float32Array(r,s+e.CenterSizeBytes,3),c=new Uint8Array(r,s+e.CenterSizeBytes+e.ScaleSizeBytes,4),h=new Uint8Array(r,s+e.CenterSizeBytes+e.ScaleSizeBytes+e.RotationSizeBytes,4),d=new fh((h[1]-128)/128,(h[2]-128)/128,(h[3]-128)/128,(h[0]-128)/128);d.normalize(),a.addSplatFromComonents(u[0],u[1],u[2],l[0],l[1],l[2],d.w,d.x,d.y,d.z,c[0],c[1],c[2],c[3])}}},{key:"parseStandardSplatToUncompressedSplatArray",value:function(t){for(var n=t.byteLength/e.RowSizeBytes,r=new Hu,i=0;i6&&void 0!==arguments[6])||arguments[6],u=arguments.length>7?arguments[7]:void 0,l=arguments.length>8?arguments[8]:void 0,c=arguments.length>9?arguments[9]:void 0,h=arguments.length>10?arguments[10]:void 0,d=arguments.length>11?arguments[11]:void 0,f=r?Qb:qb;s&&(f=qb);var p,v,m,g,y=I_.HeaderSizeBytes+I_.SectionHeaderSizeBytes,_=zy.ProgressiveLoadSectionSize,b=0,x=0,S=Fu(),A=0,w=0,T=[];return n&&n(0,"0%",Hb),Iu(t,function(e,t,a,o){var s=e>=100;if(a&&T.push(a),f!==Xb)if(o){if(!p){b=o/Jb.RowSizeBytes,p=new ArrayBuffer(o);var u=I_.CompressionLevels[0].SphericalHarmonicsDegrees[0].BytesPerSplat;f===Qb?(v=new ArrayBuffer(y+u*b),I_.writeHeaderToBuffer({versionMajor:I_.CurrentMajorVersion,versionMinor:I_.CurrentMinorVersion,maxSectionCount:1,sectionCount:1,maxSplatCount:b,splatCount:x,compressionLevel:0,sceneCenter:new ph},v)):g=new Hu(0)}if(a){new Uint8Array(p,w,a.byteLength).set(new Uint8Array(a));var l=(w+=a.byteLength)-A;if(l>_||s){var c=(s?l:_)/Jb.RowSizeBytes,h=x+c;f===Qb?Jb.parseToUncompressedSplatBufferSection(x,h-1,p,0,v,y):Jb.parseToUncompressedSplatArraySection(x,h-1,p,0,g),x=h,f===Qb&&(m||(I_.writeSectionHeaderToBuffer({maxSplatCount:b,splatCount:x,bucketSize:0,bucketCount:0,bucketBlockSize:0,compressionScaleRange:0,storageSizeBytes:0,fullBucketCount:0,partiallyFilledBucketCount:0},0,v,I_.HeaderSizeBytes),m=new I_(v,!1)),m.updateLoadedCounts(1,x),i&&i(m,s)),A+=_}}s&&(f===Qb?S.resolve(m):S.resolve(g)),n&&n(e,t,Hb)}else{if(r)throw new jb("Cannon directly load .splat because no file size info is available.");f=Xb}else s&&S.resolve(T)},!1,u).then(function(){return n&&n(0,"0%",Wb),S.promise.then(function(t){return n&&n(100,"100%",Gb),f===Xb?new Blob(T).arrayBuffer().then(function(t){return e.loadFromFileData(t,a,o,s,l,c,h,d)}):f===Qb?t:Du(function(){return $b(t,s,a,o,l,c,h,d)})})})}},{key:"loadFromFileData",value:function(e,t,n,r,i,a,o,s){return Du(function(){return $b(Jb.parseStandardSplatToUncompressedSplatArray(e),r,t,n,i,a,o,s)})}}])}(),nx=function(){function e(){A(this,e)}return T(e,null,[{key:"checkVersion",value:function(e){var t=I_.CurrentMajorVersion,n=I_.CurrentMinorVersion,r=I_.parseHeader(e);if(r.versionMajor===t&&r.versionMinor>=n||r.versionMajor>t)return!0;throw new Error("KSplat version not supported: v".concat(r.versionMajor,".").concat(r.versionMinor,". ")+"Minimum required: v".concat(t,".").concat(n))}},{key:"loadFromURL",value:function(t,n,r,i,a){var o,s,u,l,c,h=!1,d=!1,f=[],p=!1,v=!1,m=0,g=0,y=0,_=!1,b=!1,x=!1,S=[],A=Fu(),w=0,T=function(){!v&&!p&&h&&m>=I_.HeaderSizeBytes+I_.SectionHeaderSizeBytes*l.maxSectionCount&&(v=!0,new Blob(S).arrayBuffer().then(function(e){v=!1,p=!0,c=new ArrayBuffer(l.maxSectionCount*I_.SectionHeaderSizeBytes),new Uint8Array(c).set(new Uint8Array(e,I_.HeaderSizeBytes,l.maxSectionCount*I_.SectionHeaderSizeBytes)),f=I_.parseSectionHeaders(l,c,0,!1);for(var t=0,n=0;n=y,m-g>zy.ProgressiveLoadSectionSize||_){g+=zy.ProgressiveLoadSectionSize,b=g>=y,s||(s=new I_(o,!1));for(var e=I_.HeaderSizeBytes+I_.SectionHeaderSizeBytes*l.maxSectionCount,t=0,r=0,a=0,u=0;u=h))break;r++;var d=g-h,v=I_.CompressionLevels[l.compressionLevel].SphericalHarmonicsDegrees[c.sphericalHarmonicsDegree].BytesPerSplat,S=Math.floor(d/v);a+=S=Math.min(S,c.maxSplatCount),s.updateLoadedCounts(r,a),s.updateSectionLoadedCounts(u,S),t+=c.storageSizeBytes}i(s,b);var w=g/y*100,T=w.toFixed(2)+"%";n&&n(w,T,Hb),b?A.resolve(s):M()}}},zy.ProgressiveLoadSectionDelayDuration)}};return Iu(t,function(t,i,a){a&&(S.push(a),o&&new Uint8Array(o,m,a.byteLength).set(new Uint8Array(a)),m+=a.byteLength),r?(!h&&!d&&m>=I_.HeaderSizeBytes&&(d=!0,new Blob(S).arrayBuffer().then(function(t){u=new ArrayBuffer(I_.HeaderSizeBytes),new Uint8Array(u).set(new Uint8Array(t,0,I_.HeaderSizeBytes)),e.checkVersion(u),d=!1,h=!0,l=I_.parseHeader(u),window.setTimeout(function(){T()},1)})),T(),M()):n&&n(t,i,Hb)},!r,a).then(function(t){return n&&n(0,"0%",Wb),(r?A.promise:e.loadFromFileData(t)).then(function(e){return n&&n(100,"100%",Gb),e})})}},{key:"loadFromFileData",value:function(t){return Du(function(){return e.checkVersion(t),new I_(t)})}}])}();M(nx,"downloadFile",function(e,t){var n=new Blob([e.bufferData],{type:"application/octet-stream"});ex||(ex=document.createElement("a"),document.body.appendChild(ex)),ex.download=t,ex.href=URL.createObjectURL(n),ex.click()});var rx=0,ix=1,ax=2,ox=function(e){return e.endsWith(".ply")?ax:e.endsWith(".splat")?rx:e.endsWith(".ksplat")?ix:null},sx={type:"change"},ux={type:"start"},lx={type:"end"},cx=new Wh,hx=new pp,dx=Math.cos(70*zc.DEG2RAD),fx=function(e){function t(e,n){var r;A(this,t),(r=y(this,t)).object=e,r.domElement=n,r.domElement.style.touchAction="none",r.enabled=!0,r.target=new ph,r.minDistance=0,r.maxDistance=1/0,r.minZoom=0,r.maxZoom=1/0,r.minPolarAngle=0,r.maxPolarAngle=Math.PI,r.minAzimuthAngle=-Math.PI/72,r.maxAzimuthAngle=Math.PI/72,r.enableDamping=!1,r.dampingFactor=.05,r.enableZoom=!0,r.zoomSpeed=1,r.enableRotate=!0,r.rotateSpeed=1,r.enablePan=!1,r.panSpeed=1,r.screenSpacePanning=!0,r.keyPanSpeed=7,r.zoomToCursor=!1,r.autoRotate=!1,r.autoRotateSpeed=2,r.keys={LEFT:"KeyA",UP:"KeyW",RIGHT:"KeyD",BOTTOM:"KeyS"},r.mouseButtons={LEFT:Gu,MIDDLE:ju,RIGHT:Qu},r.touches={ONE:qu,TWO:Yu},r.target0=r.target.clone(),r.position0=r.object.position.clone(),r.zoom0=r.object.zoom,r._domElementKeyEvents=null,r.getPolarAngle=function(){return u.phi},r.getAzimuthalAngle=function(){return u.theta},r.getDistance=function(){return this.object.position.distanceTo(this.target)},r.listenToKeyEvents=function(e){e.addEventListener("keydown",K),r._domElementKeyEvents=e},r.stopListenToKeyEvents=function(){r._domElementKeyEvents.removeEventListener("keydown",K),r._domElementKeyEvents=null},r.saveState=function(){i.target0.copy(i.target),i.position0.copy(i.object.position),i.zoom0=i.object.zoom},r.reset=function(){i.target.copy(i.target0),i.object.position.copy(i.position0),i.object.zoom=i.zoom0,this.clearDampedRotation(),this.clearDampedPan(),i.object.updateProjectionMatrix(),i.dispatchEvent(sx),i.update(),o=a.NONE},r.clearDampedRotation=function(){l.theta=0,l.phi=0},r.clearDampedPan=function(){h.set(0,0,0)},r.update=function(){var t=new ph,n=(new fh).setFromUnitVectors(e.up,new ph(0,1,0)),r=n.clone().invert(),d=new ph,f=new fh,p=new ph,v=2*Math.PI;return function(){n.setFromUnitVectors(e.up,new ph(0,1,0)),r.copy(n).invert();var m=i.object.position;t.copy(m).sub(i.target),t.applyQuaternion(n),u.setFromVector3(t),i.autoRotate&&o===a.NONE&&k(2*Math.PI/60/60*i.autoRotateSpeed),i.enableDamping?(u.theta+=l.theta*i.dampingFactor,u.phi+=l.phi*i.dampingFactor):(u.theta+=l.theta,u.phi+=l.phi);var g=i.minAzimuthAngle,y=i.maxAzimuthAngle;isFinite(g)&&isFinite(y)&&(g<-Math.PI?g+=v:g>Math.PI&&(g-=v),y<-Math.PI?y+=v:y>Math.PI&&(y-=v),u.theta=g<=y?Math.max(g,Math.min(y,u.theta)):u.theta>(g+y)/2?Math.max(g,u.theta):Math.min(y,u.theta)),u.phi=Math.max(i.minPolarAngle,Math.min(i.maxPolarAngle,u.phi)),u.makeSafe(),!0===i.enableDamping?i.target.addScaledVector(h,i.dampingFactor):i.target.add(h),i.zoomToCursor&&T||i.object.isOrthographicCamera?u.radius=F(u.radius):u.radius=F(u.radius*c),t.setFromSpherical(u),t.applyQuaternion(r),m.copy(i.target).add(t),i.object.lookAt(i.target),!0===i.enableDamping?(l.theta*=1-i.dampingFactor,l.phi*=1-i.dampingFactor,h.multiplyScalar(1-i.dampingFactor)):(l.set(0,0,0),h.set(0,0,0));var _=!1;if(i.zoomToCursor&&T){var b=null;if(i.object.isPerspectiveCamera){var x=t.length(),A=x-(b=F(x*c));i.object.position.addScaledVector(S,A),i.object.updateMatrixWorld()}else if(i.object.isOrthographicCamera){var M=new ph(w.x,w.y,0);M.unproject(i.object),i.object.zoom=Math.max(i.minZoom,Math.min(i.maxZoom,i.object.zoom/c)),i.object.updateProjectionMatrix(),_=!0;var E=new ph(w.x,w.y,0);E.unproject(i.object),i.object.position.sub(E).add(M),i.object.updateMatrixWorld(),b=t.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),i.zoomToCursor=!1;null!==b&&(this.screenSpacePanning?i.target.set(0,0,-1).transformDirection(i.object.matrix).multiplyScalar(b).add(i.object.position):(cx.origin.copy(i.object.position),cx.direction.set(0,0,-1).transformDirection(i.object.matrix),Math.abs(i.object.up.dot(cx.direction))s||8*(1-f.dot(i.object.quaternion))>s||p.distanceToSquared(i.target)>0)&&(i.dispatchEvent(sx),d.copy(i.object.position),f.copy(i.object.quaternion),p.copy(i.target),_=!1,!0)}}(),r.dispose=function(){i.domElement.removeEventListener("contextmenu",Z),i.domElement.removeEventListener("pointerdown",Q),i.domElement.removeEventListener("pointercancel",X),i.domElement.removeEventListener("wheel",Y),i.domElement.removeEventListener("pointermove",q),i.domElement.removeEventListener("pointerup",X),null!==i._domElementKeyEvents&&(i._domElementKeyEvents.removeEventListener("keydown",K),i._domElementKeyEvents=null)};var i=r,a={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},o=a.NONE,s=1e-6,u=new nm,l=new nm,c=1,h=new ph,d=new Vc,f=new Vc,p=new Vc,v=new Vc,m=new Vc,g=new Vc,_=new Vc,b=new Vc,x=new Vc,S=new ph,w=new Vc,T=!1,M=[],E={};function C(){return Math.pow(.95,i.zoomSpeed)}function k(e){l.theta-=e}function R(e){l.phi-=e}var I=function(){var e=new ph;return function(t,n){e.setFromMatrixColumn(n,0),e.multiplyScalar(-t),h.add(e)}}(),N=function(){var e=new ph;return function(t,n){!0===i.screenSpacePanning?e.setFromMatrixColumn(n,1):(e.setFromMatrixColumn(n,0),e.crossVectors(i.object.up,e)),e.multiplyScalar(t),h.add(e)}}(),P=function(){var e=new ph;return function(t,n){var r=i.domElement;if(i.object.isPerspectiveCamera){var a=i.object.position;e.copy(a).sub(i.target);var o=e.length();o*=Math.tan(i.object.fov/2*Math.PI/180),I(2*t*o/r.clientHeight,i.object.matrix),N(2*n*o/r.clientHeight,i.object.matrix)}else i.object.isOrthographicCamera?(I(t*(i.object.right-i.object.left)/i.object.zoom/r.clientWidth,i.object.matrix),N(n*(i.object.top-i.object.bottom)/i.object.zoom/r.clientHeight,i.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),i.enablePan=!1)}}();function L(e){i.object.isPerspectiveCamera||i.object.isOrthographicCamera?c/=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),i.enableZoom=!1)}function D(e){i.object.isPerspectiveCamera||i.object.isOrthographicCamera?c*=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),i.enableZoom=!1)}function O(t){if(i.zoomToCursor){T=!0;var n=i.domElement.getBoundingClientRect(),r=t.clientX-n.left,a=t.clientY-n.top,o=n.width,s=n.height;w.x=r/o*2-1,w.y=-a/s*2+1,S.set(w.x,w.y,1).unproject(e).sub(e.position).normalize()}}function F(e){return Math.max(i.minDistance,Math.min(i.maxDistance,e))}function B(e){d.set(e.clientX,e.clientY)}function U(e){v.set(e.clientX,e.clientY)}function z(){if(1===M.length)d.set(M[0].pageX,M[0].pageY);else{var e=.5*(M[0].pageX+M[1].pageX),t=.5*(M[0].pageY+M[1].pageY);d.set(e,t)}}function V(){if(1===M.length)v.set(M[0].pageX,M[0].pageY);else{var e=.5*(M[0].pageX+M[1].pageX),t=.5*(M[0].pageY+M[1].pageY);v.set(e,t)}}function H(){var e=M[0].pageX-M[1].pageX,t=M[0].pageY-M[1].pageY,n=Math.sqrt(e*e+t*t);_.set(0,n)}function W(e){if(1==M.length)f.set(e.pageX,e.pageY);else{var t=$(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);f.set(n,r)}p.subVectors(f,d).multiplyScalar(i.rotateSpeed);var a=i.domElement;k(2*Math.PI*p.x/a.clientHeight),R(2*Math.PI*p.y/a.clientHeight),d.copy(f)}function G(e){if(1===M.length)m.set(e.pageX,e.pageY);else{var t=$(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);m.set(n,r)}g.subVectors(m,v).multiplyScalar(i.panSpeed),P(g.x,g.y),v.copy(m)}function j(e){var t=$(e),n=e.pageX-t.x,r=e.pageY-t.y,a=Math.sqrt(n*n+r*r);b.set(0,a),x.set(0,Math.pow(b.y/_.y,i.zoomSpeed)),L(x.y),_.copy(b)}function Q(e){!1!==i.enabled&&(0===M.length&&(i.domElement.setPointerCapture(e.pointerId),i.domElement.addEventListener("pointermove",q),i.domElement.addEventListener("pointerup",X)),function(e){M.push(e)}(e),"touch"===e.pointerType?function(e){switch(J(e),M.length){case 1:switch(i.touches.ONE){case qu:if(!1===i.enableRotate)return;z(),o=a.TOUCH_ROTATE;break;case Xu:if(!1===i.enablePan)return;V(),o=a.TOUCH_PAN;break;default:o=a.NONE}break;case 2:switch(i.touches.TWO){case Yu:if(!1===i.enableZoom&&!1===i.enablePan)return;i.enableZoom&&H(),i.enablePan&&V(),o=a.TOUCH_DOLLY_PAN;break;case Ku:if(!1===i.enableZoom&&!1===i.enableRotate)return;i.enableZoom&&H(),i.enableRotate&&z(),o=a.TOUCH_DOLLY_ROTATE;break;default:o=a.NONE}break;default:o=a.NONE}o!==a.NONE&&i.dispatchEvent(ux)}(e):function(e){var t;switch(e.button){case 0:t=i.mouseButtons.LEFT;break;case 1:t=i.mouseButtons.MIDDLE;break;case 2:t=i.mouseButtons.RIGHT;break;default:t=-1}switch(t){case ju:if(!1===i.enableZoom)return;!function(e){O(e),_.set(e.clientX,e.clientY)}(e),o=a.DOLLY;break;case Gu:if(e.ctrlKey||e.metaKey||e.shiftKey){if(!1===i.enablePan)return;U(e),o=a.PAN}else{if(!1===i.enableRotate)return;B(e),o=a.ROTATE}break;case Qu:if(e.ctrlKey||e.metaKey||e.shiftKey){if(!1===i.enableRotate)return;B(e),o=a.ROTATE}else{if(!1===i.enablePan)return;U(e),o=a.PAN}break;default:o=a.NONE}o!==a.NONE&&i.dispatchEvent(ux)}(e))}function q(e){!1!==i.enabled&&("touch"===e.pointerType?function(e){switch(J(e),o){case a.TOUCH_ROTATE:if(!1===i.enableRotate)return;W(e),i.update();break;case a.TOUCH_PAN:if(!1===i.enablePan)return;G(e),i.update();break;case a.TOUCH_DOLLY_PAN:if(!1===i.enableZoom&&!1===i.enablePan)return;!function(e){i.enableZoom&&j(e),i.enablePan&&G(e)}(e),i.update();break;case a.TOUCH_DOLLY_ROTATE:if(!1===i.enableZoom&&!1===i.enableRotate)return;!function(e){i.enableZoom&&j(e),i.enableRotate&&W(e)}(e),i.update();break;default:o=a.NONE}}(e):function(e){switch(o){case a.ROTATE:if(!1===i.enableRotate)return;!function(e){f.set(e.clientX,e.clientY),p.subVectors(f,d).multiplyScalar(i.rotateSpeed);var t=i.domElement;k(2*Math.PI*p.x/t.clientHeight),R(2*Math.PI*p.y/t.clientHeight),d.copy(f),i.update()}(e);break;case a.DOLLY:if(!1===i.enableZoom)return;!function(e){b.set(e.clientX,e.clientY),x.subVectors(b,_),x.y>0?L(C()):x.y<0&&D(C()),_.copy(b),i.update()}(e);break;case a.PAN:if(!1===i.enablePan)return;!function(e){m.set(e.clientX,e.clientY),g.subVectors(m,v).multiplyScalar(i.panSpeed),P(g.x,g.y),v.copy(m),i.update()}(e)}}(e))}function X(e){!function(e){delete E[e.pointerId];for(var t=0;t0&&L(C()),i.update()}(e),i.dispatchEvent(lx))}function K(e){!1!==i.enabled&&!1!==i.enablePan&&function(e){var t=!1;switch(e.code){case i.keys.UP:e.ctrlKey||e.metaKey||e.shiftKey?R(2*Math.PI*i.rotateSpeed/i.domElement.clientHeight):P(0,i.keyPanSpeed),t=!0;break;case i.keys.BOTTOM:e.ctrlKey||e.metaKey||e.shiftKey?R(-2*Math.PI*i.rotateSpeed/i.domElement.clientHeight):P(0,-i.keyPanSpeed),t=!0;break;case i.keys.LEFT:e.ctrlKey||e.metaKey||e.shiftKey?k(2*Math.PI*i.rotateSpeed/i.domElement.clientHeight):P(i.keyPanSpeed,0),t=!0;break;case i.keys.RIGHT:e.ctrlKey||e.metaKey||e.shiftKey?k(-2*Math.PI*i.rotateSpeed/i.domElement.clientHeight):P(-i.keyPanSpeed,0),t=!0}t&&(e.preventDefault(),i.update())}(e)}function Z(e){!1!==i.enabled&&e.preventDefault()}function J(e){var t=E[e.pointerId];void 0===t&&(t=new Vc,E[e.pointerId]=t),t.set(e.pageX,e.pageY)}function $(e){var t=e.pointerId===M[0].pointerId?M[1]:M[0];return E[t.pointerId]}return i.domElement.addEventListener("contextmenu",Z),i.domElement.addEventListener("pointerdown",Q),i.domElement.addEventListener("pointercancel",X),i.domElement.addEventListener("wheel",Y,{passive:!1}),r.update(),r}return x(t,e),T(t)}(kc),px=function(){return T(function e(t,n){A(this,e),this.taskIDGen=0,this.elementID=e.elementIDGen++,this.tasks=[],this.message=t||"Loading...",this.container=n||document.body,this.spinnerContainerOuter=document.createElement("div"),this.spinnerContainerOuter.className="spinnerOuterContainer".concat(this.elementID),this.spinnerContainerOuter.style.display="none",this.spinnerContainerPrimary=document.createElement("div"),this.spinnerContainerPrimary.className="spinnerContainerPrimary".concat(this.elementID),this.spinnerPrimary=document.createElement("div"),this.spinnerPrimary.classList.add("spinner".concat(this.elementID),"spinnerPrimary".concat(this.elementID)),this.messageContainerPrimary=document.createElement("div"),this.messageContainerPrimary.classList.add("messageContainer".concat(this.elementID),"messageContainerPrimary".concat(this.elementID)),this.messageContainerPrimary.innerHTML=this.message,this.spinnerContainerMin=document.createElement("div"),this.spinnerContainerMin.className="spinnerContainerMin".concat(this.elementID),this.spinnerMin=document.createElement("div"),this.spinnerMin.classList.add("spinner".concat(this.elementID),"spinnerMin".concat(this.elementID)),this.messageContainerMin=document.createElement("div"),this.messageContainerMin.classList.add("messageContainer".concat(this.elementID),"messageContainerMin".concat(this.elementID)),this.messageContainerMin.innerHTML=this.message,this.spinnerContainerPrimary.appendChild(this.spinnerPrimary),this.spinnerContainerPrimary.appendChild(this.messageContainerPrimary),this.spinnerContainerOuter.appendChild(this.spinnerContainerPrimary),this.spinnerContainerMin.appendChild(this.spinnerMin),this.spinnerContainerMin.appendChild(this.messageContainerMin),this.spinnerContainerOuter.appendChild(this.spinnerContainerMin);var r=document.createElement("style");r.innerHTML="\n\n .spinnerOuterContainer".concat(this.elementID," {\n width: 100%;\n height: 100%;\n margin: 0;\n top: 0;\n left: 0;\n position: absolute;\n pointer-events: none;\n }\n\n .messageContainer").concat(this.elementID," {\n height: 20px;\n font-family: arial;\n font-size: 12pt;\n color: #ffffff;\n text-align: center;\n vertical-align: middle;\n }\n\n .spinner").concat(this.elementID," {\n padding: 15px;\n background: #07e8d6;\n z-index:99999;\n \n aspect-ratio: 1;\n border-radius: 50%;\n --_m: \n conic-gradient(#0000,#000),\n linear-gradient(#000 0 0) content-box;\n -webkit-mask: var(--_m);\n mask: var(--_m);\n -webkit-mask-composite: source-out;\n mask-composite: subtract;\n box-sizing: border-box;\n animation: load 1s linear infinite;\n }\n\n .spinnerContainerPrimary").concat(this.elementID," {\n z-index:99999;\n background-color: rgba(128, 128, 128, 0.75);\n border: #666666 1px solid;\n border-radius: 5px;\n padding-top: 20px;\n padding-bottom: 10px;\n margin: 0;\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-80px, -80px);\n width: 180px;\n pointer-events: auto;\n }\n\n .spinnerPrimary").concat(this.elementID," {\n width: 120px;\n margin-left: 30px;\n }\n\n .messageContainerPrimary").concat(this.elementID," {\n padding-top: 15px;\n }\n\n .spinnerContainerMin").concat(this.elementID," {\n z-index:99999;\n background-color: rgba(128, 128, 128, 0.75);\n border: #666666 1px solid;\n border-radius: 5px;\n padding-top: 20px;\n padding-bottom: 15px;\n margin: 0;\n position: absolute;\n bottom: 50px;\n left: 50%;\n transform: translate(-50%, 0);\n display: flex;\n flex-direction: left;\n pointer-events: auto;\n min-width: 250px;\n }\n\n .messageContainerMin").concat(this.elementID," {\n margin-right: 15px;\n }\n\n .spinnerMin").concat(this.elementID," {\n width: 50px;\n height: 50px;\n margin-left: 15px;\n margin-right: 25px;\n }\n\n .messageContainerMin").concat(this.elementID," {\n padding-top: 15px;\n }\n \n @keyframes load {\n to{transform: rotate(1turn)}\n }\n\n "),this.spinnerContainerOuter.appendChild(r),this.container.appendChild(this.spinnerContainerOuter),this.setMinimized(!1,!0),this.fadeTransitions=[]},[{key:"addTask",value:function(e){var t={message:e,id:this.taskIDGen++};return this.tasks.push(t),this.update(),t.id}},{key:"removeTask",value:function(e){var t,n=0,r=L(this.tasks);try{for(r.s();!(t=r.n()).done;){if(t.value.id===e){this.tasks.splice(n,1);break}n++}}catch(i){r.e(i)}finally{r.f()}this.update()}},{key:"removeAllTasks",value:function(){this.tasks=[],this.update()}},{key:"setMessageForTask",value:function(e,t){var n,r=L(this.tasks);try{for(r.s();!(n=r.n()).done;){var i=n.value;if(i.id===e){i.message=t;break}}}catch(a){r.e(a)}finally{r.f()}this.update()}},{key:"update",value:function(){this.tasks.length>0?(this.show(),this.setMessage(this.tasks[this.tasks.length-1].message)):this.hide()}},{key:"show",value:function(){this.spinnerContainerOuter.style.display="block",this.visible=!0}},{key:"hide",value:function(){this.spinnerContainerOuter.style.display="none",this.visible=!1}},{key:"setContainer",value:function(e){this.container&&this.spinnerContainerOuter.parentElement===this.container&&this.container.removeChild(this.spinnerContainerOuter),e&&(this.container=e,this.container.appendChild(this.spinnerContainerOuter),this.spinnerContainerOuter.style.zIndex=this.container.style.zIndex+1)}},{key:"setMinimized",value:function(e,t){var n=this,r=function(e,t,r,i,a){r?e.style.display=t?i:"none":n.fadeTransitions[a]=function(e,t,n,r,i){var a=performance.now(),o="none"===e.style.display?0:parseFloat(e.style.opacity);isNaN(o)&&(o=1);var s=window.setInterval(function(){var u,l=performance.now()-a,c=Math.min(l/r,1);c>.999&&(c=1),t?(u=(1-c)*o)<1e-4&&(u=0):u=(1-o)*c+o,u>0?(e.style.display=n,e.style.opacity=u):e.style.display="none",c>=1&&(i&&i(),window.clearInterval(s))},16);return s}(e,!t,i,500,function(){n.fadeTransitions[a]=null})};r(this.spinnerContainerPrimary,!e,t,"block",0),r(this.spinnerContainerMin,e,t,"flex",1),this.minimized=e}},{key:"setMessage",value:function(e){this.messageContainerPrimary.innerHTML=e,this.messageContainerMin.innerHTML=e}}])}();M(px,"elementIDGen",0);var vx=function(){return T(function e(t){A(this,e),this.idGen=0,this.tasks=[],this.container=t||document.body,this.progressBarContainerOuter=document.createElement("div"),this.progressBarContainerOuter.className="progressBarOuterContainer",this.progressBarContainerOuter.style.display="none",this.progressBarBox=document.createElement("div"),this.progressBarBox.className="progressBarBox",this.progressBarBackground=document.createElement("div"),this.progressBarBackground.className="progressBarBackground",this.progressBar=document.createElement("div"),this.progressBar.className="progressBar",this.progressBarBackground.appendChild(this.progressBar),this.progressBarBox.appendChild(this.progressBarBackground),this.progressBarContainerOuter.appendChild(this.progressBarBox);var n=document.createElement("style");n.innerHTML="\n\n .progressBarOuterContainer {\n width: 100%;\n height: 100%;\n margin: 0;\n top: 0;\n left: 0;\n position: absolute;\n pointer-events: none;\n }\n\n .progressBarBox {\n z-index:99999;\n padding: 7px 9px 5px 7px;\n background-color: rgba(190, 190, 190, 0.75);\n border: #555555 1px solid;\n border-radius: 15px;\n margin: 0;\n position: absolute;\n bottom: 50px;\n left: 50%;\n transform: translate(-50%, 0);\n width: 180px;\n height: 30px;\n pointer-events: auto;\n }\n\n .progressBarBackground {\n width: 100%;\n height: 25px;\n border-radius:10px;\n background-color: rgba(128, 128, 128, 0.75);\n border: #444444 1px solid;\n box-shadow: inset 0 0 10px #333333;\n }\n\n .progressBar {\n height: 25px;\n width: 0px;\n border-radius:10px;\n background-color: rgba(0, 200, 0, 0.75);\n box-shadow: inset 0 0 10px #003300;\n }\n\n ",this.progressBarContainerOuter.appendChild(n),this.container.appendChild(this.progressBarContainerOuter)},[{key:"show",value:function(){this.progressBarContainerOuter.style.display="block"}},{key:"hide",value:function(){this.progressBarContainerOuter.style.display="none"}},{key:"setProgress",value:function(e){this.progressBar.style.width=e+"%"}},{key:"setContainer",value:function(e){this.container&&this.progressBarContainerOuter.parentElement===this.container&&this.container.removeChild(this.progressBarContainerOuter),e&&(this.container=e,this.container.appendChild(this.progressBarContainerOuter),this.progressBarContainerOuter.style.zIndex=this.container.style.zIndex+1)}}])}(),mx=new ph,gx=function(e){function t(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new ph(0,0,1),r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new ph(0,0,0),i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:.1,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:16776960,s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:.2*i,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:.2*s;A(this,t),(e=y(this,t)).type="ArrowHelper";var l=new Vp(a,a,i,32);l.translate(0,i/2,0);var c=new Vp(0,u,s,32);return c.translate(0,i,0),e.position.copy(r),e.line=new gf(l,new zd({color:o,toneMapped:!1})),e.line.matrixAutoUpdate=!1,e.add(e.line),e.cone=new gf(c,new zd({color:o,toneMapped:!1})),e.cone.matrixAutoUpdate=!1,e.add(e.cone),e.setDirection(n),e}return x(t,e),T(t,[{key:"setDirection",value:function(e){if(e.y>.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{mx.set(e.z,0,-e.x).normalize();var t=Math.acos(e.y);this.quaternion.setFromAxisAngle(mx,t)}}},{key:"setColor",value:function(e){this.line.material.color.set(e),this.cone.material.color.set(e)}},{key:"copy",value:function(e){return n(t,"copy",this,3)([e,!1]),this.line.copy(e.line),this.cone.copy(e.cone),this}},{key:"dispose",value:function(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}])}(gd),yx=function(){function e(t){var n,r,i,a,o;A(this,e),M(this,"updateFocusMarker",(n=new ph,r=new Gh,i=new ph,function(e,t,a){r.copy(t.matrixWorld).invert(),n.copy(e).applyMatrix4(r),n.normalize().multiplyScalar(10),n.applyMatrix4(t.matrixWorld),i.copy(t.position).sub(e);var o=i.length();this.focusMarker.position.copy(e),this.focusMarker.scale.set(o,o,o),this.focusMarker.material.uniforms.realFocusPosition.value.copy(e),this.focusMarker.material.uniforms.viewport.value.copy(a),this.focusMarker.material.uniformsNeedUpdate=!0})),M(this,"positionAndOrientControlPlane",(a=new fh,o=new ph(0,1,0),function(e,t){a.setFromUnitVectors(o,t),this.controlPlane.position.copy(e),this.controlPlane.quaternion.copy(a)})),this.threeScene=t,this.splatRenderTarget=null,this.renderTargetCopyQuad=null,this.renderTargetCopyCamera=null,this.meshCursor=null,this.focusMarker=null,this.controlPlane=null,this.debugRoot=null,this.secondaryDebugRoot=null}return T(e,[{key:"updateSplatRenderTargetForRenderDimensions",value:function(e,t){this.destroySplatRendertarget(),this.splatRenderTarget=new ch(e,t,{format:wl,stencilBuffer:!1,depthBuffer:!0}),this.splatRenderTarget.depthTexture=new zp(e,t),this.splatRenderTarget.depthTexture.format=Tl,this.splatRenderTarget.depthTexture.type=gl}},{key:"destroySplatRendertarget",value:function(){this.splatRenderTarget&&(this.splatRenderTarget=null)}},{key:"setupRenderTargetCopyObjects",value:function(){var e=new wf({vertexShader:"\n varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position = vec4( position.xy, 0.0, 1.0 ); \n }\n ",fragmentShader:"\n #include \n #include \n varying vec2 vUv;\n uniform sampler2D sourceColorTexture;\n uniform sampler2D sourceDepthTexture;\n void main() {\n vec4 color = texture2D(sourceColorTexture, vUv);\n float fragDepth = texture2D(sourceDepthTexture, vUv).x;\n gl_FragDepth = fragDepth;\n gl_FragColor = vec4(color.rgb, color.a * 2.0);\n }\n ",uniforms:{sourceColorTexture:{type:"t",value:null},sourceDepthTexture:{type:"t",value:null}},depthWrite:!1,depthTest:!1,transparent:!0,blending:5,blendSrc:Ju,blendSrcAlpha:Ju,blendDst:$u,blendDstAlpha:$u});e.extensions.fragDepth=!0,this.renderTargetCopyQuad=new gf(new Wp(2,2),e),this.renderTargetCopyCamera=new Lv(-1,1,1,-1,0,1)}},{key:"destroyRenderTargetCopyObjects",value:function(){this.renderTargetCopyQuad&&(Lu(this.renderTargetCopyQuad),this.renderTargetCopyQuad=null)}},{key:"setupMeshCursor",value:function(){if(!this.meshCursor){var e=new Hp(.5,1.5,32),t=new zd({color:16777215}),n=new gf(e,t);n.rotation.set(0,0,Math.PI),n.position.set(0,1,0);var r=new gf(e,t);r.position.set(0,-1,0);var i=new gf(e,t);i.rotation.set(0,0,Math.PI/2),i.position.set(1,0,0);var a=new gf(e,t);a.rotation.set(0,0,-Math.PI/2),a.position.set(-1,0,0),this.meshCursor=new gd,this.meshCursor.add(n),this.meshCursor.add(r),this.meshCursor.add(i),this.meshCursor.add(a),this.meshCursor.scale.set(.1,.1,.1),this.threeScene.add(this.meshCursor),this.meshCursor.visible=!1}}},{key:"destroyMeshCursor",value:function(){this.meshCursor&&(Lu(this.meshCursor),this.threeScene.remove(this.meshCursor),this.meshCursor=null)}},{key:"setMeshCursorVisibility",value:function(e){this.meshCursor.visible=e}},{key:"getMeschCursorVisibility",value:function(){return this.meshCursor.visible}},{key:"setMeshCursorPosition",value:function(e){this.meshCursor.position.copy(e)}},{key:"positionAndOrientMeshCursor",value:function(e,t){this.meshCursor.position.copy(e),this.meshCursor.up.copy(t.up),this.meshCursor.lookAt(t.position)}},{key:"setupFocusMarker",value:function(){if(!this.focusMarker){var t=new Gp(.5,32,32),n=e.buildFocusMarkerMaterial();n.depthTest=!1,n.depthWrite=!1,n.transparent=!0,this.focusMarker=new gf(t,n)}}},{key:"destroyFocusMarker",value:function(){this.focusMarker&&(Lu(this.focusMarker),this.focusMarker=null)}},{key:"setFocusMarkerVisibility",value:function(e){this.focusMarker.visible=e}},{key:"setFocusMarkerOpacity",value:function(e){this.focusMarker.material.uniforms.opacity.value=e,this.focusMarker.material.uniformsNeedUpdate=!0}},{key:"getFocusMarkerOpacity",value:function(){return this.focusMarker.material.uniforms.opacity.value}},{key:"setupControlPlane",value:function(){if(!this.controlPlane){var e=new Wp(1,1);e.rotateX(-Math.PI/2);var t=new zd({color:16777215});t.transparent=!0,t.opacity=.6,t.depthTest=!1,t.depthWrite=!1,t.side=2;var n=new gf(e,t),r=new ph(0,1,0);r.normalize();var i=new ph(0,0,0),a=new gx(r,i,.5,.01,56576,.1,.03);this.controlPlane=new gd,this.controlPlane.add(n),this.controlPlane.add(a)}}},{key:"destroyControlPlane",value:function(){this.controlPlane&&(Lu(this.controlPlane),this.controlPlane=null)}},{key:"setControlPlaneVisibility",value:function(e){this.controlPlane.visible=e}},{key:"addDebugMeshes",value:function(){this.debugRoot=this.createDebugMeshes(),this.secondaryDebugRoot=this.createSecondaryDebugMeshes(),this.threeScene.add(this.debugRoot),this.threeScene.add(this.secondaryDebugRoot)}},{key:"destroyDebugMeshes",value:function(){for(var e=0,t=[this.debugRoot,this.secondaryDebugRoot];e\n varying float ndcDepth;\n\n void main() {\n gl_Position = projectionMatrix * viewMatrix * modelMatrix * vec4(position.xyz, 1.0);\n ndcDepth = gl_Position.z / gl_Position.w;\n gl_Position.x = gl_Position.x / gl_Position.w;\n gl_Position.y = gl_Position.y / gl_Position.w;\n gl_Position.z = 0.0;\n gl_Position.w = 1.0;\n \n }\n ",fragmentShader:"\n #include \n uniform vec3 color;\n varying float ndcDepth;\n void main() {\n gl_FragDepth = (ndcDepth + 1.0) / 2.0;\n gl_FragColor = vec4(color.rgb, 0.0);\n }\n ",transparent:!1,depthTest:!0,depthWrite:!0,side:0});return n.extensions.fragDepth=!0,n}},{key:"buildFocusMarkerMaterial",value:function(e){var t={color:{type:"v3",value:new Od(e)},realFocusPosition:{type:"v3",value:new ph},viewport:{type:"v2",value:new Vc},opacity:{value:0}};return new wf({uniforms:t,vertexShader:"\n #include \n\n uniform vec2 viewport;\n uniform vec3 realFocusPosition;\n\n varying vec4 ndcPosition;\n varying vec4 ndcCenter;\n varying vec4 ndcFocusPosition;\n\n void main() {\n float radius = 0.01;\n\n vec4 viewPosition = modelViewMatrix * vec4(position.xyz, 1.0);\n vec4 viewCenter = modelViewMatrix * vec4(0.0, 0.0, 0.0, 1.0);\n\n vec4 viewFocusPosition = modelViewMatrix * vec4(realFocusPosition, 1.0);\n\n ndcPosition = projectionMatrix * viewPosition;\n ndcPosition = ndcPosition * vec4(1.0 / ndcPosition.w);\n ndcCenter = projectionMatrix * viewCenter;\n ndcCenter = ndcCenter * vec4(1.0 / ndcCenter.w);\n\n ndcFocusPosition = projectionMatrix * viewFocusPosition;\n ndcFocusPosition = ndcFocusPosition * vec4(1.0 / ndcFocusPosition.w);\n\n gl_Position = projectionMatrix * viewPosition;\n\n }\n ",fragmentShader:"\n #include \n uniform vec3 color;\n uniform vec2 viewport;\n uniform float opacity;\n\n varying vec4 ndcPosition;\n varying vec4 ndcCenter;\n varying vec4 ndcFocusPosition;\n\n void main() {\n vec2 screenPosition = vec2(ndcPosition) * viewport;\n vec2 screenCenter = vec2(ndcCenter) * viewport;\n\n vec2 screenVec = screenPosition - screenCenter;\n\n float projectedRadius = length(screenVec);\n\n float lineWidth = 0.0005 * viewport.y;\n float aaRange = 0.0025 * viewport.y;\n float radius = 0.06 * viewport.y;\n float radDiff = abs(projectedRadius - radius) - lineWidth;\n float alpha = 1.0 - clamp(radDiff / 5.0, 0.0, 1.0); \n\n gl_FragColor = vec4(color.rgb, alpha * opacity);\n }\n ",transparent:!0,depthTest:!1,depthWrite:!1,side:0})}}])}(),_x=new ph(1,0,0),bx=new ph(0,1,0),xx=new ph(0,0,1),Sx=function(){return T(function e(){var t,n,r,i,a,o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new ph,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new ph;A(this,e),M(this,"intersectBox",(t=new ph,n=[],r=[],i=[],function(e,a){if(r[0]=this.origin.x,r[1]=this.origin.y,r[2]=this.origin.z,i[0]=this.direction.x,i[1]=this.direction.y,i[2]=this.direction.z,this.boxContainsPoint(e,this.origin,1e-4))return a&&(a.origin.copy(this.origin),a.normal.set(0,0,0),a.distance=-1),!0;for(var o=0;o<3;o++)if(0!=i[o]){var s=0==o?_x:1==o?bx:xx,u=i[o]<0?e.max:e.min,l=-Math.sign(i[o]);n[0]=0==o?u.x:1==o?u.y:u.z;var c=n[0]-r[o];if(c*l<0){var h=(o+1)%3,d=(o+2)%3;if(n[2]=i[h]/i[o]*c+r[h],n[1]=i[d]/i[o]*c+r[d],t.set(n[o],n[d],n[h]),this.boxContainsPoint(e,t,1e-4))return a&&(a.origin.copy(t),a.normal.copy(s).multiplyScalar(l),a.distance=t.sub(this.origin).length()),!0}}return!1})),M(this,"intersectSphere",(a=new ph,function(e,t,n){a.copy(e).sub(this.origin);var r=a.dot(this.direction),i=r*r,o=a.dot(a)-i,s=t*t;if(o>s)return!1;var u=Math.sqrt(s-o),l=r-u,c=r+u;if(c<0)return!1;var h=l<0?c:l;return n&&(n.origin.copy(this.origin).addScaledVector(this.direction,h),n.normal.copy(n.origin).sub(e).normalize(),n.distance=h),!0})),this.origin=new ph,this.direction=new ph,this.setParameters(o,s)},[{key:"setParameters",value:function(e,t){this.origin.copy(e),this.direction.copy(t).normalize()}},{key:"boxContainsPoint",value:function(e,t,n){return!(t.xe.max.x+n||t.ye.max.y+n||t.ze.max.z+n)}}])}(),Ax=function(){function e(){A(this,e),this.origin=new ph,this.normal=new ph,this.distance=0,this.splatIndex=0}return T(e,[{key:"set",value:function(e,t,n,r){this.origin.copy(e),this.normal.copy(t),this.distance=n,this.splatIndex=r}},{key:"clone",value:function(){var t=new e;return t.origin.copy(this.origin),t.normal.copy(this.normal),t.distance=this.distance,t.splatIndex=this.splatIndex,t}}])}(),wx=0,Tx=1,Mx=T(function e(t,n){var r,i,a,o,s,u=this,l=arguments.length>2&&void 0!==arguments[2]&&arguments[2];A(this,e),M(this,"ndcCoords",new Vc),M(this,"setFromCameraAndScreenPosition",function(e,t,n){if(u.ndcCoords.x=t.x/n.x*2-1,u.ndcCoords.y=(n.y-t.y)/n.y*2-1,e.isPerspectiveCamera)u.ray.origin.setFromMatrixPosition(e.matrixWorld),u.ray.direction.set(u.ndcCoords.x,u.ndcCoords.y,.5).unproject(e).sub(u.ray.origin).normalize(),u.camera=e;else{if(!e.isOrthographicCamera)throw new Error("Raycaster::setFromCameraAndScreenPosition() -> Unsupported camera type");u.ray.origin.set(u.ndcCoords.x,u.ndcCoords.y,(e.near+e.far)/(e.near-e.far)).unproject(e),u.ray.direction.set(0,0,-1).transformDirection(e.matrixWorld),u.camera=e}}),M(this,"intersectSplatMesh",(r=new Gh,i=new Gh,a=new Gh,o=new Sx,s=new ph,function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],u=e.getSplatTree();if(u){for(var l=0;lt.distance?1:-1}),n}})),M(this,"castRayAtSplatTreeNode",function(){var e=new uh,t=new ph,n=new ph,r=new fh,i=new Ax,a=1e-7,o=new ph(0,0,0),s=new Gh,u=new Gh,l=new Gh,c=new Gh,h=new Gh,d=new Sx;return function(f,p,v){var m=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[];if(f.intersectBox(v.boundingBox)){if(v.data&&v.data.indexes&&v.data.indexes.length>0)for(var g=0;g0){var T,M=L(v.children);try{for(M.s();!(T=M.n()).done;){var E=T.value;this.castRayAtSplatTreeNode(f,p,E,m)}}catch(C){M.e(C)}finally{M.f()}}return m}}}()),this.ray=new Sx(t,n),this.raycastAgainstTrueSplatEllipsoid=l}),Ex=function(){return T(function e(){A(this,e)},null,[{key:"buildVertexShaderBase",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",i="";return i+=1==(!(arguments.length>4&&void 0!==arguments[4])||arguments[4])?"#define USE_FLAME":"#define USE_SKINNING",i+="\n precision highp float;\n #include \n\n attribute uint splatIndex;\n uniform highp usampler2D flameModelTexture;\n uniform highp usampler2D boneTexture;\n uniform highp usampler2D boneWeightTexture;\n\n\n uniform highp usampler2D centersColorsTexture;\n uniform highp sampler2D sphericalHarmonicsTexture;\n uniform highp sampler2D sphericalHarmonicsTextureR;\n uniform highp sampler2D sphericalHarmonicsTextureG;\n uniform highp sampler2D sphericalHarmonicsTextureB;\n\n uniform highp usampler2D sceneIndexesTexture;\n uniform vec2 sceneIndexesTextureSize;\n uniform int sceneCount;\n uniform int gaussianSplatCount;\n uniform int bsCount;\n uniform float headBoneIndex;\n #ifdef USE_SKINNING\n attribute vec4 skinIndex;\n attribute vec4 skinWeight;\n #endif\n ",t&&(i+="\n uniform float sceneOpacity[".concat(zy.MaxScenes,"];\n uniform int sceneVisibility[").concat(zy.MaxScenes,"];\n ")),e&&(i+="\n uniform highp mat4 transforms[".concat(zy.MaxScenes,"];\n ")),i+="\n ".concat(r,"\n uniform vec2 focal;\n uniform float orthoZoom;\n uniform int orthographicMode;\n uniform int pointCloudModeEnabled;\n uniform float inverseFocalAdjustment;\n uniform vec2 viewport;\n uniform vec2 basisViewport;\n uniform vec2 centersColorsTextureSize;\n uniform vec2 flameModelTextureSize;\n uniform vec2 boneWeightTextureSize;\n uniform vec2 boneTextureSize;\n\n uniform int sphericalHarmonicsDegree;\n uniform vec2 sphericalHarmonicsTextureSize;\n uniform int sphericalHarmonics8BitMode;\n uniform int sphericalHarmonicsMultiTextureMode;\n uniform float visibleRegionRadius;\n uniform float visibleRegionFadeStartRadius;\n uniform float firstRenderTime;\n uniform float currentTime;\n uniform int fadeInComplete;\n uniform vec3 sceneCenter;\n uniform float splatScale;\n uniform float sphericalHarmonics8BitCompressionRangeMin[").concat(zy.MaxScenes,"];\n uniform float sphericalHarmonics8BitCompressionRangeMax[").concat(zy.MaxScenes,"];\n\n varying vec4 vColor;\n varying vec2 vUv;\n varying vec2 vPosition;\n varying vec2 vSplatIndex;\n #ifdef USE_SKINNING\n uniform mat4 bindMatrix;\n uniform mat4 bindMatrixInverse;\n uniform highp sampler2D boneTexture0;\n mat4 getBoneMatrix0( const in float i ) {\n int size = textureSize( boneTexture0, 0 ).x;\n int j = int( i ) * 4;\n int x = j % size;\n int y = j / size;\n vec4 v1 = texelFetch( boneTexture0, ivec2( x, y ), 0 );\n vec4 v2 = texelFetch( boneTexture0, ivec2( x + 1, y ), 0 );\n vec4 v3 = texelFetch( boneTexture0, ivec2( x + 2, y ), 0 );\n vec4 v4 = texelFetch( boneTexture0, ivec2( x + 3, y ), 0 );\n return mat4( v1, v2, v3, v4 );\n }\n #endif\n\n mat3 quaternionToRotationMatrix(float x, float y, float z, float w) {\n float s = 1.0 / sqrt(w * w + x * x + y * y + z * z);\n \n return mat3(\n 1. - 2. * (y * y + z * z),\n 2. * (x * y + w * z),\n 2. * (x * z - w * y),\n 2. * (x * y - w * z),\n 1. - 2. * (x * x + z * z),\n 2. * (y * z + w * x),\n 2. * (x * z + w * y),\n 2. * (y * z - w * x),\n 1. - 2. * (x * x + y * y)\n );\n }\n\n const float sqrt8 = sqrt(8.0);\n const float minAlpha = 1.0 / 255.0;\n\n const vec4 encodeNorm4 = vec4(1.0 / 255.0, 1.0 / 255.0, 1.0 / 255.0, 1.0 / 255.0);\n const uvec4 mask4 = uvec4(uint(0x000000FF), uint(0x0000FF00), uint(0x00FF0000), uint(0xFF000000));\n const uvec4 shift4 = uvec4(0, 8, 16, 24);\n int internal = 1;//show a gaussian splatting point every internal points.\n vec4 uintToRGBAVec (uint u) {\n uvec4 urgba = mask4 & u;\n urgba = urgba >> shift4;\n vec4 rgba = vec4(urgba) * encodeNorm4;\n return rgba;\n }\n float getRealIndex(int sIndex, int reducedFactor) {\n int remainder = sIndex % reducedFactor;\n\n if(remainder == int(0)) {\n return float(sIndex);\n }\n else\n {\n return float(sIndex - remainder);\n }\n }\n\n vec2 getDataUV(in int stride, in int offset, in vec2 dimensions) {\n vec2 samplerUV = vec2(0.0, 0.0);\n float d = float(uint(getRealIndex(int(splatIndex), internal)) * uint(stride) + uint(offset)) / dimensions.x;\n samplerUV.y = float(floor(d)) / dimensions.y;\n samplerUV.x = fract(d);\n return samplerUV;\n }\n\n vec2 getFlameDataUV(in int stride, in int offset, in vec2 dimensions) {\n vec2 samplerUV = vec2(0.0, 0.0);\n float d = float(uint(int(splatIndex) / internal) * uint(stride) + uint(offset) + uint(gaussianSplatCount * bsCount)) / dimensions.x;\n samplerUV.y = float(floor(d)) / dimensions.y;\n samplerUV.x = fract(d);\n return samplerUV;\n }\n\n vec2 getBoneWeightUV(in int stride, in int offset, in vec2 dimensions) {\n vec2 samplerUV = vec2(0.0, 0.0);\n float d = float(uint(int(splatIndex) / internal) * uint(stride) + uint(offset)) / dimensions.x;\n samplerUV.y = float(floor(d)) / dimensions.y;\n samplerUV.x = fract(d);\n return samplerUV;\n }\n\n vec2 getBSFlameDataUV(in int bsInedex, in int stride, in int offset, in vec2 dimensions) {\n vec2 samplerUV = vec2(0.0, 0.0);\n float d = float(uint(int(splatIndex) / internal) * uint(stride) + uint(offset) + uint(gaussianSplatCount * bsInedex)) / dimensions.x;\n samplerUV.y = float(floor(d)) / dimensions.y;\n samplerUV.x = fract(d);\n return samplerUV;\n }\n\n vec2 getDataUVF(in uint sIndex, in float stride, in uint offset, in vec2 dimensions) {\n vec2 samplerUV = vec2(0.0, 0.0);\n float d = float(uint(float(getRealIndex(int(sIndex), internal)) * stride) + offset) / dimensions.x;\n samplerUV.y = float(floor(d)) / dimensions.y;\n samplerUV.x = fract(d);\n return samplerUV;\n }\n\n const float SH_C1 = 0.4886025119029199f;\n const float[5] SH_C2 = float[](1.0925484, -1.0925484, 0.3153916, -1.0925484, 0.5462742);\n\n mat4 getBoneMatrix( float i ) {\n float y = i;\n float x = 0.0;\n\n vec2 samplerUV = vec2(0.0, 0.0);\n float d = float(i * 4.0) / boneTextureSize.x;//4\n samplerUV.y = float(floor(d)) / boneTextureSize.y;//5\n samplerUV.x = fract(d);\n\n vec4 v1 = uintBitsToFloat(texture( boneTexture, samplerUV ));\n vec4 v2 = uintBitsToFloat(texture( boneTexture, vec2(samplerUV.x + 1.0 / boneTextureSize.x, samplerUV.y)));\n vec4 v3 = uintBitsToFloat(texture( boneTexture, vec2(samplerUV.x + 2.0 / boneTextureSize.x, samplerUV.y) ));\n vec4 v4 = uintBitsToFloat(texture( boneTexture, vec2(samplerUV.x + 3.0 / boneTextureSize.x, samplerUV.y)));\n\n return mat4( v1, v2, v3, v4 );\n }\n\n void main () {\n\n uint oddOffset = splatIndex & uint(0x00000001);\n uint doubleOddOffset = oddOffset * uint(2);\n bool isEven = oddOffset == uint(0);\n uint nearestEvenIndex = splatIndex - oddOffset;\n float fOddOffset = float(oddOffset);\n\n uvec4 sampledCenterColor = texture(centersColorsTexture, getDataUV(1, 0, centersColorsTextureSize));\n // vec3 splatCenter = uintBitsToFloat(uvec3(sampledCenterColor.gba));\n\n uvec3 sampledCenter = texture(centersColorsTexture, getDataUV(1, 0, centersColorsTextureSize)).gba;\n vec3 splatCenter = uintBitsToFloat(uvec3(sampledCenter));\n\n vec2 flameTextureUV = getBSFlameDataUV(bsCount, 1, 0, flameModelTextureSize);\n uvec3 sampledflamePos = texture(flameModelTexture, flameTextureUV).rgb;\n // splatCenter += uintBitsToFloat(uvec3(sampledflamePos.rgb));\n\n for(int i = 0; i < bsCount; ++i) {\n vec2 flameBSTextureUV = getBSFlameDataUV(i, 1, 0, flameModelTextureSize);\n uvec3 sampledBSPos = texture(flameModelTexture, flameBSTextureUV).rgb;\n\n vec2 samplerUV = vec2(0.0, 0.0);\n float d = float(i / 4 + 5 * 4) / boneTextureSize.x;//4\n samplerUV.y = float(floor(d)) / boneTextureSize.y;//32\n samplerUV.x = fract(d);\n\n vec4 bsWeight = uintBitsToFloat(texture(boneTexture, samplerUV));\n float weight = bsWeight.r;\n if(i % 4 == 1) {\n weight = bsWeight.g;\n }\n if(i % 4 == 2) {\n weight = bsWeight.b;\n }\n if(i % 4 == 3) {\n weight = bsWeight.a;\n }\n\n splatCenter = splatCenter + weight * uintBitsToFloat(sampledBSPos);\n }\n\n\n #ifdef USE_SKINNING\n mat4 boneMatX = getBoneMatrix0( skinIndex.x );\n mat4 boneMatY = getBoneMatrix0( skinIndex.y );\n mat4 boneMatZ = getBoneMatrix0( skinIndex.z );\n mat4 boneMatW = getBoneMatrix0( skinIndex.w );\n #endif\n #ifdef USE_SKINNING\n mat4 skinMatrix = mat4( 0.0 );\n skinMatrix += skinWeight.x * boneMatX;\n skinMatrix += skinWeight.y * boneMatY;\n skinMatrix += skinWeight.z * boneMatZ;\n skinMatrix += skinWeight.w * boneMatW;\n // skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n #endif\n vec3 transformed = vec3(splatCenter.xyz);\n #ifdef USE_SKINNING\n // vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n vec4 skinVertex = vec4( transformed, 1.0 );\n\n vec4 skinned = vec4( 0.0 );\n // There is an offset between the Gaussian point and the mesh vertex,\n // which will cause defects in the skeletal animation driving the Gaussian point. \n //In order to circumvent this problem, only the head bone(index is 110 currently) is used to drive\n\n if (headBoneIndex >= 0.0)\n {\n mat4 boneMat = getBoneMatrix0( headBoneIndex );\n skinned += boneMat * skinVertex * 1.0;\n }\n\n // skinned += boneMatX * skinVertex * skinWeight.x;\n // skinned += boneMatY * skinVertex * skinWeight.y;\n // skinned += boneMatZ * skinVertex * skinWeight.z;\n // skinned += boneMatW * skinVertex * skinWeight.w;\n\n // transformed = ( bindMatrixInverse * skinned ).xyz;\n transformed = skinned.xyz;\n\n #endif\n splatCenter = transformed.xyz;\n\n #ifdef USE_FLAME\n mat4 boneMatX = getBoneMatrix( 0.0 );\n mat4 boneMatY = getBoneMatrix( 1.0 );\n mat4 boneMatZ = getBoneMatrix( 2.0 );\n mat4 boneMatW = getBoneMatrix( 3.0 ); \n mat4 boneMat0 = getBoneMatrix( 4.0 ); \n \n vec2 boneWeightUV0 = getBoneWeightUV(2, 0, boneWeightTextureSize);\n vec2 boneWeightUV1 = getBoneWeightUV(2, 1, boneWeightTextureSize);\n\n uvec4 sampledBoneMatrixValue = texture(boneWeightTexture, boneWeightUV0);\n uvec4 sampledBoneMatrixValue0 = texture(boneWeightTexture, boneWeightUV1);\n\n vec4 boneMatrixValue = uintBitsToFloat(sampledBoneMatrixValue);\n vec4 boneMatrixValue0 = uintBitsToFloat(sampledBoneMatrixValue0);\n\n vec4 skinVertex = vec4( splatCenter, 1.0 );\n vec4 skinned = vec4( 0.0 );\n float minWeight = min(boneMatrixValue.x,min(boneMatrixValue.y, min(boneMatrixValue.z, min(boneMatrixValue.w, boneMatrixValue0.x))));\n \n if(boneMatrixValue.x > 0.0 && boneMatrixValue.x > minWeight)\n skinned += boneMatX * skinVertex * boneMatrixValue.x;\n \n if(boneMatrixValue.y > 0.0 && boneMatrixValue.y > minWeight)\n skinned += boneMatY * skinVertex * boneMatrixValue.y;\n \n if(boneMatrixValue.z > 0.0 && boneMatrixValue.z > minWeight)\n skinned += boneMatZ * skinVertex * boneMatrixValue.z;\n \n if(boneMatrixValue.w > 0.0 && boneMatrixValue.w > minWeight)\n skinned += boneMatW * skinVertex * boneMatrixValue.w;\n \n if(boneMatrixValue0.x > 0.0 && boneMatrixValue0.x > minWeight)\n skinned += boneMat0 * skinVertex * boneMatrixValue0.x;\n \n splatCenter = skinned.xyz;\n #endif\n\n uint sceneIndex = uint(0);\n if (sceneCount > 1) {\n sceneIndex = texture(sceneIndexesTexture, getDataUV(1, 0, sceneIndexesTextureSize)).r;\n }\n "),t&&(i+="\n float splatOpacityFromScene = sceneOpacity[sceneIndex];\n int sceneVisible = sceneVisibility[sceneIndex];\n if (splatOpacityFromScene <= 0.01 || sceneVisible == 0) {\n gl_Position = vec4(0.0, 0.0, 2.0, 1.0);\n return;\n }\n "),i+=e?"\n mat4 transform = transforms[sceneIndex];\n mat4 transformModelViewMatrix = viewMatrix * transform;\n #ifdef USE_SKINNING\n transformModelViewMatrix = transformModelViewMatrix * skinMatrix;\n #endif\n ":"mat4 transformModelViewMatrix = modelViewMatrix;",i+="\n float sh8BitCompressionRangeMinForScene = sphericalHarmonics8BitCompressionRangeMin[sceneIndex];\n float sh8BitCompressionRangeMaxForScene = sphericalHarmonics8BitCompressionRangeMax[sceneIndex];\n float sh8BitCompressionRangeForScene = sh8BitCompressionRangeMaxForScene - sh8BitCompressionRangeMinForScene;\n float sh8BitCompressionHalfRangeForScene = sh8BitCompressionRangeForScene / 2.0;\n vec3 vec8BitSHShift = vec3(sh8BitCompressionRangeMinForScene);\n\n vec4 viewCenter = transformModelViewMatrix * vec4(splatCenter, 1.0);\n\n vec4 clipCenter = projectionMatrix * viewCenter;\n\n float clip = 1.2 * clipCenter.w;\n if (clipCenter.z < -clip || clipCenter.x < -clip || clipCenter.x > clip || clipCenter.y < -clip || clipCenter.y > clip) {\n gl_Position = vec4(0.0, 0.0, 2.0, 1.0);\n return;\n }\n\n vec3 ndcCenter = clipCenter.xyz / clipCenter.w;\n\n vPosition = position.xy;\n vSplatIndex = vec2(splatIndex, splatIndex);\n\n vColor = uintToRGBAVec(sampledCenterColor.r);\n ",n>=1&&(i+=" \n if (sphericalHarmonicsDegree >= 1) {\n ",i+=e?"\n vec3 worldViewDir = normalize(splatCenter - vec3(inverse(transform) * vec4(cameraPosition, 1.0)));\n ":"\n vec3 worldViewDir = normalize(splatCenter - cameraPosition);\n ",i+="\n vec3 sh1;\n vec3 sh2;\n vec3 sh3;\n ",n>=2&&(i+="\n vec3 sh4;\n vec3 sh5;\n vec3 sh6;\n vec3 sh7;\n vec3 sh8;\n "),1===n?i+="\n if (sphericalHarmonicsMultiTextureMode == 0) {\n vec2 shUV = getDataUVF(nearestEvenIndex, 2.5, doubleOddOffset, sphericalHarmonicsTextureSize);\n vec4 sampledSH0123 = texture(sphericalHarmonicsTexture, shUV);\n shUV = getDataUVF(nearestEvenIndex, 2.5, doubleOddOffset + uint(1), sphericalHarmonicsTextureSize);\n vec4 sampledSH4567 = texture(sphericalHarmonicsTexture, shUV);\n shUV = getDataUVF(nearestEvenIndex, 2.5, doubleOddOffset + uint(2), sphericalHarmonicsTextureSize);\n vec4 sampledSH891011 = texture(sphericalHarmonicsTexture, shUV);\n sh1 = vec3(sampledSH0123.rgb) * (1.0 - fOddOffset) + vec3(sampledSH0123.ba, sampledSH4567.r) * fOddOffset;\n sh2 = vec3(sampledSH0123.a, sampledSH4567.rg) * (1.0 - fOddOffset) + vec3(sampledSH4567.gba) * fOddOffset;\n sh3 = vec3(sampledSH4567.ba, sampledSH891011.r) * (1.0 - fOddOffset) + vec3(sampledSH891011.rgb) * fOddOffset;\n } else {\n vec2 sampledSH01R = texture(sphericalHarmonicsTextureR, getDataUV(2, 0, sphericalHarmonicsTextureSize)).rg;\n vec2 sampledSH23R = texture(sphericalHarmonicsTextureR, getDataUV(2, 1, sphericalHarmonicsTextureSize)).rg;\n vec2 sampledSH01G = texture(sphericalHarmonicsTextureG, getDataUV(2, 0, sphericalHarmonicsTextureSize)).rg;\n vec2 sampledSH23G = texture(sphericalHarmonicsTextureG, getDataUV(2, 1, sphericalHarmonicsTextureSize)).rg;\n vec2 sampledSH01B = texture(sphericalHarmonicsTextureB, getDataUV(2, 0, sphericalHarmonicsTextureSize)).rg;\n vec2 sampledSH23B = texture(sphericalHarmonicsTextureB, getDataUV(2, 1, sphericalHarmonicsTextureSize)).rg;\n sh1 = vec3(sampledSH01R.rg, sampledSH23R.r);\n sh2 = vec3(sampledSH01G.rg, sampledSH23G.r);\n sh3 = vec3(sampledSH01B.rg, sampledSH23B.r);\n }\n ":2===n&&(i+="\n vec4 sampledSH0123;\n vec4 sampledSH4567;\n vec4 sampledSH891011;\n\n vec4 sampledSH0123R;\n vec4 sampledSH0123G;\n vec4 sampledSH0123B;\n\n if (sphericalHarmonicsMultiTextureMode == 0) {\n sampledSH0123 = texture(sphericalHarmonicsTexture, getDataUV(6, 0, sphericalHarmonicsTextureSize));\n sampledSH4567 = texture(sphericalHarmonicsTexture, getDataUV(6, 1, sphericalHarmonicsTextureSize));\n sampledSH891011 = texture(sphericalHarmonicsTexture, getDataUV(6, 2, sphericalHarmonicsTextureSize));\n sh1 = sampledSH0123.rgb;\n sh2 = vec3(sampledSH0123.a, sampledSH4567.rg);\n sh3 = vec3(sampledSH4567.ba, sampledSH891011.r);\n } else {\n sampledSH0123R = texture(sphericalHarmonicsTextureR, getDataUV(2, 0, sphericalHarmonicsTextureSize));\n sampledSH0123G = texture(sphericalHarmonicsTextureG, getDataUV(2, 0, sphericalHarmonicsTextureSize));\n sampledSH0123B = texture(sphericalHarmonicsTextureB, getDataUV(2, 0, sphericalHarmonicsTextureSize));\n sh1 = vec3(sampledSH0123R.rgb);\n sh2 = vec3(sampledSH0123G.rgb);\n sh3 = vec3(sampledSH0123B.rgb);\n }\n "),i+="\n if (sphericalHarmonics8BitMode == 1) {\n sh1 = sh1 * sh8BitCompressionRangeForScene + vec8BitSHShift;\n sh2 = sh2 * sh8BitCompressionRangeForScene + vec8BitSHShift;\n sh3 = sh3 * sh8BitCompressionRangeForScene + vec8BitSHShift;\n }\n float x = worldViewDir.x;\n float y = worldViewDir.y;\n float z = worldViewDir.z;\n vColor.rgb += SH_C1 * (-sh1 * y + sh2 * z - sh3 * x);\n ",n>=2&&(i+="\n if (sphericalHarmonicsDegree >= 2) {\n float xx = x * x;\n float yy = y * y;\n float zz = z * z;\n float xy = x * y;\n float yz = y * z;\n float xz = x * z;\n ",2===n&&(i+="\n if (sphericalHarmonicsMultiTextureMode == 0) {\n vec4 sampledSH12131415 = texture(sphericalHarmonicsTexture, getDataUV(6, 3, sphericalHarmonicsTextureSize));\n vec4 sampledSH16171819 = texture(sphericalHarmonicsTexture, getDataUV(6, 4, sphericalHarmonicsTextureSize));\n vec4 sampledSH20212223 = texture(sphericalHarmonicsTexture, getDataUV(6, 5, sphericalHarmonicsTextureSize));\n sh4 = sampledSH891011.gba;\n sh5 = sampledSH12131415.rgb;\n sh6 = vec3(sampledSH12131415.a, sampledSH16171819.rg);\n sh7 = vec3(sampledSH16171819.ba, sampledSH20212223.r);\n sh8 = sampledSH20212223.gba;\n } else {\n vec4 sampledSH4567R = texture(sphericalHarmonicsTextureR, getDataUV(2, 1, sphericalHarmonicsTextureSize));\n vec4 sampledSH4567G = texture(sphericalHarmonicsTextureG, getDataUV(2, 1, sphericalHarmonicsTextureSize));\n vec4 sampledSH4567B = texture(sphericalHarmonicsTextureB, getDataUV(2, 1, sphericalHarmonicsTextureSize));\n sh4 = vec3(sampledSH0123R.a, sampledSH4567R.rg);\n sh5 = vec3(sampledSH4567R.ba, sampledSH0123G.a);\n sh6 = vec3(sampledSH4567G.rgb);\n sh7 = vec3(sampledSH4567G.a, sampledSH0123B.a, sampledSH4567B.r);\n sh8 = vec3(sampledSH4567B.gba);\n }\n "),i+="\n if (sphericalHarmonics8BitMode == 1) {\n sh4 = sh4 * sh8BitCompressionRangeForScene + vec8BitSHShift;\n sh5 = sh5 * sh8BitCompressionRangeForScene + vec8BitSHShift;\n sh6 = sh6 * sh8BitCompressionRangeForScene + vec8BitSHShift;\n sh7 = sh7 * sh8BitCompressionRangeForScene + vec8BitSHShift;\n sh8 = sh8 * sh8BitCompressionRangeForScene + vec8BitSHShift;\n }\n\n vColor.rgb +=\n (SH_C2[0] * xy) * sh4 +\n (SH_C2[1] * yz) * sh5 +\n (SH_C2[2] * (2.0 * zz - xx - yy)) * sh6 +\n (SH_C2[3] * xz) * sh7 +\n (SH_C2[4] * (xx - yy)) * sh8;\n }\n "),i+="\n\n vColor.rgb = clamp(vColor.rgb, vec3(0.), vec3(1.));\n\n }\n\n "),i}},{key:"getVertexShaderFadeIn",value:function(){return"\n if (fadeInComplete == 0) {\n float opacityAdjust = 1.0;\n float centerDist = length(splatCenter - sceneCenter);\n float renderTime = max(currentTime - firstRenderTime, 0.0);\n\n float fadeDistance = 0.75;\n float distanceLoadFadeInFactor = step(visibleRegionFadeStartRadius, centerDist);\n distanceLoadFadeInFactor = (1.0 - distanceLoadFadeInFactor) +\n (1.0 - clamp((centerDist - visibleRegionFadeStartRadius) / fadeDistance, 0.0, 1.0)) *\n distanceLoadFadeInFactor;\n opacityAdjust *= distanceLoadFadeInFactor;\n vColor.a *= opacityAdjust;\n }\n "}},{key:"getUniforms",value:function(){for(var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,i=arguments.length>4&&void 0!==arguments[4]&&arguments[4],a={sceneCenter:{type:"v3",value:new ph},fadeInComplete:{type:"i",value:0},orthographicMode:{type:"i",value:0},visibleRegionFadeStartRadius:{type:"f",value:0},visibleRegionRadius:{type:"f",value:0},bindMatrix:{type:"m4",value:new Gh},bindMatrixInverse:{type:"m4",value:new Gh},currentTime:{type:"f",value:0},firstRenderTime:{type:"f",value:0},centersColorsTexture:{type:"t",value:null},flameModelTexture:{type:"t",value:null},boneTexture:{type:"t",value:null},boneTexture0:{type:"t",value:null},boneWeightTexture:{type:"t",value:null},sphericalHarmonicsTexture:{type:"t",value:null},sphericalHarmonicsTextureR:{type:"t",value:null},sphericalHarmonicsTextureG:{type:"t",value:null},sphericalHarmonicsTextureB:{type:"t",value:null},sphericalHarmonics8BitCompressionRangeMin:{type:"f",value:[]},sphericalHarmonics8BitCompressionRangeMax:{type:"f",value:[]},focal:{type:"v2",value:new Vc},orthoZoom:{type:"f",value:1},inverseFocalAdjustment:{type:"f",value:1},viewport:{type:"v2",value:new Vc},basisViewport:{type:"v2",value:new Vc},debugColor:{type:"v3",value:new Od},centersColorsTextureSize:{type:"v2",value:new Vc(1024,1024)},flameModelTextureSize:{type:"v2",value:new Vc(4096,2048)},boneTextureSize:{type:"v2",value:new Vc(4,32)},boneWeightTextureSize:{type:"v2",value:new Vc(512,512)},sphericalHarmonicsDegree:{type:"i",value:n},sphericalHarmonicsTextureSize:{type:"v2",value:new Vc(1024,1024)},sphericalHarmonics8BitMode:{type:"i",value:0},sphericalHarmonicsMultiTextureMode:{type:"i",value:0},splatScale:{type:"f",value:r},pointCloudModeEnabled:{type:"i",value:i?1:0},sceneIndexesTexture:{type:"t",value:null},sceneIndexesTextureSize:{type:"v2",value:new Vc(1024,1024)},sceneCount:{type:"i",value:1},gaussianSplatCount:{type:"i",value:1},bsCount:{type:"i",value:1},headBoneIndex:{type:"f",value:-1}},o=0;o0&&void 0!==arguments[0]&&arguments[0],n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:2048,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,o=arguments.length>5&&void 0!==arguments[5]&&arguments[5],s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,u=arguments.length>7&&void 0!==arguments[7]?arguments[7]:.3,l=!(arguments.length>8&&void 0!==arguments[8])||arguments[8],c=Ex.buildVertexShaderBase(t,n,s,"\n uniform vec2 covariancesTextureSize;\n uniform highp sampler2D covariancesTexture;\n uniform highp usampler2D covariancesTextureHalfFloat;\n uniform int covariancesAreHalfFloat;\n\n void fromCovarianceHalfFloatV4(uvec4 val, out vec4 first, out vec4 second) {\n vec2 r = unpackHalf2x16(val.r);\n vec2 g = unpackHalf2x16(val.g);\n vec2 b = unpackHalf2x16(val.b);\n\n first = vec4(r.x, r.y, g.x, g.y);\n second = vec4(b.x, b.y, 0.0, 0.0);\n }\n ",l);c+=e.buildVertexShaderProjection(r,n,i,u);var h=e.buildFragmentShader(),d=Ex.getUniforms(t,n,s,a,o);return d.covariancesTextureSize={type:"v2",value:new Vc(1024,1024)},d.covariancesTexture={type:"t",value:null},d.covariancesTextureHalfFloat={type:"t",value:null},d.covariancesAreHalfFloat={type:"i",value:0},new wf({uniforms:d,vertexShader:c,fragmentShader:h,transparent:!0,alphaTest:1,blending:1,depthTest:!0,depthWrite:!1,side:2})}},{key:"buildVertexShaderProjection",value:function(e,t,n,r){var i="\n\n vec4 sampledCovarianceA;\n vec4 sampledCovarianceB;\n vec3 cov3D_M11_M12_M13;\n vec3 cov3D_M22_M23_M33;\n if (covariancesAreHalfFloat == 0) {\n sampledCovarianceA = texture(covariancesTexture, getDataUVF(nearestEvenIndex, 1.5, oddOffset,\n covariancesTextureSize));\n sampledCovarianceB = texture(covariancesTexture, getDataUVF(nearestEvenIndex, 1.5, oddOffset + uint(1),\n covariancesTextureSize));\n\n cov3D_M11_M12_M13 = vec3(sampledCovarianceA.rgb) * (1.0 - fOddOffset) +\n vec3(sampledCovarianceA.ba, sampledCovarianceB.r) * fOddOffset;\n cov3D_M22_M23_M33 = vec3(sampledCovarianceA.a, sampledCovarianceB.rg) * (1.0 - fOddOffset) +\n vec3(sampledCovarianceB.gba) * fOddOffset;\n } else {\n uvec4 sampledCovarianceU = texture(covariancesTextureHalfFloat, getDataUV(1, 0, covariancesTextureSize));\n fromCovarianceHalfFloatV4(sampledCovarianceU, sampledCovarianceA, sampledCovarianceB);\n cov3D_M11_M12_M13 = sampledCovarianceA.rgb;\n cov3D_M22_M23_M33 = vec3(sampledCovarianceA.a, sampledCovarianceB.rg);\n }\n \n // Construct the 3D covariance matrix\n mat3 Vrk = mat3(\n cov3D_M11_M12_M13.x, cov3D_M11_M12_M13.y, cov3D_M11_M12_M13.z,\n cov3D_M11_M12_M13.y, cov3D_M22_M23_M33.x, cov3D_M22_M23_M33.y,\n cov3D_M11_M12_M13.z, cov3D_M22_M23_M33.y, cov3D_M22_M23_M33.z\n );\n\n mat3 J;\n if (orthographicMode == 1) {\n // Since the projection is linear, we don't need an approximation\n J = transpose(mat3(orthoZoom, 0.0, 0.0,\n 0.0, orthoZoom, 0.0,\n 0.0, 0.0, 0.0));\n } else {\n // Construct the Jacobian of the affine approximation of the projection matrix. It will be used to transform the\n // 3D covariance matrix instead of using the actual projection matrix because that transformation would\n // require a non-linear component (perspective division) which would yield a non-gaussian result.\n float s = 1.0 / (viewCenter.z * viewCenter.z);\n J = mat3(\n focal.x / viewCenter.z, 0., -(focal.x * viewCenter.x) * s,\n 0., focal.y / viewCenter.z, -(focal.y * viewCenter.y) * s,\n 0., 0., 0.\n );\n }\n\n // Concatenate the projection approximation with the model-view transformation\n mat3 W = transpose(mat3(transformModelViewMatrix));\n mat3 T = W * J;\n\n // Transform the 3D covariance matrix (Vrk) to compute the 2D covariance matrix\n mat3 cov2Dm = transpose(T) * Vrk * T;\n ";return i+=e?"\n float detOrig = cov2Dm[0][0] * cov2Dm[1][1] - cov2Dm[0][1] * cov2Dm[0][1];\n cov2Dm[0][0] += ".concat(r,";\n cov2Dm[1][1] += ").concat(r,";\n float detBlur = cov2Dm[0][0] * cov2Dm[1][1] - cov2Dm[0][1] * cov2Dm[0][1];\n vColor.a *= sqrt(max(detOrig / detBlur, 0.0));\n if (vColor.a < minAlpha) return;\n "):"\n cov2Dm[0][0] += ".concat(r,";\n cov2Dm[1][1] += ").concat(r,";\n "),i+="\n\n // We are interested in the upper-left 2x2 portion of the projected 3D covariance matrix because\n // we only care about the X and Y values. We want the X-diagonal, cov2Dm[0][0],\n // the Y-diagonal, cov2Dm[1][1], and the correlation between the two cov2Dm[0][1]. We don't\n // need cov2Dm[1][0] because it is a symetric matrix.\n vec3 cov2Dv = vec3(cov2Dm[0][0], cov2Dm[0][1], cov2Dm[1][1]);\n\n // We now need to solve for the eigen-values and eigen vectors of the 2D covariance matrix\n // so that we can determine the 2D basis for the splat. This is done using the method described\n // here: https://people.math.harvard.edu/~knill/teaching/math21b2004/exhibits/2dmatrices/index.html\n // After calculating the eigen-values and eigen-vectors, we calculate the basis for rendering the splat\n // by normalizing the eigen-vectors and then multiplying them by (sqrt(8) * sqrt(eigen-value)), which is\n // equal to scaling them by sqrt(8) standard deviations.\n //\n // This is a different approach than in the original work at INRIA. In that work they compute the\n // max extents of the projected splat in screen space to form a screen-space aligned bounding rectangle\n // which forms the geometry that is actually rasterized. The dimensions of that bounding box are 3.0\n // times the square root of the maximum eigen-value, or 3 standard deviations. They then use the inverse\n // 2D covariance matrix (called 'conic') in the CUDA rendering thread to determine fragment opacity by\n // calculating the full gaussian: exp(-0.5 * (X - mean) * conic * (X - mean)) * splat opacity\n float a = cov2Dv.x;\n float d = cov2Dv.z;\n float b = cov2Dv.y;\n float D = a * d - b * b;\n float trace = a + d;\n float traceOver2 = 0.5 * trace;\n float term2 = sqrt(max(0.1f, traceOver2 * traceOver2 - D));\n float eigenValue1 = traceOver2 + term2;\n float eigenValue2 = traceOver2 - term2;\n\n if (pointCloudModeEnabled == 1) {\n eigenValue1 = eigenValue2 = 0.2;\n }\n\n if (eigenValue2 <= 0.0) return;\n\n vec2 eigenVector1 = normalize(vec2(b, eigenValue1 - a));\n // since the eigen vectors are orthogonal, we derive the second one from the first\n vec2 eigenVector2 = vec2(eigenVector1.y, -eigenVector1.x);\n\n // We use sqrt(8) standard deviations instead of 3 to eliminate more of the splat with a very low opacity.\n vec2 basisVector1 = eigenVector1 * splatScale * min(sqrt8 * sqrt(eigenValue1), ".concat(parseInt(n),".0);\n vec2 basisVector2 = eigenVector2 * splatScale * min(sqrt8 * sqrt(eigenValue2), ").concat(parseInt(n),".0);\n "),t&&(i+="\n vColor.a *= splatOpacityFromScene;\n "),i+="\n vec2 ndcOffset = vec2(vPosition.x * basisVector1 + vPosition.y * basisVector2) *\n basisViewport * 2.0 * inverseFocalAdjustment;\n\n vec4 quadPos = vec4(ndcCenter.xy + ndcOffset, ndcCenter.z, 1.0);\n gl_Position = quadPos;\n\n // Scale the position data we send to the fragment shader\n vPosition *= sqrt8;\n ",i+=Ex.getVertexShaderFadeIn(),i+="}"}},{key:"buildFragmentShader",value:function(){return"\n precision highp float;\n #include \n \n uniform vec3 debugColor;\n\n varying vec4 vColor;\n varying vec2 vUv;\n varying vec2 vPosition;\n varying vec2 vSplatIndex;\n\n \n void main () {\n // Compute the positional squared distance from the center of the splat to the current fragment.\n float A = dot(vPosition, vPosition);\n // Since the positional data in vPosition has been scaled by sqrt(8), the squared result will be\n // scaled by a factor of 8. If the squared result is larger than 8, it means it is outside the ellipse\n // defined by the rectangle formed by vPosition. It also means it's farther\n // away than sqrt(8) standard deviations from the mean.\n\n // if(vSplatIndex.x > 20000.0) discard;\n // if (A > 8.0) discard;\n vec3 color = vColor.rgb;\n\n // Since the rendered splat is scaled by sqrt(8), the inverse covariance matrix that is part of\n // the gaussian formula becomes the identity matrix. We're then left with (X - mean) * (X - mean),\n // and since 'mean' is zero, we have X * X, which is the same as A:\n float opacity = exp( -0.5*A) * vColor.a;\n if(opacity < 1.0 / 255.0)\n discard;\n\n // uint a = uint(255);\n // vec3 c = vec3(vSplatIndex.x / 256.0 / 256.0, float(uint(vSplatIndex.x / 256.0 )% a) / 256.0, float(uint(vSplatIndex.x)% a) / 256.0);\n // gl_FragColor = vec4(c, 1.0);\n gl_FragColor = vec4(color, opacity);\n\n\n }\n "}}])}(),kx=function(){function e(){A(this,e)}return T(e,null,[{key:"build",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,i=arguments.length>3&&void 0!==arguments[3]&&arguments[3],a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,o=Ex.buildVertexShaderBase(t,n,a,"\n uniform vec2 scaleRotationsTextureSize;\n uniform highp sampler2D scaleRotationsTexture;\n varying mat3 vT;\n varying vec2 vQuadCenter;\n varying vec2 vFragCoord;\n ");o+=e.buildVertexShaderProjection();var s=e.buildFragmentShader(),u=Ex.getUniforms(t,n,a,r,i);return u.scaleRotationsTexture={type:"t",value:null},u.scaleRotationsTextureSize={type:"v2",value:new Vc(1024,1024)},new wf({uniforms:u,vertexShader:o,fragmentShader:s,transparent:!0,alphaTest:1,blending:1,depthTest:!0,depthWrite:!1,side:2})}},{key:"buildVertexShaderProjection",value:function(){var e="\n\n vec4 scaleRotationA = texture(scaleRotationsTexture, getDataUVF(nearestEvenIndex, 1.5,\n oddOffset, scaleRotationsTextureSize));\n vec4 scaleRotationB = texture(scaleRotationsTexture, getDataUVF(nearestEvenIndex, 1.5,\n oddOffset + uint(1), scaleRotationsTextureSize));\n\n vec3 scaleRotation123 = vec3(scaleRotationA.rgb) * (1.0 - fOddOffset) +\n vec3(scaleRotationA.ba, scaleRotationB.r) * fOddOffset;\n vec3 scaleRotation456 = vec3(scaleRotationA.a, scaleRotationB.rg) * (1.0 - fOddOffset) +\n vec3(scaleRotationB.gba) * fOddOffset;\n\n float missingW = sqrt(1.0 - scaleRotation456.x * scaleRotation456.x - scaleRotation456.y *\n scaleRotation456.y - scaleRotation456.z * scaleRotation456.z);\n mat3 R = quaternionToRotationMatrix(scaleRotation456.r, scaleRotation456.g, scaleRotation456.b, missingW);\n mat3 S = mat3(scaleRotation123.r, 0.0, 0.0,\n 0.0, scaleRotation123.g, 0.0,\n 0.0, 0.0, scaleRotation123.b);\n \n mat3 L = R * S;\n\n mat3x4 splat2World = mat3x4(vec4(L[0], 0.0),\n vec4(L[1], 0.0),\n vec4(splatCenter.x, splatCenter.y, splatCenter.z, 1.0));\n\n mat4 world2ndc = transpose(projectionMatrix * transformModelViewMatrix);\n\n mat3x4 ndc2pix = mat3x4(vec4(viewport.x / 2.0, 0.0, 0.0, (viewport.x - 1.0) / 2.0),\n vec4(0.0, viewport.y / 2.0, 0.0, (viewport.y - 1.0) / 2.0),\n vec4(0.0, 0.0, 0.0, 1.0));\n\n mat3 T = transpose(splat2World) * world2ndc * ndc2pix;\n vec3 normal = vec3(viewMatrix * vec4(L[0][2], L[1][2], L[2][2], 0.0));\n ";return e+="\n\n mat4 splat2World4 = mat4(vec4(L[0], 0.0),\n vec4(L[1], 0.0),\n vec4(L[2], 0.0),\n vec4(splatCenter.x, splatCenter.y, splatCenter.z, 1.0));\n\n mat4 Tt = transpose(transpose(splat2World4) * world2ndc);\n\n vec4 tempPoint1 = Tt * vec4(1.0, 0.0, 0.0, 1.0);\n tempPoint1 /= tempPoint1.w;\n\n vec4 tempPoint2 = Tt * vec4(0.0, 1.0, 0.0, 1.0);\n tempPoint2 /= tempPoint2.w;\n\n vec4 center = Tt * vec4(0.0, 0.0, 0.0, 1.0);\n center /= center.w;\n\n vec2 basisVector1 = tempPoint1.xy - center.xy;\n vec2 basisVector2 = tempPoint2.xy - center.xy;\n\n vec2 basisVector1Screen = basisVector1 * 0.5 * viewport;\n vec2 basisVector2Screen = basisVector2 * 0.5 * viewport;\n\n const float minPix = 1.;\n if (length(basisVector1Screen) < minPix || length(basisVector2Screen) < minPix) {\n ".concat("\n vec3 T0 = vec3(T[0][0], T[0][1], T[0][2]);\n vec3 T1 = vec3(T[1][0], T[1][1], T[1][2]);\n vec3 T3 = vec3(T[2][0], T[2][1], T[2][2]);\n\n vec3 tempPoint = vec3(1.0, 1.0, -1.0);\n float distance = (T3.x * T3.x * tempPoint.x) + (T3.y * T3.y * tempPoint.y) + (T3.z * T3.z * tempPoint.z);\n vec3 f = (1.0 / distance) * tempPoint;\n if (abs(distance) < 0.00001) return;\n\n float pointImageX = (T0.x * T3.x * f.x) + (T0.y * T3.y * f.y) + (T0.z * T3.z * f.z);\n float pointImageY = (T1.x * T3.x * f.x) + (T1.y * T3.y * f.y) + (T1.z * T3.z * f.z);\n vec2 pointImage = vec2(pointImageX, pointImageY);\n\n float tempX = (T0.x * T0.x * f.x) + (T0.y * T0.y * f.y) + (T0.z * T0.z * f.z);\n float tempY = (T1.x * T1.x * f.x) + (T1.y * T1.y * f.y) + (T1.z * T1.z * f.z);\n vec2 temp = vec2(tempX, tempY);\n\n vec2 halfExtend = pointImage * pointImage - temp;\n vec2 extent = sqrt(max(vec2(0.0001), halfExtend));\n float radius = max(extent.x, extent.y);\n\n vec2 ndcOffset = ((position.xy * radius * 3.0) * basisViewport * 2.0);\n\n vec4 quadPos = vec4(ndcCenter.xy + ndcOffset, ndcCenter.z, 1.0);\n gl_Position = quadPos;\n\n vT = T;\n vQuadCenter = pointImage;\n vFragCoord = (quadPos.xy * 0.5 + 0.5) * viewport;\n ","\n } else {\n vec2 ndcOffset = vec2(position.x * basisVector1 + position.y * basisVector2) * 3.0 * inverseFocalAdjustment;\n vec4 quadPos = vec4(ndcCenter.xy + ndcOffset, ndcCenter.z, 1.0);\n gl_Position = quadPos;\n\n vT = T;\n vQuadCenter = center.xy;\n vFragCoord = (quadPos.xy * 0.5 + 0.5) * viewport;\n }\n "),e+=Ex.getVertexShaderFadeIn(),e+="}"}},{key:"buildFragmentShader",value:function(){return"\n precision highp float;\n #include \n\n uniform vec3 debugColor;\n\n varying vec4 vColor;\n varying vec2 vUv;\n varying vec2 vPosition;\n varying mat3 vT;\n varying vec2 vQuadCenter;\n varying vec2 vFragCoord;\n\n void main () {\n\n const float FilterInvSquare = 2.0;\n const float near_n = 0.2;\n const float T = 1.0;\n\n vec2 xy = vQuadCenter;\n vec3 Tu = vT[0];\n vec3 Tv = vT[1];\n vec3 Tw = vT[2];\n vec3 k = vFragCoord.x * Tw - Tu;\n vec3 l = vFragCoord.y * Tw - Tv;\n vec3 p = cross(k, l);\n if (p.z == 0.0) discard;\n vec2 s = vec2(p.x / p.z, p.y / p.z);\n float rho3d = (s.x * s.x + s.y * s.y); \n vec2 d = vec2(xy.x - vFragCoord.x, xy.y - vFragCoord.y);\n float rho2d = FilterInvSquare * (d.x * d.x + d.y * d.y); \n\n // compute intersection and depth\n float rho = min(rho3d, rho2d);\n float depth = (rho3d <= rho2d) ? (s.x * Tw.x + s.y * Tw.y) + Tw.z : Tw.z; \n if (depth < near_n) discard;\n // vec4 nor_o = collected_normal_opacity[j];\n // float normal[3] = {nor_o.x, nor_o.y, nor_o.z};\n float opa = vColor.a;\n\n float power = -0.5f * rho;\n if (power > 0.0f) discard;\n\n // Eq. (2) from 3D Gaussian splatting paper.\n // Obtain alpha by multiplying with Gaussian opacity\n // and its exponential falloff from mean.\n // Avoid numerical instabilities (see paper appendix). \n float alpha = min(0.99f, opa * exp(power));\n if (alpha < 1.0f / 255.0f) discard;\n float test_T = T * (1.0 - alpha);\n if (test_T < 0.0001)discard;\n\n float w = alpha * T;\n gl_FragColor = vec4(vColor.rgb, w);\n }\n "}}])}(),Rx=function(){return T(function e(){A(this,e)},null,[{key:"build",value:function(e){var t=new af;t.setIndex([0,1,2,0,2,3]);var n=new Float32Array(12),r=new qd(n,3);t.setAttribute("position",r),r.setXYZ(0,-1,-1,0),r.setXYZ(1,-1,1,0),r.setXYZ(2,1,1,0),r.setXYZ(3,1,-1,0),r.needsUpdate=!0;var i=(new Bv).copy(t),a=new Uint32Array(e),o=new np(a,1,!1);return o.setUsage(Tc),i.setAttribute("splatIndex",o),i.instanceCount=0,i}}])}(),Ix=function(e){function t(e){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new ph,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new fh,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:new ph(1,1,1),o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1,u=!(arguments.length>6&&void 0!==arguments[6])||arguments[6];return A(this,t),(n=y(this,t)).splatBuffer=e,n.position.copy(r),n.quaternion.copy(i),n.scale.copy(a),n.transform=new Gh,n.minimumAlpha=o,n.opacity=s,n.visible=u,n}return x(t,e),T(t,[{key:"copyTransformData",value:function(e){this.position.copy(e.position),this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.transform.copy(e.transform)}},{key:"updateTransform",value:function(e){e?(this.matrixWorldAutoUpdate&&this.updateWorldMatrix(!0,!1),this.transform.copy(this.matrixWorld)):(this.matrixAutoUpdate&&this.updateMatrix(),this.transform.copy(this.matrix))}}])}(gd),Nx=T(function e(t,n,r,i){A(this,e),this.min=(new ph).copy(t),this.max=(new ph).copy(n),this.boundingBox=new gh(this.min,this.max),this.center=(new ph).copy(this.max).sub(this.min).multiplyScalar(.5).add(this.min),this.depth=r,this.children=[],this.data=null,this.id=i||e.idGen++});M(Nx,"idGen",0);var Px=function(){function e(t,n){A(this,e),this.maxDepth=t,this.maxCentersPerNode=n,this.sceneDimensions=new ph,this.sceneMin=new ph,this.sceneMax=new ph,this.rootNode=null,this.nodesWithIndexes=[],this.splatMesh=null}return T(e,null,[{key:"convertWorkerSubTreeNode",value:function(t){var n=(new ph).fromArray(t.min),r=(new ph).fromArray(t.max),i=new Nx(n,r,t.depth,t.id);if(t.data.indexes){i.data={indexes:[]};var a,o=L(t.data.indexes);try{for(o.s();!(a=o.n()).done;){var s=a.value;i.data.indexes.push(s)}}catch(h){o.e(h)}finally{o.f()}}if(t.children){var u,l=L(t.children);try{for(l.s();!(u=l.n()).done;){var c=u.value;i.children.push(e.convertWorkerSubTreeNode(c))}}catch(h){l.e(h)}finally{l.f()}}return i}},{key:"convertWorkerSubTree",value:function(t,n){var r=new e(t.maxDepth,t.maxCentersPerNode);r.sceneMin=(new ph).fromArray(t.sceneMin),r.sceneMax=(new ph).fromArray(t.sceneMax),r.splatMesh=n,r.rootNode=e.convertWorkerSubTreeNode(t.rootNode);var i=function(e,t){0===e.children.length&&t(e);var n,r=L(e.children);try{for(r.s();!(n=r.n()).done;){var a=n.value;i(a,t)}}catch(o){r.e(o)}finally{r.f()}};return r.nodesWithIndexes=[],i(r.rootNode,function(e){e.data&&e.data.indexes&&e.data.indexes.length>0&&r.nodesWithIndexes.push(e)}),r}}])}();function Lx(e){var t=0,n=function(){return T(function e(t,n){A(this,e),this.min=[t[0],t[1],t[2]],this.max=[n[0],n[1],n[2]]},[{key:"containsPoint",value:function(e){return e[0]>=this.min[0]&&e[0]<=this.max[0]&&e[1]>=this.min[1]&&e[1]<=this.max[1]&&e[2]>=this.min[2]&&e[2]<=this.max[2]}}])}(),r=T(function e(t,n){A(this,e),this.maxDepth=t,this.maxCentersPerNode=n,this.sceneDimensions=[],this.sceneMin=[],this.sceneMax=[],this.rootNode=null,this.addedIndexes={},this.nodesWithIndexes=[],this.splatMesh=null,this.disposed=!1}),i=T(function e(n,r,i,a){A(this,e),this.min=[n[0],n[1],n[2]],this.max=[r[0],r[1],r[2]],this.center=[.5*(r[0]-n[0])+n[0],.5*(r[1]-n[1])+n[1],.5*(r[2]-n[2])+n[2]],this.depth=i,this.children=[],this.data=null,this.id=a||t++});processSplatTreeNode=function(e){function t(t,n,r,i){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}(function(e,t,r,a){var o=t.data.indexes.length;if(oe.maxDepth){for(var s=[],u=0;ut?1:-1}),void e.nodesWithIndexes.push(t)}for(var l=[t.max[0]-t.min[0],t.max[1]-t.min[1],t.max[2]-t.min[2]],c=[.5*l[0],.5*l[1],.5*l[2]],h=[t.min[0]+c[0],t.min[1]+c[1],t.min[2]+c[2]],d=[new n([h[0]-c[0],h[1],h[2]-c[2]],[h[0],h[1]+c[1],h[2]]),new n([h[0],h[1],h[2]-c[2]],[h[0]+c[0],h[1]+c[1],h[2]]),new n([h[0],h[1],h[2]],[h[0]+c[0],h[1]+c[1],h[2]+c[2]]),new n([h[0]-c[0],h[1],h[2]],[h[0],h[1]+c[1],h[2]+c[2]]),new n([h[0]-c[0],h[1]-c[1],h[2]-c[2]],[h[0],h[1],h[2]]),new n([h[0],h[1]-c[1],h[2]-c[2]],[h[0]+c[0],h[1],h[2]]),new n([h[0],h[1]-c[1],h[2]],[h[0]+c[0],h[1],h[2]+c[2]]),new n([h[0]-c[0],h[1]-c[1],h[2]],[h[0],h[1],h[2]+c[2]])],f=[],p=0;po[0])&&(o[0]=h),(0===l||do[1])&&(o[1]=d),(0===l||fo[2])&&(o[2]=f),s.push(p)}var v=new r(t,n);return v.sceneMin=a,v.sceneMax=o,v.rootNode=new i(v.sceneMin,v.sceneMax,0),v.rootNode.data={indexes:s},v};e.onmessage=function(t){t.data.process&&function(t,n,r){var i,o=[],s=L(t);try{for(s.s();!(i=s.n()).done;)for(var u=i.value,l=Math.floor(u.length/4),c=0;c1&&void 0!==arguments[1]?arguments[1]:function(){return!0},n=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0;r.splatTreeWorker||(r.splatTreeWorker=new Worker(URL.createObjectURL(new Blob(["(",Lx.toString(),")(self)"],{type:"application/javascript"})))),r.splatMesh=e,r.subTrees=[];var a=new ph,o=function(n,r){for(var i=new Float32Array(4*r),o=0,s=0;s0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).precision>0)return"highp";t="mediump"}return"mediump"===t&&e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}var a="undefined"!=typeof WebGL2RenderingContext&&"WebGL2RenderingContext"===e.constructor.name,o=void 0!==n.precision?n.precision:"highp",s=i(o);s!==o&&(console.warn("THREE.WebGLRenderer:",o,"not supported, using",s,"instead."),o=s);var u=a||t.has("WEBGL_draw_buffers"),l=!0===n.logarithmicDepthBuffer,c=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),h=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS),d=e.getParameter(e.MAX_TEXTURE_SIZE),f=e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),p=e.getParameter(e.MAX_VERTEX_ATTRIBS),v=e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),m=e.getParameter(e.MAX_VARYING_VECTORS),g=e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),y=h>0,_=a||t.has("OES_texture_float");return{isWebGL2:a,drawBuffers:u,getMaxAnisotropy:function(){if(void 0!==r)return r;if(!0===t.has("EXT_texture_filter_anisotropic")){var n=t.get("EXT_texture_filter_anisotropic");r=e.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r},getMaxPrecision:i,precision:o,logarithmicDepthBuffer:l,maxTextures:c,maxVertexTextures:h,maxTextureSize:d,maxCubemapSize:f,maxAttributes:p,maxVertexUniforms:v,maxVaryings:m,maxFragmentUniforms:g,vertexTextures:y,floatFragmentTextures:_,floatVertexTextures:y&&_,maxSamples:a?e.getParameter(e.MAX_SAMPLES):0}}var Bx=0,Ux=2,zx=0,Vx=3,Hx=new af,Wx=new zd,Gx=16777216,jx=function(e){function t(){var e,n,r,i,a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:wx,o=arguments.length>1&&void 0!==arguments[1]&&arguments[1],s=arguments.length>2&&void 0!==arguments[2]&&arguments[2],u=arguments.length>3&&void 0!==arguments[3]&&arguments[3],l=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,c=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],h=arguments.length>6&&void 0!==arguments[6]&&arguments[6],d=arguments.length>7&&void 0!==arguments[7]&&arguments[7],f=arguments.length>8&&void 0!==arguments[8]?arguments[8]:1024,p=arguments.length>9&&void 0!==arguments[9]?arguments[9]:zx,v=arguments.length>10&&void 0!==arguments[10]?arguments[10]:0,m=arguments.length>11&&void 0!==arguments[11]?arguments[11]:1,g=arguments.length>12&&void 0!==arguments[12]?arguments[12]:.3;return A(this,t),M(e=y(this,t,[Hx,Wx]),"buildSplatTree",function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=arguments.length>1?arguments[1]:void 0,r=arguments.length>2?arguments[2]:void 0;return new Promise(function(i){e.disposeSplatTree(),e.baseSplatTree=new Dx(8,1e3);var a=performance.now(),o=new uh;e.baseSplatTree.processSplatMesh(e,function(n){e.getSplatColor(n,o);var r=e.getSceneIndexForSplat(n),i=t[r]||1;return o.w>=i},n,r).then(function(){var t=performance.now()-a;if(e.logLevel>=Vx&&console.log("SplatTree build: "+t+" ms"),e.disposed)i();else{e.splatTree=e.baseSplatTree,e.baseSplatTree=null;var n=0,r=0,o=0;e.splatTree.visitLeaves(function(e){var t=e.data.indexes.length;t>0&&(r+=t,o++,n++)}),e.logLevel>=Vx&&(console.log("SplatTree leaves: ".concat(e.splatTree.countLeaves())),console.log("SplatTree leaves with splats:".concat(n)),r/=o,console.log("Avg splat count per node: ".concat(r)),console.log("Total splat count: ".concat(e.getSplatCount()))),i()}})})}),M(e,"updateUniforms",(n=new Vc,function(e,t,r,i,a,o){if(this.getSplatCount()>0){if(n.set(e.x*this.devicePixelRatio,e.y*this.devicePixelRatio),this.material.uniforms.viewport.value.copy(n),this.material.uniforms.basisViewport.value.set(1/n.x,1/n.y),this.material.uniforms.focal.value.set(t,r),this.material.uniforms.orthographicMode.value=i?1:0,this.material.uniforms.orthoZoom.value=a,this.material.uniforms.inverseFocalAdjustment.value=o,this.dynamicMode)for(var s=0;s2&&void 0!==arguments[2])||arguments[2],i=arguments.length>3&&void 0!==arguments[3]&&arguments[3],a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6];this.sceneOptions=n,this.finalBuild=i;var o=t.getTotalMaxSplatCountForSplatBuffers(e),s=t.buildScenes(this,e,n);if(r)for(var u=0;u0,b}},{key:"freeIntermediateSplatData",value:function(){var e=this,t=function(e){delete e.source.data,delete e.image,e.onUpdate=null};delete this.splatDataTextures.baseData.covariances,delete this.splatDataTextures.baseData.centers,delete this.splatDataTextures.baseData.colors,delete this.splatDataTextures.baseData.sphericalHarmonics,delete this.splatDataTextures.centerColors.data,delete this.splatDataTextures.covariances.data,this.splatDataTextures.sphericalHarmonics&&delete this.splatDataTextures.sphericalHarmonics.data,this.splatDataTextures.sceneIndexes&&delete this.splatDataTextures.sceneIndexes.data,this.splatDataTextures.centerColors.texture.needsUpdate=!0,this.splatDataTextures.centerColors.texture.onUpdate=function(){t(e.splatDataTextures.centerColors.texture)},this.splatDataTextures.flameModelPosTexture.texture.needsUpdate=!0,this.splatDataTextures.flameModelPosTexture.texture.onUpdate=function(){t(e.splatDataTextures.flameModelPosTexture.texture)},this.splatDataTextures.covariances.texture.needsUpdate=!0,this.splatDataTextures.covariances.texture.onUpdate=function(){t(e.splatDataTextures.covariances.texture)},this.splatDataTextures.sphericalHarmonics&&(this.splatDataTextures.sphericalHarmonics.texture?(this.splatDataTextures.sphericalHarmonics.texture.needsUpdate=!0,this.splatDataTextures.sphericalHarmonics.texture.onUpdate=function(){t(e.splatDataTextures.sphericalHarmonics.texture)}):this.splatDataTextures.sphericalHarmonics.textures.forEach(function(e){e.needsUpdate=!0,e.onUpdate=function(){t(e)}})),this.splatDataTextures.sceneIndexes&&(this.splatDataTextures.sceneIndexes.texture.needsUpdate=!0,this.splatDataTextures.sceneIndexes.texture.onUpdate=function(){t(e.splatDataTextures.sceneIndexes.texture)})}},{key:"dispose",value:function(){this.disposeMeshData(),this.disposeTextures(),this.disposeSplatTree(),this.enableDistancesComputationOnGPU&&(this.computeDistancesOnGPUSyncTimeout&&(clearTimeout(this.computeDistancesOnGPUSyncTimeout),this.computeDistancesOnGPUSyncTimeout=null),this.disposeDistancesComputationGPUResources()),this.scenes=[],this.distancesTransformFeedback={id:null,vertexShader:null,fragmentShader:null,program:null,centersBuffer:null,sceneIndexesBuffer:null,outDistancesBuffer:null,centersLoc:-1,modelViewProjLoc:-1,sceneIndexesLoc:-1,transformsLocs:[]},this.renderer=null,this.globalSplatIndexToLocalSplatIndexMap=[],this.globalSplatIndexToSceneIndexMap=[],this.lastBuildSplatCount=0,this.lastBuildScenes=[],this.lastBuildMaxSplatCount=0,this.lastBuildSceneCount=0,this.firstRenderTime=-1,this.finalBuild=!1,this.webGLUtils=null,this.boundingBox=new gh,this.calculatedSceneCenter=new ph,this.maxSplatDistanceFromSceneCenter=0,this.visibleRegionBufferRadius=0,this.visibleRegionRadius=0,this.visibleRegionFadeStartRadius=0,this.visibleRegionChanging=!1,this.splatScale=1,this.pointCloudModeEnabled=!1,this.disposed=!0,this.lastRenderer=null,this.visible=!1}},{key:"disposeMeshData",value:function(){this.geometry&&this.geometry!==Hx&&(this.geometry.dispose(),this.geometry=null),this.material&&(this.material.dispose(),this.material=null)}},{key:"disposeTextures",value:function(){for(var e in this.splatDataTextures)if(this.splatDataTextures.hasOwnProperty(e)){var t=this.splatDataTextures[e];t.texture&&(t.texture.dispose(),t.texture=null)}this.splatDataTextures=null}},{key:"disposeSplatTree",value:function(){this.splatTree&&(this.splatTree.dispose(),this.splatTree=null),this.baseSplatTree&&(this.baseSplatTree.dispose(),this.baseSplatTree=null)}},{key:"getSplatTree",value:function(){return this.splatTree}},{key:"onSplatTreeReady",value:function(e){this.onSplatTreeReadyCallback=e}},{key:"getDataForDistancesComputation",value:function(e,t){return{centers:this.integerBasedDistancesComputation?this.getIntegerCenters(e,t,!0):this.getFloatCenters(e,t,!0),sceneIndexes:this.getSceneIndexes(e,t)}}},{key:"refreshGPUDataFromSplatBuffers",value:function(e){var t=this.getSplatCount(!0);this.refreshDataTexturesFromSplatBuffers(e);var n=e?this.lastBuildSplatCount:0,r=this.getDataForDistancesComputation(n,t-1),i=r.centers,a=r.sceneIndexes;return this.enableDistancesComputationOnGPU&&this.refreshGPUBuffersForDistancesComputation(i,a,e),{from:n,to:t-1,count:t-n,centers:i,sceneIndexes:a}}},{key:"refreshGPUBuffersForDistancesComputation",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=n?this.lastBuildSplatCount:0;this.updateGPUCentersBufferForDistancesComputation(n,e,r),this.updateGPUTransformIndexesBufferForDistancesComputation(n,t,r)}},{key:"refreshDataTexturesFromSplatBuffers",value:function(e){var t=this.getSplatCount(!0),n=this.lastBuildSplatCount,r=t-1;e?this.updateBaseDataFromSplatBuffers(n,r):(this.setupDataTextures(),this.updateBaseDataFromSplatBuffers()),this.updateDataTexturesFromBaseData(n,r),this.updateVisibleRegion(e)}},{key:"setupDataTextures",value:function(){var e=this,n=this.getMaxSplatCount(),r=this.getSplatCount(!0);this.disposeTextures();var i,a,o,s=function(e,t){for(var r=new Vc(4096,1024);r.x*r.y*e=1?6:4}(e);return{elementsPerTexelStored:t,texSize:s(t,6)}},l=this.getTargetCovarianceCompressionLevel(),c=this.getTargetSphericalHarmonicsCompressionLevel();if(this.splatRenderMode===wx){var h=u(l);h.texSize.x*h.texSize.y>Gx&&0===l&&(l=1),i=new Float32Array(6*n)}else a=new Float32Array(3*n),o=new Float32Array(4*n);var d=new Float32Array(3*n),f=new Uint8Array(4*n),p=Float32Array;1===c?p=Uint16Array:2===c&&(p=Uint8Array);var v=Ou(this.minSphericalHarmonicsDegree),m=this.minSphericalHarmonicsDegree?new p(n*v):void 0,g=s(4,4),y=new Uint32Array(g.x*g.y*4);t.updateCenterColorsPaddedData(0,r-1,d,f,y);var _=new Jf(y,g.x,g.y,Il,gl);if(_.internalFormat="RGBA32UI",_.needsUpdate=!0,this.material.uniforms.centersColorsTexture.value=_,this.material.uniforms.centersColorsTextureSize.value.copy(g),this.material.uniformsNeedUpdate=!0,this.splatDataTextures={baseData:{covariances:i,scales:a,rotations:o,centers:d,colors:f,sphericalHarmonics:m},centerColors:{data:y,texture:_,size:g}},this.splatRenderMode===wx){var b,x=u(l),S=x.elementsPerTexelStored,A=x.texSize,w=l>=1?8:4,T=new(l>=1?Uint32Array:Float32Array)(A.x*A.y*w);if(0===l?T.set(i):t.updatePaddedCompressedCovariancesTextureData(i,T,0,0,i.length),l>=1)(b=new Jf(T,A.x,A.y,Il,gl)).internalFormat="RGBA32UI",this.material.uniforms.covariancesTextureHalfFloat.value=b;else{b=new Jf(T,A.x,A.y,wl,yl),this.material.uniforms.covariancesTexture.value=b;var M=new Jf(new Uint32Array(32),2,2,Il,gl);M.internalFormat="RGBA32UI",this.material.uniforms.covariancesTextureHalfFloat.value=M,M.needsUpdate=!0}b.needsUpdate=!0,this.material.uniforms.covariancesAreHalfFloat.value=l>=1?1:0,this.material.uniforms.covariancesTextureSize.value.copy(A),this.splatDataTextures.covariances={data:T,texture:b,size:A,compressionLevel:l,elementsPerTexelStored:S,elementsPerTexelAllocated:w}}else{var E=s(4,6),C=Float32Array,k=new C(E.x*E.y*4);t.updateScaleRotationsPaddedData(0,r-1,a,o,k);var R=new Jf(k,E.x,E.y,wl,1015);R.needsUpdate=!0,this.material.uniforms.scaleRotationsTexture.value=R,this.material.uniforms.scaleRotationsTextureSize.value.copy(E),this.splatDataTextures.scaleRotations={data:k,texture:R,size:E,compressionLevel:0}}if(m){var I=2===c?dl:_l,N=v;N%2!=0&&N++;var P=2===this.minSphericalHarmonicsDegree?4:2,L=4===P?wl:kl,D=s(P,N);if(D.x*D.y<=Gx){for(var O=new p(D.x*D.y*P),F=0;F=3){for(var J=0;J<3;J++)X[Z+J]=m[K+3*q+J];if(H>=8)for(var $=0;$<5;$++)X[Z+3+$]=m[K+9+5*q+$]}}var ee=new Jf(X,D.x,D.y,L,I);Q.push(ee),ee.needsUpdate=!0,G[q].value=ee}this.material.uniforms.sphericalHarmonicsMultiTextureMode.value=1,this.splatDataTextures.sphericalHarmonics={componentCount:v,componentCountPerChannel:H,paddedComponentCount:N,data:j,textureCount:3,textures:Q,size:D,compressionLevel:c,elementsPerTexel:P}}this.material.uniforms.sphericalHarmonicsTextureSize.value.copy(D),this.material.uniforms.sphericalHarmonics8BitMode.value=2===c?1:0;for(var te=0;te0&&void 0!==arguments[0]&&arguments[0];if(this.bsWeight&&this.morphTargetDictionary){if(1==e)for(var t=new Float32Array(this.bonesMatrix),n=0;n<16*this.bonesNum;n++)this.splatDataTextures.baseData.boneMatrix[n]=ku(t[n]);for(var r in this.bsWeight)if(this.bsWeight.hasOwnProperty(r)){var i=this.bsWeight[r],a=this.morphTargetDictionary[r];this.splatDataTextures.baseData.boneMatrix[a+16*this.bonesNum]=ku(i)}this.splatDataTextures.boneMatrix.texture.data=this.splatDataTextures.baseData.boneMatrix,this.splatDataTextures.boneMatrix.texture.needsUpdate=!0,this.material.uniforms.boneTexture.value=this.splatDataTextures.boneMatrix.texture,this.flameModel.skeleton&&(this.material.uniforms.boneTexture0.value=this.flameModel.skeleton.boneTexture,this.material.uniforms.bindMatrix.value=this.flameModel.bindMatrix,this.material.uniforms.bindMatrixInverse.value=this.flameModel.bindMatrixInverse),this.material.uniformsNeedUpdate=!0}}},{key:"buildBoneWeightTexture",value:function(e){for(var t=e.geometry.attributes.position.array.length/3,n=new Vc(512,512),r=new Float32Array(n.x*n.y*4),i=new Uint32Array(n.x*n.y*4),a=0;a2&&void 0!==arguments[2])||arguments[2],i=new Gh;this.getSceneTransform(0,i),this.getScene(0).splatBuffer.fillSplatCenterArray(this.morphedMesh,this.splatDataTextures.baseData.centers,i,e,n,0);var a=this.splatDataTextures.centerColors,o=a.data,s=a.texture;t.updateCenterColorsPaddedData(e,n,this.splatDataTextures.baseData.centers,this.splatDataTextures.baseData.colors,o);var u=this.renderer?this.renderer.properties.get(s):null;u&&u.__webglTexture?this.updateDataTexture(o,a.texture,a.size,u,4,4,4,e,n):s.needsUpdate=!0,this.updateBoneMatrixTexture(r)}},{key:"updateBaseDataFromSplatBuffers",value:function(e,t){var n=this.splatDataTextures.covariances,r=n?n.compressionLevel:void 0,i=this.splatDataTextures.scaleRotations,a=i?i.compressionLevel:void 0,o=this.splatDataTextures.sphericalHarmonics,s=o?o.compressionLevel:0;this.fillSplatDataArrays(this.splatDataTextures.baseData.covariances,this.splatDataTextures.baseData.scales,this.splatDataTextures.baseData.rotations,this.splatDataTextures.baseData.centers,this.splatDataTextures.baseData.colors,this.splatDataTextures.baseData.sphericalHarmonics,this.splatDataTextures.baseData.flameModelPos,void 0,r,a,s,e,t,e)}},{key:"updateDataTexturesFromBaseData",value:function(e,n){var r=this,i=this.splatDataTextures.covariances,a=i?i.compressionLevel:void 0,o=this.splatDataTextures.scaleRotations,s=o?o.compressionLevel:void 0,u=this.splatDataTextures.sphericalHarmonics,l=u?u.compressionLevel:0,c=this.splatDataTextures.flameModel,h=c.data,d=c.texture,f=this.renderer?this.renderer.properties.get(d):null;f&&f.__webglTexture?this.updateDataTexture(h,c.texture,c.size,f,4,4,3,e,n):d.needsUpdate=!0;var p=this.splatDataTextures.centerColors,v=p.data,m=p.texture;t.updateCenterColorsPaddedData(e,n,this.splatDataTextures.baseData.centers,this.splatDataTextures.baseData.colors,v);var g=this.renderer?this.renderer.properties.get(m):null;if(g&&g.__webglTexture?this.updateDataTexture(v,p.texture,p.size,g,4,4,4,e,n):m.needsUpdate=!0,i){var y=i.texture,_=6*e,b=6*n;if(0===a)for(var x=_;x<=b;x++){var S=this.splatDataTextures.baseData.covariances[x];i.data[x]=S}else t.updatePaddedCompressedCovariancesTextureData(this.splatDataTextures.baseData.covariances,i.data,e*i.elementsPerTexelAllocated,_,b);var A=this.renderer?this.renderer.properties.get(y):null;A&&A.__webglTexture?0===a?this.updateDataTexture(i.data,i.texture,i.size,A,i.elementsPerTexelStored,6,4,e,n):this.updateDataTexture(i.data,i.texture,i.size,A,i.elementsPerTexelAllocated,i.elementsPerTexelAllocated,2,e,n):y.needsUpdate=!0}if(o){var w=o.data,T=o.texture,M=0===s?4:2;t.updateScaleRotationsPaddedData(e,n,this.splatDataTextures.baseData.scales,this.splatDataTextures.baseData.rotations,w);var E=this.renderer?this.renderer.properties.get(T):null;E&&E.__webglTexture?this.updateDataTexture(w,o.texture,o.size,E,4,6,M,e,n):T.needsUpdate=!0}var C=this.splatDataTextures.baseData.sphericalHarmonics;if(C){var k=4;1===l?k=2:2===l&&(k=1);var R=function(t,i,a,o,s){var u=r.renderer?r.renderer.properties.get(t):null;u&&u.__webglTexture?r.updateDataTexture(o,t,i,u,a,s,k,e,n):t.needsUpdate=!0},I=u.componentCount,N=u.paddedComponentCount;if(1===u.textureCount){for(var P=u.data,L=e;L<=n;L++)for(var D=I*L,O=N*L,F=0;F=3){for(var G=0;G<3;G++)z[W+G]=C[H+3*U+G];if(B>=8)for(var j=0;j<5;j++)z[W+3+j]=C[H+9+5*U+j]}}R(u.textures[U],u.size,u.elementsPerTexel,z,N)}}for(var Q=this.splatDataTextures.sceneIndexes,q=Q.data,X=this.lastBuildSplatCount;X<=n;X++)q[X]=this.globalSplatIndexToSceneIndexMap[X];var Y=Q.texture,K=this.renderer?this.renderer.properties.get(Y):null;K&&K.__webglTexture?this.updateDataTexture(q,Q.texture,Q.size,K,1,1,1,this.lastBuildSplatCount,n):Y.needsUpdate=!0}},{key:"getTargetCovarianceCompressionLevel",value:function(){return this.halfPrecisionCovariancesOnGPU?1:0}},{key:"getTargetSphericalHarmonicsCompressionLevel",value:function(){return Math.max(1,this.getMaximumSplatBufferCompressionLevel())}},{key:"getMaximumSplatBufferCompressionLevel",value:function(){for(var e,t=0;te)&&(e=n.compressionLevel)}return e}},{key:"getMinimumSplatBufferCompressionLevel",value:function(){for(var e,t=0;tthis.maxSplatDistanceFromSceneCenter&&(this.maxSplatDistanceFromSceneCenter=a)}this.maxSplatDistanceFromSceneCenter-this.visibleRegionBufferRadius>1&&(this.visibleRegionBufferRadius=this.maxSplatDistanceFromSceneCenter,this.visibleRegionRadius=Math.max(this.visibleRegionBufferRadius-1,0)),this.finalBuild&&(this.visibleRegionRadius=this.visibleRegionBufferRadius=this.maxSplatDistanceFromSceneCenter),this.updateVisibleRegionFadeDistance()}},{key:"updateVisibleRegionFadeDistance",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Bx,t=.012*this.sceneFadeInRateMultiplier,n=.003*this.sceneFadeInRateMultiplier,r=this.finalBuild?t:n,i=e===Bx?r:n;this.visibleRegionFadeStartRadius=(this.visibleRegionRadius-this.visibleRegionFadeStartRadius)*i+this.visibleRegionFadeStartRadius;var a=(this.visibleRegionBufferRadius>0?this.visibleRegionFadeStartRadius/this.visibleRegionBufferRadius:0)>.99,o=a||e===Ux?1:0;this.material.uniforms.visibleRegionFadeStartRadius.value=this.visibleRegionFadeStartRadius,this.material.uniforms.visibleRegionRadius.value=this.visibleRegionRadius,this.material.uniforms.firstRenderTime.value=this.firstRenderTime,this.material.uniforms.currentTime.value=performance.now(),this.material.uniforms.fadeInComplete.value=o,this.material.uniformsNeedUpdate=!0,this.visibleRegionChanging=!a}},{key:"updateRenderIndexes",value:function(e,t){var n=this.geometry;n.attributes.splatIndex.set(e),n.attributes.splatIndex.needsUpdate=!0,t>0&&-1===this.firstRenderTime&&(this.firstRenderTime=performance.now()),n.instanceCount=t,n.setDrawRange(0,t)}},{key:"updateTransforms",value:function(){for(var e=0;e0&&void 0!==arguments[0]?arguments[0]:1;this.splatScale=e,this.material.uniforms.splatScale.value=e,this.material.uniformsNeedUpdate=!0}},{key:"getSplatScale",value:function(){return this.splatScale}},{key:"setPointCloudModeEnabled",value:function(e){this.pointCloudModeEnabled=e,this.material.uniforms.pointCloudModeEnabled.value=e?1:0,this.material.uniformsNeedUpdate=!0}},{key:"getPointCloudModeEnabled",value:function(){return this.pointCloudModeEnabled}},{key:"getSplatDataTextures",value:function(){return this.splatDataTextures}},{key:"getSplatCount",value:function(){return arguments.length>0&&void 0!==arguments[0]&&arguments[0]?t.getTotalSplatCountForScenes(this.scenes):this.lastBuildSplatCount}},{key:"getMaxSplatCount",value:function(){return t.getTotalMaxSplatCountForScenes(this.scenes)}},{key:"disposeDistancesComputationGPUResources",value:function(){if(this.renderer){var e=this.renderer.getContext();this.distancesTransformFeedback.vao&&(e.deleteVertexArray(this.distancesTransformFeedback.vao),this.distancesTransformFeedback.vao=null),this.distancesTransformFeedback.program&&(e.deleteProgram(this.distancesTransformFeedback.program),e.deleteShader(this.distancesTransformFeedback.vertexShader),e.deleteShader(this.distancesTransformFeedback.fragmentShader),this.distancesTransformFeedback.program=null,this.distancesTransformFeedback.vertexShader=null,this.distancesTransformFeedback.fragmentShader=null),this.disposeDistancesComputationGPUBufferResources(),this.distancesTransformFeedback.id&&(e.deleteTransformFeedback(this.distancesTransformFeedback.id),this.distancesTransformFeedback.id=null)}}},{key:"disposeDistancesComputationGPUBufferResources",value:function(){if(this.renderer){var e=this.renderer.getContext();this.distancesTransformFeedback.centersBuffer&&(this.distancesTransformFeedback.centersBuffer=null,e.deleteBuffer(this.distancesTransformFeedback.centersBuffer)),this.distancesTransformFeedback.outDistancesBuffer&&(e.deleteBuffer(this.distancesTransformFeedback.outDistancesBuffer),this.distancesTransformFeedback.outDistancesBuffer=null)}}},{key:"setRenderer",value:function(e){if(e!==this.renderer){this.renderer=e;var t=this.renderer.getContext(),n=new Ox(t),r=new Fx(t,n,{});if(n.init(r),this.webGLUtils=new Ny(t,n),this.enableDistancesComputationOnGPU&&this.getSplatCount()>0){this.setupDistancesComputationTransformFeedback();var i=this.getDataForDistancesComputation(0,this.getSplatCount()-1),a=i.centers,o=i.sceneIndexes;this.refreshGPUBuffersForDistancesComputation(a,o)}}}},{key:"updateGPUCentersBufferForDistancesComputation",value:function(e,t,n){if(this.renderer){var r=this.renderer.getContext(),i=r.getParameter(r.VERTEX_ARRAY_BINDING);r.bindVertexArray(this.distancesTransformFeedback.vao);var a=this.integerBasedDistancesComputation?Uint32Array:Float32Array,o=16*n;if(r.bindBuffer(r.ARRAY_BUFFER,this.distancesTransformFeedback.centersBuffer),e)r.bufferSubData(r.ARRAY_BUFFER,o,t);else{var s=new a(16*this.getMaxSplatCount());s.set(t),r.bufferData(r.ARRAY_BUFFER,s,r.STATIC_DRAW)}r.bindBuffer(r.ARRAY_BUFFER,null),i&&r.bindVertexArray(i)}}},{key:"updateGPUTransformIndexesBufferForDistancesComputation",value:function(e,t,n){if(this.renderer&&this.dynamicMode){var r=this.renderer.getContext(),i=r.getParameter(r.VERTEX_ARRAY_BINDING);r.bindVertexArray(this.distancesTransformFeedback.vao);var a=4*n;if(r.bindBuffer(r.ARRAY_BUFFER,this.distancesTransformFeedback.sceneIndexesBuffer),e)r.bufferSubData(r.ARRAY_BUFFER,a,t);else{var o=new Uint32Array(4*this.getMaxSplatCount());o.set(t),r.bufferData(r.ARRAY_BUFFER,o,r.STATIC_DRAW)}r.bindBuffer(r.ARRAY_BUFFER,null),i&&r.bindVertexArray(i)}}},{key:"getSceneIndexes",value:function(e,t){var n;n=new Uint32Array(t-e+1);for(var r=e;r<=t;r++)n[r]=this.globalSplatIndexToSceneIndexMap[r];return n}},{key:"getLocalSplatParameters",value:function(e,t,n){null==n&&(n=!this.dynamicMode),t.splatBuffer=this.getSplatBufferForSplat(e),t.localIndex=this.getSplatLocalIndex(e),t.sceneTransform=n?this.getSceneTransformForSplat(e):null}},{key:"fillSplatDataArrays",value:function(e,t,n,r,i,a,o,s){var u=arguments.length>8&&void 0!==arguments[8]?arguments[8]:0,l=arguments.length>9&&void 0!==arguments[9]?arguments[9]:0,c=arguments.length>10&&void 0!==arguments[10]?arguments[10]:1,h=arguments.length>11?arguments[11]:void 0,d=arguments.length>12?arguments[12]:void 0,f=arguments.length>13&&void 0!==arguments[13]?arguments[13]:0,p=arguments.length>14?arguments[14]:void 0,v=new ph;v.x=void 0,v.y=void 0,this.splatRenderMode===wx?v.z=void 0:v.z=1;var m=new Gh,g=0,y=this.scenes.length-1;null!=p&&p>=0&&p<=this.scenes.length&&(g=p,y=p);for(var _=g;_<=y;_++){null==s&&(s=!this.dynamicMode);var b=this.getScene(_),x=b.splatBuffer,S=void 0;if(s&&(this.getSceneTransform(_,m),S=m),e&&x.fillSplatCovarianceArray(e,S,h,d,f,u),t||n){if(!t||!n)throw new Error('SplatMesh::fillSplatDataArrays() -> "scales" and "rotations" must both be valid.');x.fillSplatScaleRotationArray(t,n,S,h,d,f,l,v)}r&&x.fillSplatCenterArray(this.morphedMesh,r,S,h,d,f),i&&x.fillSplatColorArray(i,b.minimumAlpha,h,d,f),a&&x.fillSphericalHarmonicsArray(a,this.minSphericalHarmonicsDegree,S,h,d,f,c),f+=x.getSplatCount()}}},{key:"getIntegerCenters",value:function(e,t){var n,r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=t-e+1,a=new Float32Array(3*i);this.fillSplatDataArrays(null,null,null,a,null,null,void 0,void 0,void 0,void 0,e);var o=r?4:3;n=new Int32Array(i*o);for(var s=0;s2&&void 0!==arguments[2]&&arguments[2],r=t-e+1,i=new Float32Array(3*r);if(this.fillSplatDataArrays(null,null,null,i,null,null,void 0,void 0,void 0,void 0,e),!n)return i;for(var a=new Float32Array(4*r),o=0;o=this.scenes.length)throw new Error("SplatMesh::getScene() -> Invalid scene index.");return this.scenes[e]}},{key:"getSceneCount",value:function(){return this.scenes.length}},{key:"getSplatBufferForSplat",value:function(e){return this.getScene(this.globalSplatIndexToSceneIndexMap[e]).splatBuffer}},{key:"getSceneIndexForSplat",value:function(e){return this.globalSplatIndexToSceneIndexMap[e]}},{key:"getSceneTransformForSplat",value:function(e){return this.getScene(this.globalSplatIndexToSceneIndexMap[e]).transform}},{key:"getSplatLocalIndex",value:function(e){return this.globalSplatIndexToLocalSplatIndexMap[e]}},{key:"computeBoundingBox",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1?arguments[1]:void 0,n=this.getSplatCount();if(null!=t){if(t<0||t>=this.scenes.length)throw new Error("SplatMesh::computeBoundingBox() -> Invalid scene index.");n=this.scenes[t].splatBuffer.getSplatCount()}var r=new Float32Array(3*n);this.fillSplatDataArrays(null,null,null,r,null,null,e,void 0,void 0,void 0,void 0,t);for(var i=new ph,a=new ph,o=0;oa.x)&&(a.x=u),(0===o||l>a.y)&&(a.y=l),(0===o||c>a.z)&&(a.z=c)}return new gh(i,a)}}],[{key:"buildScenes",value:function(e,n,r){var i=[];i.length=n.length;for(var a=0;a5&&void 0!==arguments[5]?arguments[5]:1,!(arguments.length>6&&void 0!==arguments[6])||arguments[6])}},{key:"buildSplatIndexMaps",value:function(e){for(var t=[],n=[],r=0,i=0;i=3&&(o+=2,s=0)}},{key:"updateCenterColorsPaddedData",value:function(e,t,n,r,i){for(var a=e;a<=t;a++){var o=4*a,s=3*a,u=4*a;i[u]=Ru(r,o),i[u+1]=ku(n[s]),i[u+2]=ku(n[s+1]),i[u+3]=ku(n[s+2])}}},{key:"updateScaleRotationsPaddedData",value:function(e,t,n,r,i){for(var a=e;a<=t;a++){var o=3*a,s=4*a,u=6*a;i[u]=n[o],i[u+1]=n[o+1],i[u+2]=n[o+2],i[u+3]=r[s],i[u+4]=r[s+1],i[u+5]=r[s+2]}}},{key:"getTotalSplatCountForScenes",value:function(e){var t,n=0,r=L(e);try{for(r.s();!(t=r.n()).done;){var i=t.value;i&&i.splatBuffer&&(n+=i.splatBuffer.getSplatCount())}}catch(a){r.e(a)}finally{r.f()}return n}},{key:"getTotalSplatCountForSplatBuffers",value:function(e){var t,n=0,r=L(e);try{for(r.s();!(t=r.n()).done;){n+=t.value.getSplatCount()}}catch(i){r.e(i)}finally{r.f()}return n}},{key:"getTotalMaxSplatCountForScenes",value:function(e){var t,n=0,r=L(e);try{for(r.s();!(t=r.n()).done;){var i=t.value;i&&i.splatBuffer&&(n+=i.splatBuffer.getMaxSplatCount())}}catch(a){r.e(a)}finally{r.f()}return n}},{key:"getTotalMaxSplatCountForSplatBuffers",value:function(e){var t,n=0,r=L(e);try{for(r.s();!(t=r.n()).done;){n+=t.value.getMaxSplatCount()}}catch(i){r.e(i)}finally{r.f()}return n}},{key:"getIntegerMatrixArray",value:function(e){for(var t=e.elements,n=[],r=0;r<16;r++)n[r]=Math.round(1e3*t[r]);return n}}])}(gf),Qx="AGFzbQEAAAAADwhkeWxpbmsuMAEEAAAAAAEXAmAAAGAQf39/f39/f39/f39/f39/fwACEgEDZW52Bm1lbW9yeQIDAICABAMDAgABBz4DEV9fd2FzbV9jYWxsX2N0b3JzAAAYX193YXNtX2FwcGx5X2RhdGFfcmVsb2NzAAALc29ydEluZGV4ZXMAAQqiDwICAAucDwMBfAd9Bn8gCyAKayEMAkACQCAOBEAgDQRAQfj///8HIQpBiICAgHghDSALIAxNDQMgDCEFA0AgAyAFQQJ0IgFqIAIgACABaigCAEECdGooAgAiATYCACABIAogASAKSBshCiABIA0gASANShshDSAFQQFqIgUgC0cNAAsMAwsgDwRAIAsgDE0NAkF/IQ9B+P///wchCkGIgICAeCENIAwhAgNAIA8gByAAIAJBAnQiGmooAgBBAnQiG2ooAgAiDkcEQAJ/IAUqAjgiESAIIA5BBnRqIg8qAjyUIAUqAigiEiAPKgI4lCAFKgIIIhMgDyoCMJQgBSoCGCIUIA8qAjSUkpKSu0QAAAAAAECPQKIiEJlEAAAAAAAA4EFjBEAgEKoMAQtBgICAgHgLIRgCfyARIA8qAiyUIBIgDyoCKJQgEyAPKgIglCAUIA8qAiSUkpKSu0QAAAAAAECPQKIiEJlEAAAAAAAA4EFjBEAgEKoMAQtBgICAgHgLIRkCfyARIA8qAhyUIBIgDyoCGJQgEyAPKgIQlCAUIA8qAhSUkpKSu0QAAAAAAECPQKIiEJlEAAAAAAAA4EFjBEAgEKoMAQtBgICAgHgLIRwCfyARIA8qAgyUIBIgDyoCCJQgEyAPKgIAlCAUIA8qAgSUkpKSu0QAAAAAAECPQKIiEJlEAAAAAAAA4EFjBEAgEKoMAQtBgICAgHgLIR0gDiEPCyADIBpqIAEgG0ECdGoiDigCBCAcbCAOKAIAIB1saiAOKAIIIBlsaiAOKAIMIBhsaiIONgIAIA4gCiAKIA5KGyEKIA4gDSANIA5IGyENIAJBAWoiAiALRw0ACwwDCwJ/IAUqAii7RAAAAAAAQI9AoiIQmUQAAAAAAADgQWMEQCAQqgwBC0GAgICAeAshAgJ/IAUqAhi7RAAAAAAAQI9AoiIQmUQAAAAAAADgQWMEQCAQqgwBC0GAgICAeAshByALIAxNAn8gBSoCCLtEAAAAAABAj0CiIhCZRAAAAAAAAOBBYwRAIBCqDAELQYCAgIB4CyEPQfj///8HIQpBiICAgHghDQ0CIAwhBQNAIAMgBUECdCIIaiABIAAgCGooAgBBBHRqIggoAgQgB2wgCCgCACAPbGogCCgCCCACbGoiCDYCACAIIAogCCAKSBshCiAIIA0gCCANShshDSAFQQFqIgUgC0cNAAsMAgsgDQRAQfj///8HIQpBiICAgHghDSALIAxNDQIgDCEFA0AgAyAFQQJ0IgFqAn8gAiAAIAFqKAIAQQJ0aioCALtEAAAAAAAAsECiIhCZRAAAAAAAAOBBYwRAIBCqDAELQYCAgIB4CyIONgIAIAogDiAKIA5IGyEKIA0gDiANIA5KGyENIAVBAWoiBSALRw0ACwwCCyAPRQRAIAsgDE0NASAFKgIoIREgBSoCGCESIAUqAgghE0H4////ByEKQYiAgIB4IQ0gDCEFA0ACfyARIAEgACAFQQJ0IgdqKAIAQQR0aiICKgIIlCATIAIqAgCUIBIgAioCBJSSkrtEAAAAAAAAsECiIhCZRAAAAAAAAOBBYwRAIBCqDAELQYCAgIB4CyEOIAMgB2ogDjYCACAKIA4gCiAOSBshCiANIA4gDSAOShshDSAFQQFqIgUgC0cNAAsMAgsgCyAMTQ0AQX8hD0H4////ByEKQYiAgIB4IQ0gDCECA0AgDyAHIAAgAkECdCIYaigCAEECdCIZaigCACIORwRAIAUqAjgiESAIIA5BBnRqIg8qAjyUIAUqAigiEiAPKgI4lCAFKgIIIhMgDyoCMJQgBSoCGCIUIA8qAjSUkpKSIRUgESAPKgIslCASIA8qAiiUIBMgDyoCIJQgFCAPKgIklJKSkiEWIBEgDyoCHJQgEiAPKgIYlCATIA8qAhCUIBQgDyoCFJSSkpIhFyARIA8qAgyUIBIgDyoCCJQgEyAPKgIAlCAUIA8qAgSUkpKSIREgDiEPCyADIBhqAn8gFSABIBlBAnRqIg4qAgyUIBYgDioCCJQgESAOKgIAlCAXIA4qAgSUkpKSu0QAAAAAAACwQKIiEJlEAAAAAAAA4EFjBEAgEKoMAQtBgICAgHgLIg42AgAgCiAOIAogDkgbIQogDSAOIA0gDkobIQ0gAkEBaiICIAtHDQALDAELQYiAgIB4IQ1B+P///wchCgsgCyAMSwRAIAlBAWuzIA2yIAqyk5UhESAMIQ0DQAJ/IBEgAyANQQJ0aiIBKAIAIAprspQiEotDAAAAT10EQCASqAwBC0GAgICAeAshDiABIA42AgAgBCAOQQJ0aiIBIAEoAgBBAWo2AgAgDUEBaiINIAtHDQALCyAJQQJPBEAgBCgCACENQQEhCgNAIAQgCkECdGoiASABKAIAIA1qIg02AgAgCkEBaiIKIAlHDQALCyAMQQBKBEAgDCEKA0AgBiAKQQFrIgFBAnQiAmogACACaigCADYCACAKQQFLIAEhCg0ACwsgCyAMSgRAIAshCgNAIAYgCyAEIAMgCkEBayIKQQJ0IgFqKAIAQQJ0aiICKAIAIgVrQQJ0aiAAIAFqKAIANgIAIAIgBUEBazYCACAKIAxKDQALCws=";function qx(e){var t,n,r,i,a,o,s,u,l,c,h,d,f,p,v,m,g,y,_,b;e.onmessage=function(x){if(x.data.centers)centers=x.data.centers,sceneIndexes=x.data.sceneIndexes,i?new Int32Array(n,p+x.data.range.from*b.BytesPerInt*4,4*x.data.range.count).set(new Int32Array(centers)):new Float32Array(n,p+x.data.range.from*b.BytesPerFloat*4,4*x.data.range.count).set(new Float32Array(centers)),a&&new Uint32Array(n,l+4*x.data.range.from,x.data.range.count).set(new Uint32Array(sceneIndexes)),_=x.data.range.from+x.data.range.count;else if(x.data.sort){var S,A,w,T=Math.min(x.data.sort.splatRenderCount||0,_),M=Math.min(x.data.sort.splatSortCount||0,_),E=x.data.sort.usePrecomputedDistances;r||(S=x.data.sort.indexesToSort,w=x.data.sort.transforms,E&&(A=x.data.sort.precomputedDistances)),function(_,x,S,A,w,T,M){var E=performance.now();r||(new Uint32Array(n,s,w.byteLength/b.BytesPerInt).set(w),new Float32Array(n,c,M.byteLength/b.BytesPerFloat).set(M),A&&(i?new Int32Array(n,h,T.byteLength/b.BytesPerInt):new Float32Array(n,h,T.byteLength/b.BytesPerFloat)).set(T)),m||(m=new Uint32Array(y)),new Float32Array(n,v,16).set(S),new Uint32Array(n,f,y).set(m),t.exports.sortIndexes(s,p,h,d,f,v,u,l,c,y,_,x,o,A,i,a);var C={sortDone:!0,splatSortCount:_,splatRenderCount:x,sortTime:0};if(!r){var k=new Uint32Array(n,u,x);(!g||g.length5&&void 0!==arguments[5]?arguments[5]:zy.DefaultSplatSortDistanceMapPrecision,o=new Worker(URL.createObjectURL(new Blob(["(",qx.toString(),")(self)"],{type:"application/javascript"}))),s="AGFzbQEAAAAADwhkeWxpbmsuMAEEAAAAAAEbA2AAAGAQf39/f39/f39/f39/f39/fwBgAAF/AhIBA2VudgZtZW1vcnkCAwCAgAQDBAMAAQIHVAQRX193YXNtX2NhbGxfY3RvcnMAABhfX3dhc21fYXBwbHlfZGF0YV9yZWxvY3MAAAtzb3J0SW5kZXhlcwABE2Vtc2NyaXB0ZW5fdGxzX2luaXQAAgqWEAMDAAELihAEAXwDewN/A30gCyAKayEMAkACQCAOBEAgDQRAQfj///8HIQpBiICAgHghDSALIAxNDQMgDCEBA0AgAyABQQJ0IgVqIAIgACAFaigCAEECdGooAgAiBTYCACAFIAogBSAKSBshCiAFIA0gBSANShshDSABQQFqIgEgC0cNAAsMAwsgDwRAIAsgDE0NAkF/IQ9B+P///wchCkGIgICAeCENIAwhAgNAIA8gByAAIAJBAnQiFWooAgAiFkECdGooAgAiFEcEQAJ/IAX9CQI4IAggFEEGdGoiDv0JAgwgDioCHP0gASAOKgIs/SACIA4qAjz9IAP95gEgBf0JAiggDv0JAgggDioCGP0gASAOKgIo/SACIA4qAjj9IAP95gEgBf0JAgggDv0JAgAgDioCEP0gASAOKgIg/SACIA4qAjD9IAP95gEgBf0JAhggDv0JAgQgDioCFP0gASAOKgIk/SACIA4qAjT9IAP95gH95AH95AH95AEiEf1f/QwAAAAAAECPQAAAAAAAQI9AIhL98gEiE/0hASIQmUQAAAAAAADgQWMEQCAQqgwBC0GAgICAeAshDgJ/IBP9IQAiEJlEAAAAAAAA4EFjBEAgEKoMAQtBgICAgHgL/REgDv0cAQJ/IBEgEf0NCAkKCwwNDg8AAAAAAAAAAP1fIBL98gEiEf0hACIQmUQAAAAAAADgQWMEQCAQqgwBC0GAgICAeAv9HAICfyAR/SEBIhCZRAAAAAAAAOBBYwRAIBCqDAELQYCAgIB4C/0cAyESIBQhDwsgAyAVaiABIBZBBHRq/QAAACAS/bUBIhH9GwAgEf0bAWogEf0bAmogEf0bA2oiDjYCACAOIAogCiAOShshCiAOIA0gDSAOSBshDSACQQFqIgIgC0cNAAsMAwsCfyAFKgIIu/0UIAUqAhi7/SIB/QwAAAAAAECPQAAAAAAAQI9A/fIBIhH9IQEiEJlEAAAAAAAA4EFjBEAgEKoMAQtBgICAgHgLIQ4CfyAR/SEAIhCZRAAAAAAAAOBBYwRAIBCqDAELQYCAgIB4CyECAn8gBSoCKLtEAAAAAABAj0CiIhCZRAAAAAAAAOBBYwRAIBCqDAELQYCAgIB4CyEFQfj///8HIQpBiICAgHghDSALIAxNDQIgAv0RIA79HAEgBf0cAiESIAwhBQNAIAMgBUECdCICaiABIAAgAmooAgBBBHRq/QAAACAS/bUBIhH9GwAgEf0bAWogEf0bAmoiAjYCACACIAogAiAKSBshCiACIA0gAiANShshDSAFQQFqIgUgC0cNAAsMAgsgDQRAQfj///8HIQpBiICAgHghDSALIAxNDQIgDCEBA0AgAyABQQJ0IgVqAn8gAiAAIAVqKAIAQQJ0aioCALtEAAAAAAAAsECiIhCZRAAAAAAAAOBBYwRAIBCqDAELQYCAgIB4CyIONgIAIAogDiAKIA5IGyEKIA0gDiANIA5KGyENIAFBAWoiASALRw0ACwwCCyAPRQRAIAsgDE0NASAFKgIoIRcgBSoCGCEYIAUqAgghGUH4////ByEKQYiAgIB4IQ0gDCEFA0ACfyAXIAEgACAFQQJ0IgdqKAIAQQR0aiICKgIIlCAZIAIqAgCUIBggAioCBJSSkrtEAAAAAAAAsECiIhCZRAAAAAAAAOBBYwRAIBCqDAELQYCAgIB4CyEOIAMgB2ogDjYCACAKIA4gCiAOSBshCiANIA4gDSAOShshDSAFQQFqIgUgC0cNAAsMAgsgCyAMTQ0AQX8hD0H4////ByEKQYiAgIB4IQ0gDCECA0AgDyAHIAAgAkECdCIUaigCAEECdCIVaigCACIORwRAIAX9CQI4IAggDkEGdGoiD/0JAgwgDyoCHP0gASAPKgIs/SACIA8qAjz9IAP95gEgBf0JAiggD/0JAgggDyoCGP0gASAPKgIo/SACIA8qAjj9IAP95gEgBf0JAgggD/0JAgAgDyoCEP0gASAPKgIg/SACIA8qAjD9IAP95gEgBf0JAhggD/0JAgQgDyoCFP0gASAPKgIk/SACIA8qAjT9IAP95gH95AH95AH95AEhESAOIQ8LIAMgFGoCfyAR/R8DIAEgFUECdCIOQQxyaioCAJQgEf0fAiABIA5BCHJqKgIAlCAR/R8AIAEgDmoqAgCUIBH9HwEgASAOQQRyaioCAJSSkpK7RAAAAAAAALBAoiIQmUQAAAAAAADgQWMEQCAQqgwBC0GAgICAeAsiDjYCACAKIA4gCiAOSBshCiANIA4gDSAOShshDSACQQFqIgIgC0cNAAsMAQtBiICAgHghDUH4////ByEKCyALIAxLBEAgCUEBa7MgDbIgCrKTlSEXIAwhDQNAAn8gFyADIA1BAnRqIgEoAgAgCmuylCIYi0MAAABPXQRAIBioDAELQYCAgIB4CyEOIAEgDjYCACAEIA5BAnRqIgEgASgCAEEBajYCACANQQFqIg0gC0cNAAsLIAlBAk8EQCAEKAIAIQ1BASEKA0AgBCAKQQJ0aiIBIAEoAgAgDWoiDTYCACAKQQFqIgogCUcNAAsLIAxBAEoEQCAMIQoDQCAGIApBAWsiAUECdCICaiAAIAJqKAIANgIAIApBAUshAiABIQogAg0ACwsgCyAMSgRAIAshCgNAIAYgCyAEIAMgCkEBayIKQQJ0IgFqKAIAQQJ0aiICKAIAIgVrQQJ0aiAAIAFqKAIANgIAIAIgBUEBazYCACAKIAxKDQALCwsEAEEACw==",u=zu()?Vu():null;n||t?n?t||u&&u.major<=16&&u.minor<4&&(s="AGFzbQEAAAAADwhkeWxpbmsuMAEEAAAAAAEXAmAAAGAQf39/f39/f39/f39/f39/fwACDwEDZW52Bm1lbW9yeQIAAAMDAgABBz4DEV9fd2FzbV9jYWxsX2N0b3JzAAAYX193YXNtX2FwcGx5X2RhdGFfcmVsb2NzAAALc29ydEluZGV4ZXMAAQrrDwICAAvlDwQBfAN7B30DfyALIAprIQwCQAJAIA4EQCANBEBB+P///wchCkGIgICAeCENIAsgDE0NAyAMIQUDQCADIAVBAnQiAWogAiAAIAFqKAIAQQJ0aigCACIBNgIAIAEgCiABIApIGyEKIAEgDSABIA1KGyENIAVBAWoiBSALRw0ACwwDCyAPBEAgCyAMTQ0CQX8hD0H4////ByEKQYiAgIB4IQ0gDCECA0AgDyAHIAAgAkECdCIcaigCACIdQQJ0aigCACIbRwRAAn8gBf0JAjggCCAbQQZ0aiIO/QkCDCAOKgIc/SABIA4qAiz9IAIgDioCPP0gA/3mASAF/QkCKCAO/QkCCCAOKgIY/SABIA4qAij9IAIgDioCOP0gA/3mASAF/QkCCCAO/QkCACAOKgIQ/SABIA4qAiD9IAIgDioCMP0gA/3mASAF/QkCGCAO/QkCBCAOKgIU/SABIA4qAiT9IAIgDioCNP0gA/3mAf3kAf3kAf3kASIR/V/9DAAAAAAAQI9AAAAAAABAj0AiEv3yASIT/SEBIhCZRAAAAAAAAOBBYwRAIBCqDAELQYCAgIB4CyEOAn8gE/0hACIQmUQAAAAAAADgQWMEQCAQqgwBC0GAgICAeAv9ESAO/RwBAn8gESAR/Q0ICQoLDA0ODwABAgMAAQID/V8gEv3yASIR/SEAIhCZRAAAAAAAAOBBYwRAIBCqDAELQYCAgIB4C/0cAgJ/IBH9IQEiEJlEAAAAAAAA4EFjBEAgEKoMAQtBgICAgHgL/RwDIRIgGyEPCyADIBxqIAEgHUEEdGr9AAAAIBL9tQEiEf0bACAR/RsBaiAR/RsCaiAR/RsDaiIONgIAIA4gCiAKIA5KGyEKIA4gDSANIA5IGyENIAJBAWoiAiALRw0ACwwDCwJ/IAUqAgi7/RQgBSoCGLv9IgH9DAAAAAAAQI9AAAAAAABAj0D98gEiEf0hASIQmUQAAAAAAADgQWMEQCAQqgwBC0GAgICAeAshDgJ/IBH9IQAiEJlEAAAAAAAA4EFjBEAgEKoMAQtBgICAgHgLAn8gBSoCKLtEAAAAAABAj0CiIhCZRAAAAAAAAOBBYwRAIBCqDAELQYCAgIB4CyEFQfj///8HIQpBiICAgHghDSALIAxNDQL9ESAO/RwBIAX9HAIhEiAMIQUDQCADIAVBAnQiAmogASAAIAJqKAIAQQR0av0AAAAgEv21ASIR/RsAIBH9GwFqIBH9GwJqIgI2AgAgAiAKIAIgCkgbIQogAiANIAIgDUobIQ0gBUEBaiIFIAtHDQALDAILIA0EQEH4////ByEKQYiAgIB4IQ0gCyAMTQ0CIAwhBQNAIAMgBUECdCIBagJ/IAIgACABaigCAEECdGoqAgC7RAAAAAAAALBAoiIQmUQAAAAAAADgQWMEQCAQqgwBC0GAgICAeAsiDjYCACAKIA4gCiAOSBshCiANIA4gDSAOShshDSAFQQFqIgUgC0cNAAsMAgsgD0UEQCALIAxNDQEgBSoCKCEUIAUqAhghFSAFKgIIIRZB+P///wchCkGIgICAeCENIAwhBQNAAn8gFCABIAAgBUECdCIHaigCAEEEdGoiAioCCJQgFiACKgIAlCAVIAIqAgSUkpK7RAAAAAAAALBAoiIQmUQAAAAAAADgQWMEQCAQqgwBC0GAgICAeAshDiADIAdqIA42AgAgCiAOIAogDkgbIQogDSAOIA0gDkobIQ0gBUEBaiIFIAtHDQALDAILIAsgDE0NAEF/IQ9B+P///wchCkGIgICAeCENIAwhAgNAIA8gByAAIAJBAnQiG2ooAgBBAnQiHGooAgAiDkcEQCAFKgI4IhQgCCAOQQZ0aiIPKgI8lCAFKgIoIhUgDyoCOJQgBSoCCCIWIA8qAjCUIAUqAhgiFyAPKgI0lJKSkiEYIBQgDyoCLJQgFSAPKgIolCAWIA8qAiCUIBcgDyoCJJSSkpIhGSAUIA8qAhyUIBUgDyoCGJQgFiAPKgIQlCAXIA8qAhSUkpKSIRogFCAPKgIMlCAVIA8qAgiUIBYgDyoCAJQgFyAPKgIElJKSkiEUIA4hDwsgAyAbagJ/IBggASAcQQJ0aiIOKgIMlCAZIA4qAgiUIBQgDioCAJQgGiAOKgIElJKSkrtEAAAAAAAAsECiIhCZRAAAAAAAAOBBYwRAIBCqDAELQYCAgIB4CyIONgIAIAogDiAKIA5IGyEKIA0gDiANIA5KGyENIAJBAWoiAiALRw0ACwwBC0GIgICAeCENQfj///8HIQoLIAsgDEsEQCAJQQFrsyANsiAKspOVIRQgDCENA0ACfyAUIAMgDUECdGoiASgCACAKa7KUIhWLQwAAAE9dBEAgFagMAQtBgICAgHgLIQ4gASAONgIAIAQgDkECdGoiASABKAIAQQFqNgIAIA1BAWoiDSALRw0ACwsgCUECTwRAIAQoAgAhDUEBIQoDQCAEIApBAnRqIgEgASgCACANaiINNgIAIApBAWoiCiAJRw0ACwsgDEEASgRAIAwhCgNAIAYgCkEBayIBQQJ0IgJqIAAgAmooAgA2AgAgCkEBSyABIQoNAAsLIAsgDEoEQCALIQoDQCAGIAsgBCADIApBAWsiCkECdCIBaigCAEECdGoiAigCACIFa0ECdGogACABaigCADYCACACIAVBAWs2AgAgCiAMSg0ACwsL"):s=Qx:(s=Qx,u&&u.major<=16&&u.minor<4&&(s="AGFzbQEAAAAADwhkeWxpbmsuMAEEAAAAAAEXAmAAAGAQf39/f39/f39/f39/f39/fwACDwEDZW52Bm1lbW9yeQIAAAMDAgABBz4DEV9fd2FzbV9jYWxsX2N0b3JzAAAYX193YXNtX2FwcGx5X2RhdGFfcmVsb2NzAAALc29ydEluZGV4ZXMAAQqiDwICAAucDwMBfAd9Bn8gCyAKayEMAkACQCAOBEAgDQRAQfj///8HIQpBiICAgHghDSALIAxNDQMgDCEFA0AgAyAFQQJ0IgFqIAIgACABaigCAEECdGooAgAiATYCACABIAogASAKSBshCiABIA0gASANShshDSAFQQFqIgUgC0cNAAsMAwsgDwRAIAsgDE0NAkF/IQ9B+P///wchCkGIgICAeCENIAwhAgNAIA8gByAAIAJBAnQiGmooAgBBAnQiG2ooAgAiDkcEQAJ/IAUqAjgiESAIIA5BBnRqIg8qAjyUIAUqAigiEiAPKgI4lCAFKgIIIhMgDyoCMJQgBSoCGCIUIA8qAjSUkpKSu0QAAAAAAECPQKIiEJlEAAAAAAAA4EFjBEAgEKoMAQtBgICAgHgLIRgCfyARIA8qAiyUIBIgDyoCKJQgEyAPKgIglCAUIA8qAiSUkpKSu0QAAAAAAECPQKIiEJlEAAAAAAAA4EFjBEAgEKoMAQtBgICAgHgLIRkCfyARIA8qAhyUIBIgDyoCGJQgEyAPKgIQlCAUIA8qAhSUkpKSu0QAAAAAAECPQKIiEJlEAAAAAAAA4EFjBEAgEKoMAQtBgICAgHgLIRwCfyARIA8qAgyUIBIgDyoCCJQgEyAPKgIAlCAUIA8qAgSUkpKSu0QAAAAAAECPQKIiEJlEAAAAAAAA4EFjBEAgEKoMAQtBgICAgHgLIR0gDiEPCyADIBpqIAEgG0ECdGoiDigCBCAcbCAOKAIAIB1saiAOKAIIIBlsaiAOKAIMIBhsaiIONgIAIA4gCiAKIA5KGyEKIA4gDSANIA5IGyENIAJBAWoiAiALRw0ACwwDCwJ/IAUqAii7RAAAAAAAQI9AoiIQmUQAAAAAAADgQWMEQCAQqgwBC0GAgICAeAshAgJ/IAUqAhi7RAAAAAAAQI9AoiIQmUQAAAAAAADgQWMEQCAQqgwBC0GAgICAeAshByALIAxNAn8gBSoCCLtEAAAAAABAj0CiIhCZRAAAAAAAAOBBYwRAIBCqDAELQYCAgIB4CyEPQfj///8HIQpBiICAgHghDQ0CIAwhBQNAIAMgBUECdCIIaiABIAAgCGooAgBBBHRqIggoAgQgB2wgCCgCACAPbGogCCgCCCACbGoiCDYCACAIIAogCCAKSBshCiAIIA0gCCANShshDSAFQQFqIgUgC0cNAAsMAgsgDQRAQfj///8HIQpBiICAgHghDSALIAxNDQIgDCEFA0AgAyAFQQJ0IgFqAn8gAiAAIAFqKAIAQQJ0aioCALtEAAAAAAAAsECiIhCZRAAAAAAAAOBBYwRAIBCqDAELQYCAgIB4CyIONgIAIAogDiAKIA5IGyEKIA0gDiANIA5KGyENIAVBAWoiBSALRw0ACwwCCyAPRQRAIAsgDE0NASAFKgIoIREgBSoCGCESIAUqAgghE0H4////ByEKQYiAgIB4IQ0gDCEFA0ACfyARIAEgACAFQQJ0IgdqKAIAQQR0aiICKgIIlCATIAIqAgCUIBIgAioCBJSSkrtEAAAAAAAAsECiIhCZRAAAAAAAAOBBYwRAIBCqDAELQYCAgIB4CyEOIAMgB2ogDjYCACAKIA4gCiAOSBshCiANIA4gDSAOShshDSAFQQFqIgUgC0cNAAsMAgsgCyAMTQ0AQX8hD0H4////ByEKQYiAgIB4IQ0gDCECA0AgDyAHIAAgAkECdCIYaigCAEECdCIZaigCACIORwRAIAUqAjgiESAIIA5BBnRqIg8qAjyUIAUqAigiEiAPKgI4lCAFKgIIIhMgDyoCMJQgBSoCGCIUIA8qAjSUkpKSIRUgESAPKgIslCASIA8qAiiUIBMgDyoCIJQgFCAPKgIklJKSkiEWIBEgDyoCHJQgEiAPKgIYlCATIA8qAhCUIBQgDyoCFJSSkpIhFyARIA8qAgyUIBIgDyoCCJQgEyAPKgIAlCAUIA8qAgSUkpKSIREgDiEPCyADIBhqAn8gFSABIBlBAnRqIg4qAgyUIBYgDioCCJQgESAOKgIAlCAXIA4qAgSUkpKSu0QAAAAAAACwQKIiEJlEAAAAAAAA4EFjBEAgEKoMAQtBgICAgHgLIg42AgAgCiAOIAogDkgbIQogDSAOIA0gDkobIQ0gAkEBaiICIAtHDQALDAELQYiAgIB4IQ1B+P///wchCgsgCyAMSwRAIAlBAWuzIA2yIAqyk5UhESAMIQ0DQAJ/IBEgAyANQQJ0aiIBKAIAIAprspQiEotDAAAAT10EQCASqAwBC0GAgICAeAshDiABIA42AgAgBCAOQQJ0aiIBIAEoAgBBAWo2AgAgDUEBaiINIAtHDQALCyAJQQJPBEAgBCgCACENQQEhCgNAIAQgCkECdGoiASABKAIAIA1qIg02AgAgCkEBaiIKIAlHDQALCyAMQQBKBEAgDCEKA0AgBiAKQQFrIgFBAnQiAmogACACaigCADYCACAKQQFLIAEhCg0ACwsgCyAMSgRAIAshCgNAIAYgCyAEIAMgCkEBayIKQQJ0IgFqKAIAQQJ0aiICKAIAIgVrQQJ0aiAAIAFqKAIANgIAIAIgBUEBazYCACAKIAxKDQALCws="));for(var l=atob(s),c=new Uint8Array(l.length),h=0;h1&&void 0!==arguments[1]?arguments[1]:{},r=document.createElement("button");function i(){r.style.display="",r.style.cursor="auto",r.style.left="calc(50% - 75px)",r.style.width="150px",r.onmouseenter=null,r.onmouseleave=null,r.onclick=null}function a(e){e.style.position="absolute",e.style.bottom="20px",e.style.padding="12px 6px",e.style.border="1px solid #fff",e.style.borderRadius="4px",e.style.background="rgba(0,0,0,0.1)",e.style.color="#fff",e.style.font="normal 13px sans-serif",e.style.textAlign="center",e.style.opacity="0.5",e.style.outline="none",e.style.zIndex="999"}if("xr"in navigator)return r.id="VRButton",r.style.display="none",a(r),navigator.xr.isSessionSupported("immersive-vr").then(function(a){a?function(){var e=null;function i(e){return a.apply(this,arguments)}function a(){return(a=v(d().m(function n(i){return d().w(function(n){for(;;)switch(n.n){case 0:return i.addEventListener("end",o),n.n=1,t.xr.setSession(i);case 1:r.textContent="EXIT VR",e=i;case 2:return n.a(2)}},n)}))).apply(this,arguments)}function o(){e.removeEventListener("end",o),r.textContent="ENTER VR",e=null}r.style.display="",r.style.cursor="pointer",r.style.left="calc(50% - 50px)",r.style.width="100px",r.textContent="ENTER VR";var u=s(s({},n),{},{optionalFeatures:["local-floor","bounded-floor","layers"].concat(I(n.optionalFeatures||[]))});r.onmouseenter=function(){r.style.opacity="1.0"},r.onmouseleave=function(){r.style.opacity="0.5"},r.onclick=function(){null===e?navigator.xr.requestSession("immersive-vr",u).then(i):(e.end(),void 0!==navigator.xr.offerSession&&navigator.xr.offerSession("immersive-vr",u).then(i).catch(function(e){console.warn(e)}))},void 0!==navigator.xr.offerSession&&navigator.xr.offerSession("immersive-vr",u).then(i).catch(function(e){console.warn(e)})}():(i(),r.textContent="VR NOT SUPPORTED"),a&&e.xrSessionIsGranted&&r.click()}).catch(function(e){i(),console.warn("Exception when trying to call xr.isSessionSupported",e),r.textContent="VR NOT ALLOWED"}),r;var o=document.createElement("a");return!1===window.isSecureContext?(o.href=document.location.href.replace(/^http:/,"https:"),o.innerHTML="WEBXR NEEDS HTTPS"):(o.href="https://immersiveweb.dev/",o.innerHTML="WEBXR NOT AVAILABLE"),o.style.left="calc(50% - 90px)",o.style.width="180px",o.style.textDecoration="none",a(o),o}},{key:"registerSessionGrantedListener",value:function(){if("undefined"!=typeof navigator&&"xr"in navigator){if(/WebXRViewer\//i.test(navigator.userAgent))return;navigator.xr.addEventListener("sessiongranted",function(){e.xrSessionIsGranted=!0})}}}])}();Jx.xrSessionIsGranted=!1,Jx.registerSessionGrantedListener();var $x=function(){return T(function e(){A(this,e)},null,[{key:"createButton",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=document.createElement("button");function r(){n.style.display="",n.style.cursor="auto",n.style.left="calc(50% - 75px)",n.style.width="150px",n.onmouseenter=null,n.onmouseleave=null,n.onclick=null}function i(e){e.style.position="absolute",e.style.bottom="20px",e.style.padding="12px 6px",e.style.border="1px solid #fff",e.style.borderRadius="4px",e.style.background="rgba(0,0,0,0.1)",e.style.color="#fff",e.style.font="normal 13px sans-serif",e.style.textAlign="center",e.style.opacity="0.5",e.style.outline="none",e.style.zIndex="999"}if("xr"in navigator)return n.id="ARButton",n.style.display="none",i(n),navigator.xr.isSessionSupported("immersive-ar").then(function(i){i?function(){if(void 0===t.domOverlay){var r=document.createElement("div");r.style.display="none",document.body.appendChild(r);var i=document.createElementNS("http://www.w3.org/2000/svg","svg");i.setAttribute("width",38),i.setAttribute("height",38),i.style.position="absolute",i.style.right="20px",i.style.top="20px",i.addEventListener("click",function(){o.end()}),r.appendChild(i);var a=document.createElementNS("http://www.w3.org/2000/svg","path");a.setAttribute("d","M 12,12 L 28,28 M 28,12 12,28"),a.setAttribute("stroke","#fff"),a.setAttribute("stroke-width",2),i.appendChild(a),void 0===t.optionalFeatures&&(t.optionalFeatures=[]),t.optionalFeatures.push("dom-overlay"),t.domOverlay={root:r}}var o=null;function s(e){return u.apply(this,arguments)}function u(){return(u=v(d().m(function r(i){return d().w(function(r){for(;;)switch(r.n){case 0:return i.addEventListener("end",l),e.xr.setReferenceSpaceType("local"),r.n=1,e.xr.setSession(i);case 1:n.textContent="STOP AR",t.domOverlay.root.style.display="",o=i;case 2:return r.a(2)}},r)}))).apply(this,arguments)}function l(){o.removeEventListener("end",l),n.textContent="START AR",t.domOverlay.root.style.display="none",o=null}n.style.display="",n.style.cursor="pointer",n.style.left="calc(50% - 50px)",n.style.width="100px",n.textContent="START AR",n.onmouseenter=function(){n.style.opacity="1.0"},n.onmouseleave=function(){n.style.opacity="0.5"},n.onclick=function(){null===o?navigator.xr.requestSession("immersive-ar",t).then(s):(o.end(),void 0!==navigator.xr.offerSession&&navigator.xr.offerSession("immersive-ar",t).then(s).catch(function(e){console.warn(e)}))},void 0!==navigator.xr.offerSession&&navigator.xr.offerSession("immersive-ar",t).then(s).catch(function(e){console.warn(e)})}():(r(),n.textContent="AR NOT SUPPORTED")}).catch(function(e){r(),console.warn("Exception when trying to call xr.isSessionSupported",e),n.textContent="AR NOT ALLOWED"}),n;var a=document.createElement("a");return!1===window.isSecureContext?(a.href=document.location.href.replace(/^http:/,"https:"),a.innerHTML="WEBXR NEEDS HTTPS"):(a.href="https://immersiveweb.dev/",a.innerHTML="WEBXR NOT AVAILABLE"),a.style.left="calc(50% - 90px)",a.style.width="180px",a.style.textDecoration="none",i(a),a}}])}(),eS=0,tS=2,nS=["alphaMap","alphaTest","anisotropy","anisotropyMap","anisotropyRotation","aoMap","attenuationColor","attenuationDistance","bumpMap","clearcoat","clearcoatMap","clearcoatNormalMap","clearcoatNormalScale","clearcoatRoughness","color","dispersion","displacementMap","emissive","emissiveMap","envMap","gradientMap","ior","iridescence","iridescenceIOR","iridescenceMap","iridescenceThicknessMap","lightMap","map","matcap","metalness","metalnessMap","normalMap","normalScale","opacity","roughness","roughnessMap","sheen","sheenColor","sheenColorMap","sheenRoughnessMap","shininess","specular","specularColor","specularColorMap","specularIntensity","specularIntensityMap","specularMap","thickness","transmission","transmissionMap"],rS=function(){return T(function e(t){A(this,e),this.renderObjects=new WeakMap,this.hasNode=this.containsNode(t),this.hasAnimation=!0===t.object.isSkinnedMesh,this.refreshUniforms=nS,this.renderId=0},[{key:"firstInitialization",value:function(e){return!1===this.renderObjects.has(e)&&(this.getRenderObjectData(e),!0)}},{key:"getRenderObjectData",value:function(e){var t=this.renderObjects.get(e);if(void 0===t){var n=e.geometry,r=e.material,i=e.object;if(t={material:this.getMaterialData(r),geometry:{id:n.id,attributes:this.getAttributesData(n.attributes),indexVersion:n.index?n.index.version:null,drawRange:{start:n.drawRange.start,count:n.drawRange.count}},worldMatrix:i.matrixWorld.clone()},i.center&&(t.center=i.center.clone()),i.morphTargetInfluences&&(t.morphTargetInfluences=i.morphTargetInfluences.slice()),null!==e.bundle&&(t.version=e.bundle.version),t.material.transmission>0){var a=e.context,o=a.width,s=a.height;t.bufferWidth=o,t.bufferHeight=s}this.renderObjects.set(e,t)}return t}},{key:"getAttributesData",value:function(e){var t={};for(var n in e){var r=e[n];t[n]={version:r.version}}return t}},{key:"containsNode",value:function(e){var t=e.material;for(var n in t)if(t[n]&&t[n].isNode)return!0;return null!==e.renderer.nodes.modelViewMatrix||null!==e.renderer.nodes.modelNormalViewMatrix}},{key:"getMaterialData",value:function(e){var t,n={},r=L(this.refreshUniforms);try{for(r.s();!(t=r.n()).done;){var i=t.value,a=e[i];null!=a&&("object"===P(a)&&void 0!==a.clone?!0===a.isTexture?n[i]={id:a.id,version:a.version}:n[i]=a.clone():n[i]=a)}}catch(o){r.e(o)}finally{r.f()}return n}},{key:"equals",value:function(e){var t=e.object,n=e.material,r=e.geometry,i=this.getRenderObjectData(e);if(!0!==i.worldMatrix.equals(t.matrixWorld))return i.worldMatrix.copy(t.matrixWorld),!1;var a=i.material;for(var o in a){var s=a[o],u=n[o];if(void 0!==s.equals){if(!1===s.equals(u))return s.copy(u),!1}else if(!0===u.isTexture){if(s.id!==u.id||s.version!==u.version)return s.id=u.id,s.version=u.version,!1}else if(s!==u)return a[o]=u,!1}if(a.transmission>0){var l=e.context,c=l.width,h=l.height;if(i.bufferWidth!==c||i.bufferHeight!==h)return i.bufferWidth=c,i.bufferHeight=h,!1}var d=i.geometry,f=r.attributes,p=d.attributes,v=Object.keys(p),m=Object.keys(f);if(d.id!==r.id)return d.id=r.id,!1;if(v.length!==m.length)return i.geometry.attributes=this.getAttributesData(f),!1;for(var g=0,y=v;g1&&void 0!==arguments[1]?arguments[1]:0,n=3735928559^t,r=1103547991^t;if(e instanceof Array)for(var i,a=0;a>>16,2246822507),n^=Math.imul(r^r>>>13,3266489909),r=Math.imul(r^r>>>16,2246822507),4294967296*(2097151&(r^=Math.imul(n^n>>>13,3266489909)))+(n>>>0)}var aS=function(e){return iS(e)},oS=function(){for(var e=arguments.length,t=new Array(e),n=0;n1&&void 0!==arguments[1]&&arguments[1],n=[];!0===e.isNode&&(n.push(e.id),e=e.getSelf());var r,i=L(uS(e));try{for(i.s();!(r=i.n()).done;){var a=r.value,o=a.property,s=a.childNode;n.push(iS(o.slice(0,-4)),s.getCacheKey(t))}}catch(u){i.e(u)}finally{i.f()}return iS(n)}function uS(e){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return d().m(function r(){var i,a,o,s,u,l,c,h,f,p;return d().w(function(r){for(;;)switch(r.n){case 0:c=t(e);case 1:if((h=c()).done){r.n=12;break}if(!0!==(i=h.value).startsWith("_")){r.n=2;break}return r.a(3,1);case 2:if(a=e[i],!0!==Array.isArray(a)){r.n=6;break}o=0;case 3:if(!(o1?t-1:0),r=1;r0&&void 0!==arguments[0]?arguments[0]:null;return A(this,t),(e=y(this,t)).nodeType=n,e.updateType=_S.NONE,e.updateBeforeType=_S.NONE,e.updateAfterType=_S.NONE,e.uuid=zc.generateUUID(),e.version=0,e.global=!1,e.isNode=!0,e._cacheKey=null,e._cacheKeyVersion=0,Object.defineProperty(e,"id",{value:wS++}),e}return x(t,e),T(t,[{key:"needsUpdate",set:function(e){!0===e&&this.version++}},{key:"type",get:function(){return this.constructor.type}},{key:"onUpdate",value:function(e,t){return this.updateType=t,this.update=e.bind(this.getSelf()),this}},{key:"onFrameUpdate",value:function(e){return this.onUpdate(e,_S.FRAME)}},{key:"onRenderUpdate",value:function(e){return this.onUpdate(e,_S.RENDER)}},{key:"onObjectUpdate",value:function(e){return this.onUpdate(e,_S.OBJECT)}},{key:"onReference",value:function(e){return this.updateReference=e.bind(this.getSelf()),this}},{key:"getSelf",value:function(){return this.self||this}},{key:"updateReference",value:function(){return this}},{key:"isGlobal",value:function(){return this.global}},{key:"getChildren",value:d().m(function e(){var t,n,r,i;return d().w(function(e){for(;;)switch(e.n){case 0:t=L(uS(this)),e.p=1,t.s();case 2:if((n=t.n()).done){e.n=4;break}return r=n.value.childNode,e.n=3,r;case 3:e.n=2;break;case 4:e.n=6;break;case 5:e.p=5,i=e.v,t.e(i);case 6:return e.p=6,t.f(),e.f(6);case 7:return e.a(2)}},e,this,[[1,5,6,7]])})},{key:"dispose",value:function(){this.dispatchEvent({type:"dispose"})}},{key:"traverse",value:function(e){e(this);var t,n=L(this.getChildren());try{for(n.s();!(t=n.n()).done;){t.value.traverse(e)}}catch(r){n.e(r)}finally{n.f()}}},{key:"getCacheKey",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return!0!==(e=e||this.version!==this._cacheKeyVersion)&&null!==this._cacheKey||(this._cacheKey=oS(sS(this,e),this.customCacheKey()),this._cacheKeyVersion=this.version),this._cacheKey}},{key:"customCacheKey",value:function(){return 0}},{key:"getScope",value:function(){return this}},{key:"getHash",value:function(){return this.uuid}},{key:"getUpdateType",value:function(){return this.updateType}},{key:"getUpdateBeforeType",value:function(){return this.updateBeforeType}},{key:"getUpdateAfterType",value:function(){return this.updateAfterType}},{key:"getElementType",value:function(e){var t=this.getNodeType(e);return e.getElementType(t)}},{key:"getMemberType",value:function(){return"void"}},{key:"getNodeType",value:function(e){var t=e.getNodeProperties(this);return t.outputNode?t.outputNode.getNodeType(e):this.nodeType}},{key:"getShared",value:function(e){var t=this.getHash(e);return e.getNodeFromHash(t)||this}},{key:"setup",value:function(e){var t,n=e.getNodeProperties(this),r=0,i=L(this.getChildren());try{for(i.s();!(t=i.n()).done;){var a=t.value;n["node"+r++]=a}}catch(o){i.e(o)}finally{i.f()}return n.outputNode||null}},{key:"analyze",value:function(e){if(1===e.increaseUsage(this))for(var t=e.getNodeProperties(this),n=0,r=Object.values(t);n1&&void 0!==arguments[1]?arguments[1]:null,n=this.getShared(e);if(this!==n)return n.build(e,t);e.addNode(this),e.addChain(this);var r=null,i=e.getBuildStage();if("setup"===i){this.updateReference(e);var a=e.getNodeProperties(this);if(!0!==a.initialized){a.initialized=!0;for(var o=this.setup(e),s=o&&!0===o.isNode,u=0,l=Object.values(a);u0&&(e.inputNodes=n)}},{key:"deserialize",value:function(e){if(void 0!==e.inputNodes){var t=e.meta.nodes;for(var n in e.inputNodes)if(Array.isArray(e.inputNodes[n])){var r,i=[],a=L(e.inputNodes[n]);try{for(a.s();!(r=a.n()).done;){var o=r.value;i.push(t[o])}}catch(h){a.e(h)}finally{a.f()}this[n]=i}else if("object"===P(e.inputNodes[n])){var s={};for(var u in e.inputNodes[n]){var l=e.inputNodes[n][u];s[u]=t[l]}this[n]=s}else{var c=e.inputNodes[n];this[n]=t[c]}}}},{key:"toJSON",value:function(e){var t=this.uuid,n=this.type,r=void 0===e||"string"==typeof e;r&&(e={textures:{},images:{},nodes:{}});var i=e.nodes[t];function a(e){var t=[];for(var n in e){var r=e[n];delete r.metadata,t.push(r)}return t}if(void 0===i&&(i={uuid:t,type:n,meta:e,metadata:{version:4.6,type:"Node",generator:"Node.toJSON"}},!0!==r&&(e.nodes[i.uuid]=i),this.serialize(i),delete i.meta),r){var o=a(e.textures),s=a(e.images),u=a(e.nodes);o.length>0&&(i.textures=o),s.length>0&&(i.images=s),u.length>0&&(i.nodes=u)}return i}}],[{key:"type",get:function(){return"Node"}}])}(kc),MS=function(e){function t(e,n){var r;return A(this,t),(r=y(this,t)).node=e,r.indexNode=n,r.isArrayElementNode=!0,r}return x(t,e),T(t,[{key:"getNodeType",value:function(e){return this.node.getElementType(e)}},{key:"generate",value:function(e){var t=this.node.build(e),n=this.indexNode.build(e,"uint");return"".concat(t,"[ ").concat(n," ]")}}],[{key:"type",get:function(){return"ArrayElementNode"}}])}(TS),ES=function(e){function t(e,n){var r;return A(this,t),(r=y(this,t)).node=e,r.convertTo=n,r}return x(t,e),T(t,[{key:"getNodeType",value:function(e){var t,n=this.node.getNodeType(e),r=null,i=L(this.convertTo.split("|"));try{for(i.s();!(t=i.n()).done;){var a=t.value;null!==r&&e.getTypeLength(n)!==e.getTypeLength(a)||(r=a)}}catch(o){i.e(o)}finally{i.f()}return r}},{key:"serialize",value:function(e){n(t,"serialize",this,3)([e]),e.convertTo=this.convertTo}},{key:"deserialize",value:function(e){n(t,"deserialize",this,3)([e]),this.convertTo=e.convertTo}},{key:"generate",value:function(e,t){var n=this.node,r=this.getNodeType(e),i=n.build(e,r);return e.format(i,r,t)}}],[{key:"type",get:function(){return"ConvertNode"}}])}(TS),CS=function(e){function t(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return A(this,t),(e=y(this,t,[n])).isTempNode=!0,e}return x(t,e),T(t,[{key:"hasDependencies",value:function(e){return e.getDataFromNode(this).usageCount>1}},{key:"build",value:function(e,r){if("generate"===e.getBuildStage()){var i=e.getVectorType(this.getNodeType(e,r)),a=e.getDataFromNode(this);if(void 0!==a.propertyName)return e.format(a.propertyName,i,r);if("void"!==i&&"void"!==r&&this.hasDependencies(e)){var o=n(t,"build",this,3)([e,i]),s=e.getVarFromNode(this,null,i),u=e.getPropertyName(s);return e.addLineFlowCode("".concat(u," = ").concat(o),this),a.snippet=o,a.propertyName=u,e.format(a.propertyName,i,r)}}return n(t,"build",this,3)([e,r])}}],[{key:"type",get:function(){return"TempNode"}}])}(TS),kS=function(e){function t(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return A(this,t),(e=y(this,t,[r])).nodes=n,e}return x(t,e),T(t,[{key:"getNodeType",value:function(e){return null!==this.nodeType?e.getVectorType(this.nodeType):e.getTypeFromLength(this.nodes.reduce(function(t,n){return t+e.getTypeLength(n.getNodeType(e))},0))}},{key:"generate",value:function(e,t){var n,r=this.getNodeType(e),i=this.nodes,a=e.getComponentType(r),o=[],s=L(i);try{for(s.s();!(n=s.n()).done;){var u=n.value,l=u.build(e),c=e.getComponentType(u.getNodeType(e));c!==a&&(l=e.format(l,c,a)),o.push(l)}}catch(d){s.e(d)}finally{s.f()}var h="".concat(e.getType(r),"( ").concat(o.join(", ")," )");return e.format(h,r,t)}}],[{key:"type",get:function(){return"JoinNode"}}])}(CS),RS=AS.join(""),IS=function(e){function t(e){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"x";return A(this,t),(n=y(this,t)).node=e,n.components=r,n.isSplitNode=!0,n}return x(t,e),T(t,[{key:"getVectorLength",value:function(){var e,t=this.components.length,n=L(this.components);try{for(n.s();!(e=n.n()).done;){var r=e.value;t=Math.max(AS.indexOf(r)+1,t)}}catch(i){n.e(i)}finally{n.f()}return t}},{key:"getComponentType",value:function(e){return e.getComponentType(this.node.getNodeType(e))}},{key:"getNodeType",value:function(e){return e.getTypeFromLength(this.components.length,this.getComponentType(e))}},{key:"generate",value:function(e,t){var n=this.node,r=e.getTypeLength(n.getNodeType(e)),i=null;if(r>1){var a=null;this.getVectorLength()>=r&&(a=e.getTypeFromLength(this.getVectorLength(),this.getComponentType(e)));var o=n.build(e,a);i=this.components.length===r&&this.components===RS.slice(0,this.components.length)?e.format(o,a,t):e.format("".concat(o,".").concat(this.components),this.getNodeType(e),t)}else i=n.build(e,t);return i}},{key:"serialize",value:function(e){n(t,"serialize",this,3)([e]),e.components=this.components}},{key:"deserialize",value:function(e){n(t,"deserialize",this,3)([e]),this.components=e.components}}],[{key:"type",get:function(){return"SplitNode"}}])}(TS),NS=function(e){function t(e,n,r){var i;return A(this,t),(i=y(this,t)).sourceNode=e,i.components=n,i.targetNode=r,i}return x(t,e),T(t,[{key:"getNodeType",value:function(e){return this.sourceNode.getNodeType(e)}},{key:"generate",value:function(e){for(var t=this.sourceNode,n=this.components,r=this.targetNode,i=this.getNodeType(e),a=e.getComponentType(r.getNodeType(e)),o=e.getTypeFromLength(n.length,a),s=r.build(e,o),u=t.build(e,i),l=e.getTypeLength(i),c=[],h=0;h1&&void 0!==arguments[1]?arguments[1]:null;return A(this,t),(n=y(this,t,[r])).isInputNode=!0,n.value=e,n.precision=null,n}return x(t,e),T(t,[{key:"getNodeType",value:function(){return null===this.nodeType?fS(this.value):this.nodeType}},{key:"getInputType",value:function(e){return this.getNodeType(e)}},{key:"setPrecision",value:function(e){return this.precision=e,this}},{key:"serialize",value:function(e){n(t,"serialize",this,3)([e]),e.value=this.value,this.value&&this.value.toArray&&(e.value=this.value.toArray()),e.valueType=fS(this.value),e.nodeType=this.nodeType,"ArrayBuffer"===e.valueType&&(e.value=mS(e.value)),e.precision=this.precision}},{key:"deserialize",value:function(e){n(t,"deserialize",this,3)([e]),this.nodeType=e.nodeType,this.value=Array.isArray(e.value)?pS.apply(void 0,[e.valueType].concat(I(e.value))):e.value,this.precision=e.precision||null,this.value&&this.value.fromArray&&(this.value=this.value.fromArray(e.value))}},{key:"generate",value:function(){console.warn("Abstract function.")}}],[{key:"type",get:function(){return"InputNode"}}])}(TS),DS=/float|u?int/,OS=function(e){function t(e){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return A(this,t),(n=y(this,t,[e,r])).isConstNode=!0,n}return x(t,e),T(t,[{key:"generateConst",value:function(e){return e.generateConst(this.getNodeType(e),this.value)}},{key:"generate",value:function(e,t){var n=this.getNodeType(e);return DS.test(n)&&DS.test(t)?e.generateConst(t,this.value):e.format(this.generateConst(e),n,t)}}],[{key:"type",get:function(){return"ConstNode"}}])}(LS),FS=function(e){function t(e,n){var r;return A(this,t),(r=y(this,t)).node=e,r.property=n,r.isMemberNode=!0,r}return x(t,e),T(t,[{key:"getNodeType",value:function(e){return this.node.getMemberType(e,this.property)}},{key:"generate",value:function(e){return this.node.build(e)+"."+this.property}}],[{key:"type",get:function(){return"MemberNode"}}])}(TS),BS=null,US=new Map;function zS(e,t){if(US.has(e))console.warn("Redefinition of method chaining ".concat(e));else{if("function"!=typeof t)throw new Error("Node element ".concat(e," is not a function"));US.set(e,t)}}for(var VS=function(e){return e.replace(/r|s/g,"x").replace(/g|t/g,"y").replace(/b|p/g,"z").replace(/a|q/g,"w")},HS=function(e){return VS(e).split("").sort().join("")},WS={setup:function(e,t){var n=t.shift();return e.apply(void 0,[EA(n)].concat(I(t)))},get:function(e,t,n){if("string"==typeof t&&void 0===e[t]){if(!0!==e.isStackNode&&"assign"===t)return function(){for(var e,t=arguments.length,r=new Array(t),i=0;i1&&void 0!==arguments[1]?arguments[1]:null,n=fS(e);if("node"===n){var r=GS.get(e);return void 0===r&&(r=new Proxy(e,WS),GS.set(e,r),GS.set(r,r)),r}return null===t&&("float"===n||"boolean"===n)||n&&"shader"!==n&&"string"!==n?MA(xA(e,t)):"shader"===n?IA(e):e},qS=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;for(var n in e)e[n]=MA(e[n],t);return e},XS=function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=e.length,r=0;r1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=function(e){return MA(null!==r?Object.assign(e,r):e)};return null===t?function(){for(var t=arguments.length,n=new Array(t),r=0;r1?t-1:0),r=1;r1?s(n||[],e):s(e);i=MA(u)}return t.once&&(r.onceOutput=i),i}},{key:"getOutputNode",value:function(e){var t=e.getNodeProperties(this);return null===t.outputNode&&(t.outputNode=this.setupOutput(e)),t.outputNode}},{key:"setup",value:function(e){return this.getOutputNode(e)}},{key:"setupOutput",value:function(e){return e.addStack(),e.stack.outputNode=this.call(e),e.removeStack()}},{key:"generate",value:function(e,t){return this.getOutputNode(e).build(e,t)}}])}(TS),JS=function(e){function t(e,n){var r;return A(this,t),(r=y(this,t,[n])).jsFunc=e,r.layout=null,r.global=!0,r.once=!1,r}return x(t,e),T(t,[{key:"setLayout",value:function(e){return this.layout=e,this}},{key:"call",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return EA(e),MA(new ZS(this,e))}},{key:"setup",value:function(){return this.call()}}])}(TS),$S=[.5,1.5,1/3,1e-6,1e6,Math.PI,2*Math.PI,1/Math.PI,2/Math.PI,1/(2*Math.PI),Math.PI/2],eA=new Map,tA=0,nA=[!1,!0];tA1&&void 0!==arguments[1]?arguments[1]:null;return function(){for(var n=arguments.length,r=new Array(n),i=0;i1&&void 0!==arguments[1]?arguments[1]:null)},EA=function(e){return new qS(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:null)},CA=function(e){return new XS(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:null)},kA=function(){for(var e=arguments.length,t=new Array(e),n=0;n2&&void 0!==arguments[2]?arguments[2]:null;return A(this,t),(r=y(this,t,[e])).count=n,r.values=i,r.isArrayNode=!0,r}return x(t,e),T(t,[{key:"getNodeType",value:function(e){return null===this.nodeType&&(this.nodeType=this.values[0].getNodeType(e)),this.nodeType}},{key:"getElementType",value:function(e){return this.getNodeType(e)}},{key:"generate",value:function(e){var t=this.getNodeType(e);return e.generateArray(t,this.count,this.values)}}],[{key:"type",get:function(){return"ArrayNode"}}])}(CS),aw=function(){var e;if(1===arguments.length){var t=arguments.length<=0?void 0:arguments[0];e=new iw(null,t.length,t)}else{e=new iw(arguments.length<=0?void 0:arguments[0],arguments.length<=1?void 0:arguments[1])}return MA(e)};zS("toArray",function(e,t){return aw(Array(t).fill(e))});var ow=function(e){function t(e){var n,r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;return A(this,t),(n=y(this,t,["string"])).name=e,n.shared=r,n.order=i,n.isUniformGroup=!0,n}return x(t,e),T(t,[{key:"serialize",value:function(e){n(t,"serialize",this,3)([e]),e.name=this.name,e.version=this.version,e.shared=this.shared}},{key:"deserialize",value:function(e){n(t,"deserialize",this,3)([e]),this.name=e.name,this.version=e.version,this.shared=e.shared}}],[{key:"type",get:function(){return"UniformGroupNode"}}])}(TS),sw=function(e){return new ow(e)},uw=function(e){return new ow(e,!0,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0)},lw=uw("frame"),cw=uw("render"),hw=sw("object"),dw=function(e){function t(e){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return A(this,t),(n=y(this,t,[e,r])).isUniformNode=!0,n.name="",n.groupNode=hw,n}return x(t,e),T(t,[{key:"label",value:function(e){return this.name=e,this}},{key:"setGroup",value:function(e){return this.groupNode=e,this}},{key:"getGroup",value:function(){return this.groupNode}},{key:"getUniformHash",value:function(e){return this.getHash(e)}},{key:"onUpdate",value:function(e,r){var i=this,a=this.getSelf();return e=e.bind(a),n(t,"onUpdate",this,3)([function(t){var n=e(t,a);void 0!==n&&(i.value=n)},r])}},{key:"generate",value:function(e,t){var n=this.getNodeType(e),r=this.getUniformHash(e),i=e.getNodeFromHash(r);void 0===i&&(e.setHashNode(this,r),i=this);var a=i.getInputType(e),o=e.getUniformFromNode(i,a,e.shaderStage,this.name||e.context.label),s=e.getPropertyName(o);return void 0!==e.context.label&&delete e.context.label,e.format(s,n,t)}}],[{key:"type",get:function(){return"UniformNode"}}])}(LS),fw=function(e,t){var n=wA(t||e),r=e&&!0===e.isNode?e.node&&e.node.value||e.value:e;return MA(new dw(r,n))},pw=function(e){function t(e){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return A(this,t),(n=y(this,t,[e])).name=r,n.varying=i,n.isPropertyNode=!0,n}return x(t,e),T(t,[{key:"getHash",value:function(e){return this.name||n(t,"getHash",this,3)([e])}},{key:"isGlobal",value:function(){return!0}},{key:"generate",value:function(e){var t;return!0===this.varying?(t=e.getVaryingFromNode(this,this.name)).needsInterpolation=!0:t=e.getVarFromNode(this,this.name),e.getPropertyName(t)}}],[{key:"type",get:function(){return"PropertyNode"}}])}(TS),vw=function(e,t){return MA(new pw(e,t))},mw=function(e,t){return MA(new pw(e,t,!0))},gw=RA(pw,"vec4","DiffuseColor"),yw=RA(pw,"vec3","EmissiveColor"),_w=RA(pw,"float","Roughness"),bw=RA(pw,"float","Metalness"),xw=RA(pw,"float","Clearcoat"),Sw=RA(pw,"float","ClearcoatRoughness"),Aw=RA(pw,"vec3","Sheen"),ww=RA(pw,"float","SheenRoughness"),Tw=RA(pw,"float","Iridescence"),Mw=RA(pw,"float","IridescenceIOR"),Ew=RA(pw,"float","IridescenceThickness"),Cw=RA(pw,"float","AlphaT"),kw=RA(pw,"float","Anisotropy"),Rw=RA(pw,"vec3","AnisotropyT"),Iw=RA(pw,"vec3","AnisotropyB"),Nw=RA(pw,"color","SpecularColor"),Pw=RA(pw,"float","SpecularF90"),Lw=RA(pw,"float","Shininess"),Dw=RA(pw,"vec4","Output"),Ow=RA(pw,"float","dashSize"),Fw=RA(pw,"float","gapSize"),Bw=RA(pw,"float","pointWidth"),Uw=RA(pw,"float","IOR"),zw=RA(pw,"float","Transmission"),Vw=RA(pw,"float","Thickness"),Hw=RA(pw,"float","AttenuationDistance"),Ww=RA(pw,"color","AttenuationColor"),Gw=RA(pw,"float","Dispersion"),jw=function(e){function t(e,n){var r;return A(this,t),(r=y(this,t)).targetNode=e,r.sourceNode=n,r}return x(t,e),T(t,[{key:"hasDependencies",value:function(){return!1}},{key:"getNodeType",value:function(e,t){return"void"!==t?this.targetNode.getNodeType(e):"void"}},{key:"needsSplitAssign",value:function(e){var t=this.targetNode;if(!1===e.isAvailable("swizzleAssign")&&t.isSplitNode&&t.components.length>1){var n=e.getTypeLength(t.node.getNodeType(e));return AS.join("").slice(0,n)!==t.components}return!1}},{key:"generate",value:function(e,t){var n,r=this.targetNode,i=this.sourceNode,a=this.needsSplitAssign(e),o=r.getNodeType(e),s=r.context({assign:!0}).build(e),u=i.build(e,o),l=i.getNodeType(e),c=e.getDataFromNode(this);if(!0===c.initialized)"void"!==t&&(n=s);else if(a){var h=e.getVarFromNode(this,null,o),d=e.getPropertyName(h);e.addLineFlowCode("".concat(d," = ").concat(u),this);for(var f=r.node.context({assign:!0}).build(e),p=0;p0&&void 0!==arguments[0]?arguments[0]:null,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return A(this,t),(e=y(this,t)).functionNode=n,e.parameters=r,e}return x(t,e),T(t,[{key:"setParameters",value:function(e){return this.parameters=e,this}},{key:"getParameters",value:function(){return this.parameters}},{key:"getNodeType",value:function(e){return this.functionNode.getNodeType(e)}},{key:"generate",value:function(e){var t=[],n=this.functionNode,r=n.getInputs(e),i=this.parameters,a=function(t,n){var r=n.type;return"pointer"===r?"&"+t.build(e):t.build(e,r)};if(Array.isArray(i))for(var o=0;o1?t-1:0),r=1;r1||n[0]&&!0===n[0].isNode?CA(n):EA(n[0]),MA(new qw(MA(e),n))};zS("call",Xw);var Yw=function(e){function t(e,n,r){var i;if(A(this,t),i=y(this,t),(arguments.length<=3?0:arguments.length-3)>0){for(var a,o=new t(e,n,r),s=0;s<(arguments.length<=3?0:arguments.length-3)-1;s++)o=new t(e,o,s+3<3||arguments.length<=s+3?void 0:arguments[s+3]);n=o,r=(a=(arguments.length<=3?0:arguments.length-3)-1+3)<3||arguments.length<=a?void 0:arguments[a]}return i.op=e,i.aNode=n,i.bNode=r,i.isOperatorNode=!0,i}return x(t,e),T(t,[{key:"getNodeType",value:function(e,t){var n=this.op,r=this.aNode,i=this.bNode,a=r.getNodeType(e),o=void 0!==i?i.getNodeType(e):null;if("void"===a||"void"===o)return"void";if("%"===n)return a;if("~"===n||"&"===n||"|"===n||"^"===n||">>"===n||"<<"===n)return e.getIntegerType(a);if("!"===n||"=="===n||"&&"===n||"||"===n||"^^"===n)return"bool";if("<"===n||">"===n||"<="===n||">="===n){var s=t?e.getTypeLength(t):Math.max(e.getTypeLength(a),e.getTypeLength(o));return s>1?"bvec".concat(s):"bool"}if(e.isMatrix(a)){if("float"===o)return a;if(e.isVector(o))return e.getVectorFromMatrix(a);if(e.isMatrix(o))return a}else if(e.isMatrix(o)){if("float"===a)return o;if(e.isVector(a))return e.getVectorFromMatrix(o)}return e.getTypeLength(o)>e.getTypeLength(a)?o:a}},{key:"generate",value:function(e,t){var n=this.op,r=this.aNode,i=this.bNode,a=this.getNodeType(e,t),o=null,s=null;"void"!==a?(o=r.getNodeType(e),s=void 0!==i?i.getNodeType(e):null,"<"===n||">"===n||"<="===n||">="===n||"=="===n?e.isVector(o)?s=o:o!==s&&(o=s="float"):">>"===n||"<<"===n?(o=a,s=e.changeComponentType(s,"uint")):e.isMatrix(o)?"float"===s?s="float":e.isVector(s)?s=e.getVectorFromMatrix(o):e.isMatrix(s)||(o=s=a):o=e.isMatrix(s)?"float"===o?"float":e.isVector(o)?e.getVectorFromMatrix(s):s=a:s=a):o=s=a;var u=r.build(e,o),l=void 0!==i?i.build(e,s):null,c=e.getTypeLength(t),h=e.getFunctionOperator(n);return"void"!==t?"<"===n&&c>1?e.useComparisonMethod?e.format("".concat(e.getMethod("lessThan",t),"( ").concat(u,", ").concat(l," )"),a,t):e.format("( ".concat(u," < ").concat(l," )"),a,t):"<="===n&&c>1?e.useComparisonMethod?e.format("".concat(e.getMethod("lessThanEqual",t),"( ").concat(u,", ").concat(l," )"),a,t):e.format("( ".concat(u," <= ").concat(l," )"),a,t):">"===n&&c>1?e.useComparisonMethod?e.format("".concat(e.getMethod("greaterThan",t),"( ").concat(u,", ").concat(l," )"),a,t):e.format("( ".concat(u," > ").concat(l," )"),a,t):">="===n&&c>1?e.useComparisonMethod?e.format("".concat(e.getMethod("greaterThanEqual",t),"( ").concat(u,", ").concat(l," )"),a,t):e.format("( ".concat(u," >= ").concat(l," )"),a,t):"!"===n||"~"===n?e.format("(".concat(n).concat(u,")"),o,t):h?e.format("".concat(h,"( ").concat(u,", ").concat(l," )"),a,t):e.isMatrix(o)&&"float"===s?e.format("( ".concat(l," ").concat(n," ").concat(u," )"),a,t):"float"===o&&e.isMatrix(s)?e.format("".concat(u," ").concat(n," ").concat(l),a,t):e.format("( ".concat(u," ").concat(n," ").concat(l," )"),a,t):"void"!==o?h?e.format("".concat(h,"( ").concat(u,", ").concat(l," )"),a,t):e.isMatrix(o)&&"float"===s?e.format("".concat(l," ").concat(n," ").concat(u),a,t):e.format("".concat(u," ").concat(n," ").concat(l),a,t):void 0}},{key:"serialize",value:function(e){n(t,"serialize",this,3)([e]),e.op=this.op}},{key:"deserialize",value:function(e){n(t,"deserialize",this,3)([e]),this.op=e.op}}],[{key:"type",get:function(){return"OperatorNode"}}])}(CS),Kw=kA(Yw,"+"),Zw=kA(Yw,"-"),Jw=kA(Yw,"*"),$w=kA(Yw,"/"),eT=kA(Yw,"%"),tT=kA(Yw,"=="),nT=kA(Yw,"!="),rT=kA(Yw,"<"),iT=kA(Yw,">"),aT=kA(Yw,"<="),oT=kA(Yw,">="),sT=kA(Yw,"&&"),uT=kA(Yw,"||"),lT=kA(Yw,"!"),cT=kA(Yw,"^^"),hT=kA(Yw,"&"),dT=kA(Yw,"~"),fT=kA(Yw,"|"),pT=kA(Yw,"^"),vT=kA(Yw,"<<"),mT=kA(Yw,">>");zS("add",Kw),zS("sub",Zw),zS("mul",Jw),zS("div",$w),zS("modInt",eT),zS("equal",tT),zS("notEqual",nT),zS("lessThan",rT),zS("greaterThan",iT),zS("lessThanEqual",aT),zS("greaterThanEqual",oT),zS("and",sT),zS("or",uT),zS("not",lT),zS("xor",cT),zS("bitAnd",hT),zS("bitNot",dT),zS("bitOr",fT),zS("bitXor",pT),zS("shiftLeft",vT),zS("shiftRight",mT);var gT=function(){return console.warn("TSL.OperatorNode: .remainder() has been renamed to .modInt()."),eT.apply(void 0,arguments)};zS("remainder",gT);var yT=function(e){function t(e,n){var r,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;return A(this,t),(r=y(this,t)).method=e,r.aNode=n,r.bNode=i,r.cNode=a,r.isMathNode=!0,r}return x(t,e),T(t,[{key:"getInputType",value:function(e){var t=this.aNode.getNodeType(e),n=this.bNode?this.bNode.getNodeType(e):null,r=this.cNode?this.cNode.getNodeType(e):null,i=e.isMatrix(t)?0:e.getTypeLength(t),a=e.isMatrix(n)?0:e.getTypeLength(n),o=e.isMatrix(r)?0:e.getTypeLength(r);return i>a&&i>o?t:a>o?n:o>i?r:t}},{key:"getNodeType",value:function(e){var n=this.method;return n===t.LENGTH||n===t.DISTANCE||n===t.DOT?"float":n===t.CROSS?"vec3":n===t.ALL?"bool":n===t.EQUALS?e.changeComponentType(this.aNode.getNodeType(e),"bool"):n===t.MOD?this.aNode.getNodeType(e):this.getInputType(e)}},{key:"generate",value:function(e,n){var r=this.method,i=this.getNodeType(e),a=this.getInputType(e),o=this.aNode,s=this.bNode,u=this.cNode,l=e.renderer.coordinateSystem;if(r===t.TRANSFORM_DIRECTION){var c=o,h=s;e.isMatrix(c.getNodeType(e))?h=YA(jA(h),0):c=YA(jA(c),0);var d=Jw(c,h).xyz;return DT(d).build(e,n)}if(r===t.NEGATE)return e.format("( - "+o.build(e,a)+" )",i,n);if(r===t.ONE_MINUS)return Zw(1,o).build(e,n);if(r===t.RECIPROCAL)return $w(1,o).build(e,n);if(r===t.DIFFERENCE)return WT(Zw(o,s)).build(e,n);var f=[];return r===t.CROSS||r===t.MOD?f.push(o.build(e,i),s.build(e,i)):l===Ec&&r===t.STEP?f.push(o.build(e,1===e.getTypeLength(o.getNodeType(e))?"float":a),s.build(e,a)):l===Ec&&(r===t.MIN||r===t.MAX)||r===t.MOD?f.push(o.build(e,a),s.build(e,1===e.getTypeLength(s.getNodeType(e))?"float":a)):r===t.REFRACT?f.push(o.build(e,a),s.build(e,a),u.build(e,"float")):r===t.MIX?f.push(o.build(e,a),s.build(e,a),u.build(e,1===e.getTypeLength(u.getNodeType(e))?"float":a)):(l===Cc&&r===t.ATAN&&null!==s&&(r="atan2"),f.push(o.build(e,a)),null!==s&&f.push(s.build(e,a)),null!==u&&f.push(u.build(e,a))),e.format("".concat(e.getMethod(r,i),"( ").concat(f.join(", ")," )"),i,n)}},{key:"serialize",value:function(e){n(t,"serialize",this,3)([e]),e.method=this.method}},{key:"deserialize",value:function(e){n(t,"deserialize",this,3)([e]),this.method=e.method}}],[{key:"type",get:function(){return"MathNode"}}])}(CS);yT.ALL="all",yT.ANY="any",yT.RADIANS="radians",yT.DEGREES="degrees",yT.EXP="exp",yT.EXP2="exp2",yT.LOG="log",yT.LOG2="log2",yT.SQRT="sqrt",yT.INVERSE_SQRT="inversesqrt",yT.FLOOR="floor",yT.CEIL="ceil",yT.NORMALIZE="normalize",yT.FRACT="fract",yT.SIN="sin",yT.COS="cos",yT.TAN="tan",yT.ASIN="asin",yT.ACOS="acos",yT.ATAN="atan",yT.ABS="abs",yT.SIGN="sign",yT.LENGTH="length",yT.NEGATE="negate",yT.ONE_MINUS="oneMinus",yT.DFDX="dFdx",yT.DFDY="dFdy",yT.ROUND="round",yT.RECIPROCAL="reciprocal",yT.TRUNC="trunc",yT.FWIDTH="fwidth",yT.TRANSPOSE="transpose",yT.BITCAST="bitcast",yT.EQUALS="equals",yT.MIN="min",yT.MAX="max",yT.MOD="mod",yT.STEP="step",yT.REFLECT="reflect",yT.DISTANCE="distance",yT.DIFFERENCE="difference",yT.DOT="dot",yT.CROSS="cross",yT.POW="pow",yT.TRANSFORM_DIRECTION="transformDirection",yT.MIX="mix",yT.CLAMP="clamp",yT.REFRACT="refract",yT.SMOOTHSTEP="smoothstep",yT.FACEFORWARD="faceforward";var _T=FA(1e-6),bT=FA(1e6),xT=FA(Math.PI),ST=FA(2*Math.PI),AT=kA(yT,yT.ALL),wT=kA(yT,yT.ANY),TT=kA(yT,yT.RADIANS),MT=kA(yT,yT.DEGREES),ET=kA(yT,yT.EXP),CT=kA(yT,yT.EXP2),kT=kA(yT,yT.LOG),RT=kA(yT,yT.LOG2),IT=kA(yT,yT.SQRT),NT=kA(yT,yT.INVERSE_SQRT),PT=kA(yT,yT.FLOOR),LT=kA(yT,yT.CEIL),DT=kA(yT,yT.NORMALIZE),OT=kA(yT,yT.FRACT),FT=kA(yT,yT.SIN),BT=kA(yT,yT.COS),UT=kA(yT,yT.TAN),zT=kA(yT,yT.ASIN),VT=kA(yT,yT.ACOS),HT=kA(yT,yT.ATAN),WT=kA(yT,yT.ABS),GT=kA(yT,yT.SIGN),jT=kA(yT,yT.LENGTH),QT=kA(yT,yT.NEGATE),qT=kA(yT,yT.ONE_MINUS),XT=kA(yT,yT.DFDX),YT=kA(yT,yT.DFDY),KT=kA(yT,yT.ROUND),ZT=kA(yT,yT.RECIPROCAL),JT=kA(yT,yT.TRUNC),$T=kA(yT,yT.FWIDTH),eM=kA(yT,yT.TRANSPOSE),tM=kA(yT,yT.BITCAST),nM=kA(yT,yT.EQUALS),rM=kA(yT,yT.MIN),iM=kA(yT,yT.MAX),aM=kA(yT,yT.MOD),oM=kA(yT,yT.STEP),sM=kA(yT,yT.REFLECT),uM=kA(yT,yT.DISTANCE),lM=kA(yT,yT.DIFFERENCE),cM=kA(yT,yT.DOT),hM=kA(yT,yT.CROSS),dM=kA(yT,yT.POW),fM=kA(yT,yT.POW,2),pM=kA(yT,yT.POW,3),vM=kA(yT,yT.POW,4),mM=kA(yT,yT.TRANSFORM_DIRECTION),gM=function(e){return Jw(GT(e),dM(WT(e),1/3))},yM=function(e){return cM(e,e)},_M=kA(yT,yT.MIX),bM=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;return MA(new yT(yT.CLAMP,MA(e),MA(t),MA(n)))},xM=function(e){return bM(e)},SM=kA(yT,yT.REFRACT),AM=kA(yT,yT.SMOOTHSTEP),wM=kA(yT,yT.FACEFORWARD),TM=IA(function(e){var t=C(e,1)[0],n=cM(t.xy,VA(12.9898,78.233)),r=aM(n,xT);return OT(FT(r).mul(43758.5453))}),MM=function(e,t,n){return _M(t,n,e)},EM=function(e,t,n){return AM(t,n,e)},CM=function(e,t){return console.warn('THREE.TSL: "atan2" is overloaded. Use "atan" instead.'),HT(e,t)},kM=wM,RM=NT;zS("all",AT),zS("any",wT),zS("equals",nM),zS("radians",TT),zS("degrees",MT),zS("exp",ET),zS("exp2",CT),zS("log",kT),zS("log2",RT),zS("sqrt",IT),zS("inverseSqrt",NT),zS("floor",PT),zS("ceil",LT),zS("normalize",DT),zS("fract",OT),zS("sin",FT),zS("cos",BT),zS("tan",UT),zS("asin",zT),zS("acos",VT),zS("atan",HT),zS("abs",WT),zS("sign",GT),zS("length",jT),zS("lengthSq",yM),zS("negate",QT),zS("oneMinus",qT),zS("dFdx",XT),zS("dFdy",YT),zS("round",KT),zS("reciprocal",ZT),zS("trunc",JT),zS("fwidth",$T),zS("atan2",CM),zS("min",rM),zS("max",iM),zS("mod",aM),zS("step",oM),zS("reflect",sM),zS("distance",uM),zS("dot",cM),zS("cross",hM),zS("pow",dM),zS("pow2",fM),zS("pow3",pM),zS("pow4",vM),zS("transformDirection",mM),zS("mix",MM),zS("clamp",bM),zS("refract",SM),zS("smoothstep",EM),zS("faceForward",wM),zS("difference",lM),zS("saturate",xM),zS("cbrt",gM),zS("transpose",eM),zS("rand",TM);var IM=function(e){function t(e,n){var r,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return A(this,t),(r=y(this,t)).condNode=e,r.ifNode=n,r.elseNode=i,r}return x(t,e),T(t,[{key:"getNodeType",value:function(e){var t=e.getNodeProperties(this),n=t.ifNode,r=t.elseNode;if(void 0===n)return this.setup(e),this.getNodeType(e);var i=n.getNodeType(e);if(null!==r){var a=r.getNodeType(e);if(e.getTypeLength(a)>e.getTypeLength(i))return a}return i}},{key:"setup",value:function(e){var t=this.condNode.cache(),n=this.ifNode.cache(),r=this.elseNode?this.elseNode.cache():null,i=e.context.nodeBlock;e.getDataFromNode(n).parentNodeBlock=i,null!==r&&(e.getDataFromNode(r).parentNodeBlock=i);var a=e.getNodeProperties(this);a.condNode=t,a.ifNode=n.context({nodeBlock:n}),a.elseNode=r?r.context({nodeBlock:r}):null}},{key:"generate",value:function(e,t){var n=this.getNodeType(e),r=e.getDataFromNode(this);if(void 0!==r.nodeProperty)return r.nodeProperty;var i=e.getNodeProperties(this),a=i.condNode,o=i.ifNode,s=i.elseNode,u="void"!==t,l=u?vw(n).build(e):"";r.nodeProperty=l;var c=a.build(e,"bool");e.addFlowCode("\n".concat(e.tab,"if ( ").concat(c," ) {\n\n")).addFlowTab();var h=o.build(e,n);if(h&&(h=u?l+" = "+h+";":"return "+h+";"),e.removeFlowTab().addFlowCode(e.tab+"\t"+h+"\n\n"+e.tab+"}"),null!==s){e.addFlowCode(" else {\n\n").addFlowTab();var d=s.build(e,n);d&&(d=u?l+" = "+d+";":"return "+d+";"),e.removeFlowTab().addFlowCode(e.tab+"\t"+d+"\n\n"+e.tab+"}\n\n")}else e.addFlowCode("\n\n");return e.format(l,n,t)}}],[{key:"type",get:function(){return"ConditionalNode"}}])}(TS),NM=kA(IM);zS("select",NM);var PM=function(){return console.warn("TSL.ConditionalNode: cond() has been renamed to select()."),NM.apply(void 0,arguments)};zS("cond",PM);var LM=function(e){function t(e){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return A(this,t),(n=y(this,t)).isContextNode=!0,n.node=e,n.value=r,n}return x(t,e),T(t,[{key:"getScope",value:function(){return this.node.getScope()}},{key:"getNodeType",value:function(e){return this.node.getNodeType(e)}},{key:"analyze",value:function(e){this.node.build(e)}},{key:"setup",value:function(e){var t=e.getContext();e.setContext(s(s({},e.context),this.value));var n=this.node.build(e);return e.setContext(t),n}},{key:"generate",value:function(e,t){var n=e.getContext();e.setContext(s(s({},e.context),this.value));var r=this.node.build(e,t);return e.setContext(n),r}}],[{key:"type",get:function(){return"ContextNode"}}])}(TS),DM=kA(LM),OM=function(e,t){return DM(e,{label:t})};zS("context",DM),zS("label",OM);var FM=function(e){function t(e){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return A(this,t),(n=y(this,t)).node=e,n.name=r,n.global=!0,n.isVarNode=!0,n.readOnly=i,n}return x(t,e),T(t,[{key:"getHash",value:function(e){return this.name||n(t,"getHash",this,3)([e])}},{key:"getMemberType",value:function(e,t){return this.node.getMemberType(e,t)}},{key:"getElementType",value:function(e){return this.node.getElementType(e)}},{key:"getNodeType",value:function(e){return this.node.getNodeType(e)}},{key:"generate",value:function(e){var t=this.node,n=this.name,r=this.readOnly,i=!0===e.renderer.backend.isWebGPUBackend,a=!1,o=!1;r&&(a=e.isDeterministic(t),o=i?r:a);var s=e.getVectorType(this.getNodeType(e)),u=t.build(e,s),l=e.getVarFromNode(this,n,s,void 0,o),c=e.getPropertyName(l),h=c;if(o)if(i)h=a?"const ".concat(c):"let ".concat(c);else{var d=e.getArrayCount(t);h="const ".concat(e.getVar(l.type,c,d))}return e.addLineFlowCode("".concat(h," = ").concat(u),this),c}}],[{key:"type",get:function(){return"VarNode"}}])}(TS),BM=kA(FM),UM=function(e){return BM(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:null).append()},zM=function(e){return BM(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,!0).append()};zS("toVar",UM),zS("toConst",zM);var VM=function(e){return console.warn('TSL: "temp( node )" is deprecated. Use "Var( node )" or "node.toVar()" instead.'),BM(e)};zS("temp",VM);var HM=function(e){function t(e){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return A(this,t),(n=y(this,t)).node=e,n.name=r,n.isVaryingNode=!0,n}return x(t,e),T(t,[{key:"isGlobal",value:function(){return!0}},{key:"getHash",value:function(e){return this.name||n(t,"getHash",this,3)([e])}},{key:"getNodeType",value:function(e){return this.node.getNodeType(e)}},{key:"setupVarying",value:function(e){var t=e.getNodeProperties(this),n=t.varying;if(void 0===n){var r=this.name,i=this.getNodeType(e);t.varying=n=e.getVaryingFromNode(this,r,i),t.node=this.node}return n.needsInterpolation||(n.needsInterpolation="fragment"===e.shaderStage),n}},{key:"setup",value:function(e){this.setupVarying(e)}},{key:"analyze",value:function(e){return this.setupVarying(e),this.node.analyze(e)}},{key:"generate",value:function(e){var t=e.getNodeProperties(this),n=this.setupVarying(e),r="fragment"===e.shaderStage&&!0===t.reassignPosition&&e.context.needsPositionReassign;if(void 0===t.propertyName||r){var i=this.getNodeType(e),a=e.getPropertyName(n,yS.VERTEX);e.flowNodeFromShaderStage(yS.VERTEX,this.node,i,a),t.propertyName=a,r?t.reassignPosition=!1:void 0===t.reassignPosition&&e.context.isPositionNodeInput&&(t.reassignPosition=!0)}return e.getPropertyName(n)}}],[{key:"type",get:function(){return"VaryingNode"}}])}(TS),WM=kA(HM),GM=function(e){return WM(e)};zS("toVarying",WM),zS("toVertexStage",GM),zS("varying",function(){return console.warn("TSL.VaryingNode: .varying() has been renamed to .toVarying()."),WM.apply(void 0,arguments)}),zS("vertexStage",function(){return console.warn("TSL.VaryingNode: .vertexStage() has been renamed to .toVertexStage()."),WM.apply(void 0,arguments)});var jM=IA(function(e){var t=C(e,1)[0],n=t.mul(.9478672986).add(.0521327014).pow(2.4),r=t.mul(.0773993808),i=t.lessThanEqual(.04045);return _M(n,r,i)}).setLayout({name:"sRGBTransferEOTF",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),QM=IA(function(e){var t=C(e,1)[0],n=t.pow(.41666).mul(1.055).sub(.055),r=t.mul(12.92),i=t.lessThanEqual(.0031308);return _M(n,r,i)}).setLayout({name:"sRGBTransferOETF",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),qM="WorkingColorSpace",XM="OutputColorSpace",YM=function(e){function t(e,n,r){var i;return A(this,t),(i=y(this,t,["vec4"])).colorNode=e,i.source=n,i.target=r,i}return x(t,e),T(t,[{key:"resolveColorSpace",value:function(e,t){return t===qM?$c.workingColorSpace:t===XM?e.context.outputColorSpace||e.renderer.outputColorSpace:t}},{key:"setup",value:function(e){var t=this.colorNode,n=this.resolveColorSpace(e,this.source),r=this.resolveColorSpace(e,this.target),i=t;return!1!==$c.enabled&&n!==r&&n&&r?($c.getTransfer(n)===Sc&&(i=YA(jM(i.rgb),i.a)),$c.getPrimaries(n)!==$c.getPrimaries(r)&&(i=YA(ew($c._getMatrix(new Hc,n,r)).mul(i.rgb),i.a)),$c.getTransfer(r)===Sc&&(i=YA(QM(i.rgb),i.a)),i):i}}],[{key:"type",get:function(){return"ColorSpaceNode"}}])}(CS),KM=function(e){return MA(new YM(MA(e),qM,XM))},ZM=function(e){return MA(new YM(MA(e),XM,qM))},JM=function(e,t){return MA(new YM(MA(e),qM,t))},$M=function(e,t){return MA(new YM(MA(e),t,qM))};zS("toOutputColorSpace",KM),zS("toWorkingColorSpace",ZM),zS("workingToColorSpace",JM),zS("colorSpaceToWorking",$M);var eE=function(e){function t(e,n){var r;return A(this,t),(r=y(this,t,[e,n])).referenceNode=e,r.isReferenceElementNode=!0,r}return x(t,e),T(t,[{key:"getNodeType",value:function(){return this.referenceNode.uniformType}},{key:"generate",value:function(e){var r=n(t,"generate",this,3)([e]),i=this.referenceNode.getNodeType(),a=this.getNodeType();return e.format(r,i,a)}}],[{key:"type",get:function(){return"ReferenceElementNode"}}])}(MS),tE=function(e){function t(e,n){var r,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;return A(this,t),(r=y(this,t)).property=e,r.uniformType=n,r.object=i,r.count=a,r.properties=e.split("."),r.reference=i,r.node=null,r.group=null,r.updateType=_S.OBJECT,r}return x(t,e),T(t,[{key:"setGroup",value:function(e){return this.group=e,this}},{key:"element",value:function(e){return MA(new eE(this,MA(e)))}},{key:"setNodeType",value:function(e){var t=fw(null,e).getSelf();null!==this.group&&t.setGroup(this.group),this.node=t}},{key:"getNodeType",value:function(e){return null===this.node&&(this.updateReference(e),this.updateValue()),this.node.getNodeType(e)}},{key:"getValueFromReference",value:function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.reference,t=this.properties,n=e[t[0]],r=1;r2&&void 0!==arguments[2]?arguments[2]:null;return A(this,t),(r=y(this,t,[e,n,i])).renderer=i,r.setGroup(cw),r}return x(t,e),T(t,[{key:"updateReference",value:function(e){return this.reference=null!==this.renderer?this.renderer:e.renderer,this.reference}}],[{key:"type",get:function(){return"RendererReferenceNode"}}])}(tE),rE=function(e,t){return MA(new nE(e,t,arguments.length>2&&void 0!==arguments[2]?arguments[2]:null))},iE=function(e){function t(e){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:oE,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return A(this,t),(n=y(this,t,["vec3"])).toneMapping=e,n.exposureNode=r,n.colorNode=i,n}return x(t,e),T(t,[{key:"customCacheKey",value:function(){return oS(this.toneMapping)}},{key:"setup",value:function(e){var t=this.colorNode||e.context.color,n=this.toneMapping;if(0===n)return t;var r=null,i=e.renderer.library.getToneMappingFunction(n);return null!==i?r=YA(i(t.rgb,this.exposureNode),t.a):(console.error("ToneMappingNode: Unsupported Tone Mapping configuration.",n),r=t),r}}],[{key:"type",get:function(){return"ToneMappingNode"}}])}(CS),aE=function(e,t,n){return MA(new iE(e,MA(t),MA(n)))},oE=rE("toneMappingExposure","float");zS("toneMapping",function(e,t,n){return aE(t,n,e)});var sE=function(e){function t(e){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return A(this,t),(n=y(this,t,[e,r])).isBufferNode=!0,n.bufferType=r,n.bufferStride=i,n.bufferOffset=a,n.usage=wc,n.instanced=!1,n.attribute=null,n.global=!0,e&&!0===e.isBufferAttribute&&(n.attribute=e,n.usage=e.usage,n.instanced=e.isInstancedBufferAttribute),n}return x(t,e),T(t,[{key:"getHash",value:function(e){if(0===this.bufferStride&&0===this.bufferOffset){var t=e.globalCache.getData(this.value);return void 0===t&&(t={node:this},e.globalCache.setData(this.value,t)),t.node.uuid}return this.uuid}},{key:"getNodeType",value:function(e){return null===this.bufferType&&(this.bufferType=e.getTypeFromAttribute(this.attribute)),this.bufferType}},{key:"setup",value:function(e){if(null===this.attribute){var t=this.getNodeType(e),n=this.value,r=e.getTypeLength(t),i=this.bufferStride||r,a=this.bufferOffset,o=!0===n.isInterleavedBuffer?n:new Bf(n,i),s=new zf(o,r,a);o.setUsage(this.usage),this.attribute=s,this.attribute.isInstancedBufferAttribute=this.instanced}}},{key:"generate",value:function(e){var t=this.getNodeType(e),n=e.getBufferAttributeFromNode(this,t),r=e.getPropertyName(n),i=null;"vertex"===e.shaderStage||"compute"===e.shaderStage?(this.name=r,i=r):i=WM(this).build(e,t);return i}},{key:"getInputType",value:function(){return"bufferAttribute"}},{key:"setUsage",value:function(e){return this.usage=e,this.attribute&&!0===this.attribute.isBufferAttribute&&(this.attribute.usage=e),this}},{key:"setInstanced",value:function(e){return this.instanced=e,this}}],[{key:"type",get:function(){return"BufferAttributeNode"}}])}(LS),uE=function(e){return MA(new sE(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,arguments.length>3&&void 0!==arguments[3]?arguments[3]:0))},lE=function(e){return uE(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,arguments.length>3&&void 0!==arguments[3]?arguments[3]:0).setUsage(Tc)},cE=function(e){return uE(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,arguments.length>3&&void 0!==arguments[3]?arguments[3]:0).setInstanced(!0)},hE=function(e){return lE(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,arguments.length>3&&void 0!==arguments[3]?arguments[3]:0).setInstanced(!0)};zS("toAttribute",function(e){return uE(e.value)});var dE=function(e){function t(e,n){var r,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[64];return A(this,t),(r=y(this,t,["void"])).isComputeNode=!0,r.computeNode=e,r.count=n,r.workgroupSize=i,r.dispatchCount=0,r.version=1,r.name="",r.updateBeforeType=_S.OBJECT,r.onInitFunction=null,r.updateDispatchCount(),r}return x(t,e),T(t,[{key:"dispose",value:function(){this.dispatchEvent({type:"dispose"})}},{key:"label",value:function(e){return this.name=e,this}},{key:"updateDispatchCount",value:function(){for(var e=this.count,t=this.workgroupSize,n=t[0],r=1;r1&&void 0!==arguments[1])||arguments[1];return A(this,t),(n=y(this,t)).node=e,n.parent=r,n.isCacheNode=!0,n}return x(t,e),T(t,[{key:"getNodeType",value:function(e){var t=e.getCache(),n=e.getCacheFromNode(this,this.parent);e.setCache(n);var r=this.node.getNodeType(e);return e.setCache(t),r}},{key:"build",value:function(e){var t,n=e.getCache(),r=e.getCacheFromNode(this,this.parent);e.setCache(r);for(var i=arguments.length,a=new Array(i>1?i-1:0),o=1;o3&&void 0!==arguments[3]?arguments[3]:FA(0),o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:FA(1);return A(this,t),(i=y(this,t)).node=e,i.inLowNode=n,i.inHighNode=r,i.outLowNode=a,i.outHighNode=o,i.doClamp=!0,i}return x(t,e),T(t,[{key:"setup",value:function(){var e=this.node,t=this.inLowNode,n=this.inHighNode,r=this.outLowNode,i=this.outHighNode,a=this.doClamp,o=e.sub(t).div(n.sub(t));return!0===a&&(o=o.clamp()),o.mul(i.sub(r)).add(r)}}],[{key:"type",get:function(){return"RemapNode"}}])}(TS),yE=kA(gE,null,null,{doClamp:!1}),_E=kA(gE);zS("remap",yE),zS("remapClamp",_E);var bE=function(e){function t(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"void";return A(this,t),(e=y(this,t,[r])).snippet=n,e}return x(t,e),T(t,[{key:"generate",value:function(e,t){var n=this.getNodeType(e),r=this.snippet;if("void"!==n)return e.format("( ".concat(r," )"),n,t);e.addLineFlowCode(r,this)}}],[{key:"type",get:function(){return"ExpressionNode"}}])}(TS),xE=kA(bE),SE=function(e){return(e?NM(e,xE("discard")):xE("discard")).append()};zS("discard",SE);var AE=function(e){function t(e,n,r){var i;return A(this,t),(i=y(this,t,["vec4"])).colorNode=e,i.toneMapping=n,i.outputColorSpace=r,i.isRenderOutputNode=!0,i}return x(t,e),T(t,[{key:"setup",value:function(e){var t=e.context,n=this.colorNode||t.color,r=(null!==this.toneMapping?this.toneMapping:t.toneMapping)||0,i=(null!==this.outputColorSpace?this.outputColorSpace:t.outputColorSpace)||yc;return 0!==r&&(n=n.toneMapping(r)),i!==yc&&i!==$c.workingColorSpace&&(n=n.workingToColorSpace(i)),n}}],[{key:"type",get:function(){return"RenderOutputNode"}}])}(CS),wE=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return MA(new AE(MA(e),t,n))};zS("renderOutput",wE);var TE=function(e){function t(e){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return A(this,t),(n=y(this,t,[r])).global=!0,n._attributeName=e,n}return x(t,e),T(t,[{key:"getHash",value:function(e){return this.getAttributeName(e)}},{key:"getNodeType",value:function(e){var t=this.nodeType;if(null===t){var n=this.getAttributeName(e);if(e.hasGeometryAttribute(n)){var r=e.geometry.getAttribute(n);t=e.getTypeFromAttribute(r)}else t="float"}return t}},{key:"setAttributeName",value:function(e){return this._attributeName=e,this}},{key:"getAttributeName",value:function(){return this._attributeName}},{key:"generate",value:function(e){var t=this.getAttributeName(e),n=this.getNodeType(e);if(!0===e.hasGeometryAttribute(t)){var r=e.geometry.getAttribute(t),i=e.getTypeFromAttribute(r),a=e.getAttribute(t,i);return"vertex"===e.shaderStage?e.format(a.name,i,n):WM(this).build(e,n)}return console.warn('AttributeNode: Vertex attribute "'.concat(t,'" not found on geometry.')),e.generateConst(n)}},{key:"serialize",value:function(e){n(t,"serialize",this,3)([e]),e.global=this.global,e._attributeName=this._attributeName}},{key:"deserialize",value:function(e){n(t,"deserialize",this,3)([e]),this.global=e.global,this._attributeName=e._attributeName}}],[{key:"type",get:function(){return"AttributeNode"}}])}(TS),ME=function(e,t){return MA(new TE(e,t))},EE=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return ME("uv"+(e>0?e:""),"vec2")},CE=function(e){function t(e){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return A(this,t),(n=y(this,t,["uvec2"])).isTextureSizeNode=!0,n.textureNode=e,n.levelNode=r,n}return x(t,e),T(t,[{key:"generate",value:function(e,t){var n=this.textureNode.build(e,"property"),r=null===this.levelNode?"0":this.levelNode.build(e,"int");return e.format("".concat(e.getMethod("textureDimensions"),"( ").concat(n,", ").concat(r," )"),this.getNodeType(e),t)}}],[{key:"type",get:function(){return"TextureSizeNode"}}])}(TS),kE=kA(CE),RE=kA(function(e){function t(e){var n;return A(this,t),(n=y(this,t,[0]))._textureNode=e,n.updateType=_S.FRAME,n}return x(t,e),T(t,[{key:"textureNode",get:function(){return this._textureNode}},{key:"texture",get:function(){return this._textureNode.value}},{key:"update",value:function(){var e=this.texture,t=e.images,n=t&&t.length>0?t[0]&&t[0].image||t[0]:e.image;if(n&&void 0!==n.width){var r=n.width,i=n.height;this.value=Math.log2(Math.max(r,i))}}}],[{key:"type",get:function(){return"MaxMipLevelNode"}}])}(dw)),IE=function(e){function t(e){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;return A(this,t),(n=y(this,t,[e])).isTextureNode=!0,n.uvNode=r,n.levelNode=i,n.biasNode=a,n.compareNode=null,n.depthNode=null,n.gradNode=null,n.sampler=!0,n.updateMatrix=!1,n.updateType=_S.NONE,n.referenceNode=null,n._value=e,n._matrixUniform=null,n.setUpdateMatrix(null===r),n}return x(t,e),T(t,[{key:"value",get:function(){return this.referenceNode?this.referenceNode.value:this._value},set:function(e){this.referenceNode?this.referenceNode.value=e:this._value=e}},{key:"getUniformHash",value:function(){return this.value.uuid}},{key:"getNodeType",value:function(){return!0===this.value.isDepthTexture?"float":this.value.type===gl?"uvec4":this.value.type===ml?"ivec4":"vec4"}},{key:"getInputType",value:function(){return"texture"}},{key:"getDefaultUV",value:function(){return EE(this.value.channel)}},{key:"updateReference",value:function(){return this.value}},{key:"getTransformedUV",value:function(e){return null===this._matrixUniform&&(this._matrixUniform=fw(this.value.matrix)),this._matrixUniform.mul(jA(e,1)).xy}},{key:"setUpdateMatrix",value:function(e){return this.updateMatrix=e,this.updateType=e?_S.RENDER:_S.NONE,this}},{key:"setupUV",value:function(e,t){var n=this.value;return e.isFlipY()&&(n.image instanceof ImageBitmap&&!0===n.flipY||!0===n.isRenderTargetTexture||!0===n.isFramebufferTexture||!0===n.isDepthTexture)&&(t=this.sampler?t.flipY():t.setY(BA(kE(this,this.levelNode).y).sub(t.y).sub(1))),t}},{key:"setup",value:function(e){var t=e.getNodeProperties(this);t.referenceNode=this.referenceNode;var n=this.value;if(!n||!0!==n.isTexture)throw new Error("THREE.TSL: `texture( value )` function expects a valid instance of THREE.Texture().");var r=this.uvNode;null!==r&&!0!==e.context.forceUVContext||!e.context.getUV||(r=e.context.getUV(this)),r||(r=this.getDefaultUV()),!0===this.updateMatrix&&(r=this.getTransformedUV(r)),r=this.setupUV(e,r);var i=this.levelNode;null===i&&e.context.getTextureLevel&&(i=e.context.getTextureLevel(this)),t.uvNode=r,t.levelNode=i,t.biasNode=this.biasNode,t.compareNode=this.compareNode,t.gradNode=this.gradNode,t.depthNode=this.depthNode}},{key:"generateUV",value:function(e,t){return t.build(e,!0===this.sampler?"vec2":"ivec2")}},{key:"generateSnippet",value:function(e,t,n,r,i,a,o,s){var u=this.value;return r?e.generateTextureLevel(u,t,n,r,a):i?e.generateTextureBias(u,t,n,i,a):s?e.generateTextureGrad(u,t,n,s,a):o?e.generateTextureCompare(u,t,n,o,a):!1===this.sampler?e.generateTextureLoad(u,t,n,a):e.generateTexture(u,t,n,a)}},{key:"generate",value:function(e,r){var i=this.value,a=e.getNodeProperties(this),o=n(t,"generate",this,3)([e,"property"]);if("sampler"===r)return o+"_sampler";if(e.isReference(r))return o;var s=e.getDataFromNode(this),u=s.propertyName;if(void 0===u){var l=a.uvNode,c=a.levelNode,h=a.biasNode,d=a.compareNode,f=a.depthNode,p=a.gradNode,v=this.generateUV(e,l),m=c?c.build(e,"float"):null,g=h?h.build(e,"float"):null,y=f?f.build(e,"int"):null,_=d?d.build(e,"float"):null,b=p?[p[0].build(e,"vec2"),p[1].build(e,"vec2")]:null,x=e.getVarFromNode(this);u=e.getPropertyName(x);var S=this.generateSnippet(e,o,v,m,g,y,_,b);e.addLineFlowCode("".concat(u," = ").concat(S),this),s.snippet=S,s.propertyName=u}var A=u,w=this.getNodeType(e);return e.needsToWorkingColorSpace(i)&&(A=$M(xE(A,w),i.colorSpace).setup(e).build(e,w)),e.format(A,w,r)}},{key:"setSampler",value:function(e){return this.sampler=e,this}},{key:"getSampler",value:function(){return this.sampler}},{key:"uv",value:function(e){return console.warn("THREE.TextureNode: .uv() has been renamed. Use .sample() instead."),this.sample(e)}},{key:"sample",value:function(e){var t=this.clone();return t.uvNode=MA(e),t.referenceNode=this.getSelf(),MA(t)}},{key:"blur",value:function(e){var t=this.clone();return t.biasNode=MA(e).mul(RE(t)),t.referenceNode=this.getSelf(),MA(t)}},{key:"level",value:function(e){var t=this.clone();return t.levelNode=MA(e),t.referenceNode=this.getSelf(),MA(t)}},{key:"size",value:function(e){return kE(this,e)}},{key:"bias",value:function(e){var t=this.clone();return t.biasNode=MA(e),t.referenceNode=this.getSelf(),MA(t)}},{key:"compare",value:function(e){var t=this.clone();return t.compareNode=MA(e),t.referenceNode=this.getSelf(),MA(t)}},{key:"grad",value:function(e,t){var n=this.clone();return n.gradNode=[MA(e),MA(t)],n.referenceNode=this.getSelf(),MA(n)}},{key:"depth",value:function(e){var t=this.clone();return t.depthNode=MA(e),t.referenceNode=this.getSelf(),MA(t)}},{key:"serialize",value:function(e){n(t,"serialize",this,3)([e]),e.value=this.value.toJSON(e.meta).uuid,e.sampler=this.sampler,e.updateMatrix=this.updateMatrix,e.updateType=this.updateType}},{key:"deserialize",value:function(e){n(t,"deserialize",this,3)([e]),this.value=e.meta.textures[e.value],this.sampler=e.sampler,this.updateMatrix=e.updateMatrix,this.updateType=e.updateType}},{key:"update",value:function(){var e=this.value,t=this._matrixUniform;null!==t&&(t.value=e.matrix),!0===e.matrixAutoUpdate&&e.updateMatrix()}},{key:"clone",value:function(){var e=new this.constructor(this.value,this.uvNode,this.levelNode,this.biasNode);return e.sampler=this.sampler,e}}],[{key:"type",get:function(){return"TextureNode"}}])}(dw),NE=kA(IE),PE=function(){return NE.apply(void 0,arguments).setSampler(!1)},LE=function(e){function t(e,n){var r,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return A(this,t),(r=y(this,t,[e,n])).isBufferNode=!0,r.bufferType=n,r.bufferCount=i,r}return x(t,e),T(t,[{key:"getElementType",value:function(e){return this.getNodeType(e)}},{key:"getInputType",value:function(){return"buffer"}}],[{key:"type",get:function(){return"BufferNode"}}])}(dw),DE=function(e,t,n){return MA(new LE(e,t,n))},OE=function(e){function t(e,n){var r;return A(this,t),(r=y(this,t,[e,n])).isArrayBufferElementNode=!0,r}return x(t,e),T(t,[{key:"generate",value:function(e){var r=n(t,"generate",this,3)([e]),i=this.getNodeType(),a=this.node.getPaddedType();return e.format(r,a,i)}}],[{key:"type",get:function(){return"UniformArrayElementNode"}}])}(MS),FE=function(e){function t(e){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return A(this,t),(n=y(this,t,[null])).array=e,n.elementType=null===r?fS(e[0]):r,n.paddedType=n.getPaddedType(),n.updateType=_S.RENDER,n.isArrayBufferNode=!0,n}return x(t,e),T(t,[{key:"getNodeType",value:function(){return this.paddedType}},{key:"getElementType",value:function(){return this.elementType}},{key:"getPaddedType",value:function(){var e=this.elementType,t="vec4";return"mat2"===e?t="mat2":!0===/mat/.test(e)?t="mat4":"i"===e.charAt(0)?t="ivec4":"u"===e.charAt(0)&&(t="uvec4"),t}},{key:"update",value:function(){var e=this.array,t=this.value,n=this.elementType;if("float"===n||"int"===n||"uint"===n)for(var r=0;r0){var r,i=[],a=L(n.cameras);try{for(a.s();!(r=a.n()).done;){var o=r.value;i.push(o.projectionMatrix)}}catch(s){a.e(s)}finally{a.f()}t=BE(i).setGroup(cw).label("cameraProjectionMatrices").element(UE).toVar("cameraProjectionMatrix")}else t=fw("mat4").label("cameraProjectionMatrix").setGroup(cw).onRenderUpdate(function(e){return e.camera.projectionMatrix});return t}).once()(),WE=fw("mat4").label("cameraProjectionMatrixInverse").setGroup(cw).onRenderUpdate(function(e){return e.camera.projectionMatrixInverse}),GE=IA(function(e){var t,n=e.camera;if(n.isArrayCamera&&n.cameras.length>0){var r,i=[],a=L(n.cameras);try{for(a.s();!(r=a.n()).done;){var o=r.value;i.push(o.matrixWorldInverse)}}catch(s){a.e(s)}finally{a.f()}t=BE(i).setGroup(cw).label("cameraViewMatrices").element(UE).toVar("cameraViewMatrix")}else t=fw("mat4").label("cameraViewMatrix").setGroup(cw).onRenderUpdate(function(e){return e.camera.matrixWorldInverse});return t}).once()(),jE=fw("mat4").label("cameraWorldMatrix").setGroup(cw).onRenderUpdate(function(e){return e.camera.matrixWorld}),QE=fw("mat3").label("cameraNormalMatrix").setGroup(cw).onRenderUpdate(function(e){return e.camera.normalMatrix}),qE=fw(new ph).label("cameraPosition").setGroup(cw).onRenderUpdate(function(e,t){var n=e.camera;return t.value.setFromMatrixPosition(n.matrixWorld)}),XE=function(e){function t(e){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return A(this,t),(n=y(this,t)).scope=e,n.object3d=r,n.updateType=_S.OBJECT,n._uniformNode=new dw(null),n}return x(t,e),T(t,[{key:"getNodeType",value:function(){var e=this.scope;return e===t.WORLD_MATRIX?"mat4":e===t.POSITION||e===t.VIEW_POSITION||e===t.DIRECTION||e===t.SCALE?"vec3":void 0}},{key:"update",value:function(e){var n=this.object3d,r=this._uniformNode,i=this.scope;if(i===t.WORLD_MATRIX)r.value=n.matrixWorld;else if(i===t.POSITION)r.value=r.value||new ph,r.value.setFromMatrixPosition(n.matrixWorld);else if(i===t.SCALE)r.value=r.value||new ph,r.value.setFromMatrixScale(n.matrixWorld);else if(i===t.DIRECTION)r.value=r.value||new ph,n.getWorldDirection(r.value);else if(i===t.VIEW_POSITION){var a=e.camera;r.value=r.value||new ph,r.value.setFromMatrixPosition(n.matrixWorld),r.value.applyMatrix4(a.matrixWorldInverse)}}},{key:"generate",value:function(e){var n=this.scope;return n===t.WORLD_MATRIX?this._uniformNode.nodeType="mat4":n!==t.POSITION&&n!==t.VIEW_POSITION&&n!==t.DIRECTION&&n!==t.SCALE||(this._uniformNode.nodeType="vec3"),this._uniformNode.build(e)}},{key:"serialize",value:function(e){n(t,"serialize",this,3)([e]),e.scope=this.scope}},{key:"deserialize",value:function(e){n(t,"deserialize",this,3)([e]),this.scope=e.scope}}],[{key:"type",get:function(){return"Object3DNode"}}])}(TS);XE.WORLD_MATRIX="worldMatrix",XE.POSITION="position",XE.SCALE="scale",XE.VIEW_POSITION="viewPosition",XE.DIRECTION="direction";var YE=kA(XE,XE.DIRECTION),KE=kA(XE,XE.WORLD_MATRIX),ZE=kA(XE,XE.POSITION),JE=kA(XE,XE.SCALE),$E=kA(XE,XE.VIEW_POSITION),eC=function(e){function t(e){return A(this,t),y(this,t,[e])}return x(t,e),T(t,[{key:"update",value:function(e){this.object3d=e.object,n(t,"update",this,3)([e])}}],[{key:"type",get:function(){return"ModelNode"}}])}(XE),tC=RA(eC,eC.DIRECTION),nC=RA(eC,eC.WORLD_MATRIX),rC=RA(eC,eC.POSITION),iC=RA(eC,eC.SCALE),aC=RA(eC,eC.VIEW_POSITION),oC=fw(new Hc).onObjectUpdate(function(e,t){var n=e.object;return t.value.getNormalMatrix(n.matrixWorld)}),sC=fw(new Gh).onObjectUpdate(function(e,t){var n=e.object;return t.value.copy(n.matrixWorld).invert()}),uC=IA(function(e){return e.renderer.nodes.modelViewMatrix||lC}).once()().toVar("modelViewMatrix"),lC=GE.mul(nC),cC=IA(function(e){return e.context.isHighPrecisionModelViewMatrix=!0,fw("mat4").onObjectUpdate(function(e){var t=e.object,n=e.camera;return t.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,t.matrixWorld)})}).once()().toVar("highpModelViewMatrix"),hC=IA(function(e){var t=e.context.isHighPrecisionModelViewMatrix;return fw("mat3").onObjectUpdate(function(e){var n=e.object,r=e.camera;return!0!==t&&n.modelViewMatrix.multiplyMatrices(r.matrixWorldInverse,n.matrixWorld),n.normalMatrix.getNormalMatrix(n.modelViewMatrix)})}).once()().toVar("highpModelNormalViewMatrix"),dC=ME("position","vec3"),fC=dC.toVarying("positionLocal"),pC=dC.toVarying("positionPrevious"),vC=nC.mul(fC).xyz.toVarying("v_positionWorld").context({needsPositionReassign:!0}),mC=fC.transformDirection(nC).toVarying("v_positionWorldDirection").normalize().toVar("positionWorldDirection").context({needsPositionReassign:!0}),gC=IA(function(e){return e.context.setupPositionView()},"vec3").once()().toVarying("v_positionView").context({needsPositionReassign:!0}),yC=gC.negate().toVarying("v_positionViewDirection").normalize().toVar("positionViewDirection"),_C=function(e){function t(){var e;return A(this,t),(e=y(this,t,["bool"])).isFrontFacingNode=!0,e}return x(t,e),T(t,[{key:"generate",value:function(e){var t=e.renderer,n=e.material;return t.coordinateSystem===Ec&&1===n.side?"false":e.getFrontFacing()}}],[{key:"type",get:function(){return"FrontFacingNode"}}])}(TS),bC=RA(_C),xC=FA(bC).mul(2).sub(1),SC=ME("normal","vec3"),AC=IA(function(e){return!1===e.geometry.hasAttribute("normal")?(console.warn('TSL.NormalNode: Vertex attribute "normal" not found on geometry.'),jA(0,1,0)):SC},"vec3").once()().toVar("normalLocal"),wC=gC.dFdx().cross(gC.dFdy()).normalize().toVar("normalFlat"),TC=IA(function(e){return!0===e.material.flatShading?wC:WM(IC(AC),"v_normalView").normalize()},"vec3").once()().toVar("normalView"),MC=WM(TC.transformDirection(GE),"v_normalWorld").normalize().toVar("normalWorld"),EC=IA(function(e){return e.context.setupNormal().context({getUV:null})},"vec3").once()().mul(xC).toVar("transformedNormalView"),CC=EC.transformDirection(GE).toVar("transformedNormalWorld"),kC=IA(function(e){return e.context.setupClearcoatNormal().context({getUV:null})},"vec3").once()().mul(xC).toVar("transformedClearcoatNormalView"),RC=IA(function(e){var t=C(e,2),n=t[0],r=t[1],i=ew(void 0===r?nC:r),a=n.div(jA(i[0].dot(i[0]),i[1].dot(i[1]),i[2].dot(i[2])));return i.mul(a).xyz}),IC=IA(function(e,t){var n=C(e,1)[0],r=t.renderer.nodes.modelNormalViewMatrix;if(null!==r)return r.transformDirection(n);var i=oC.mul(n);return GE.transformDirection(i)}),NC=fw(0).onReference(function(e){return e.material}).onRenderUpdate(function(e){return e.material.refractionRatio}),PC=yC.negate().reflect(EC),LC=yC.negate().refract(EC,NC),DC=PC.transformDirection(GE).toVar("reflectVector"),OC=LC.transformDirection(GE).toVar("reflectVector"),FC=function(e){function t(e){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;return A(this,t),(n=y(this,t,[e,r,i,a])).isCubeTextureNode=!0,n}return x(t,e),T(t,[{key:"getInputType",value:function(){return"cubeTexture"}},{key:"getDefaultUV",value:function(){var e=this.value;return e.mapping===tl?DC:e.mapping===nl?OC:(console.error('THREE.CubeTextureNode: Mapping "%s" not supported.',e.mapping),jA(0,0,0))}},{key:"setUpdateMatrix",value:function(){}},{key:"setupUV",value:function(e,t){var n=this.value;return e.renderer.coordinateSystem!==Cc&&n.isRenderTargetTexture?t:jA(t.x.negate(),t.yz)}},{key:"generateUV",value:function(e,t){return t.build(e,"vec3")}}],[{key:"type",get:function(){return"CubeTextureNode"}}])}(IE),BC=kA(FC),UC=function(e){function t(e,n){var r;return A(this,t),(r=y(this,t,[e,n])).referenceNode=e,r.isReferenceElementNode=!0,r}return x(t,e),T(t,[{key:"getNodeType",value:function(){return this.referenceNode.uniformType}},{key:"generate",value:function(e){var r=n(t,"generate",this,3)([e]),i=this.referenceNode.getNodeType(),a=this.getNodeType();return e.format(r,i,a)}}],[{key:"type",get:function(){return"ReferenceElementNode"}}])}(MS),zC=function(e){function t(e,n){var r,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;return A(this,t),(r=y(this,t)).property=e,r.uniformType=n,r.object=i,r.count=a,r.properties=e.split("."),r.reference=i,r.node=null,r.group=null,r.name=null,r.updateType=_S.OBJECT,r}return x(t,e),T(t,[{key:"element",value:function(e){return MA(new UC(this,MA(e)))}},{key:"setGroup",value:function(e){return this.group=e,this}},{key:"label",value:function(e){return this.name=e,this}},{key:"setNodeType",value:function(e){var t=null;t=null!==this.count?DE(null,e,this.count):Array.isArray(this.getValueFromReference())?BE(null,e):"texture"===e?NE(null):"cubeTexture"===e?BC(null):fw(null,e),null!==this.group&&t.setGroup(this.group),null!==this.name&&t.label(this.name),this.node=t.getSelf()}},{key:"getNodeType",value:function(e){return null===this.node&&(this.updateReference(e),this.updateValue()),this.node.getNodeType(e)}},{key:"getValueFromReference",value:function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.reference,t=this.properties,n=e[t[0]],r=1;r2&&void 0!==arguments[2]?arguments[2]:null;return A(this,t),(r=y(this,t,[e,n,i])).material=i,r.isMaterialReferenceNode=!0,r}return x(t,e),T(t,[{key:"updateReference",value:function(e){return this.reference=null!==this.material?this.material:e.material,this.reference}}],[{key:"type",get:function(){return"MaterialReferenceNode"}}])}(zC),GC=function(e,t){return MA(new WC(e,t,arguments.length>2&&void 0!==arguments[2]?arguments[2]:null))},jC=IA(function(e){return!1===e.geometry.hasAttribute("tangent")&&e.geometry.computeTangents(),ME("tangent","vec4")})(),QC=jC.xyz.toVar("tangentLocal"),qC=uC.mul(YA(QC,0)).xyz.toVarying("v_tangentView").normalize().toVar("tangentView"),XC=qC.transformDirection(GE).toVarying("v_tangentWorld").normalize().toVar("tangentWorld"),YC=qC.toVar("transformedTangentView"),KC=YC.transformDirection(GE).normalize().toVar("transformedTangentWorld"),ZC=function(e){return e.mul(jC.w).xyz},JC=WM(ZC(SC.cross(jC)),"v_bitangentGeometry").normalize().toVar("bitangentGeometry"),$C=WM(ZC(AC.cross(QC)),"v_bitangentLocal").normalize().toVar("bitangentLocal"),ek=WM(ZC(TC.cross(qC)),"v_bitangentView").normalize().toVar("bitangentView"),tk=WM(ZC(MC.cross(XC)),"v_bitangentWorld").normalize().toVar("bitangentWorld"),nk=ZC(EC.cross(YC)).normalize().toVar("transformedBitangentView"),rk=nk.transformDirection(GE).normalize().toVar("transformedBitangentWorld"),ik=ew(qC,ek,TC),ak=yC.mul(ik),ok=function(){var e=Iw.cross(yC);return e=e.cross(Iw).normalize(),e=_M(e,EC,kw.mul(_w.oneMinus()).oneMinus().pow2().pow2()).normalize()}(),sk=IA(function(e){var t=e.eye_pos,n=e.surf_norm,r=e.mapN,i=e.uv,a=t.dFdx(),o=t.dFdy(),s=i.dFdx(),u=i.dFdy(),l=n,c=o.cross(l),h=l.cross(a),d=c.mul(s.x).add(h.mul(u.x)),f=c.mul(s.y).add(h.mul(u.y)),p=d.dot(d).max(f.dot(f)),v=xC.mul(p.inverseSqrt());return Kw(d.mul(r.x,v),f.mul(r.y,v),l.mul(r.z)).normalize()}),uk=function(e){function t(e){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return A(this,t),(n=y(this,t,["vec3"])).node=e,n.scaleNode=r,n.normalMapType=0,n}return x(t,e),T(t,[{key:"setup",value:function(e){var t=this.normalMapType,n=this.scaleNode,r=this.node.mul(2).sub(1);null!==n&&(r=jA(r.xy.mul(n),r.z));var i=null;if(1===t)i=IC(r);else if(0===t){i=!0===e.hasGeometryAttribute("tangent")?ik.mul(r).normalize():sk({eye_pos:gC,surf_norm:TC,mapN:r,uv:EE()})}return i}}],[{key:"type",get:function(){return"NormalMapNode"}}])}(CS),lk=kA(uk),ck=IA(function(e){var t=e.textureNode,n=e.bumpScale,r=function(e){return t.cache().context({getUV:function(t){return e(t.uvNode||EE())},forceUVContext:!0})},i=FA(r(function(e){return e}));return VA(FA(r(function(e){return e.add(e.dFdx())})).sub(i),FA(r(function(e){return e.add(e.dFdy())})).sub(i)).mul(n)}),hk=IA(function(e){var t=e.surf_pos,n=e.surf_norm,r=e.dHdxy,i=t.dFdx().normalize(),a=n,o=t.dFdy().normalize().cross(a),s=a.cross(i),u=i.dot(o).mul(xC),l=u.sign().mul(r.x.mul(o).add(r.y.mul(s)));return u.abs().mul(n).sub(l).normalize()}),dk=function(e){function t(e){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return A(this,t),(n=y(this,t,["vec3"])).textureNode=e,n.scaleNode=r,n}return x(t,e),T(t,[{key:"setup",value:function(){var e=null!==this.scaleNode?this.scaleNode:1,t=ck({textureNode:this.textureNode,bumpScale:e});return hk({surf_pos:gC,surf_norm:TC,dHdxy:t})}}],[{key:"type",get:function(){return"BumpMapNode"}}])}(CS),fk=kA(dk),pk=new Map,vk=function(e){function t(e){var n;return A(this,t),(n=y(this,t)).scope=e,n}return x(t,e),T(t,[{key:"getCache",value:function(e,t){var n=pk.get(e);return void 0===n&&(n=GC(e,t),pk.set(e,n)),n}},{key:"getFloat",value:function(e){return this.getCache(e,"float")}},{key:"getColor",value:function(e){return this.getCache(e,"color")}},{key:"getTexture",value:function(e){return this.getCache("map"===e?"map":e+"Map","texture")}},{key:"setup",value:function(e){var n=e.context.material,r=this.scope,i=null;if(r===t.COLOR){var a=void 0!==n.color?this.getColor(r):jA();i=n.map&&!0===n.map.isTexture?a.mul(this.getTexture("map")):a}else if(r===t.OPACITY){var o=this.getFloat(r);i=n.alphaMap&&!0===n.alphaMap.isTexture?o.mul(this.getTexture("alpha")):o}else if(r===t.SPECULAR_STRENGTH)i=n.specularMap&&!0===n.specularMap.isTexture?this.getTexture("specular").r:FA(1);else if(r===t.SPECULAR_INTENSITY){var s=this.getFloat(r);i=n.specularIntensityMap&&!0===n.specularIntensityMap.isTexture?s.mul(this.getTexture(r).a):s}else if(r===t.SPECULAR_COLOR){var u=this.getColor(r);i=n.specularColorMap&&!0===n.specularColorMap.isTexture?u.mul(this.getTexture(r).rgb):u}else if(r===t.ROUGHNESS){var l=this.getFloat(r);i=n.roughnessMap&&!0===n.roughnessMap.isTexture?l.mul(this.getTexture(r).g):l}else if(r===t.METALNESS){var c=this.getFloat(r);i=n.metalnessMap&&!0===n.metalnessMap.isTexture?c.mul(this.getTexture(r).b):c}else if(r===t.EMISSIVE){var h=this.getFloat("emissiveIntensity"),d=this.getColor(r).mul(h);i=n.emissiveMap&&!0===n.emissiveMap.isTexture?d.mul(this.getTexture(r)):d}else if(r===t.NORMAL)n.normalMap?(i=lk(this.getTexture("normal"),this.getCache("normalScale","vec2"))).normalMapType=n.normalMapType:i=n.bumpMap?fk(this.getTexture("bump").r,this.getFloat("bumpScale")):TC;else if(r===t.CLEARCOAT){var f=this.getFloat(r);i=n.clearcoatMap&&!0===n.clearcoatMap.isTexture?f.mul(this.getTexture(r).r):f}else if(r===t.CLEARCOAT_ROUGHNESS){var p=this.getFloat(r);i=n.clearcoatRoughnessMap&&!0===n.clearcoatRoughnessMap.isTexture?p.mul(this.getTexture(r).r):p}else if(r===t.CLEARCOAT_NORMAL)i=n.clearcoatNormalMap?lk(this.getTexture(r),this.getCache(r+"Scale","vec2")):TC;else if(r===t.SHEEN){var v=this.getColor("sheenColor").mul(this.getFloat("sheen"));i=n.sheenColorMap&&!0===n.sheenColorMap.isTexture?v.mul(this.getTexture("sheenColor").rgb):v}else if(r===t.SHEEN_ROUGHNESS){var m=this.getFloat(r);i=(i=n.sheenRoughnessMap&&!0===n.sheenRoughnessMap.isTexture?m.mul(this.getTexture(r).a):m).clamp(.07,1)}else if(r===t.ANISOTROPY)if(n.anisotropyMap&&!0===n.anisotropyMap.isTexture){var g=this.getTexture(r);i=$A($k.x,$k.y,$k.y.negate(),$k.x).mul(g.rg.mul(2).sub(VA(1)).normalize().mul(g.b))}else i=$k;else if(r===t.IRIDESCENCE_THICKNESS){var y=VC("1","float",n.iridescenceThicknessRange);if(n.iridescenceThicknessMap){var _=VC("0","float",n.iridescenceThicknessRange);i=y.sub(_).mul(this.getTexture(r).g).add(_)}else i=y}else if(r===t.TRANSMISSION){var b=this.getFloat(r);i=n.transmissionMap?b.mul(this.getTexture(r).r):b}else if(r===t.THICKNESS){var x=this.getFloat(r);i=n.thicknessMap?x.mul(this.getTexture(r).g):x}else if(r===t.IOR)i=this.getFloat(r);else if(r===t.LIGHT_MAP)i=this.getTexture(r).rgb.mul(this.getFloat("lightMapIntensity"));else if(r===t.AO)i=this.getTexture(r).r.sub(1).mul(this.getFloat("aoMapIntensity")).add(1);else{var S=this.getNodeType(e);i=this.getCache(r,S)}return i}}],[{key:"type",get:function(){return"MaterialNode"}}])}(TS);vk.ALPHA_TEST="alphaTest",vk.COLOR="color",vk.OPACITY="opacity",vk.SHININESS="shininess",vk.SPECULAR="specular",vk.SPECULAR_STRENGTH="specularStrength",vk.SPECULAR_INTENSITY="specularIntensity",vk.SPECULAR_COLOR="specularColor",vk.REFLECTIVITY="reflectivity",vk.ROUGHNESS="roughness",vk.METALNESS="metalness",vk.NORMAL="normal",vk.CLEARCOAT="clearcoat",vk.CLEARCOAT_ROUGHNESS="clearcoatRoughness",vk.CLEARCOAT_NORMAL="clearcoatNormal",vk.EMISSIVE="emissive",vk.ROTATION="rotation",vk.SHEEN="sheen",vk.SHEEN_ROUGHNESS="sheenRoughness",vk.ANISOTROPY="anisotropy",vk.IRIDESCENCE="iridescence",vk.IRIDESCENCE_IOR="iridescenceIOR",vk.IRIDESCENCE_THICKNESS="iridescenceThickness",vk.IOR="ior",vk.TRANSMISSION="transmission",vk.THICKNESS="thickness",vk.ATTENUATION_DISTANCE="attenuationDistance",vk.ATTENUATION_COLOR="attenuationColor",vk.LINE_SCALE="scale",vk.LINE_DASH_SIZE="dashSize",vk.LINE_GAP_SIZE="gapSize",vk.LINE_WIDTH="linewidth",vk.LINE_DASH_OFFSET="dashOffset",vk.POINT_SIZE="size",vk.DISPERSION="dispersion",vk.LIGHT_MAP="light",vk.AO="ao";var mk=RA(vk,vk.ALPHA_TEST),gk=RA(vk,vk.COLOR),yk=RA(vk,vk.SHININESS),_k=RA(vk,vk.EMISSIVE),bk=RA(vk,vk.OPACITY),xk=RA(vk,vk.SPECULAR),Sk=RA(vk,vk.SPECULAR_INTENSITY),Ak=RA(vk,vk.SPECULAR_COLOR),wk=RA(vk,vk.SPECULAR_STRENGTH),Tk=RA(vk,vk.REFLECTIVITY),Mk=RA(vk,vk.ROUGHNESS),Ek=RA(vk,vk.METALNESS),Ck=RA(vk,vk.NORMAL),kk=RA(vk,vk.CLEARCOAT),Rk=RA(vk,vk.CLEARCOAT_ROUGHNESS),Ik=RA(vk,vk.CLEARCOAT_NORMAL),Nk=RA(vk,vk.ROTATION),Pk=RA(vk,vk.SHEEN),Lk=RA(vk,vk.SHEEN_ROUGHNESS),Dk=RA(vk,vk.ANISOTROPY),Ok=RA(vk,vk.IRIDESCENCE),Fk=RA(vk,vk.IRIDESCENCE_IOR),Bk=RA(vk,vk.IRIDESCENCE_THICKNESS),Uk=RA(vk,vk.TRANSMISSION),zk=RA(vk,vk.THICKNESS),Vk=RA(vk,vk.IOR),Hk=RA(vk,vk.ATTENUATION_DISTANCE),Wk=RA(vk,vk.ATTENUATION_COLOR),Gk=RA(vk,vk.LINE_SCALE),jk=RA(vk,vk.LINE_DASH_SIZE),Qk=RA(vk,vk.LINE_GAP_SIZE),qk=RA(vk,vk.LINE_WIDTH),Xk=RA(vk,vk.LINE_DASH_OFFSET),Yk=RA(vk,vk.POINT_SIZE),Kk=RA(vk,vk.DISPERSION),Zk=RA(vk,vk.LIGHT_MAP),Jk=RA(vk,vk.AO),$k=fw(new Vc).onReference(function(e){return e.material}).onRenderUpdate(function(e){var t=e.material;this.value.set(t.anisotropy*Math.cos(t.anisotropyRotation),t.anisotropy*Math.sin(t.anisotropyRotation))}),eR=IA(function(e){return e.context.setupModelViewProjection()},"vec4").once()().toVarying("v_modelViewProjection"),tR=function(e){function t(e){var n;return A(this,t),(n=y(this,t,["uint"])).scope=e,n.isIndexNode=!0,n}return x(t,e),T(t,[{key:"generate",value:function(e){var n,r,i=this.getNodeType(e),a=this.scope;if(a===t.VERTEX)n=e.getVertexIndex();else if(a===t.INSTANCE)n=e.getInstanceIndex();else if(a===t.DRAW)n=e.getDrawIndex();else if(a===t.INVOCATION_LOCAL)n=e.getInvocationLocalIndex();else if(a===t.INVOCATION_SUBGROUP)n=e.getInvocationSubgroupIndex();else{if(a!==t.SUBGROUP)throw new Error("THREE.IndexNode: Unknown scope: "+a);n=e.getSubgroupIndex()}"vertex"===e.shaderStage||"compute"===e.shaderStage?r=n:r=WM(this).build(e,i);return r}}],[{key:"type",get:function(){return"IndexNode"}}])}(TS);tR.VERTEX="vertex",tR.INSTANCE="instance",tR.SUBGROUP="subgroup",tR.INVOCATION_LOCAL="invocationLocal",tR.INVOCATION_SUBGROUP="invocationSubgroup",tR.DRAW="draw";var nR=RA(tR,tR.VERTEX),rR=RA(tR,tR.INSTANCE),iR=RA(tR,tR.SUBGROUP),aR=RA(tR,tR.INVOCATION_SUBGROUP),oR=RA(tR,tR.INVOCATION_LOCAL),sR=RA(tR,tR.DRAW),uR=function(e){function t(e,n,r){var i;return A(this,t),(i=y(this,t,["void"])).count=e,i.instanceMatrix=n,i.instanceColor=r,i.instanceMatrixNode=null,i.instanceColorNode=null,i.updateType=_S.FRAME,i.buffer=null,i.bufferColor=null,i}return x(t,e),T(t,[{key:"setup",value:function(e){var t=this.count,n=this.instanceMatrix,r=this.instanceColor,i=this.instanceMatrixNode,a=this.instanceColorNode;if(null===i){if(t<=1e3)i=DE(n.array,"mat4",Math.max(t,1)).element(rR);else{var o=new tm(n.array,16,1);this.buffer=o;var s=n.usage===Tc?hE:cE,u=[s(o,"vec4",16,0),s(o,"vec4",16,4),s(o,"vec4",16,8),s(o,"vec4",16,12)];i=tw.apply(void 0,u)}this.instanceMatrixNode=i}if(r&&null===a){var l=new np(r.array,3),c=r.usage===Tc?hE:cE;this.bufferColor=l,a=jA(c(l,"vec3",3,0)),this.instanceColorNode=a}var h=i.mul(fC).xyz;if(fC.assign(h),e.hasGeometryAttribute("normal")){var d=RC(AC,i);AC.assign(d)}null!==this.instanceColorNode&&mw("vec3","vInstanceColor").assign(this.instanceColorNode)}},{key:"update",value:function(){this.instanceMatrix.usage!==Tc&&null!==this.buffer&&this.instanceMatrix.version!==this.buffer.version&&(this.buffer.version=this.instanceMatrix.version),this.instanceColor&&this.instanceColor.usage!==Tc&&null!==this.bufferColor&&this.instanceColor.version!==this.bufferColor.version&&(this.bufferColor.version=this.instanceColor.version)}}],[{key:"type",get:function(){return"InstanceNode"}}])}(TS),lR=kA(uR),cR=kA(function(e){function t(e){var n;return A(this,t),(n=y(this,t,[e.count,e.instanceMatrix,e.instanceColor])).instancedMesh=e,n}return x(t,e),T(t,null,[{key:"type",get:function(){return"InstancedMeshNode"}}])}(uR)),hR=function(e){function t(e){var n;return A(this,t),(n=y(this,t,["void"])).batchMesh=e,n.batchingIdNode=null,n}return x(t,e),T(t,[{key:"setup",value:function(e){var t=this;null===this.batchingIdNode&&(null===e.getDrawIndex()?this.batchingIdNode=rR:this.batchingIdNode=sR);var n=IA(function(e){var n=C(e,1)[0],r=BA(kE(PE(t.batchMesh._indirectTexture),0)),i=BA(n).modInt(r),a=BA(n).div(r);return PE(t.batchMesh._indirectTexture,HA(i,a)).x}).setLayout({name:"getIndirectIndex",type:"uint",inputs:[{name:"id",type:"int"}]}),r=n(BA(this.batchingIdNode)),i=this.batchMesh._matricesTexture,a=kE(PE(i),0),o=FA(r).mul(4).toInt().toVar(),s=o.modInt(a),u=o.div(BA(a)),l=tw(PE(i,HA(s,u)),PE(i,HA(s.add(1),u)),PE(i,HA(s.add(2),u)),PE(i,HA(s.add(3),u))),c=this.batchMesh._colorsTexture;if(null!==c){var h=IA(function(e){var t=C(e,1)[0],n=kE(PE(c),0).x,r=t,i=r.modInt(n),a=r.div(n);return PE(c,HA(i,a)).rgb}).setLayout({name:"getBatchingColor",type:"vec3",inputs:[{name:"id",type:"int"}]}),d=h(r);mw("vec3","vBatchColor").assign(d)}var f=ew(l);fC.assign(l.mul(fC));var p=AC.div(jA(f[0].dot(f[0]),f[1].dot(f[1]),f[2].dot(f[2]))),v=f.mul(p).xyz;AC.assign(v),e.hasGeometryAttribute("tangent")&&QC.mulAssign(f)}}],[{key:"type",get:function(){return"BatchNode"}}])}(TS),dR=kA(hR),fR=new WeakMap,pR=function(e){function t(e){var n,r,i,a,o=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return A(this,t),(n=y(this,t,["void"])).skinnedMesh=e,n.useReference=o,n.updateType=_S.OBJECT,n.skinIndexNode=ME("skinIndex","uvec4"),n.skinWeightNode=ME("skinWeight","vec4"),o?(r=VC("bindMatrix","mat4"),i=VC("bindMatrixInverse","mat4"),a=HC("skeleton.boneMatrices","mat4",e.skeleton.bones.length)):(r=fw(e.bindMatrix,"mat4"),i=fw(e.bindMatrixInverse,"mat4"),a=DE(e.skeleton.boneMatrices,"mat4",e.skeleton.bones.length)),n.bindMatrixNode=r,n.bindMatrixInverseNode=i,n.boneMatricesNode=a,n.previousBoneMatricesNode=null,n}return x(t,e),T(t,[{key:"getSkinnedPosition",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.boneMatricesNode,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:fC,n=this.skinIndexNode,r=this.skinWeightNode,i=this.bindMatrixNode,a=this.bindMatrixInverseNode,o=e.element(n.x),s=e.element(n.y),u=e.element(n.z),l=e.element(n.w),c=i.mul(t),h=Kw(o.mul(r.x).mul(c),s.mul(r.y).mul(c),u.mul(r.z).mul(c),l.mul(r.w).mul(c));return a.mul(h).xyz}},{key:"getSkinnedNormal",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.boneMatricesNode,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:AC,n=this.skinIndexNode,r=this.skinWeightNode,i=this.bindMatrixNode,a=this.bindMatrixInverseNode,o=e.element(n.x),s=e.element(n.y),u=e.element(n.z),l=e.element(n.w),c=Kw(r.x.mul(o),r.y.mul(s),r.z.mul(u),r.w.mul(l));return(c=a.mul(c).mul(i)).transformDirection(t).xyz}},{key:"getPreviousSkinnedPosition",value:function(e){var t=e.object;return null===this.previousBoneMatricesNode&&(t.skeleton.previousBoneMatrices=new Float32Array(t.skeleton.boneMatrices),this.previousBoneMatricesNode=HC("skeleton.previousBoneMatrices","mat4",t.skeleton.bones.length)),this.getSkinnedPosition(this.previousBoneMatricesNode,pC)}},{key:"needsPreviousBoneMatrices",value:function(e){var t=e.renderer.getMRT();return t&&t.has("velocity")||!0===vS(e.object).useVelocity}},{key:"setup",value:function(e){this.needsPreviousBoneMatrices(e)&&pC.assign(this.getPreviousSkinnedPosition(e));var t=this.getSkinnedPosition();if(fC.assign(t),e.hasGeometryAttribute("normal")){var n=this.getSkinnedNormal();AC.assign(n),e.hasGeometryAttribute("tangent")&&QC.assign(n)}}},{key:"generate",value:function(e,t){if("void"!==t)return fC.build(e,t)}},{key:"update",value:function(e){var t=(this.useReference?e.object:this.skinnedMesh).skeleton;fR.get(t)!==e.frameId&&(fR.set(t,e.frameId),null!==this.previousBoneMatricesNode&&t.previousBoneMatrices.set(t.boneMatrices),t.update())}}],[{key:"type",get:function(){return"SkinningNode"}}])}(TS),vR=function(e){return MA(new pR(e,!0))},mR=function(e){function t(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return A(this,t),(e=y(this,t)).params=n,e}return x(t,e),T(t,[{key:"getVarName",value:function(e){return String.fromCharCode("i".charCodeAt(0)+e)}},{key:"getProperties",value:function(e){var t=e.getNodeProperties(this);if(void 0!==t.stackNode)return t;for(var n={},r=0,i=this.params.length-1;rNumber(u)?">=":"<"));var f={start:s,end:u},p=f.start,v=f.end,m="",g="",y="";d||(d="int"===c||"uint"===c?h.includes("<")?"++":"--":h.includes("<")?"+= 1.":"-= 1."),m+=e.getVar(c,l)+" = "+p,g+=l+" "+h+" "+v,y+=l+" "+d;var _="for ( ".concat(m,"; ").concat(g,"; ").concat(y," )");e.addFlowCode((0===i?"\n":"")+e.tab+_+" {\n\n").addFlowTab()}var b=r.build(e,"void"),x=t.returnsNode?t.returnsNode.build(e):"";e.removeFlowTab().addFlowCode("\n"+e.tab+b);for(var S=0,A=this.params.length-1;Sf&&(d=Math.ceil(h/f),h=f);var p=new Float32Array(h*d*4*a),v=new hh(p,h,d,a);v.type=yl,v.needsUpdate=!0;for(var m=4*c,g=0;g1&&null!==t.mesh.morphTexture&&void 0!==t.mesh.morphTexture?a.assign(PE(t.mesh.morphTexture,HA(BA(n).add(1),BA(rR))).r):a.assign(VC("morphTargetInfluences","float").element(n).toVar()),!0===r&&fC.addAssign(xR({bufferMap:u,influence:a,stride:l,width:h,depth:n,offset:BA(0)})),!0===i&&AC.addAssign(xR({bufferMap:u,influence:a,stride:l,width:h,depth:n,offset:BA(1)}))})}},{key:"update",value:function(){var e=this.morphBaseInfluence;this.mesh.geometry.morphTargetsRelative?e.value=1:e.value=1-this.mesh.morphTargetInfluences.reduce(function(e,t){return e+t},0)}}],[{key:"type",get:function(){return"MorphNode"}}])}(TS),TR=kA(wR),MR=function(e){function t(){var e;return A(this,t),(e=y(this,t,["vec3"])).isLightingNode=!0,e}return x(t,e),T(t,null,[{key:"type",get:function(){return"LightingNode"}}])}(TS),ER=function(e){function t(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return A(this,t),(e=y(this,t)).aoNode=n,e}return x(t,e),T(t,[{key:"setup",value:function(e){e.context.ambientOcclusion.mulAssign(this.aoNode)}}],[{key:"type",get:function(){return"AONode"}}])}(MR),CR=function(e){function t(e){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;return A(this,t),(n=y(this,t,[e])).lightingModel=r,n.backdropNode=i,n.backdropAlphaNode=a,n._value=null,n}return x(t,e),T(t,[{key:"getContext",value:function(){var e=this.backdropNode,t=this.backdropAlphaNode,n={directDiffuse:jA().toVar("directDiffuse"),directSpecular:jA().toVar("directSpecular"),indirectDiffuse:jA().toVar("indirectDiffuse"),indirectSpecular:jA().toVar("indirectSpecular")};return{radiance:jA().toVar("radiance"),irradiance:jA().toVar("irradiance"),iblIrradiance:jA().toVar("iblIrradiance"),ambientOcclusion:FA(1).toVar("ambientOcclusion"),reflectedLight:n,backdrop:e,backdropAlpha:t}}},{key:"setup",value:function(e){return this.value=this._value||(this._value=this.getContext()),this.value.lightingModel=this.lightingModel||e.context.lightingModel,n(t,"setup",this,3)([e])}}],[{key:"type",get:function(){return"LightingContextNode"}}])}(LM),kR=kA(CR),RR=function(e){function t(e){var n;return A(this,t),(n=y(this,t)).node=e,n}return x(t,e),T(t,[{key:"setup",value:function(e){e.context.irradiance.addAssign(this.node)}}],[{key:"type",get:function(){return"IrradianceNode"}}])}(MR),IR=function(e){function t(e){var n;return A(this,t),(n=y(this,t)).scope=e,n.isViewportNode=!0,n}return x(t,e),T(t,[{key:"getNodeType",value:function(){return this.scope===t.VIEWPORT?"vec4":"vec2"}},{key:"getUpdateType",value:function(){var e=_S.NONE;return this.scope!==t.SIZE&&this.scope!==t.VIEWPORT||(e=_S.RENDER),this.updateType=e,e}},{key:"update",value:function(e){var n=e.renderer,r=n.getRenderTarget();this.scope===t.VIEWPORT?null!==r?AR.copy(r.viewport):(n.getViewport(AR),AR.multiplyScalar(n.getPixelRatio())):null!==r?(SR.width=r.width,SR.height=r.height):n.getDrawingBufferSize(SR)}},{key:"setup",value:function(){var e=this.scope;return e===t.SIZE?fw(SR||(SR=new Vc)):e===t.VIEWPORT?fw(AR||(AR=new uh)):VA(LR.div(PR))}},{key:"generate",value:function(e){if(this.scope===t.COORDINATE){var r=e.getFragCoord();if(e.isFlipY()){var i=e.getNodeProperties(PR).outputNode.build(e);r="".concat(e.getType("vec2"),"( ").concat(r,".x, ").concat(i,".y - ").concat(r,".y )")}return r}return n(t,"generate",this,3)([e])}}],[{key:"type",get:function(){return"ScreenNode"}}])}(TS);IR.COORDINATE="coordinate",IR.VIEWPORT="viewport",IR.SIZE="size",IR.UV="uv";var NR=RA(IR,IR.UV),PR=RA(IR,IR.SIZE),LR=RA(IR,IR.COORDINATE),DR=RA(IR,IR.VIEWPORT),OR=DR.zw,FR=LR.sub(DR.xy),BR=FR.div(OR),UR=IA(function(){return console.warn('TSL.ViewportNode: "viewportResolution" is deprecated. Use "screenSize" instead.'),PR},"vec2").once()(),zR=IA(function(){return console.warn('TSL.ViewportNode: "viewportTopLeft" is deprecated. Use "screenUV" instead.'),NR},"vec2").once()(),VR=IA(function(){return console.warn('TSL.ViewportNode: "viewportBottomLeft" is deprecated. Use "screenUV.flipY()" instead.'),NR.flipY()},"vec2").once()(),HR=new Vc,WR=function(e){function t(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:NR,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return A(this,t),null===i&&((i=new Up).minFilter=hl),(e=y(this,t,[i,n,r])).generateMipmaps=!1,e.isOutputTextureNode=!0,e.updateBeforeType=_S.FRAME,e}return x(t,e),T(t,[{key:"updateBefore",value:function(e){var t=e.renderer;t.getDrawingBufferSize(HR);var n=this.value;n.image.width===HR.width&&n.image.height===HR.height||(n.image.width=HR.width,n.image.height=HR.height,n.needsUpdate=!0);var r=n.generateMipmaps;n.generateMipmaps=this.generateMipmaps,t.copyFramebufferToTexture(n),n.generateMipmaps=r}},{key:"clone",value:function(){var e=new this.constructor(this.uvNode,this.levelNode,this.value);return e.generateMipmaps=this.generateMipmaps,e}}],[{key:"type",get:function(){return"ViewportTextureNode"}}])}(IE),GR=kA(WR),jR=kA(WR,null,null,{generateMipmaps:!0}),QR=null,qR=function(e){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:NR,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return A(this,t),null===QR&&(QR=new zp),y(this,t,[e,n,QR])}return x(t,e),T(t,null,[{key:"type",get:function(){return"ViewportDepthTextureNode"}}])}(WR),XR=kA(qR),YR=function(e){function t(e){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return A(this,t),(n=y(this,t,["float"])).scope=e,n.valueNode=r,n.isViewportDepthNode=!0,n}return x(t,e),T(t,[{key:"generate",value:function(e){return this.scope===t.DEPTH_BASE?e.getFragDepth():n(t,"generate",this,3)([e])}},{key:"setup",value:function(e){var n=e.camera,r=this.scope,i=this.valueNode,a=null;if(r===t.DEPTH_BASE)null!==i&&(a=eI().assign(i));else if(r===t.DEPTH)a=n.isPerspectiveCamera?ZR(gC.z,zE,VE):KR(gC.z,zE,VE);else if(r===t.LINEAR_DEPTH)if(null!==i)if(n.isPerspectiveCamera){var o=JR(i,zE,VE);a=KR(o,zE,VE)}else a=i;else a=KR(gC.z,zE,VE);return a}}],[{key:"type",get:function(){return"ViewportDepthNode"}}])}(TS);YR.DEPTH_BASE="depthBase",YR.DEPTH="depth",YR.LINEAR_DEPTH="linearDepth";var KR=function(e,t,n){return e.add(t).div(t.sub(n))},ZR=function(e,t,n){return t.add(e).mul(n).div(n.sub(t).mul(e))},JR=function(e,t,n){return t.mul(n).div(n.sub(t).mul(e).sub(n))},$R=function(e,t,n){t=t.max(1e-6).toVar();var r=RT(e.negate().div(t)),i=RT(n.div(t));return r.div(i)},eI=kA(YR,YR.DEPTH_BASE),tI=RA(YR,YR.DEPTH),nI=kA(YR,YR.LINEAR_DEPTH),rI=nI(XR());tI.assign=function(e){return eI(e)};var iI=function(e){function t(e){var n;return A(this,t),(n=y(this,t,["float"])).name=e,n.isBuiltinNode=!0,n}return x(t,e),T(t,[{key:"generate",value:function(){return this.name}}])}(TS),aI=kA(iI),oI=function(e){function t(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t.DEFAULT;return A(this,t),(e=y(this,t)).scope=n,e}return x(t,e),T(t,[{key:"setup",value:function(e){n(t,"setup",this,3)([e]);var r=e.clippingContext,i=r.intersectionPlanes,a=r.unionPlanes;return this.hardwareClipping=e.material.hardwareClipping,this.scope===t.ALPHA_TO_COVERAGE?this.setupAlphaToCoverage(i,a):this.scope===t.HARDWARE?this.setupHardwareClipping(a,e):this.setupDefault(i,a)}},{key:"setupAlphaToCoverage",value:function(e,t){var n=this;return IA(function(){var r=FA().toVar("distanceToPlane"),i=FA().toVar("distanceToGradient"),a=FA(1).toVar("clipOpacity"),o=t.length;if(!1===n.hardwareClipping&&o>0){var s=BE(t);gR(o,function(e){var t=e.i,n=s.element(t);r.assign(gC.dot(n.xyz).negate().add(n.w)),i.assign(r.fwidth().div(2)),a.mulAssign(AM(i.negate(),i,r))})}var u=e.length;if(u>0){var l=BE(e),c=FA(1).toVar("intersectionClipOpacity");gR(u,function(e){var t=e.i,n=l.element(t);r.assign(gC.dot(n.xyz).negate().add(n.w)),i.assign(r.fwidth().div(2)),c.mulAssign(AM(i.negate(),i,r).oneMinus())}),a.mulAssign(c.oneMinus())}gw.a.mulAssign(a),gw.a.equal(0).discard()})()}},{key:"setupDefault",value:function(e,t){var n=this;return IA(function(){var r=t.length;if(!1===n.hardwareClipping&&r>0){var i=BE(t);gR(r,function(e){var t=e.i,n=i.element(t);gC.dot(n.xyz).greaterThan(n.w).discard()})}var a=e.length;if(a>0){var o=BE(e),s=zA(!0).toVar("clipped");gR(a,function(e){var t=e.i,n=o.element(t);s.assign(gC.dot(n.xyz).greaterThan(n.w).and(s))}),s.discard()}})()}},{key:"setupHardwareClipping",value:function(e,t){var n=e.length;return t.enableHardwareClipping(n),IA(function(){var r=BE(e),i=aI(t.getClipDistance());gR(n,function(e){var t=e.i,n=r.element(t),a=gC.dot(n.xyz).sub(n.w).negate();i.element(t).assign(a)})})()}}],[{key:"type",get:function(){return"ClippingNode"}}])}(TS);oI.ALPHA_TO_COVERAGE="alphaToCoverage",oI.DEFAULT="default",oI.HARDWARE="hardware";var sI=IA(function(e){var t=C(e,1)[0];return OT(Jw(1e4,FT(Jw(17,t.x).add(Jw(.1,t.y)))).mul(Kw(.1,WT(FT(Jw(13,t.y).add(t.x))))))}),uI=IA(function(e){var t=C(e,1)[0];return sI(VA(sI(t.xy),t.z))}),lI=IA(function(e){var t=C(e,1)[0],n=iM(jT(XT(t.xyz)),jT(YT(t.xyz))),r=FA(1).div(FA(.05).mul(n)).toVar("pixScale"),i=VA(CT(PT(RT(r))),CT(LT(RT(r)))),a=VA(uI(PT(i.x.mul(t.xyz))),uI(PT(i.y.mul(t.xyz)))),o=OT(RT(r)),s=Kw(Jw(o.oneMinus(),a.x),Jw(o,a.y)),u=rM(o,o.oneMinus()),l=jA(s.mul(s).div(Jw(2,u).mul(Zw(1,u))),s.sub(Jw(.5,u)).div(Zw(1,u)),Zw(1,Zw(1,s).mul(Zw(1,s)).div(Jw(2,u).mul(Zw(1,u))))),c=s.lessThan(u.oneMinus()).select(s.lessThan(u).select(l.x,l.y),l.z);return bM(c,1e-6,1)}).setLayout({name:"getAlphaHashThreshold",type:"float",inputs:[{name:"position",type:"vec3"}]}),cI=function(e){function t(){var e;return A(this,t),(e=y(this,t)).isNodeMaterial=!0,e.fog=!0,e.lights=!1,e.hardwareClipping=!1,e.lightsNode=null,e.envNode=null,e.aoNode=null,e.colorNode=null,e.normalNode=null,e.opacityNode=null,e.backdropNode=null,e.backdropAlphaNode=null,e.alphaTestNode=null,e.positionNode=null,e.geometryNode=null,e.depthNode=null,e.shadowPositionNode=null,e.receivedShadowNode=null,e.castShadowNode=null,e.outputNode=null,e.mrtNode=null,e.fragmentNode=null,e.vertexNode=null,e}return x(t,e),T(t,[{key:"type",get:function(){return this.constructor.type},set:function(e){}},{key:"customProgramCacheKey",value:function(){return this.type+sS(this)}},{key:"build",value:function(e){this.setup(e)}},{key:"setupObserver",value:function(e){return new rS(e)}},{key:"setup",value:function(e){var t=this;e.context.setupNormal=function(){return t.setupNormal(e)},e.context.setupPositionView=function(){return t.setupPositionView(e)},e.context.setupModelViewProjection=function(){return t.setupModelViewProjection(e)};var n=e.renderer,r=n.getRenderTarget();e.addStack();var i,a=this.vertexNode||this.setupVertex(e);e.stack.outputNode=a,this.setupHardwareClipping(e),null!==this.geometryNode&&(e.stack.outputNode=e.stack.outputNode.bypass(this.geometryNode)),e.addFlow("vertex",e.removeStack()),e.addStack();var o=this.setupClipping(e);if(!0!==this.depthWrite&&!0!==this.depthTest||(null!==r?!0===r.depthBuffer&&this.setupDepth(e):!0===n.depth&&this.setupDepth(e)),null===this.fragmentNode){this.setupDiffuseColor(e),this.setupVariants(e);var s=this.setupLighting(e);null!==o&&e.stack.add(o);var u=YA(s,gw.a).max(0);if(i=this.setupOutput(e,u),Dw.assign(i),null!==this.outputNode&&(i=this.outputNode),null!==r){var l=n.getMRT(),c=this.mrtNode;null!==l?(i=l,null!==c&&(i=l.merge(c))):null!==c&&(i=c)}}else{var h=this.fragmentNode;!0!==h.isOutputStructNode&&(h=YA(h)),i=this.setupOutput(e,h)}e.stack.outputNode=i,e.addFlow("fragment",e.removeStack()),e.observer=this.setupObserver(e)}},{key:"setupClipping",value:function(e){if(null===e.clippingContext)return null;var t=e.clippingContext,n=t.unionPlanes,r=t.intersectionPlanes,i=null;if(n.length>0||r.length>0){var a=e.renderer.samples;this.alphaToCoverage&&a>1?i=MA(new oI(oI.ALPHA_TO_COVERAGE)):e.stack.add(MA(new oI))}return i}},{key:"setupHardwareClipping",value:function(e){if(this.hardwareClipping=!1,null!==e.clippingContext){var t=e.clippingContext.unionPlanes.length;t>0&&t<=8&&e.isAvailable("clipDistance")&&(e.stack.add(MA(new oI(oI.HARDWARE))),this.hardwareClipping=!0)}}},{key:"setupDepth",value:function(e){var t=e.renderer,n=e.camera,r=this.depthNode;if(null===r){var i=t.getMRT();i&&i.has("depth")?r=i.get("depth"):!0===t.logarithmicDepthBuffer&&(r=n.isPerspectiveCamera?$R(gC.z,zE,VE):KR(gC.z,zE,VE))}null!==r&&tI.assign(r).append()}},{key:"setupPositionView",value:function(){return uC.mul(fC).xyz}},{key:"setupModelViewProjection",value:function(){return HE.mul(gC)}},{key:"setupVertex",value:function(e){return e.addStack(),this.setupPosition(e),e.context.vertex=e.removeStack(),eR}},{key:"setupPosition",value:function(e){var t=e.object,n=e.geometry;if((n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color)&&TR(t).append(),!0===t.isSkinnedMesh&&vR(t).append(),this.displacementMap){var r=GC("displacementMap","texture"),i=GC("displacementScale","float"),a=GC("displacementBias","float");fC.addAssign(AC.normalize().mul(r.x.mul(i).add(a)))}return t.isBatchedMesh&&dR(t).append(),t.isInstancedMesh&&t.instanceMatrix&&!0===t.instanceMatrix.isInstancedBufferAttribute&&cR(t).append(),null!==this.positionNode&&fC.assign(this.positionNode.context({isPositionNodeInput:!0})),fC}},{key:"setupDiffuseColor",value:function(e){var t=e.object,n=e.geometry,r=this.colorNode?YA(this.colorNode):gk;(!0===this.vertexColors&&n.hasAttribute("color")&&(r=YA(r.xyz.mul(ME("color","vec3")),r.a)),t.instanceColor)&&(r=mw("vec3","vInstanceColor").mul(r));t.isBatchedMesh&&t._colorsTexture&&(r=mw("vec3","vBatchColor").mul(r));gw.assign(r);var i=this.opacityNode?FA(this.opacityNode):bk;if(gw.a.assign(gw.a.mul(i)),null!==this.alphaTestNode||this.alphaTest>0){var a=null!==this.alphaTestNode?FA(this.alphaTestNode):mk;gw.a.lessThanEqual(a).discard()}!0===this.alphaHash&&gw.a.lessThan(lI(fC)).discard(),!1===this.transparent&&1===this.blending&&!1===this.alphaToCoverage&&gw.a.assign(1)}},{key:"setupVariants",value:function(){}},{key:"setupOutgoingLight",value:function(){return!0===this.lights?jA(0):gw.rgb}},{key:"setupNormal",value:function(){return this.normalNode?jA(this.normalNode):Ck}},{key:"setupEnvironment",value:function(){var e=null;return this.envNode?e=this.envNode:this.envMap&&(e=this.envMap.isCubeTexture?GC("envMap","cubeTexture"):GC("envMap","texture")),e}},{key:"setupLightMap",value:function(e){var t=null;return e.material.lightMap&&(t=new RR(Zk)),t}},{key:"setupLights",value:function(e){var t=[],n=this.setupEnvironment(e);n&&n.isLightingNode&&t.push(n);var r=this.setupLightMap(e);if(r&&r.isLightingNode&&t.push(r),null!==this.aoNode||e.material.aoMap){var i=null!==this.aoNode?this.aoNode:Jk;t.push(new ER(i))}var a=this.lightsNode||e.lightsNode;return t.length>0&&(a=e.renderer.lighting.createNode([].concat(I(a.getLights()),t))),a}},{key:"setupLightingModel",value:function(){}},{key:"setupLighting",value:function(e){var t=e.material,n=this.backdropNode,r=this.backdropAlphaNode,i=this.emissiveNode,a=!0===this.lights||null!==this.lightsNode?this.setupLights(e):null,o=this.setupOutgoingLight(e);if(a&&a.getScope().hasLights){var s=this.setupLightingModel(e);o=kR(a,s,n,r)}else null!==n&&(o=jA(null!==r?_M(o,n,r):n));return(i&&!0===i.isNode||t.emissive&&!0===t.emissive.isColor)&&(yw.assign(jA(i||_k)),o=o.add(yw)),o}},{key:"setupOutput",value:function(e,t){if(!0===this.fog){var n=e.fogNode;n&&(Dw.assign(t),t=YA(n))}return t}},{key:"setDefaultValues",value:function(e){for(var t in e){var n=e[t];void 0===this[t]&&(this[t]=n,n&&n.clone&&(this[t]=n.clone()))}var r=Object.getOwnPropertyDescriptors(e.constructor.prototype);for(var i in r)void 0===Object.getOwnPropertyDescriptor(this.constructor.prototype,i)&&void 0!==r[i].get&&Object.defineProperty(this.constructor.prototype,i,r[i])}},{key:"toJSON",value:function(e){var t=void 0===e||"string"==typeof e;t&&(e={textures:{},images:{},nodes:{}});var n=Ud.prototype.toJSON.call(this,e),r=uS(this);n.inputNodes={};var i,a=L(r);try{for(a.s();!(i=a.n()).done;){var o=i.value,s=o.property,u=o.childNode;n.inputNodes[s]=u.toJSON(e).uuid}}catch(f){a.e(f)}finally{a.f()}function l(e){var t=[];for(var n in e){var r=e[n];delete r.metadata,t.push(r)}return t}if(t){var c=l(e.textures),h=l(e.images),d=l(e.nodes);c.length>0&&(n.textures=c),h.length>0&&(n.images=h),d.length>0&&(n.nodes=d)}return n}},{key:"copy",value:function(e){return this.lightsNode=e.lightsNode,this.envNode=e.envNode,this.colorNode=e.colorNode,this.normalNode=e.normalNode,this.opacityNode=e.opacityNode,this.backdropNode=e.backdropNode,this.backdropAlphaNode=e.backdropAlphaNode,this.alphaTestNode=e.alphaTestNode,this.positionNode=e.positionNode,this.geometryNode=e.geometryNode,this.depthNode=e.depthNode,this.shadowPositionNode=e.shadowPositionNode,this.receivedShadowNode=e.receivedShadowNode,this.castShadowNode=e.castShadowNode,this.outputNode=e.outputNode,this.mrtNode=e.mrtNode,this.fragmentNode=e.fragmentNode,this.vertexNode=e.vertexNode,n(t,"copy",this,3)([e])}}],[{key:"type",get:function(){return"NodeMaterial"}}])}(Ud),hI=null,dI=function(e){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:NR,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return A(this,t),null===hI&&(hI=new Up),y(this,t,[e,n,hI])}return x(t,e),T(t,[{key:"updateReference",value:function(){return this}}],[{key:"type",get:function(){return"ViewportSharedTextureNode"}}])}(WR),fI=kA(dI),pI=function(e){function t(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:mC;return A(this,t),(e=y(this,t,["vec2"])).dirNode=n,e}return x(t,e),T(t,[{key:"setup",value:function(){var e=this.dirNode,t=e.z.atan(e.x).mul(1/(2*Math.PI)).add(.5),n=e.y.clamp(-1,1).asin().mul(1/Math.PI).add(.5);return VA(t,n)}}],[{key:"type",get:function(){return"EquirectUVNode"}}])}(CS),vI=kA(pI),mI=IA(function(e){var t=e.f0,n=e.f90,r=e.dotVH,i=r.mul(-5.55473).sub(6.98316).mul(r).exp2();return t.mul(i.oneMinus()).add(n.mul(i))}),gI=IA(function(e){return e.diffuseColor.mul(1/Math.PI)}),yI=IA(function(e){if(!1===e.geometry.hasAttribute("normal"))return FA(0);var t=TC.dFdx().abs().max(TC.dFdy().abs());return t.x.max(t.y).max(t.z)}),_I=IA(function(e){var t=e.roughness,n=yI(),r=t.max(.0525);return r=(r=r.add(n)).min(1)}),bI=IA(function(e){var t=e.alpha,n=e.dotNL,r=e.dotNV,i=t.pow2(),a=n.mul(i.add(i.oneMinus().mul(r.pow2())).sqrt()),o=r.mul(i.add(i.oneMinus().mul(n.pow2())).sqrt());return $w(.5,a.add(o).max(_T))}).setLayout({name:"V_GGX_SmithCorrelated",type:"float",inputs:[{name:"alpha",type:"float"},{name:"dotNL",type:"float"},{name:"dotNV",type:"float"}]}),xI=IA(function(e){var t=e.alphaT,n=e.alphaB,r=e.dotTV,i=e.dotBV,a=e.dotTL,o=e.dotBL,s=e.dotNV,u=e.dotNL,l=u.mul(jA(t.mul(r),n.mul(i),s).length()),c=s.mul(jA(t.mul(a),n.mul(o),u).length());return $w(.5,l.add(c)).saturate()}).setLayout({name:"V_GGX_SmithCorrelated_Anisotropic",type:"float",inputs:[{name:"alphaT",type:"float",qualifier:"in"},{name:"alphaB",type:"float",qualifier:"in"},{name:"dotTV",type:"float",qualifier:"in"},{name:"dotBV",type:"float",qualifier:"in"},{name:"dotTL",type:"float",qualifier:"in"},{name:"dotBL",type:"float",qualifier:"in"},{name:"dotNV",type:"float",qualifier:"in"},{name:"dotNL",type:"float",qualifier:"in"}]}),SI=IA(function(e){var t=e.alpha,n=e.dotNH,r=t.pow2(),i=n.pow2().mul(r.oneMinus()).oneMinus();return r.div(i.pow2()).mul(1/Math.PI)}).setLayout({name:"D_GGX",type:"float",inputs:[{name:"alpha",type:"float"},{name:"dotNH",type:"float"}]}),AI=FA(1/Math.PI),wI=IA(function(e){var t=e.alphaT,n=e.alphaB,r=e.dotNH,i=e.dotTH,a=e.dotBH,o=t.mul(n),s=jA(n.mul(i),t.mul(a),o.mul(r)),u=s.dot(s),l=o.div(u);return AI.mul(o.mul(l.pow2()))}).setLayout({name:"D_GGX_Anisotropic",type:"float",inputs:[{name:"alphaT",type:"float",qualifier:"in"},{name:"alphaB",type:"float",qualifier:"in"},{name:"dotNH",type:"float",qualifier:"in"},{name:"dotTH",type:"float",qualifier:"in"},{name:"dotBH",type:"float",qualifier:"in"}]}),TI=IA(function(e){var t,n,r=e.lightDirection,i=e.f0,a=e.f90,o=e.roughness,s=e.f,u=e.USE_IRIDESCENCE,l=e.USE_ANISOTROPY,c=e.normalView||EC,h=o.pow2(),d=r.add(yC).normalize(),f=c.dot(r).clamp(),p=c.dot(yC).clamp(),v=c.dot(d).clamp(),m=yC.dot(d).clamp(),g=mI({f0:i,f90:a,dotVH:m});if(AA(u)&&(g=Tw.mix(g,s)),AA(l)){var y=Rw.dot(r),_=Rw.dot(yC),b=Rw.dot(d),x=Iw.dot(r),S=Iw.dot(yC),A=Iw.dot(d);t=xI({alphaT:Cw,alphaB:h,dotTV:_,dotBV:S,dotTL:y,dotBL:x,dotNV:p,dotNL:f}),n=wI({alphaT:Cw,alphaB:h,dotNH:v,dotTH:b,dotBH:A})}else t=bI({alpha:h,dotNL:f,dotNV:p}),n=SI({alpha:h,dotNH:v});return g.mul(t).mul(n)}),MI=IA(function(e){var t=e.roughness,n=e.dotNV,r=YA(-1,-.0275,-.572,.022),i=YA(1,.0425,1.04,-.04),a=t.mul(r).add(i),o=a.x.mul(a.x).min(n.mul(-9.28).exp2()).mul(a.x).add(a.y);return VA(-1.04,1.04).mul(o).add(a.zw)}).setLayout({name:"DFGApprox",type:"vec2",inputs:[{name:"roughness",type:"float"},{name:"dotNV",type:"vec3"}]}),EI=IA(function(e){var t=e.f,n=e.f90,r=e.dotVH.oneMinus().saturate(),i=r.mul(r),a=r.mul(i,i).clamp(0,.9999);return t.sub(jA(n).mul(a)).div(a.oneMinus())}).setLayout({name:"Schlick_to_F0",type:"vec3",inputs:[{name:"f",type:"vec3"},{name:"f90",type:"float"},{name:"dotVH",type:"float"}]}),CI=1/6,kI=function(e){return Jw(CI,Jw(e,Jw(e,e.negate().add(3)).sub(3)).add(1))},RI=function(e){return Jw(CI,Jw(e,Jw(e,Jw(3,e).sub(6))).add(4))},II=function(e){return Jw(CI,Jw(e,Jw(e,Jw(-3,e).add(3)).add(3)).add(1))},NI=function(e){return Jw(CI,dM(e,3))},PI=function(e){return kI(e).add(RI(e))},LI=function(e){return II(e).add(NI(e))},DI=function(e){return Kw(-1,RI(e).div(kI(e).add(RI(e))))},OI=function(e){return Kw(1,NI(e).div(II(e).add(NI(e))))},FI=function(e,t,n){var r=e.uvNode,i=Jw(r,t.zw).add(.5),a=PT(i),o=OT(i),s=PI(o.x),u=LI(o.x),l=DI(o.x),c=OI(o.x),h=DI(o.y),d=OI(o.y),f=VA(a.x.add(l),a.y.add(h)).sub(.5).mul(t.xy),p=VA(a.x.add(c),a.y.add(h)).sub(.5).mul(t.xy),v=VA(a.x.add(l),a.y.add(d)).sub(.5).mul(t.xy),m=VA(a.x.add(c),a.y.add(d)).sub(.5).mul(t.xy),g=PI(o.y).mul(Kw(s.mul(e.sample(f).level(n)),u.mul(e.sample(p).level(n)))),y=LI(o.y).mul(Kw(s.mul(e.sample(v).level(n)),u.mul(e.sample(m).level(n))));return g.add(y)},BI=IA(function(e){var t=C(e,2),n=t[0],r=t[1],i=void 0===r?FA(3):r,a=VA(n.size(BA(i))),o=VA(n.size(BA(i.add(1)))),s=$w(1,a),u=$w(1,o),l=FI(n,YA(s,a),PT(i)),c=FI(n,YA(u,o),LT(i));return OT(i).mix(l,c)});jA(.04),FA(1);var UI=FA(1),zI=FA(-2),VI=FA(.8),HI=FA(-1),WI=FA(.4),GI=FA(2),jI=FA(.305),QI=FA(3),qI=FA(.21),XI=FA(4),YI=FA(4),KI=FA(16),ZI=IA(function(e){var t=C(e,1)[0],n=jA(WT(t)).toVar(),r=FA(-1).toVar();return LA(n.x.greaterThan(n.z),function(){LA(n.x.greaterThan(n.y),function(){r.assign(NM(t.x.greaterThan(0),0,3))}).Else(function(){r.assign(NM(t.y.greaterThan(0),1,4))})}).Else(function(){LA(n.z.greaterThan(n.y),function(){r.assign(NM(t.z.greaterThan(0),2,5))}).Else(function(){r.assign(NM(t.y.greaterThan(0),1,4))})}),r}).setLayout({name:"getFace",type:"float",inputs:[{name:"direction",type:"vec3"}]}),JI=IA(function(e){var t=C(e,2),n=t[0],r=t[1],i=VA().toVar();return LA(r.equal(0),function(){i.assign(VA(n.z,n.y).div(WT(n.x)))}).ElseIf(r.equal(1),function(){i.assign(VA(n.x.negate(),n.z.negate()).div(WT(n.y)))}).ElseIf(r.equal(2),function(){i.assign(VA(n.x.negate(),n.y).div(WT(n.z)))}).ElseIf(r.equal(3),function(){i.assign(VA(n.z.negate(),n.y).div(WT(n.x)))}).ElseIf(r.equal(4),function(){i.assign(VA(n.x.negate(),n.z).div(WT(n.y)))}).Else(function(){i.assign(VA(n.x,n.y).div(WT(n.z)))}),Jw(.5,i.add(1))}).setLayout({name:"getUV",type:"vec2",inputs:[{name:"direction",type:"vec3"},{name:"face",type:"float"}]}),$I=IA(function(e){var t=C(e,1)[0],n=FA(0).toVar();return LA(t.greaterThanEqual(VI),function(){n.assign(UI.sub(t).mul(HI.sub(zI)).div(UI.sub(VI)).add(zI))}).ElseIf(t.greaterThanEqual(WI),function(){n.assign(VI.sub(t).mul(GI.sub(HI)).div(VI.sub(WI)).add(HI))}).ElseIf(t.greaterThanEqual(jI),function(){n.assign(WI.sub(t).mul(QI.sub(GI)).div(WI.sub(jI)).add(GI))}).ElseIf(t.greaterThanEqual(qI),function(){n.assign(jI.sub(t).mul(XI.sub(QI)).div(jI.sub(qI)).add(QI))}).Else(function(){n.assign(FA(-2).mul(RT(Jw(1.16,t))))}),n}).setLayout({name:"roughnessToMip",type:"float",inputs:[{name:"roughness",type:"float"}]}),eN=IA(function(e){var t=C(e,2),n=t[0],r=t[1],i=n.toVar();i.assign(Jw(2,i).sub(1));var a=jA(i,1).toVar();return LA(r.equal(0),function(){a.assign(a.zyx)}).ElseIf(r.equal(1),function(){a.assign(a.xzy),a.xz.mulAssign(-1)}).ElseIf(r.equal(2),function(){a.x.mulAssign(-1)}).ElseIf(r.equal(3),function(){a.assign(a.zyx),a.xz.mulAssign(-1)}).ElseIf(r.equal(4),function(){a.assign(a.xzy),a.xy.mulAssign(-1)}).ElseIf(r.equal(5),function(){a.z.mulAssign(-1)}),a}).setLayout({name:"getDirection",type:"vec3",inputs:[{name:"uv",type:"vec2"},{name:"face",type:"float"}]}),tN=IA(function(e){var t=C(e,6),n=t[0],r=t[1],i=t[2],a=t[3],o=t[4],s=t[5],u=FA(i),l=jA(r),c=bM($I(u),zI,s),h=OT(c),d=PT(c),f=jA(nN(n,l,d,a,o,s)).toVar();return LA(h.notEqual(0),function(){var e=jA(nN(n,l,d.add(1),a,o,s)).toVar();f.assign(_M(f,e,h))}),f}),nN=IA(function(e){var t=C(e,6),n=t[0],r=t[1],i=t[2],a=t[3],o=t[4],s=t[5],u=FA(i).toVar(),l=jA(r),c=FA(ZI(l)).toVar(),h=FA(iM(YI.sub(u),0)).toVar();u.assign(iM(u,YI));var d=FA(CT(u)).toVar(),f=VA(JI(l,c).mul(d.sub(2)).add(1)).toVar();return LA(c.greaterThan(2),function(){f.y.addAssign(d),c.subAssign(3)}),f.x.addAssign(c.mul(d)),f.x.addAssign(h.mul(Jw(3,KI))),f.y.addAssign(Jw(4,CT(s).sub(d))),f.x.mulAssign(a),f.y.mulAssign(o),n.sample(f).grad(VA(),VA())}),rN=IA(function(e){var t=e.envMap,n=e.mipInt,r=e.outputDirection,i=e.theta,a=e.axis,o=e.CUBEUV_TEXEL_WIDTH,s=e.CUBEUV_TEXEL_HEIGHT,u=e.CUBEUV_MAX_MIP,l=BT(i),c=r.mul(l).add(a.cross(r).mul(FT(i))).add(a.mul(a.dot(r).mul(l.oneMinus())));return nN(t,c,n,o,s,u)}),iN=IA(function(e){var t=e.n,n=e.latitudinal,r=e.poleAxis,i=e.outputDirection,a=e.weights,o=e.samples,s=e.dTheta,u=e.mipInt,l=e.envMap,c=e.CUBEUV_TEXEL_WIDTH,h=e.CUBEUV_TEXEL_HEIGHT,d=e.CUBEUV_MAX_MIP,f=jA(NM(n,r,hM(r,i))).toVar();LA(AT(f.equals(jA(0))),function(){f.assign(jA(i.z,0,i.x.negate()))}),f.assign(DT(f));var p=jA().toVar();return p.addAssign(a.element(0).mul(rN({theta:0,axis:f,outputDirection:i,mipInt:u,envMap:l,CUBEUV_TEXEL_WIDTH:c,CUBEUV_TEXEL_HEIGHT:h,CUBEUV_MAX_MIP:d}))),gR({start:BA(1),end:t},function(e){var t=e.i;LA(t.greaterThanEqual(o),function(){yR()});var n=FA(s.mul(FA(t))).toVar();p.addAssign(a.element(t).mul(rN({theta:n.mul(-1),axis:f,outputDirection:i,mipInt:u,envMap:l,CUBEUV_TEXEL_WIDTH:c,CUBEUV_TEXEL_HEIGHT:h,CUBEUV_MAX_MIP:d}))),p.addAssign(a.element(t).mul(rN({theta:n,axis:f,outputDirection:i,mipInt:u,envMap:l,CUBEUV_TEXEL_WIDTH:c,CUBEUV_TEXEL_HEIGHT:h,CUBEUV_MAX_MIP:d})))}),YA(p,1)}),aN=null,oN=new WeakMap;function sN(e){var t=oN.get(e);if((void 0!==t?t.pmremVersion:-1)!==e.pmremVersion){var n=e.image;if(e.isCubeTexture){if(!function(e){if(null==e)return!1;for(var t=0,n=6,r=0;r0}(n))return null;t=aN.fromEquirectangular(e,t)}t.pmremVersion=e.pmremVersion,oN.set(e,t)}return t.texture}var uN=function(e){function t(e){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;A(this,t),(n=y(this,t,["vec3"]))._value=e,n._pmrem=null,n.uvNode=r,n.levelNode=i,n._generator=null;var a=new sh;return a.isRenderTargetTexture=!0,n._texture=NE(a),n._width=fw(0),n._height=fw(0),n._maxMip=fw(0),n.updateBeforeType=_S.RENDER,n}return x(t,e),T(t,[{key:"value",get:function(){return this._value},set:function(e){this._value=e,this._pmrem=null}},{key:"updateFromTexture",value:function(e){var t,n,r,i=(t=e.image.height,n=Math.log2(t)-2,r=1/t,{texelWidth:1/(3*Math.max(Math.pow(2,n),112)),texelHeight:r,maxMip:n});this._texture.value=e,this._width.value=i.texelWidth,this._height.value=i.texelHeight,this._maxMip.value=i.maxMip}},{key:"updateBefore",value:function(){var e=this._pmrem,t=e?e.pmremVersion:-1,n=this._value;t!==n.pmremVersion&&null!==(e=!0===n.isPMREMTexture?n:sN(n))&&(this._pmrem=e,this.updateFromTexture(e))}},{key:"setup",value:function(e){null===aN&&(aN=e.createPMREMGenerator()),this.updateBefore(e);var t=this.uvNode;null===t&&e.context.getUV&&(t=e.context.getUV(this));var n=this.value;e.renderer.coordinateSystem===Ec&&!0!==n.isPMREMTexture&&!0===n.isRenderTargetTexture&&(t=jA(t.x.negate(),t.yz)),t=jA(t.x,t.y.negate(),t.z);var r=this.levelNode;return null===r&&e.context.getTextureLevel&&(r=e.context.getTextureLevel(this)),tN(this._texture,t,r,this._width,this._height,this._maxMip)}}],[{key:"type",get:function(){return"PMREMNode"}}])}(CS);var lN=kA(uN),cN=function(e){function t(){return A(this,t),y(this,t,["vec2"])}return x(t,e),T(t,[{key:"setup",value:function(){var e=jA(yC.z,0,yC.x.negate()).normalize(),t=yC.cross(e);return VA(e.dot(EC),t.dot(EC)).mul(.495).add(.5)}}],[{key:"type",get:function(){return"MatcapUVNode"}}])}(CS),hN=RA(cN),dN=kA(function(e){function t(e,n){var r;return A(this,t),(r=y(this,t)).positionNode=e,r.rotationNode=n,r}return x(t,e),T(t,[{key:"getNodeType",value:function(e){return this.positionNode.getNodeType(e)}},{key:"setup",value:function(e){var t=this.rotationNode,n=this.positionNode;if("vec2"===this.getNodeType(e)){var r=t.cos(),i=t.sin();return $A(r,i,i.negate(),r).mul(n)}var a=t,o=tw(YA(1,0,0,0),YA(0,BT(a.x),FT(a.x).negate(),0),YA(0,FT(a.x),BT(a.x),0),YA(0,0,0,1)),s=tw(YA(BT(a.y),0,FT(a.y),0),YA(0,1,0,0),YA(FT(a.y).negate(),0,BT(a.y),0),YA(0,0,0,1)),u=tw(YA(BT(a.z),FT(a.z).negate(),0,0),YA(FT(a.z),BT(a.z),0,0),YA(0,0,1,0),YA(0,0,0,1));return o.mul(s).mul(u).mul(YA(n,1)).xyz}}],[{key:"type",get:function(){return"RotateNode"}}])}(CS)),fN=IA(function(e){var t=e.texture,n=e.uv,r=1e-4,i=jA().toVar();return LA(n.x.lessThan(r),function(){i.assign(jA(1,0,0))}).ElseIf(n.y.lessThan(r),function(){i.assign(jA(0,1,0))}).ElseIf(n.z.lessThan(r),function(){i.assign(jA(0,0,1))}).ElseIf(n.x.greaterThan(.9999),function(){i.assign(jA(-1,0,0))}).ElseIf(n.y.greaterThan(.9999),function(){i.assign(jA(0,-1,0))}).ElseIf(n.z.greaterThan(.9999),function(){i.assign(jA(0,0,-1))}).Else(function(){var e=.01,r=t.sample(n.add(jA(-.01,0,0))).r.sub(t.sample(n.add(jA(e,0,0))).r),a=t.sample(n.add(jA(0,-.01,0))).r.sub(t.sample(n.add(jA(0,e,0))).r),o=t.sample(n.add(jA(0,0,-.01))).r.sub(t.sample(n.add(jA(0,0,e))).r);i.assign(jA(r,a,o))}),i.normalize()}),pN=function(e){function t(e){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return A(this,t),(n=y(this,t,[e,r,i])).isTexture3DNode=!0,n}return x(t,e),T(t,[{key:"getInputType",value:function(){return"texture3D"}},{key:"getDefaultUV",value:function(){return jA(.5,.5,.5)}},{key:"setUpdateMatrix",value:function(){}},{key:"setupUV",value:function(e,t){var n=this.value;return!e.isFlipY()||!0!==n.isRenderTargetTexture&&!0!==n.isFramebufferTexture||(t=this.sampler?t.flipY():t.setY(BA(kE(this,this.levelNode).y).sub(t.y).sub(1))),t}},{key:"generateUV",value:function(e,t){return t.build(e,"vec3")}},{key:"normal",value:function(e){return fN({texture:this,uv:e})}}],[{key:"type",get:function(){return"Texture3DNode"}}])}(IE),vN=kA(pN),mN=function(e){function t(e){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return A(this,t),(n=y(this,t,[e,r])).isParameterNode=!0,n}return x(t,e),T(t,[{key:"getHash",value:function(){return this.uuid}},{key:"generate",value:function(){return this.name}}],[{key:"type",get:function(){return"ParameterNode"}}])}(pw),gN=function(e){function t(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return A(this,t),(e=y(this,t)).nodes=[],e.outputNode=null,e.parent=n,e._currentCond=null,e.isStackNode=!0,e}return x(t,e),T(t,[{key:"getNodeType",value:function(e){return this.outputNode?this.outputNode.getNodeType(e):"void"}},{key:"getMemberType",value:function(e,t){return this.outputNode?this.outputNode.getMemberType(e,t):"void"}},{key:"add",value:function(e){return this.nodes.push(e),this}},{key:"If",value:function(e,t){var n=new TA(t);return this._currentCond=NM(e,n),this.add(this._currentCond)}},{key:"ElseIf",value:function(e,t){var n=new TA(t),r=NM(e,n);return this._currentCond.elseNode=r,this._currentCond=r,this}},{key:"Else",value:function(e){return this._currentCond.elseNode=new TA(e),this}},{key:"build",value:function(e){var r,i=PA();NA(this);var a,o=L(this.nodes);try{for(o.s();!(a=o.n()).done;){a.value.build(e,"void")}}catch(c){o.e(c)}finally{o.f()}NA(i);for(var s=arguments.length,u=new Array(s>1?s-1:0),l=1;l1&&void 0!==arguments[1]?arguments[1]:null;return A(this,t),(n=y(this,t,["struct"])).membersLayout=(r=e,Object.entries(r).map(function(e){var t=C(e,2),n=t[0],r=t[1];return"string"==typeof r?{name:n,type:r,atomic:!1}:{name:n,type:r.type,atomic:r.atomic||!1}})),n.name=i,n.isStructLayoutNode=!0,n}return x(t,e),T(t,[{key:"getLength",value:function(){var e,t=0,n=L(this.membersLayout);try{for(n.s();!(e=n.n()).done;){t+=dS(e.value.type)}}catch(r){n.e(r)}finally{n.f()}return t}},{key:"getMemberType",value:function(e,t){var n=this.membersLayout.find(function(e){return e.name===t});return n?n.type:"void"}},{key:"getNodeType",value:function(e){return e.getStructTypeFromNode(this,this.membersLayout,this.name).name}},{key:"generate",value:function(e){return this.getNodeType(e)}}],[{key:"type",get:function(){return"StructTypeNode"}}])}(TS),bN=function(e){function t(e,n){var r;return A(this,t),(r=y(this,t,["vec3"])).structLayoutNode=e,r.values=n,r.isStructNode=!0,r}return x(t,e),T(t,[{key:"getNodeType",value:function(e){return this.structLayoutNode.getNodeType(e)}},{key:"getMemberType",value:function(e,t){return this.structLayoutNode.getMemberType(e,t)}},{key:"generate",value:function(e){var t=e.getVarFromNode(this),n=t.type,r=e.getPropertyName(t);return e.addLineFlowCode("".concat(r," = ").concat(e.generateStruct(n,this.structLayoutNode.membersLayout,this.values)),this),t.name}}],[{key:"type",get:function(){return"StructNode"}}])}(TS),xN=function(e){function t(){var e;A(this,t),e=y(this,t);for(var n=arguments.length,r=new Array(n),i=0;i0&&void 0!==arguments[0]?arguments[0]:[];A(this,t),(e=y(this,t)).functionNodes=n;for(var r=arguments.length,i=new Array(r>1?r-1:0),a=1;aa&&(i=s,a=c)}}}catch(p){o.e(p)}finally{o.f()}this._candidateFnCall=n=i.apply(void 0,I(t))}return n}}],[{key:"type",get:function(){return"FunctionOverloadingNode"}}])}(TS),NN=kA(IN),PN=function(e){return function(){for(var t=arguments.length,n=new Array(t),r=0;r1&&void 0!==arguments[1]?arguments[1]:EE(),i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:FA(0);return A(this,t),(n=y(this,t,["vec2"])).countNode=e,n.uvNode=r,n.frameNode=i,n}return x(t,e),T(t,[{key:"setup",value:function(){var e=this.frameNode,t=this.uvNode,n=this.countNode,r=n.width,i=n.height,a=e.mod(r.mul(i)).floor(),o=a.mod(r),s=i.sub(a.add(1).div(r).ceil()),u=n.reciprocal(),l=VA(o,s);return t.add(l).mul(u)}}],[{key:"type",get:function(){return"SpriteSheetUVNode"}}])}(TS),HN=kA(VN),WN=function(e){function t(e){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:FA(1),o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:fC,s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:AC;return A(this,t),(n=y(this,t,["vec4"])).textureXNode=e,n.textureYNode=r,n.textureZNode=i,n.scaleNode=a,n.positionNode=o,n.normalNode=s,n}return x(t,e),T(t,[{key:"setup",value:function(){var e=this.textureXNode,t=this.textureYNode,n=this.textureZNode,r=this.scaleNode,i=this.positionNode,a=this.normalNode.abs().normalize();a=a.div(a.dot(jA(1)));var o=i.yz.mul(r),s=i.zx.mul(r),u=i.xy.mul(r),l=e.value,c=null!==t?t.value:l,h=null!==n?n.value:l,d=NE(l,o).mul(a.x),f=NE(c,s).mul(a.y),p=NE(h,u).mul(a.z);return Kw(d,f,p)}}],[{key:"type",get:function(){return"TriplanarTexturesNode"}}])}(TS),GN=kA(WN),jN=new pp,QN=new ph,qN=new ph,XN=new ph,YN=new Gh,KN=new ph(0,0,-1),ZN=new uh,JN=new ph,$N=new ph,eP=new uh,tP=new Vc,nP=new lh,rP=NR.flipX();nP.depthTexture=new zp(1,1);var iP=!1,aP=function(e){function t(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return A(this,t),(e=y(this,t,[n.defaultTexture||nP.texture,rP]))._reflectorBaseNode=n.reflector||new oP(e,n),e._depthNode=null,e.setUpdateMatrix(!1),e}return x(t,e),T(t,[{key:"reflector",get:function(){return this._reflectorBaseNode}},{key:"target",get:function(){return this._reflectorBaseNode.target}},{key:"getDepthNode",value:function(){if(null===this._depthNode){if(!0!==this._reflectorBaseNode.depth)throw new Error("THREE.ReflectorNode: Depth node can only be requested when the reflector is created with { depth: true }. ");this._depthNode=MA(new t({defaultTexture:nP.depthTexture,reflector:this._reflectorBaseNode}))}return this._depthNode}},{key:"setup",value:function(e){return e.object.isQuadMesh||this._reflectorBaseNode.build(e),n(t,"setup",this,3)([e])}},{key:"clone",value:function(){var e=new this.constructor(this.reflectorNode);return e._reflectorBaseNode=this._reflectorBaseNode,e}}],[{key:"type",get:function(){return"ReflectorNode"}}])}(IE),oP=function(e){function t(e){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};A(this,t),n=y(this,t);var i=r.target,a=void 0===i?new gd:i,o=r.resolution,s=void 0===o?1:o,u=r.generateMipmaps,l=void 0!==u&&u,c=r.bounces,h=void 0===c||c,d=r.depth,f=void 0!==d&&d;return n.textureNode=e,n.target=a,n.resolution=s,n.generateMipmaps=l,n.bounces=h,n.depth=f,n.updateBeforeType=h?_S.RENDER:_S.FRAME,n.virtualCameras=new WeakMap,n.renderTargets=new WeakMap,n}return x(t,e),T(t,[{key:"_updateResolution",value:function(e,t){var n=this.resolution;t.getDrawingBufferSize(tP),e.setSize(Math.round(tP.width*n),Math.round(tP.height*n))}},{key:"setup",value:function(e){return this._updateResolution(nP,e.renderer),n(t,"setup",this,3)([e])}},{key:"getVirtualCamera",value:function(e){var t=this.virtualCameras.get(e);return void 0===t&&(t=e.clone(),this.virtualCameras.set(e,t)),t}},{key:"getRenderTarget",value:function(e){var t=this.renderTargets.get(e);return void 0===t&&(t=new lh(0,0,{type:_l}),!0===this.generateMipmaps&&(t.texture.minFilter=1008,t.texture.generateMipmaps=!0),!0===this.depth&&(t.depthTexture=new zp),this.renderTargets.set(e,t)),t}},{key:"updateBefore",value:function(e){if(!1===this.bounces&&iP)return!1;iP=!0;var t=e.scene,n=e.camera,r=e.renderer,i=e.material,a=this.target,o=this.getVirtualCamera(n),s=this.getRenderTarget(o);if(r.getDrawingBufferSize(tP),this._updateResolution(s,r),qN.setFromMatrixPosition(a.matrixWorld),XN.setFromMatrixPosition(n.matrixWorld),YN.extractRotation(a.matrixWorld),QN.set(0,0,1),QN.applyMatrix4(YN),JN.subVectors(qN,XN),!(JN.dot(QN)>0)){JN.reflect(QN).negate(),JN.add(qN),YN.extractRotation(n.matrixWorld),KN.set(0,0,-1),KN.applyMatrix4(YN),KN.add(XN),$N.subVectors(qN,KN),$N.reflect(QN).negate(),$N.add(qN),o.coordinateSystem=n.coordinateSystem,o.position.copy(JN),o.up.set(0,1,0),o.up.applyMatrix4(YN),o.up.reflect(QN),o.lookAt($N),o.near=n.near,o.far=n.far,o.updateMatrixWorld(),o.projectionMatrix.copy(n.projectionMatrix),jN.setFromNormalAndCoplanarPoint(QN,qN),jN.applyMatrix4(o.matrixWorldInverse),ZN.set(jN.normal.x,jN.normal.y,jN.normal.z,jN.constant);var u=o.projectionMatrix;eP.x=(Math.sign(ZN.x)+u.elements[8])/u.elements[0],eP.y=(Math.sign(ZN.y)+u.elements[9])/u.elements[5],eP.z=-1,eP.w=(1+u.elements[10])/u.elements[14],ZN.multiplyScalar(1/ZN.dot(eP));u.elements[2]=ZN.x,u.elements[6]=ZN.y,u.elements[10]=r.coordinateSystem===Cc?ZN.z-0:ZN.z+1-0,u.elements[14]=ZN.w,this.textureNode.value=s.texture,!0===this.depth&&(this.textureNode.getDepthNode().value=s.depthTexture),i.visible=!1;var l=r.getRenderTarget(),c=r.getMRT(),h=r.autoClear;r.setMRT(null),r.setRenderTarget(s),r.autoClear=!0,r.render(t,o),r.setMRT(c),r.setRenderTarget(l),r.autoClear=h,i.visible=!0,iP=!1}}}],[{key:"type",get:function(){return"ReflectorBaseNode"}}])}(TS),sP=new Lv(-1,1,1,-1,0,1),uP=function(e){function t(){var e,n=arguments.length>0&&void 0!==arguments[0]&&arguments[0];A(this,t);var r=!1===n?[0,-1,0,1,2,1]:[0,2,0,0,2,0];return(e=y(this,t)).setAttribute("position",new Kd([-1,3,0,-1,-1,0,3,-1,0],3)),e.setAttribute("uv",new Kd(r,2)),e}return x(t,e),T(t)}(af),lP=new uP,cP=function(e){function t(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return A(this,t),(e=y(this,t,[lP,n])).camera=sP,e.isQuadMesh=!0,e}return x(t,e),T(t,[{key:"renderAsync",value:(n=v(d().m(function e(t){return d().w(function(e){for(;;)if(0===e.n)return e.a(2,t.renderAsync(this,sP))},e,this)})),function(e){return n.apply(this,arguments)})},{key:"render",value:function(e){e.render(this,sP)}}]);var n}(gf),hP=new Vc,dP=function(e){function t(e){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{type:_l};A(this,t);var o=new lh(r,i,a);return(n=y(this,t,[o.texture,EE()])).node=e,n.width=r,n.height=i,n.pixelRatio=1,n.renderTarget=o,n.textureNeedsUpdate=!0,n.autoUpdate=!0,n._rttNode=null,n._quadMesh=new cP(new cI),n.updateBeforeType=_S.RENDER,n}return x(t,e),T(t,[{key:"autoSize",get:function(){return null===this.width}},{key:"setup",value:function(e){return this._rttNode=this.node.context(e.getSharedContext()),this._quadMesh.material.name="RTT",this._quadMesh.material.needsUpdate=!0,n(t,"setup",this,3)([e])}},{key:"setSize",value:function(e,t){this.width=e,this.height=t;var n=e*this.pixelRatio,r=t*this.pixelRatio;this.renderTarget.setSize(n,r),this.textureNeedsUpdate=!0}},{key:"setPixelRatio",value:function(e){this.pixelRatio=e,this.setSize(this.width,this.height)}},{key:"updateBefore",value:function(e){var t=e.renderer;if(!1!==this.textureNeedsUpdate||!1!==this.autoUpdate){if(this.textureNeedsUpdate=!1,!0===this.autoSize){this.pixelRatio=t.getPixelRatio();var n=t.getSize(hP);this.setSize(n.width,n.height)}this._quadMesh.material.fragmentNode=this._rttNode;var r=t.getRenderTarget();t.setRenderTarget(this.renderTarget),this._quadMesh.render(t),t.setRenderTarget(r)}}},{key:"clone",value:function(){var e=new IE(this.value,this.uvNode,this.levelNode);return e.sampler=this.sampler,e.referenceNode=this,e}}],[{key:"type",get:function(){return"RTTNode"}}])}(IE),fP=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r2&&void 0!==arguments[2]?arguments[2]:Float32Array;return A(this,t),(r=y(this,t,[ArrayBuffer.isView(e)?e:new i(e*n),n])).isStorageInstancedBufferAttribute=!0,r}return x(t,e),T(t)}(np),yP=function(e){function t(e,n){var r,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Float32Array;return A(this,t),(r=y(this,t,[ArrayBuffer.isView(e)?e:new i(e*n),n])).isStorageBufferAttribute=!0,r}return x(t,e),T(t)}(qd),_P=function(e){function t(e,n){var r;return A(this,t),(r=y(this,t,[e,n])).isStorageArrayElementNode=!0,r}return x(t,e),T(t,[{key:"storageBufferNode",get:function(){return this.node},set:function(e){this.node=e}},{key:"getMemberType",value:function(e,t){var n=this.storageBufferNode.structTypeNode;return n?n.getMemberType(e,t):"void"}},{key:"setup",value:function(e){return!1===e.isAvailable("storageBuffer")&&!0===this.node.isPBO&&e.setupPBO(this.node),n(t,"setup",this,3)([e])}},{key:"generate",value:function(e,r){var i,a=e.context.assign;if(i=!1===e.isAvailable("storageBuffer")?!0!==this.node.isPBO||!0===a||!this.node.value.isInstancedBufferAttribute&&"compute"===e.shaderStage?this.node.build(e):e.generatePBO(this):n(t,"generate",this,3)([e]),!0!==a){var o=this.getNodeType(e);i=e.format(i,o,r)}return i}}],[{key:"type",get:function(){return"StorageArrayElementNode"}}])}(MS),bP=kA(_P),xP=function(e){function t(e){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;A(this,t);var a,o=null;return r&&r.isStruct?(a="struct",o=r.layout):null===r&&(e.isStorageBufferAttribute||e.isStorageInstancedBufferAttribute)?(a=function(e){return lS.get(e)}(e.itemSize),i=e.count):a=r,(n=y(this,t,[e,a,i])).isStorageBufferNode=!0,n.structTypeNode=o,n.access=bS.READ_WRITE,n.isAtomic=!1,n.isPBO=!1,n._attribute=null,n._varying=null,n.global=!0,!0!==e.isStorageBufferAttribute&&!0!==e.isStorageInstancedBufferAttribute&&(e.isInstancedBufferAttribute?e.isStorageInstancedBufferAttribute=!0:e.isStorageBufferAttribute=!0),n}return x(t,e),T(t,[{key:"getHash",value:function(e){if(0===this.bufferCount){var t=e.globalCache.getData(this.value);return void 0===t&&(t={node:this},e.globalCache.setData(this.value,t)),t.node.uuid}return this.uuid}},{key:"getInputType",value:function(){return this.value.isIndirectStorageBufferAttribute?"indirectStorageBuffer":"storageBuffer"}},{key:"element",value:function(e){return bP(this,e)}},{key:"setPBO",value:function(e){return this.isPBO=e,this}},{key:"getPBO",value:function(){return this.isPBO}},{key:"setAccess",value:function(e){return this.access=e,this}},{key:"toReadOnly",value:function(){return this.setAccess(bS.READ_ONLY)}},{key:"setAtomic",value:function(e){return this.isAtomic=e,this}},{key:"toAtomic",value:function(){return this.setAtomic(!0)}},{key:"getAttributeData",value:function(){return null===this._attribute&&(this._attribute=uE(this.value),this._varying=WM(this._attribute)),{attribute:this._attribute,varying:this._varying}}},{key:"getNodeType",value:function(e){return null!==this.structTypeNode?this.structTypeNode.getNodeType(e):e.isAvailable("storageBuffer")||e.isAvailable("indirectStorageBuffer")?n(t,"getNodeType",this,3)([e]):this.getAttributeData().attribute.getNodeType(e)}},{key:"generate",value:function(e){if(null!==this.structTypeNode&&this.structTypeNode.build(e),e.isAvailable("storageBuffer")||e.isAvailable("indirectStorageBuffer"))return n(t,"generate",this,3)([e]);var r=this.getAttributeData(),i=r.attribute,a=r.varying.build(e);return e.registerTransform(a,i),a}}],[{key:"type",get:function(){return"StorageBufferNode"}}])}(LE),SP=function(e){return MA(new xP(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,arguments.length>2&&void 0!==arguments[2]?arguments[2]:0))},AP=function(e){function t(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return A(this,t),(e=y(this,t,[null,"vec4"])).isVertexColorNode=!0,e.index=n,e}return x(t,e),T(t,[{key:"getAttributeName",value:function(){var e=this.index;return"color"+(e>0?e:"")}},{key:"generate",value:function(e){var r=this.getAttributeName(e);return!0===e.hasGeometryAttribute(r)?n(t,"generate",this,3)([e]):e.generateConst(this.nodeType,new uh(1,1,1,1))}},{key:"serialize",value:function(e){n(t,"serialize",this,3)([e]),e.index=this.index}},{key:"deserialize",value:function(e){n(t,"deserialize",this,3)([e]),this.index=e.index}}],[{key:"type",get:function(){return"VertexColorNode"}}])}(TE),wP=RA(function(e){function t(){var e;return A(this,t),(e=y(this,t,["vec2"])).isPointUVNode=!0,e}return x(t,e),T(t,[{key:"generate",value:function(){return"vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y )"}}],[{key:"type",get:function(){return"PointUVNode"}}])}(TS)),TP=new ed,MP=new Gh,EP=function(e){function t(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t.BACKGROUND_BLURRINESS,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return A(this,t),(e=y(this,t)).scope=n,e.scene=r,e}return x(t,e),T(t,[{key:"setup",value:function(e){var n,r=this.scope,i=null!==this.scene?this.scene:e.scene;return r===t.BACKGROUND_BLURRINESS?n=VC("backgroundBlurriness","float",i):r===t.BACKGROUND_INTENSITY?n=VC("backgroundIntensity","float",i):r===t.BACKGROUND_ROTATION?n=fw("mat4").label("backgroundRotation").setGroup(cw).onRenderUpdate(function(){var e=i.background;return null!==e&&e.isTexture&&300!==e.mapping?(TP.copy(i.backgroundRotation),TP.x*=-1,TP.y*=-1,TP.z*=-1,MP.makeRotationFromEuler(TP)):MP.identity(),MP}):console.error("THREE.SceneNode: Unknown scope:",r),n}}],[{key:"type",get:function(){return"SceneNode"}}])}(TS);EP.BACKGROUND_BLURRINESS="backgroundBlurriness",EP.BACKGROUND_INTENSITY="backgroundIntensity",EP.BACKGROUND_ROTATION="backgroundRotation";var CP=RA(EP,EP.BACKGROUND_BLURRINESS),kP=RA(EP,EP.BACKGROUND_INTENSITY),RP=RA(EP,EP.BACKGROUND_ROTATION),IP=function(e){function t(e,n){var r,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return A(this,t),(r=y(this,t,[e,n])).storeNode=i,r.isStorageTextureNode=!0,r.access=bS.WRITE_ONLY,r}return x(t,e),T(t,[{key:"getInputType",value:function(){return"storageTexture"}},{key:"setup",value:function(e){n(t,"setup",this,3)([e]),e.getNodeProperties(this).storeNode=this.storeNode}},{key:"setAccess",value:function(e){return this.access=e,this}},{key:"generate",value:function(e,r){return null!==this.storeNode?this.generateStore(e):n(t,"generate",this,3)([e,r])}},{key:"toReadWrite",value:function(){return this.setAccess(bS.READ_WRITE)}},{key:"toReadOnly",value:function(){return this.setAccess(bS.READ_ONLY)}},{key:"toWriteOnly",value:function(){return this.setAccess(bS.WRITE_ONLY)}},{key:"generateStore",value:function(e){var r=e.getNodeProperties(this),i=r.uvNode,a=r.storeNode,o=n(t,"generate",this,3)([e,"property"]),s=i.build(e,"uvec2"),u=a.build(e,"vec4"),l=e.generateTextureStore(e,o,s,u);e.addLineFlowCode(l,this)}}],[{key:"type",get:function(){return"StorageTextureNode"}}])}(IE),NP=kA(IP),PP=function(e){function t(e,n){var r,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return A(this,t),(r=y(this,t,[e,n,i])).userData=i,r}return x(t,e),T(t,[{key:"updateReference",value:function(e){return this.reference=null!==this.userData?this.userData:e.object.userData,this.reference}}],[{key:"type",get:function(){return"UserDataNode"}}])}(zC),LP=new WeakMap;function DP(e){var t=LP.get(e);return void 0===t&&(t={},LP.set(e,t)),t}function OP(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=DP(e),r=n[t];return void 0===r&&(n[t]=r=new Gh),r}var FP=RA(function(e){function t(){var e;return A(this,t),(e=y(this,t,["vec2"])).projectionMatrix=null,e.updateType=_S.OBJECT,e.updateAfterType=_S.OBJECT,e.previousModelWorldMatrix=fw(new Gh),e.previousProjectionMatrix=fw(new Gh).setGroup(cw),e.previousCameraViewMatrix=fw(new Gh),e}return x(t,e),T(t,[{key:"setProjectionMatrix",value:function(e){this.projectionMatrix=e}},{key:"update",value:function(e){var t=e.frameId,n=e.camera,r=OP(e.object);this.previousModelWorldMatrix.value.copy(r);var i=DP(n);i.frameId!==t&&(i.frameId=t,void 0===i.previousProjectionMatrix?(i.previousProjectionMatrix=new Gh,i.previousCameraViewMatrix=new Gh,i.currentProjectionMatrix=new Gh,i.currentCameraViewMatrix=new Gh,i.previousProjectionMatrix.copy(this.projectionMatrix||n.projectionMatrix),i.previousCameraViewMatrix.copy(n.matrixWorldInverse)):(i.previousProjectionMatrix.copy(i.currentProjectionMatrix),i.previousCameraViewMatrix.copy(i.currentCameraViewMatrix)),i.currentProjectionMatrix.copy(this.projectionMatrix||n.projectionMatrix),i.currentCameraViewMatrix.copy(n.matrixWorldInverse),this.previousProjectionMatrix.value.copy(i.previousProjectionMatrix),this.previousCameraViewMatrix.value.copy(i.previousCameraViewMatrix))}},{key:"updateAfter",value:function(e){var t=e.object;OP(t).copy(t.matrixWorld)}},{key:"setup",value:function(){var e=null===this.projectionMatrix?HE:fw(this.projectionMatrix),t=this.previousCameraViewMatrix.mul(this.previousModelWorldMatrix),n=e.mul(uC).mul(fC),r=this.previousProjectionMatrix.mul(t).mul(pC),i=n.xy.div(n.w),a=r.xy.div(r.w);return Zw(i,a)}}],[{key:"type",get:function(){return"VelocityNode"}}])}(CS)),BP=IA(function(e){var t=C(e,2),n=t[0],r=t[1];return rM(1,n.oneMinus().div(r)).oneMinus()}).setLayout({name:"blendBurn",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),UP=IA(function(e){var t=C(e,2),n=t[0],r=t[1];return rM(n.div(r.oneMinus()),1)}).setLayout({name:"blendDodge",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),zP=IA(function(e){var t=C(e,2),n=t[0],r=t[1];return n.oneMinus().mul(r.oneMinus()).oneMinus()}).setLayout({name:"blendScreen",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),VP=IA(function(e){var t=C(e,2),n=t[0],r=t[1];return _M(n.mul(2).mul(r),n.oneMinus().mul(2).mul(r.oneMinus()).oneMinus(),oM(.5,n))}).setLayout({name:"blendOverlay",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),HP=IA(function(e){var t=C(e,2),n=t[0],r=t[1],i=r.a.add(n.a.mul(r.a.oneMinus()));return YA(r.rgb.mul(r.a).add(n.rgb.mul(n.a).mul(r.a.oneMinus())).div(i),i)}).setLayout({name:"blendColor",type:"vec4",inputs:[{name:"base",type:"vec4"},{name:"blend",type:"vec4"}]}),WP=IA(function(e){var t=C(e,1)[0];return qP(t.rgb)}),GP=IA(function(e){var t=C(e,2),n=t[0],r=t[1];return(void 0===r?FA(1):r).mix(qP(n.rgb),n.rgb)}),jP=IA(function(e){var t=C(e,2),n=t[0],r=t[1],i=void 0===r?FA(1):r,a=Kw(n.r,n.g,n.b).div(3),o=n.r.max(n.g.max(n.b)),s=o.sub(a).mul(i).mul(-3);return _M(n.rgb,o,s)}),QP=IA(function(e){var t=C(e,2),n=t[0],r=t[1],i=void 0===r?FA(1):r,a=jA(.57735,.57735,.57735),o=i.cos();return jA(n.rgb.mul(o).add(a.cross(n.rgb).mul(i.sin()).add(a.mul(cM(a,n.rgb).mul(o.oneMinus())))))}),qP=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:jA($c.getLuminanceCoefficients(new ph));return cM(e,t)},XP=IA(function(e){var t=C(e,6),n=t[0],r=t[1],i=void 0===r?jA(1):r,a=t[2],o=void 0===a?jA(0):a,s=t[3],u=void 0===s?jA(1):s,l=t[4],c=void 0===l?FA(1):l,h=t[5],d=void 0===h?jA($c.getLuminanceCoefficients(new ph,bc)):h,f=n.rgb.dot(jA(d)),p=iM(n.rgb.mul(i).add(o),0).toVar(),v=p.pow(u).toVar();return LA(p.r.greaterThan(0),function(){p.r.assign(v.r)}),LA(p.g.greaterThan(0),function(){p.g.assign(v.g)}),LA(p.b.greaterThan(0),function(){p.b.assign(v.b)}),p.assign(f.add(p.sub(f).mul(c))),YA(p.rgb,n.a)}),YP=kA(function(e){function t(e,n){var r;return A(this,t),(r=y(this,t)).sourceNode=e,r.stepsNode=n,r}return x(t,e),T(t,[{key:"setup",value:function(){var e=this.sourceNode,t=this.stepsNode;return e.mul(t).floor().div(t)}}],[{key:"type",get:function(){return"PosterizeNode"}}])}(CS)),KP=new Vc,ZP=function(e){function t(e,n){var r;return A(this,t),(r=y(this,t,[n])).passNode=e,r.setUpdateMatrix(!1),r}return x(t,e),T(t,[{key:"setup",value:function(e){return e.object.isQuadMesh&&this.passNode.build(e),n(t,"setup",this,3)([e])}},{key:"clone",value:function(){return new this.constructor(this.passNode,this.value)}}],[{key:"type",get:function(){return"PassTextureNode"}}])}(IE),JP=function(e){function t(e,n){var r,i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return A(this,t),(r=y(this,t,[e,null])).textureName=n,r.previousTexture=i,r}return x(t,e),T(t,[{key:"updateTexture",value:function(){this.value=this.previousTexture?this.passNode.getPreviousTexture(this.textureName):this.passNode.getTexture(this.textureName)}},{key:"setup",value:function(e){return this.updateTexture(),n(t,"setup",this,3)([e])}},{key:"clone",value:function(){return new this.constructor(this.passNode,this.textureName,this.previousTexture)}}],[{key:"type",get:function(){return"PassMultipleTextureNode"}}])}(ZP),$P=function(e){function t(e,n,r){var i,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};A(this,t),(i=y(this,t,["vec4"])).scope=e,i.scene=n,i.camera=r,i.options=a,i._pixelRatio=1,i._width=1,i._height=1;var o=new zp;o.isRenderTargetTexture=!0,o.name="depth";var u=new lh(i._width*i._pixelRatio,i._height*i._pixelRatio,s({type:_l},a));return u.texture.name="output",u.depthTexture=o,i.renderTarget=u,i._textures={output:u.texture,depth:o},i._textureNodes={},i._linearDepthNodes={},i._viewZNodes={},i._previousTextures={},i._previousTextureNodes={},i._cameraNear=fw(0),i._cameraFar=fw(0),i._mrt=null,i.isPassNode=!0,i.updateBeforeType=_S.FRAME,i}return x(t,e),T(t,[{key:"setMRT",value:function(e){return this._mrt=e,this}},{key:"getMRT",value:function(){return this._mrt}},{key:"isGlobal",value:function(){return!0}},{key:"getTexture",value:function(e){var t=this._textures[e];void 0===t&&((t=this.renderTarget.texture.clone()).name=e,this._textures[e]=t,this.renderTarget.textures.push(t));return t}},{key:"getPreviousTexture",value:function(e){var t=this._previousTextures[e];return void 0===t&&(t=this.getTexture(e).clone(),this._previousTextures[e]=t),t}},{key:"toggleTexture",value:function(e){var t=this._previousTextures[e];if(void 0!==t){var n=this._textures[e],r=this.renderTarget.textures.indexOf(n);this.renderTarget.textures[r]=t,this._textures[e]=t,this._previousTextures[e]=n,this._textureNodes[e].updateTexture(),this._previousTextureNodes[e].updateTexture()}}},{key:"getTextureNode",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"output",t=this._textureNodes[e];return void 0===t&&((t=MA(new JP(this,e))).updateTexture(),this._textureNodes[e]=t),t}},{key:"getPreviousTextureNode",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"output",t=this._previousTextureNodes[e];return void 0===t&&(void 0===this._textureNodes[e]&&this.getTextureNode(e),(t=MA(new JP(this,e,!0))).updateTexture(),this._previousTextureNodes[e]=t),t}},{key:"getViewZNode",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"depth",t=this._viewZNodes[e];if(void 0===t){var n=this._cameraNear,r=this._cameraFar;this._viewZNodes[e]=t=JR(this.getTextureNode(e),n,r)}return t}},{key:"getLinearDepthNode",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"depth",t=this._linearDepthNodes[e];if(void 0===t){var n=this._cameraNear,r=this._cameraFar,i=this.getViewZNode(e);this._linearDepthNodes[e]=t=KR(i,n,r)}return t}},{key:"setup",value:function(e){var n=e.renderer;return this.renderTarget.samples=void 0===this.options.samples?n.samples:this.options.samples,!0===n.backend.isWebGLBackend&&(this.renderTarget.samples=0),this.renderTarget.texture.type=n.getColorBufferType(),this.scope===t.COLOR?this.getTextureNode():this.getLinearDepthNode()}},{key:"updateBefore",value:function(e){var t=e.renderer,n=this.scene,r=this.camera;this._pixelRatio=t.getPixelRatio();var i=t.getSize(KP);this.setSize(i.width,i.height);var a=t.getRenderTarget(),o=t.getMRT();for(var s in this._cameraNear.value=r.near,this._cameraFar.value=r.far,this._previousTextures)this.toggleTexture(s);t.setRenderTarget(this.renderTarget),t.setMRT(this._mrt),t.render(n,r),t.setRenderTarget(a),t.setMRT(o)}},{key:"setSize",value:function(e,t){this._width=e,this._height=t;var n=this._width*this._pixelRatio,r=this._height*this._pixelRatio;this.renderTarget.setSize(n,r)}},{key:"setPixelRatio",value:function(e){this._pixelRatio=e,this.setSize(this._width,this._height)}},{key:"dispose",value:function(){this.renderTarget.dispose()}}],[{key:"type",get:function(){return"PassNode"}}])}(CS);$P.COLOR="color",$P.DEPTH="depth";var eL=function(e){function t(e,n,r,i,a){var o;return A(this,t),(o=y(this,t,[$P.COLOR,e,n])).colorNode=r,o.thicknessNode=i,o.alphaNode=a,o._materialCache=new WeakMap,o}return x(t,e),T(t,[{key:"updateBefore",value:function(e){var r=this,i=e.renderer,a=i.getRenderObjectFunction();i.setRenderObjectFunction(function(e,t,n,a,o,s,u,l){if((o.isMeshToonMaterial||o.isMeshToonNodeMaterial)&&!1===o.wireframe){var c=r._getOutlineMaterial(o);i.renderObject(e,t,n,a,c,s,u,l)}i.renderObject(e,t,n,a,o,s,u,l)}),n(t,"updateBefore",this,3)([e]),i.setRenderObjectFunction(a)}},{key:"_createMaterial",value:function(){var e=new cI;e.isMeshToonOutlineMaterial=!0,e.name="Toon_Outline",e.side=1;var t=AC.negate(),n=HE.mul(uC),r=FA(1),i=n.mul(YA(fC,1)),a=n.mul(YA(fC.add(t),1)),o=DT(i.sub(a));return e.vertexNode=i.add(o.mul(this.thicknessNode).mul(i.w).mul(r)),e.colorNode=YA(this.colorNode,this.alphaNode),e}},{key:"_getOutlineMaterial",value:function(e){var t=this._materialCache.get(e);return void 0===t&&(t=this._createMaterial(),this._materialCache.set(e,t)),t}}],[{key:"type",get:function(){return"ToonOutlinePassNode"}}])}($P),tL=IA(function(e){var t=C(e,2),n=t[0],r=t[1];return n.mul(r).clamp()}).setLayout({name:"linearToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),nL=IA(function(e){var t=C(e,2),n=t[0],r=t[1];return(n=n.mul(r)).div(n.add(1)).clamp()}).setLayout({name:"reinhardToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),rL=IA(function(e){var t=C(e,2),n=t[0],r=t[1],i=(n=(n=n.mul(r)).sub(.004).max(0)).mul(n.mul(6.2).add(.5)),a=n.mul(n.mul(6.2).add(1.7)).add(.06);return i.div(a).pow(2.2)}).setLayout({name:"cineonToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),iL=IA(function(e){var t=C(e,1)[0],n=t.mul(t.add(.0245786)).sub(90537e-9),r=t.mul(t.add(.432951).mul(.983729)).add(.238081);return n.div(r)}),aL=IA(function(e){var t=C(e,2),n=t[0],r=t[1],i=ew(.59719,.35458,.04823,.076,.90834,.01566,.0284,.13383,.83777),a=ew(1.60475,-.53108,-.07367,-.10208,1.10813,-.00605,-.00327,-.07276,1.07602);return n=n.mul(r).div(.6),n=i.mul(n),n=iL(n),(n=a.mul(n)).clamp()}).setLayout({name:"acesFilmicToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),oL=ew(jA(1.6605,-.1246,-.0182),jA(-.5876,1.1329,-.1006),jA(-.0728,-.0083,1.1187)),sL=ew(jA(.6274,.0691,.0164),jA(.3293,.9195,.088),jA(.0433,.0113,.8956)),uL=IA(function(e){var t=C(e,1)[0],n=jA(t).toVar(),r=jA(n.mul(n)).toVar(),i=jA(r.mul(r)).toVar();return FA(15.5).mul(i.mul(r)).sub(Jw(40.14,i.mul(n))).add(Jw(31.96,i).sub(Jw(6.868,r.mul(n))).add(Jw(.4298,r).add(Jw(.1191,n).sub(.00232))))}),lL=IA(function(e){var t=C(e,2),n=t[0],r=t[1],i=jA(n).toVar(),a=ew(jA(.856627153315983,.137318972929847,.11189821299995),jA(.0951212405381588,.761241990602591,.0767994186031903),jA(.0482516061458583,.101439036467562,.811302368396859)),o=ew(jA(1.1271005818144368,-.1413297634984383,-.14132976349843826),jA(-.11060664309660323,1.157823702216272,-.11060664309660294),jA(-.016493938717834573,-.016493938717834257,1.2519364065950405)),s=FA(-12.47393),u=FA(4.026069);return i.mulAssign(r),i.assign(sL.mul(i)),i.assign(a.mul(i)),i.assign(iM(i,1e-10)),i.assign(RT(i)),i.assign(i.sub(s).div(u.sub(s))),i.assign(bM(i,0,1)),i.assign(uL(i)),i.assign(o.mul(i)),i.assign(dM(iM(jA(0),i),jA(2.2))),i.assign(oL.mul(i)),i.assign(bM(i,0,1)),i}).setLayout({name:"agxToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),cL=IA(function(e){var t=C(e,2),n=t[0],r=t[1],i=FA(.76),a=FA(.15);n=n.mul(r);var o=rM(n.r,rM(n.g,n.b)),s=NM(o.lessThan(.08),o.sub(Jw(6.25,o.mul(o))),.04);n.subAssign(s);var u=iM(n.r,iM(n.g,n.b));LA(u.lessThan(i),function(){return n});var l=Zw(1,i),c=Zw(1,l.mul(l).div(u.add(l.sub(i))));n.mulAssign(c.div(u));var h=Zw(1,$w(1,a.mul(u.sub(c)).add(1)));return _M(n,jA(c),h)}).setLayout({name:"neutralToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),hL=function(e){function t(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return A(this,t),(e=y(this,t,["code"])).isCodeNode=!0,e.code=n,e.includes=r,e.language=i,e}return x(t,e),T(t,[{key:"isGlobal",value:function(){return!0}},{key:"setIncludes",value:function(e){return this.includes=e,this}},{key:"getIncludes",value:function(){return this.includes}},{key:"generate",value:function(e){var t,n=L(this.getIncludes(e));try{for(n.s();!(t=n.n()).done;){t.value.build(e)}}catch(i){n.e(i)}finally{n.f()}var r=e.getCodeFromNode(this,this.getNodeType(e));return r.code=this.code,r.code}},{key:"serialize",value:function(e){n(t,"serialize",this,3)([e]),e.code=this.code,e.language=this.language}},{key:"deserialize",value:function(e){n(t,"deserialize",this,3)([e]),this.code=e.code,this.language=e.language}}],[{key:"type",get:function(){return"CodeNode"}}])}(TS),dL=kA(hL),fL=function(e){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return A(this,t),y(this,t,[e,n,r])}return x(t,e),T(t,[{key:"getNodeType",value:function(e){return this.getNodeFunction(e).type}},{key:"getInputs",value:function(e){return this.getNodeFunction(e).inputs}},{key:"getNodeFunction",value:function(e){var t=e.getDataFromNode(this),n=t.nodeFunction;return void 0===n&&(n=e.parser.parseFunction(this.code),t.nodeFunction=n),n}},{key:"generate",value:function(e,r){n(t,"generate",this,3)([e]);var i=this.getNodeFunction(e),a=i.name,o=i.type,s=e.getCodeFromNode(this,o);""!==a&&(s.name=a);var u=e.getPropertyName(s),l=this.getNodeFunction(e).getCode(u);return s.code=l+"\n","property"===r?u:e.format("".concat(u,"()"),o,r)}}],[{key:"type",get:function(){return"FunctionNode"}}])}(hL),pL=function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",r=0;r0&&void 0!==arguments[0]?arguments[0]:null;return A(this,t),(e=y(this,t))._value=n,e._cache=null,e.inputType=null,e.outputType=null,e.events=new kc,e.isScriptableValueNode=!0,e}return x(t,e),T(t,[{key:"isScriptableOutputNode",get:function(){return null!==this.outputType}},{key:"value",get:function(){return this._value},set:function(e){this._value!==e&&(this._cache&&"URL"===this.inputType&&this.value.value instanceof ArrayBuffer&&(URL.revokeObjectURL(this._cache),this._cache=null),this._value=e,this.events.dispatchEvent({type:"change"}),this.refresh())}},{key:"refresh",value:function(){this.events.dispatchEvent({type:"refresh"})}},{key:"getValue",value:function(){var e=this.value;if(e&&null===this._cache&&"URL"===this.inputType&&e.value instanceof ArrayBuffer)this._cache=URL.createObjectURL(new Blob([e.value]));else if(e&&null!==e.value&&void 0!==e.value&&(("URL"===this.inputType||"String"===this.inputType)&&"string"==typeof e.value||"Number"===this.inputType&&"number"==typeof e.value||"Vector2"===this.inputType&&e.value.isVector2||"Vector3"===this.inputType&&e.value.isVector3||"Vector4"===this.inputType&&e.value.isVector4||"Color"===this.inputType&&e.value.isColor||"Matrix3"===this.inputType&&e.value.isMatrix3||"Matrix4"===this.inputType&&e.value.isMatrix4))return e.value;return this._cache||e}},{key:"getNodeType",value:function(e){return this.value&&this.value.isNode?this.value.getNodeType(e):"float"}},{key:"setup",value:function(){return this.value&&this.value.isNode?this.value:FA()}},{key:"serialize",value:function(e){n(t,"serialize",this,3)([e]),null!==this.value?"ArrayBuffer"===this.inputType?e.value=mS(this.value):e.value=this.value?this.value.toJSON(e.meta).uuid:null:e.value=null,e.inputType=this.inputType,e.outputType=this.outputType}},{key:"deserialize",value:function(e){n(t,"deserialize",this,3)([e]);var r=null;null!==e.value&&(r="ArrayBuffer"===e.inputType?gS(e.value):"Texture"===e.inputType?e.meta.textures[e.value]:e.meta.nodes[e.value]||null),this.value=r,this.inputType=e.inputType,this.outputType=e.outputType}}],[{key:"type",get:function(){return"ScriptableValueNode"}}])}(TS),mL=kA(vL),gL=function(e){function t(){return A(this,t),y(this,t,arguments)}return x(t,e),T(t,[{key:"get",value:function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(this.has(e))return n(t,"get",this,3)([e]);if(null!==r){for(var i=arguments.length,a=new Array(i>2?i-2:0),o=2;o0&&void 0!==arguments[0]?arguments[0]:null,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return A(this,t),(e=y(this,t)).codeNode=n,e.parameters=r,e._local=new gL,e._output=mL(),e._outputs={},e._source=e.source,e._method=null,e._object=null,e._value=null,e._needsOutputUpdate=!0,e.onRefresh=e.onRefresh.bind(e),e.isScriptableNode=!0,e}return x(t,e),T(t,[{key:"source",get:function(){return this.codeNode?this.codeNode.code:""}},{key:"setLocal",value:function(e,t){return this._local.set(e,t)}},{key:"getLocal",value:function(e){return this._local.get(e)}},{key:"onRefresh",value:function(){this._refresh()}},{key:"getInputLayout",value:function(e){var t,n=L(this.getLayout());try{for(n.s();!(t=n.n()).done;){var r=t.value;if(r.inputType&&(r.id===e||r.name===e))return r}}catch(i){n.e(i)}finally{n.f()}}},{key:"getOutputLayout",value:function(e){var t,n=L(this.getLayout());try{for(n.s();!(t=n.n()).done;){var r=t.value;if(r.outputType&&(r.id===e||r.name===e))return r}}catch(i){n.e(i)}finally{n.f()}}},{key:"setOutput",value:function(e,t){var n=this._outputs;return void 0===n[e]?n[e]=mL(t):n[e].value=t,this}},{key:"getOutput",value:function(e){return this._outputs[e]}},{key:"getParameter",value:function(e){return this.parameters[e]}},{key:"setParameter",value:function(e,t){var n=this.parameters;return t&&t.isScriptableNode?(this.deleteParameter(e),n[e]=t,n[e].getDefaultOutput().events.addEventListener("refresh",this.onRefresh)):t&&t.isScriptableValueNode?(this.deleteParameter(e),n[e]=t,n[e].events.addEventListener("refresh",this.onRefresh)):void 0===n[e]?(n[e]=mL(t),n[e].events.addEventListener("refresh",this.onRefresh)):n[e].value=t,this}},{key:"getValue",value:function(){return this.getDefaultOutput().getValue()}},{key:"deleteParameter",value:function(e){var t=this.parameters[e];return t&&(t.isScriptableNode&&(t=t.getDefaultOutput()),t.events.removeEventListener("refresh",this.onRefresh)),this}},{key:"clearParameters",value:function(){for(var e=0,t=Object.keys(this.parameters);e1?n-1:0),i=1;i1?i-1:0),o=1;o0&&void 0!==arguments[0]?arguments[0]:null;null!==e?this.getOutput(e).refresh():this._refresh()}},{key:"getObject",value:function(){var e=this;if(this.needsUpdate&&this.dispose(),null!==this._object)return this._object;var t=new yL(this),n=_L.get("THREE"),r=_L.get("TSL"),i=this.getMethod(),a=[t,this._local,_L,function(){return e.refresh()},function(t,n){return e.setOutput(t,n)},n,r];this._object=i.apply(void 0,a);var o=this._object.layout;if(o&&(!1===o.cache&&this._local.clear(),this._output.outputType=o.outputType||null,Array.isArray(o.elements))){var s,u=L(o.elements);try{for(u.s();!(s=u.n()).done;){var l=s.value,c=l.id||l.name;l.inputType&&(void 0===this.getParameter(c)&&this.setParameter(c,null),this.getParameter(c).inputType=l.inputType),l.outputType&&(void 0===this.getOutput(c)&&this.setOutput(c,null),this.getOutput(c).outputType=l.outputType)}}catch(h){u.e(h)}finally{u.f()}}return this._object}},{key:"deserialize",value:function(e){for(var r in n(t,"deserialize",this,3)([e]),this.parameters){var i=this.parameters[r];i.isScriptableNode&&(i=i.getDefaultOutput()),i.events.addEventListener("refresh",this.onRefresh)}}},{key:"getLayout",value:function(){return this.getObject().layout}},{key:"getDefaultOutputNode",value:function(){var e=this.getDefaultOutput().value;return e&&e.isNode?e:FA()}},{key:"getDefaultOutput",value:function(){return this._exec()._output}},{key:"getMethod",value:function(){if(this.needsUpdate&&this.dispose(),null!==this._method)return this._method;var e=["layout","init","main","dispose"].join(", "),t="\nreturn { ...output, "+e+" };",n="var "+e+"; var output = {};\n"+this.codeNode.code+t;return this._method=g(Function,["parameters","local","global","refresh","setOutput","THREE","TSL"].concat([n])),this._method}},{key:"dispose",value:function(){null!==this._method&&(this._object&&"function"==typeof this._object.dispose&&this._object.dispose(),this._method=null,this._object=null,this._source=null,this._value=null,this._needsOutputUpdate=!0,this._output.value=null,this._outputs={})}},{key:"setup",value:function(){return this.getDefaultOutputNode()}},{key:"getCacheKey",value:function(e){var t,n=[(t=this.source,iS(t)),this.getDefaultOutputNode().getCacheKey(e)];for(var r in this.parameters)n.push(this.parameters[r].getCacheKey(e));return aS(n)}},{key:"needsUpdate",get:function(){return this.source!==this._source},set:function(e){!0===e&&this.dispose()}},{key:"_exec",value:function(){return null===this.codeNode||(!0===this._needsOutputUpdate&&(this._value=this.call("main"),this._needsOutputUpdate=!1),this._output.value=this._value),this}},{key:"_refresh",value:function(){this.needsUpdate=!0,this._exec(),this._output.refresh()}}],[{key:"type",get:function(){return"ScriptableNode"}}]);var r}(TS),xL=kA(bL);function SL(e){var t,n=e.context.getViewZ;return void 0!==n&&(t=n(this)),(t||gC.z).negate()}var AL=IA(function(e,t){var n=C(e,2),r=n[0],i=n[1],a=SL(t);return AM(r,i,a)}),wL=IA(function(e,t){var n=C(e,1)[0],r=SL(t);return n.mul(n,r,r).negate().exp().oneMinus()}),TL=IA(function(e){var t=C(e,2),n=t[0],r=t[1];return YA(r.toFloat().mix(Dw.rgb,n.toVec3()),Dw.a)});var ML=null,EL=null,CL=function(e){function t(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:FA(),r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:FA();return A(this,t),(e=y(this,t)).minNode=n,e.maxNode=r,e}return x(t,e),T(t,[{key:"getVectorLength",value:function(e){var t=e.getTypeLength(fS(this.minNode.value)),n=e.getTypeLength(fS(this.maxNode.value));return t>n?t:n}},{key:"getNodeType",value:function(e){return e.object.count>1?e.getTypeFromLength(this.getVectorLength(e)):"float"}},{key:"setup",value:function(e){var t=e.object,n=null;if(t.count>1){var r=this.minNode.value,i=this.maxNode.value,a=e.getTypeLength(fS(r)),o=e.getTypeLength(fS(i));ML=ML||new uh,EL=EL||new uh,ML.setScalar(0),EL.setScalar(0),1===a?ML.setScalar(r):r.isColor?ML.set(r.r,r.g,r.b,1):ML.set(r.x,r.y,r.z||0,r.w||0),1===o?EL.setScalar(i):i.isColor?EL.set(i.r,i.g,i.b,1):EL.set(i.x,i.y,i.z||0,i.w||0);for(var s=4*t.count,u=new Float32Array(s),l=0;l2&&void 0!==arguments[2]?arguments[2]:0;return A(this,t),(r=y(this,t,[n])).bufferType=n,r.bufferCount=i,r.isWorkgroupInfoNode=!0,r.elementType=n,r.scope=e,r}return x(t,e),T(t,[{key:"label",value:function(e){return this.name=e,this}},{key:"setScope",value:function(e){return this.scope=e,this}},{key:"getElementType",value:function(){return this.elementType}},{key:"getInputType",value:function(){return"".concat(this.scope,"Array")}},{key:"element",value:function(e){return MA(new UL(this,e))}},{key:"generate",value:function(e){return e.getScopedArray(this.name||"".concat(this.scope,"Array_").concat(this.id),this.scope.toLowerCase(),this.bufferType,this.bufferCount)}}])}(TS),VL=function(e){function t(e,n,r){var i,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;return A(this,t),(i=y(this,t,["uint"])).method=e,i.pointerNode=n,i.valueNode=r,i.storeNode=a,i}return x(t,e),T(t,[{key:"getInputType",value:function(e){return this.pointerNode.getNodeType(e)}},{key:"getNodeType",value:function(e){return this.getInputType(e)}},{key:"generate",value:function(e){var t=this.method,n=this.getNodeType(e),r=this.getInputType(e),i=this.pointerNode,a=this.valueNode,o=[];o.push("&".concat(i.build(e,r))),null!==a&&o.push(a.build(e,r));var s="".concat(e.getMethod(t,n),"( ").concat(o.join(", ")," )");if(null!==this.storeNode){var u=this.storeNode.build(e,r);e.addLineFlowCode("".concat(u," = ").concat(s),this)}else e.addLineFlowCode(s,this)}}],[{key:"type",get:function(){return"AtomicFunctionNode"}}])}(CS);VL.ATOMIC_LOAD="atomicLoad",VL.ATOMIC_STORE="atomicStore",VL.ATOMIC_ADD="atomicAdd",VL.ATOMIC_SUB="atomicSub",VL.ATOMIC_MAX="atomicMax",VL.ATOMIC_MIN="atomicMin",VL.ATOMIC_AND="atomicAnd",VL.ATOMIC_OR="atomicOr",VL.ATOMIC_XOR="atomicXor";var HL,WL=kA(VL),GL=function(e,t,n){var r=WL(e,t,n,arguments.length>3&&void 0!==arguments[3]?arguments[3]:null);return r.append(),r};function jL(e){var t=(HL=HL||new WeakMap).get(e);return void 0===t&&HL.set(e,t={}),t}function QL(e){var t=jL(e);return t.shadowMatrix||(t.shadowMatrix=fw("mat4").setGroup(cw).onRenderUpdate(function(){return!0!==e.castShadow&&e.shadow.updateMatrices(e),e.shadow.matrix}))}function qL(e){var t=jL(e);return t.position||(t.position=fw(new ph).setGroup(cw).onRenderUpdate(function(t,n){return n.value.setFromMatrixPosition(e.matrixWorld)}))}function XL(e){var t=jL(e);return t.targetPosition||(t.targetPosition=fw(new ph).setGroup(cw).onRenderUpdate(function(t,n){return n.value.setFromMatrixPosition(e.target.matrixWorld)}))}var YL=function(e,t){var n,r=L(t);try{for(r.s();!(n=r.n()).done;){var i=n.value;if(i.isAnalyticLightNode&&i.light.id===e)return i}}catch(a){r.e(a)}finally{r.f()}return null},KL=new WeakMap,ZL=function(e){function t(){var e;return A(this,t),(e=y(this,t,["vec3"])).totalDiffuseNode=jA().toVar("totalDiffuse"),e.totalSpecularNode=jA().toVar("totalSpecular"),e.outgoingLightNode=jA().toVar("outgoingLight"),e._lights=[],e._lightNodes=null,e._lightNodesHash=null,e.global=!0,e}return x(t,e),T(t,[{key:"customCacheKey",value:function(){for(var e=[],t=this._lights,n=0;n0}}],[{key:"type",get:function(){return"LightsNode"}}])}(TS),JL=function(e){function t(e){var n;return A(this,t),(n=y(this,t)).light=e,n.updateBeforeType=_S.RENDER,n.isShadowBaseNode=!0,n}return x(t,e),T(t,[{key:"setupShadowPosition",value:function(e){var t=e.material;$L.assign(t.shadowPositionNode||vC)}},{key:"dispose",value:function(){this.updateBeforeType=_S.NONE}}],[{key:"type",get:function(){return"ShadowBaseNode"}}])}(TS),$L=jA().toVar("shadowPositionWorld");function eD(e,t){return t=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.toneMapping=e.toneMapping,t.toneMappingExposure=e.toneMappingExposure,t.outputColorSpace=e.outputColorSpace,t.renderTarget=e.getRenderTarget(),t.activeCubeFace=e.getActiveCubeFace(),t.activeMipmapLevel=e.getActiveMipmapLevel(),t.renderObjectFunction=e.getRenderObjectFunction(),t.pixelRatio=e.getPixelRatio(),t.mrt=e.getMRT(),t.clearColor=e.getClearColor(t.clearColor||new Od),t.clearAlpha=e.getClearAlpha(),t.autoClear=e.autoClear,t.scissorTest=e.getScissorTest(),t}(e,t),e.setMRT(null),e.setRenderObjectFunction(null),e.setClearColor(0,1),e.autoClear=!0,t}var tD,nD=new WeakMap,rD=IA(function(e){var t=C(e,3),n=t[0],r=t[1],i=t[2],a=vC.sub(n).length();return a=(a=a.sub(r).div(i.sub(r))).saturate()}),iD=function(e){var t=nD.get(e);if(void 0===t){var n=e.isPointLight?function(e){var t=e.shadow.camera,n=VC("near","float",t).setGroup(cw),r=VC("far","float",t).setGroup(cw),i=ZE(e);return rD(i,n,r)}(e):null;(t=new cI).colorNode=YA(0,0,0,1),t.depthNode=n,t.isShadowPassMaterial=!0,t.name="ShadowMaterial",t.fog=!1,nD.set(e,t)}return t},aD=IA(function(e){var t=e.depthTexture,n=e.shadowCoord;return NE(t,n.xy).compare(n.z)}),oD=IA(function(e){var t=e.depthTexture,n=e.shadowCoord,r=e.shadow,i=function(e,n){return NE(t,e).compare(n)},a=VC("mapSize","vec2",r).setGroup(cw),o=VC("radius","float",r).setGroup(cw),s=VA(1).div(a),u=s.x.negate().mul(o),l=s.y.negate().mul(o),c=s.x.mul(o),h=s.y.mul(o),d=u.div(2),f=l.div(2),p=c.div(2),v=h.div(2);return Kw(i(n.xy.add(VA(u,l)),n.z),i(n.xy.add(VA(0,l)),n.z),i(n.xy.add(VA(c,l)),n.z),i(n.xy.add(VA(d,f)),n.z),i(n.xy.add(VA(0,f)),n.z),i(n.xy.add(VA(p,f)),n.z),i(n.xy.add(VA(u,0)),n.z),i(n.xy.add(VA(d,0)),n.z),i(n.xy,n.z),i(n.xy.add(VA(p,0)),n.z),i(n.xy.add(VA(c,0)),n.z),i(n.xy.add(VA(d,v)),n.z),i(n.xy.add(VA(0,v)),n.z),i(n.xy.add(VA(p,v)),n.z),i(n.xy.add(VA(u,h)),n.z),i(n.xy.add(VA(0,h)),n.z),i(n.xy.add(VA(c,h)),n.z)).mul(1/17)}),sD=IA(function(e){var t=e.depthTexture,n=e.shadowCoord,r=e.shadow,i=function(e,n){return NE(t,e).compare(n)},a=VC("mapSize","vec2",r).setGroup(cw),o=VA(1).div(a),s=o.x,u=o.y,l=n.xy,c=OT(l.mul(a).add(.5));return l.subAssign(c.mul(o)),Kw(i(l,n.z),i(l.add(VA(s,0)),n.z),i(l.add(VA(0,u)),n.z),i(l.add(o),n.z),_M(i(l.add(VA(s.negate(),0)),n.z),i(l.add(VA(s.mul(2),0)),n.z),c.x),_M(i(l.add(VA(s.negate(),u)),n.z),i(l.add(VA(s.mul(2),u)),n.z),c.x),_M(i(l.add(VA(0,u.negate())),n.z),i(l.add(VA(0,u.mul(2))),n.z),c.y),_M(i(l.add(VA(s,u.negate())),n.z),i(l.add(VA(s,u.mul(2))),n.z),c.y),_M(_M(i(l.add(VA(s.negate(),u.negate())),n.z),i(l.add(VA(s.mul(2),u.negate())),n.z),c.x),_M(i(l.add(VA(s.negate(),u.mul(2))),n.z),i(l.add(VA(s.mul(2),u.mul(2))),n.z),c.x),c.y)).mul(1/9)}),uD=IA(function(e){var t=e.depthTexture,n=e.shadowCoord,r=FA(1).toVar(),i=NE(t).sample(n.xy).rg,a=oM(n.z,i.x);return LA(a.notEqual(FA(1)),function(){var e=n.z.sub(i.x),t=iM(0,i.y.mul(i.y)),o=t.div(t.add(e.mul(e)));o=bM(Zw(o,.3).div(.95-.3)),r.assign(bM(iM(a,o)))}),r}),lD=IA(function(e){var t=e.samples,n=e.radius,r=e.size,i=e.shadowPass,a=FA(0).toVar(),o=FA(0).toVar(),s=t.lessThanEqual(FA(1)).select(FA(0),FA(2).div(t.sub(1))),u=t.lessThanEqual(FA(1)).select(FA(0),FA(-1));gR({start:BA(0),end:BA(t),type:"int",condition:"<"},function(e){var t=e.i,l=u.add(FA(t).mul(s)),c=i.sample(Kw(LR.xy,VA(0,l).mul(n)).div(r)).x;a.addAssign(c),o.addAssign(c.mul(c))}),a.divAssign(t),o.divAssign(t);var l=IT(o.sub(a.mul(a)));return VA(a,l)}),cD=IA(function(e){var t=e.samples,n=e.radius,r=e.size,i=e.shadowPass,a=FA(0).toVar(),o=FA(0).toVar(),s=t.lessThanEqual(FA(1)).select(FA(0),FA(2).div(t.sub(1))),u=t.lessThanEqual(FA(1)).select(FA(0),FA(-1));gR({start:BA(0),end:BA(t),type:"int",condition:"<"},function(e){var t=e.i,l=u.add(FA(t).mul(s)),c=i.sample(Kw(LR.xy,VA(l,0).mul(n)).div(r));a.addAssign(c.x),o.addAssign(Kw(c.y.mul(c.y),c.x.mul(c.x)))}),a.divAssign(t),o.divAssign(t);var l=IT(o.sub(a.mul(a)));return VA(a,l)}),hD=[aD,oD,sD,uD],dD=new cP,fD=function(e){function t(e){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return A(this,t),(n=y(this,t,[e])).shadow=r||e.shadow,n.shadowMap=null,n.vsmShadowMapVertical=null,n.vsmShadowMapHorizontal=null,n.vsmMaterialVertical=null,n.vsmMaterialHorizontal=null,n._node=null,n.isShadowNode=!0,n}return x(t,e),T(t,[{key:"setupShadowFilter",value:function(e,t){var n=t.filterFn,r=t.depthTexture,i=t.shadowCoord,a=t.shadow,o=i.x.greaterThanEqual(0).and(i.x.lessThanEqual(1)).and(i.y.greaterThanEqual(0)).and(i.y.lessThanEqual(1)).and(i.z.lessThanEqual(1)),s=n({depthTexture:r,shadowCoord:i,shadow:a});return o.select(s,FA(1))}},{key:"setupShadowCoord",value:function(e,t){var n,r=this.shadow,i=e.renderer,a=VC("bias","float",r).setGroup(cw),o=t;if(r.camera.isOrthographicCamera||!0!==i.logarithmicDepthBuffer)n=(o=o.xyz.div(o.w)).z,i.coordinateSystem===Cc&&(n=n.mul(2).sub(1));else{var s=o.w;o=o.xy.div(s);var u=VC("near","float",r.camera).setGroup(cw),l=VC("far","float",r.camera).setGroup(cw);n=$R(s.negate(),u,l)}return o=jA(o.x,o.y.oneMinus(),n.add(a))}},{key:"getShadowFilterFn",value:function(e){return hD[e]}},{key:"setupShadow",value:function(e){var t=e.renderer,n=this.light,r=this.shadow,i=t.shadowMap.type,a=new zp(r.mapSize.width,r.mapSize.height);a.compareFunction=513;var o=e.createRenderTarget(r.mapSize.width,r.mapSize.height);if(o.depthTexture=a,r.camera.updateProjectionMatrix(),3===i){a.compareFunction=null,this.vsmShadowMapVertical=e.createRenderTarget(r.mapSize.width,r.mapSize.height,{format:kl,type:_l}),this.vsmShadowMapHorizontal=e.createRenderTarget(r.mapSize.width,r.mapSize.height,{format:kl,type:_l});var s=NE(a),u=NE(this.vsmShadowMapVertical.texture),l=VC("blurSamples","float",r).setGroup(cw),c=VC("radius","float",r).setGroup(cw),h=VC("mapSize","vec2",r).setGroup(cw),d=this.vsmMaterialVertical||(this.vsmMaterialVertical=new cI);d.fragmentNode=lD({samples:l,radius:c,size:h,shadowPass:s}).context(e.getSharedContext()),d.name="VSMVertical",(d=this.vsmMaterialHorizontal||(this.vsmMaterialHorizontal=new cI)).fragmentNode=cD({samples:l,radius:c,size:h,shadowPass:u}).context(e.getSharedContext()),d.name="VSMHorizontal"}var f=VC("intensity","float",r).setGroup(cw),p=VC("normalBias","float",r).setGroup(cw),v=QL(n).mul($L.add(CC.mul(p))),m=this.setupShadowCoord(e,v),g=r.filterNode||this.getShadowFilterFn(t.shadowMap.type)||null;if(null===g)throw new Error("THREE.WebGPURenderer: Shadow map type not supported yet.");var y=3===i?this.vsmShadowMapHorizontal.texture:a,_=this.setupShadowFilter(e,{filterFn:g,shadowTexture:o.texture,depthTexture:y,shadowCoord:m,shadow:r}),b=NE(o.texture,m),x=_M(1,_.rgb.mix(b,1),f.mul(b.a)).toVar();return this.shadowMap=o,this.shadow.map=o,x}},{key:"setup",value:function(e){var t=this;if(!1!==e.renderer.shadowMap.enabled)return IA(function(){var n=t._node;return t.setupShadowPosition(e),null===n&&(t._node=n=t.setupShadow(e)),e.material.shadowNode&&console.warn('THREE.NodeMaterial: ".shadowNode" is deprecated. Use ".castShadowNode" instead.'),e.material.receivedShadowNode&&(n=e.material.receivedShadowNode(n)),n})()}},{key:"renderShadow",value:function(e){var t=this.shadow,n=this.shadowMap,r=this.light,i=e.renderer,a=e.scene;t.updateMatrices(r),n.setSize(t.mapSize.width,t.mapSize.height),i.render(a,t.camera)}},{key:"updateShadow",value:function(e){var t=this.shadowMap,n=this.light,r=this.shadow,i=e.renderer,a=e.scene,o=e.camera,s=i.shadowMap.type,u=t.depthTexture.version;this._depthVersionCached=u,r.camera.layers.mask=o.layers.mask;var l=i.getRenderObjectFunction(),c=i.getMRT(),h=!!c&&c.has("velocity");tD=function(e,t,n){return n=function(e,t){return t=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.background=e.background,t.backgroundNode=e.backgroundNode,t.overrideMaterial=e.overrideMaterial,t}(e,t),e.background=null,e.backgroundNode=null,e.overrideMaterial=null,t}(t,n=eD(e,n)),n}(i,a,tD),a.overrideMaterial=iD(n),i.setRenderObjectFunction(function(e,t,n,a,u,l){if(!0===e.castShadow||e.receiveShadow&&3===s){h&&(vS(e).useVelocity=!0),e.onBeforeShadow(i,e,o,r.camera,a,t.overrideMaterial,l);for(var c=arguments.length,d=new Array(c>6?c-6:0),f=6;f1){var u=FA(s.fwidth()).toVar();o.assign(AM(u.oneMinus(),u.add(1),s).oneMinus())}else s.greaterThan(1).discard();return o}),yD=IA(function(e){var t=C(e,3),n=t[0],r=t[1],i=t[2],a=FA(i).toVar(),o=FA(r).toVar(),s=zA(n).toVar();return NM(s,o,a)}).setLayout({name:"mx_select",type:"float",inputs:[{name:"b",type:"bool"},{name:"t",type:"float"},{name:"f",type:"float"}]}),_D=IA(function(e){var t=C(e,2),n=t[0],r=t[1],i=zA(r).toVar(),a=FA(n).toVar();return NM(i,a.negate(),a)}).setLayout({name:"mx_negate_if",type:"float",inputs:[{name:"val",type:"float"},{name:"b",type:"bool"}]}),bD=IA(function(e){var t=C(e,1)[0],n=FA(t).toVar();return BA(PT(n))}).setLayout({name:"mx_floor",type:"int",inputs:[{name:"x",type:"float"}]}),xD=IA(function(e){var t=C(e,2),n=t[0],r=t[1],i=FA(n).toVar();return r.assign(bD(i)),i.sub(FA(r))}),SD=IA(function(e){var t=C(e,6),n=t[0],r=t[1],i=t[2],a=t[3],o=t[4],s=t[5],u=FA(s).toVar(),l=FA(o).toVar(),c=FA(a).toVar(),h=FA(i).toVar(),d=FA(r).toVar(),f=FA(n).toVar(),p=FA(Zw(1,l)).toVar();return Zw(1,u).mul(f.mul(p).add(d.mul(l))).add(u.mul(h.mul(p).add(c.mul(l))))}).setLayout({name:"mx_bilerp_0",type:"float",inputs:[{name:"v0",type:"float"},{name:"v1",type:"float"},{name:"v2",type:"float"},{name:"v3",type:"float"},{name:"s",type:"float"},{name:"t",type:"float"}]}),AD=IA(function(e){var t=C(e,6),n=t[0],r=t[1],i=t[2],a=t[3],o=t[4],s=t[5],u=FA(s).toVar(),l=FA(o).toVar(),c=jA(a).toVar(),h=jA(i).toVar(),d=jA(r).toVar(),f=jA(n).toVar(),p=FA(Zw(1,l)).toVar();return Zw(1,u).mul(f.mul(p).add(d.mul(l))).add(u.mul(h.mul(p).add(c.mul(l))))}).setLayout({name:"mx_bilerp_1",type:"vec3",inputs:[{name:"v0",type:"vec3"},{name:"v1",type:"vec3"},{name:"v2",type:"vec3"},{name:"v3",type:"vec3"},{name:"s",type:"float"},{name:"t",type:"float"}]}),wD=PN([SD,AD]),TD=IA(function(e){var t=C(e,11),n=t[0],r=t[1],i=t[2],a=t[3],o=t[4],s=t[5],u=t[6],l=t[7],c=t[8],h=t[9],d=t[10],f=FA(d).toVar(),p=FA(h).toVar(),v=FA(c).toVar(),m=FA(l).toVar(),g=FA(u).toVar(),y=FA(s).toVar(),_=FA(o).toVar(),b=FA(a).toVar(),x=FA(i).toVar(),S=FA(r).toVar(),A=FA(n).toVar(),w=FA(Zw(1,v)).toVar(),T=FA(Zw(1,p)).toVar();return FA(Zw(1,f)).toVar().mul(T.mul(A.mul(w).add(S.mul(v))).add(p.mul(x.mul(w).add(b.mul(v))))).add(f.mul(T.mul(_.mul(w).add(y.mul(v))).add(p.mul(g.mul(w).add(m.mul(v))))))}).setLayout({name:"mx_trilerp_0",type:"float",inputs:[{name:"v0",type:"float"},{name:"v1",type:"float"},{name:"v2",type:"float"},{name:"v3",type:"float"},{name:"v4",type:"float"},{name:"v5",type:"float"},{name:"v6",type:"float"},{name:"v7",type:"float"},{name:"s",type:"float"},{name:"t",type:"float"},{name:"r",type:"float"}]}),MD=IA(function(e){var t=C(e,11),n=t[0],r=t[1],i=t[2],a=t[3],o=t[4],s=t[5],u=t[6],l=t[7],c=t[8],h=t[9],d=t[10],f=FA(d).toVar(),p=FA(h).toVar(),v=FA(c).toVar(),m=jA(l).toVar(),g=jA(u).toVar(),y=jA(s).toVar(),_=jA(o).toVar(),b=jA(a).toVar(),x=jA(i).toVar(),S=jA(r).toVar(),A=jA(n).toVar(),w=FA(Zw(1,v)).toVar(),T=FA(Zw(1,p)).toVar();return FA(Zw(1,f)).toVar().mul(T.mul(A.mul(w).add(S.mul(v))).add(p.mul(x.mul(w).add(b.mul(v))))).add(f.mul(T.mul(_.mul(w).add(y.mul(v))).add(p.mul(g.mul(w).add(m.mul(v))))))}).setLayout({name:"mx_trilerp_1",type:"vec3",inputs:[{name:"v0",type:"vec3"},{name:"v1",type:"vec3"},{name:"v2",type:"vec3"},{name:"v3",type:"vec3"},{name:"v4",type:"vec3"},{name:"v5",type:"vec3"},{name:"v6",type:"vec3"},{name:"v7",type:"vec3"},{name:"s",type:"float"},{name:"t",type:"float"},{name:"r",type:"float"}]}),ED=PN([TD,MD]),CD=IA(function(e){var t=C(e,3),n=t[0],r=t[1],i=t[2],a=FA(i).toVar(),o=FA(r).toVar(),s=UA(n).toVar(),u=UA(s.bitAnd(UA(7))).toVar(),l=FA(yD(u.lessThan(UA(4)),o,a)).toVar(),c=FA(Jw(2,yD(u.lessThan(UA(4)),a,o))).toVar();return _D(l,zA(u.bitAnd(UA(1)))).add(_D(c,zA(u.bitAnd(UA(2)))))}).setLayout({name:"mx_gradient_float_0",type:"float",inputs:[{name:"hash",type:"uint"},{name:"x",type:"float"},{name:"y",type:"float"}]}),kD=IA(function(e){var t=C(e,4),n=t[0],r=t[1],i=t[2],a=t[3],o=FA(a).toVar(),s=FA(i).toVar(),u=FA(r).toVar(),l=UA(n).toVar(),c=UA(l.bitAnd(UA(15))).toVar(),h=FA(yD(c.lessThan(UA(8)),u,s)).toVar(),d=FA(yD(c.lessThan(UA(4)),s,yD(c.equal(UA(12)).or(c.equal(UA(14))),u,o))).toVar();return _D(h,zA(c.bitAnd(UA(1)))).add(_D(d,zA(c.bitAnd(UA(2)))))}).setLayout({name:"mx_gradient_float_1",type:"float",inputs:[{name:"hash",type:"uint"},{name:"x",type:"float"},{name:"y",type:"float"},{name:"z",type:"float"}]}),RD=PN([CD,kD]),ID=IA(function(e){var t=C(e,3),n=t[0],r=t[1],i=t[2],a=FA(i).toVar(),o=FA(r).toVar(),s=qA(n).toVar();return jA(RD(s.x,o,a),RD(s.y,o,a),RD(s.z,o,a))}).setLayout({name:"mx_gradient_vec3_0",type:"vec3",inputs:[{name:"hash",type:"uvec3"},{name:"x",type:"float"},{name:"y",type:"float"}]}),ND=IA(function(e){var t=C(e,4),n=t[0],r=t[1],i=t[2],a=t[3],o=FA(a).toVar(),s=FA(i).toVar(),u=FA(r).toVar(),l=qA(n).toVar();return jA(RD(l.x,u,s,o),RD(l.y,u,s,o),RD(l.z,u,s,o))}).setLayout({name:"mx_gradient_vec3_1",type:"vec3",inputs:[{name:"hash",type:"uvec3"},{name:"x",type:"float"},{name:"y",type:"float"},{name:"z",type:"float"}]}),PD=PN([ID,ND]),LD=IA(function(e){var t=C(e,1)[0],n=FA(t).toVar();return Jw(.6616,n)}).setLayout({name:"mx_gradient_scale2d_0",type:"float",inputs:[{name:"v",type:"float"}]}),DD=IA(function(e){var t=C(e,1)[0],n=FA(t).toVar();return Jw(.982,n)}).setLayout({name:"mx_gradient_scale3d_0",type:"float",inputs:[{name:"v",type:"float"}]}),OD=IA(function(e){var t=C(e,1)[0],n=jA(t).toVar();return Jw(.6616,n)}).setLayout({name:"mx_gradient_scale2d_1",type:"vec3",inputs:[{name:"v",type:"vec3"}]}),FD=PN([LD,OD]),BD=IA(function(e){var t=C(e,1)[0],n=jA(t).toVar();return Jw(.982,n)}).setLayout({name:"mx_gradient_scale3d_1",type:"vec3",inputs:[{name:"v",type:"vec3"}]}),UD=PN([DD,BD]),zD=IA(function(e){var t=C(e,2),n=t[0],r=t[1],i=BA(r).toVar(),a=UA(n).toVar();return a.shiftLeft(i).bitOr(a.shiftRight(BA(32).sub(i)))}).setLayout({name:"mx_rotl32",type:"uint",inputs:[{name:"x",type:"uint"},{name:"k",type:"int"}]}),VD=IA(function(e){var t=C(e,3),n=t[0],r=t[1],i=t[2];n.subAssign(i),n.bitXorAssign(zD(i,BA(4))),i.addAssign(r),r.subAssign(n),r.bitXorAssign(zD(n,BA(6))),n.addAssign(i),i.subAssign(r),i.bitXorAssign(zD(r,BA(8))),r.addAssign(n),n.subAssign(i),n.bitXorAssign(zD(i,BA(16))),i.addAssign(r),r.subAssign(n),r.bitXorAssign(zD(n,BA(19))),n.addAssign(i),i.subAssign(r),i.bitXorAssign(zD(r,BA(4))),r.addAssign(n)}),HD=IA(function(e){var t=C(e,3),n=t[0],r=t[1],i=t[2],a=UA(i).toVar(),o=UA(r).toVar(),s=UA(n).toVar();return a.bitXorAssign(o),a.subAssign(zD(o,BA(14))),s.bitXorAssign(a),s.subAssign(zD(a,BA(11))),o.bitXorAssign(s),o.subAssign(zD(s,BA(25))),a.bitXorAssign(o),a.subAssign(zD(o,BA(16))),s.bitXorAssign(a),s.subAssign(zD(a,BA(4))),o.bitXorAssign(s),o.subAssign(zD(s,BA(14))),a.bitXorAssign(o),a.subAssign(zD(o,BA(24))),a}).setLayout({name:"mx_bjfinal",type:"uint",inputs:[{name:"a",type:"uint"},{name:"b",type:"uint"},{name:"c",type:"uint"}]}),WD=IA(function(e){var t=C(e,1)[0],n=UA(t).toVar();return FA(n).div(FA(UA(BA(4294967295))))}).setLayout({name:"mx_bits_to_01",type:"float",inputs:[{name:"bits",type:"uint"}]}),GD=IA(function(e){var t=C(e,1)[0],n=FA(t).toVar();return n.mul(n).mul(n).mul(n.mul(n.mul(6).sub(15)).add(10))}).setLayout({name:"mx_fade",type:"float",inputs:[{name:"t",type:"float"}]}),jD=IA(function(e){var t=C(e,1)[0],n=BA(t).toVar(),r=UA(UA(1)).toVar(),i=UA(UA(BA(3735928559)).add(r.shiftLeft(UA(2))).add(UA(13))).toVar();return HD(i.add(UA(n)),i,i)}).setLayout({name:"mx_hash_int_0",type:"uint",inputs:[{name:"x",type:"int"}]}),QD=IA(function(e){var t=C(e,2),n=t[0],r=t[1],i=BA(r).toVar(),a=BA(n).toVar(),o=UA(UA(2)).toVar(),s=UA().toVar(),u=UA().toVar(),l=UA().toVar();return s.assign(u.assign(l.assign(UA(BA(3735928559)).add(o.shiftLeft(UA(2))).add(UA(13))))),s.addAssign(UA(a)),u.addAssign(UA(i)),HD(s,u,l)}).setLayout({name:"mx_hash_int_1",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"}]}),qD=IA(function(e){var t=C(e,3),n=t[0],r=t[1],i=t[2],a=BA(i).toVar(),o=BA(r).toVar(),s=BA(n).toVar(),u=UA(UA(3)).toVar(),l=UA().toVar(),c=UA().toVar(),h=UA().toVar();return l.assign(c.assign(h.assign(UA(BA(3735928559)).add(u.shiftLeft(UA(2))).add(UA(13))))),l.addAssign(UA(s)),c.addAssign(UA(o)),h.addAssign(UA(a)),HD(l,c,h)}).setLayout({name:"mx_hash_int_2",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"}]}),XD=IA(function(e){var t=C(e,4),n=t[0],r=t[1],i=t[2],a=t[3],o=BA(a).toVar(),s=BA(i).toVar(),u=BA(r).toVar(),l=BA(n).toVar(),c=UA(UA(4)).toVar(),h=UA().toVar(),d=UA().toVar(),f=UA().toVar();return h.assign(d.assign(f.assign(UA(BA(3735928559)).add(c.shiftLeft(UA(2))).add(UA(13))))),h.addAssign(UA(l)),d.addAssign(UA(u)),f.addAssign(UA(s)),VD(h,d,f),h.addAssign(UA(o)),HD(h,d,f)}).setLayout({name:"mx_hash_int_3",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"},{name:"xx",type:"int"}]}),YD=IA(function(e){var t=C(e,5),n=t[0],r=t[1],i=t[2],a=t[3],o=t[4],s=BA(o).toVar(),u=BA(a).toVar(),l=BA(i).toVar(),c=BA(r).toVar(),h=BA(n).toVar(),d=UA(UA(5)).toVar(),f=UA().toVar(),p=UA().toVar(),v=UA().toVar();return f.assign(p.assign(v.assign(UA(BA(3735928559)).add(d.shiftLeft(UA(2))).add(UA(13))))),f.addAssign(UA(h)),p.addAssign(UA(c)),v.addAssign(UA(l)),VD(f,p,v),f.addAssign(UA(u)),p.addAssign(UA(s)),HD(f,p,v)}).setLayout({name:"mx_hash_int_4",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"},{name:"xx",type:"int"},{name:"yy",type:"int"}]}),KD=PN([jD,QD,qD,XD,YD]),ZD=IA(function(e){var t=C(e,2),n=t[0],r=t[1],i=BA(r).toVar(),a=BA(n).toVar(),o=UA(KD(a,i)).toVar(),s=qA().toVar();return s.x.assign(o.bitAnd(BA(255))),s.y.assign(o.shiftRight(BA(8)).bitAnd(BA(255))),s.z.assign(o.shiftRight(BA(16)).bitAnd(BA(255))),s}).setLayout({name:"mx_hash_vec3_0",type:"uvec3",inputs:[{name:"x",type:"int"},{name:"y",type:"int"}]}),JD=IA(function(e){var t=C(e,3),n=t[0],r=t[1],i=t[2],a=BA(i).toVar(),o=BA(r).toVar(),s=BA(n).toVar(),u=UA(KD(s,o,a)).toVar(),l=qA().toVar();return l.x.assign(u.bitAnd(BA(255))),l.y.assign(u.shiftRight(BA(8)).bitAnd(BA(255))),l.z.assign(u.shiftRight(BA(16)).bitAnd(BA(255))),l}).setLayout({name:"mx_hash_vec3_1",type:"uvec3",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"}]}),$D=PN([ZD,JD]),eO=IA(function(e){var t=C(e,1)[0],n=VA(t).toVar(),r=BA().toVar(),i=BA().toVar(),a=FA(xD(n.x,r)).toVar(),o=FA(xD(n.y,i)).toVar(),s=FA(GD(a)).toVar(),u=FA(GD(o)).toVar(),l=FA(wD(RD(KD(r,i),a,o),RD(KD(r.add(BA(1)),i),a.sub(1),o),RD(KD(r,i.add(BA(1))),a,o.sub(1)),RD(KD(r.add(BA(1)),i.add(BA(1))),a.sub(1),o.sub(1)),s,u)).toVar();return FD(l)}).setLayout({name:"mx_perlin_noise_float_0",type:"float",inputs:[{name:"p",type:"vec2"}]}),tO=IA(function(e){var t=C(e,1)[0],n=jA(t).toVar(),r=BA().toVar(),i=BA().toVar(),a=BA().toVar(),o=FA(xD(n.x,r)).toVar(),s=FA(xD(n.y,i)).toVar(),u=FA(xD(n.z,a)).toVar(),l=FA(GD(o)).toVar(),c=FA(GD(s)).toVar(),h=FA(GD(u)).toVar(),d=FA(ED(RD(KD(r,i,a),o,s,u),RD(KD(r.add(BA(1)),i,a),o.sub(1),s,u),RD(KD(r,i.add(BA(1)),a),o,s.sub(1),u),RD(KD(r.add(BA(1)),i.add(BA(1)),a),o.sub(1),s.sub(1),u),RD(KD(r,i,a.add(BA(1))),o,s,u.sub(1)),RD(KD(r.add(BA(1)),i,a.add(BA(1))),o.sub(1),s,u.sub(1)),RD(KD(r,i.add(BA(1)),a.add(BA(1))),o,s.sub(1),u.sub(1)),RD(KD(r.add(BA(1)),i.add(BA(1)),a.add(BA(1))),o.sub(1),s.sub(1),u.sub(1)),l,c,h)).toVar();return UD(d)}).setLayout({name:"mx_perlin_noise_float_1",type:"float",inputs:[{name:"p",type:"vec3"}]}),nO=PN([eO,tO]),rO=IA(function(e){var t=C(e,1)[0],n=VA(t).toVar(),r=BA().toVar(),i=BA().toVar(),a=FA(xD(n.x,r)).toVar(),o=FA(xD(n.y,i)).toVar(),s=FA(GD(a)).toVar(),u=FA(GD(o)).toVar(),l=jA(wD(PD($D(r,i),a,o),PD($D(r.add(BA(1)),i),a.sub(1),o),PD($D(r,i.add(BA(1))),a,o.sub(1)),PD($D(r.add(BA(1)),i.add(BA(1))),a.sub(1),o.sub(1)),s,u)).toVar();return FD(l)}).setLayout({name:"mx_perlin_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"vec2"}]}),iO=IA(function(e){var t=C(e,1)[0],n=jA(t).toVar(),r=BA().toVar(),i=BA().toVar(),a=BA().toVar(),o=FA(xD(n.x,r)).toVar(),s=FA(xD(n.y,i)).toVar(),u=FA(xD(n.z,a)).toVar(),l=FA(GD(o)).toVar(),c=FA(GD(s)).toVar(),h=FA(GD(u)).toVar(),d=jA(ED(PD($D(r,i,a),o,s,u),PD($D(r.add(BA(1)),i,a),o.sub(1),s,u),PD($D(r,i.add(BA(1)),a),o,s.sub(1),u),PD($D(r.add(BA(1)),i.add(BA(1)),a),o.sub(1),s.sub(1),u),PD($D(r,i,a.add(BA(1))),o,s,u.sub(1)),PD($D(r.add(BA(1)),i,a.add(BA(1))),o.sub(1),s,u.sub(1)),PD($D(r,i.add(BA(1)),a.add(BA(1))),o,s.sub(1),u.sub(1)),PD($D(r.add(BA(1)),i.add(BA(1)),a.add(BA(1))),o.sub(1),s.sub(1),u.sub(1)),l,c,h)).toVar();return UD(d)}).setLayout({name:"mx_perlin_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec3"}]}),aO=PN([rO,iO]),oO=IA(function(e){var t=C(e,1)[0],n=FA(t).toVar(),r=BA(bD(n)).toVar();return WD(KD(r))}).setLayout({name:"mx_cell_noise_float_0",type:"float",inputs:[{name:"p",type:"float"}]}),sO=IA(function(e){var t=C(e,1)[0],n=VA(t).toVar(),r=BA(bD(n.x)).toVar(),i=BA(bD(n.y)).toVar();return WD(KD(r,i))}).setLayout({name:"mx_cell_noise_float_1",type:"float",inputs:[{name:"p",type:"vec2"}]}),uO=IA(function(e){var t=C(e,1)[0],n=jA(t).toVar(),r=BA(bD(n.x)).toVar(),i=BA(bD(n.y)).toVar(),a=BA(bD(n.z)).toVar();return WD(KD(r,i,a))}).setLayout({name:"mx_cell_noise_float_2",type:"float",inputs:[{name:"p",type:"vec3"}]}),lO=IA(function(e){var t=C(e,1)[0],n=YA(t).toVar(),r=BA(bD(n.x)).toVar(),i=BA(bD(n.y)).toVar(),a=BA(bD(n.z)).toVar(),o=BA(bD(n.w)).toVar();return WD(KD(r,i,a,o))}).setLayout({name:"mx_cell_noise_float_3",type:"float",inputs:[{name:"p",type:"vec4"}]}),cO=PN([oO,sO,uO,lO]),hO=IA(function(e){var t=C(e,1)[0],n=FA(t).toVar(),r=BA(bD(n)).toVar();return jA(WD(KD(r,BA(0))),WD(KD(r,BA(1))),WD(KD(r,BA(2))))}).setLayout({name:"mx_cell_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"float"}]}),dO=IA(function(e){var t=C(e,1)[0],n=VA(t).toVar(),r=BA(bD(n.x)).toVar(),i=BA(bD(n.y)).toVar();return jA(WD(KD(r,i,BA(0))),WD(KD(r,i,BA(1))),WD(KD(r,i,BA(2))))}).setLayout({name:"mx_cell_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec2"}]}),fO=IA(function(e){var t=C(e,1)[0],n=jA(t).toVar(),r=BA(bD(n.x)).toVar(),i=BA(bD(n.y)).toVar(),a=BA(bD(n.z)).toVar();return jA(WD(KD(r,i,a,BA(0))),WD(KD(r,i,a,BA(1))),WD(KD(r,i,a,BA(2))))}).setLayout({name:"mx_cell_noise_vec3_2",type:"vec3",inputs:[{name:"p",type:"vec3"}]}),pO=IA(function(e){var t=C(e,1)[0],n=YA(t).toVar(),r=BA(bD(n.x)).toVar(),i=BA(bD(n.y)).toVar(),a=BA(bD(n.z)).toVar(),o=BA(bD(n.w)).toVar();return jA(WD(KD(r,i,a,o,BA(0))),WD(KD(r,i,a,o,BA(1))),WD(KD(r,i,a,o,BA(2))))}).setLayout({name:"mx_cell_noise_vec3_3",type:"vec3",inputs:[{name:"p",type:"vec4"}]}),vO=PN([hO,dO,fO,pO]),mO=IA(function(e){var t=C(e,4),n=t[0],r=t[1],i=t[2],a=t[3],o=FA(a).toVar(),s=FA(i).toVar(),u=BA(r).toVar(),l=jA(n).toVar(),c=FA(0).toVar(),h=FA(1).toVar();return gR(u,function(){c.addAssign(h.mul(nO(l))),h.mulAssign(o),l.mulAssign(s)}),c}).setLayout({name:"mx_fractal_noise_float",type:"float",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),gO=IA(function(e){var t=C(e,4),n=t[0],r=t[1],i=t[2],a=t[3],o=FA(a).toVar(),s=FA(i).toVar(),u=BA(r).toVar(),l=jA(n).toVar(),c=jA(0).toVar(),h=FA(1).toVar();return gR(u,function(){c.addAssign(h.mul(aO(l))),h.mulAssign(o),l.mulAssign(s)}),c}).setLayout({name:"mx_fractal_noise_vec3",type:"vec3",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),yO=IA(function(e){var t=C(e,4),n=t[0],r=t[1],i=t[2],a=t[3],o=FA(a).toVar(),s=FA(i).toVar(),u=BA(r).toVar(),l=jA(n).toVar();return VA(mO(l,u,s,o),mO(l.add(jA(BA(19),BA(193),BA(17))),u,s,o))}).setLayout({name:"mx_fractal_noise_vec2",type:"vec2",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),_O=IA(function(e){var t=C(e,4),n=t[0],r=t[1],i=t[2],a=t[3],o=FA(a).toVar(),s=FA(i).toVar(),u=BA(r).toVar(),l=jA(n).toVar(),c=jA(gO(l,u,s,o)).toVar(),h=FA(mO(l.add(jA(BA(19),BA(193),BA(17))),u,s,o)).toVar();return YA(c,h)}).setLayout({name:"mx_fractal_noise_vec4",type:"vec4",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),bO=IA(function(e){var t=C(e,7),n=t[0],r=t[1],i=t[2],a=t[3],o=t[4],s=t[5],u=t[6],l=BA(u).toVar(),c=FA(s).toVar(),h=BA(o).toVar(),d=BA(a).toVar(),f=BA(i).toVar(),p=BA(r).toVar(),v=VA(n).toVar(),m=jA(vO(VA(p.add(d),f.add(h)))).toVar(),g=VA(m.x,m.y).toVar();g.subAssign(.5),g.mulAssign(c),g.addAssign(.5);var y=VA(VA(FA(p),FA(f)).add(g)).toVar(),_=VA(y.sub(v)).toVar();return LA(l.equal(BA(2)),function(){return WT(_.x).add(WT(_.y))}),LA(l.equal(BA(3)),function(){return iM(WT(_.x),WT(_.y))}),cM(_,_)}).setLayout({name:"mx_worley_distance_0",type:"float",inputs:[{name:"p",type:"vec2"},{name:"x",type:"int"},{name:"y",type:"int"},{name:"xoff",type:"int"},{name:"yoff",type:"int"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),xO=IA(function(e){var t=C(e,9),n=t[0],r=t[1],i=t[2],a=t[3],o=t[4],s=t[5],u=t[6],l=t[7],c=t[8],h=BA(c).toVar(),d=FA(l).toVar(),f=BA(u).toVar(),p=BA(s).toVar(),v=BA(o).toVar(),m=BA(a).toVar(),g=BA(i).toVar(),y=BA(r).toVar(),_=jA(n).toVar(),b=jA(vO(jA(y.add(v),g.add(p),m.add(f)))).toVar();b.subAssign(.5),b.mulAssign(d),b.addAssign(.5);var x=jA(jA(FA(y),FA(g),FA(m)).add(b)).toVar(),S=jA(x.sub(_)).toVar();return LA(h.equal(BA(2)),function(){return WT(S.x).add(WT(S.y)).add(WT(S.z))}),LA(h.equal(BA(3)),function(){return iM(iM(WT(S.x),WT(S.y)),WT(S.z))}),cM(S,S)}).setLayout({name:"mx_worley_distance_1",type:"float",inputs:[{name:"p",type:"vec3"},{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"},{name:"xoff",type:"int"},{name:"yoff",type:"int"},{name:"zoff",type:"int"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),SO=PN([bO,xO]),AO=IA(function(e){var t=C(e,3),n=t[0],r=t[1],i=t[2],a=BA(i).toVar(),o=FA(r).toVar(),s=VA(n).toVar(),u=BA().toVar(),l=BA().toVar(),c=VA(xD(s.x,u),xD(s.y,l)).toVar(),h=FA(1e6).toVar();return gR({start:-1,end:BA(1),name:"x",condition:"<="},function(e){var t=e.x;gR({start:-1,end:BA(1),name:"y",condition:"<="},function(e){var n=e.y,r=FA(SO(c,t,n,u,l,o,a)).toVar();h.assign(rM(h,r))})}),LA(a.equal(BA(0)),function(){h.assign(IT(h))}),h}).setLayout({name:"mx_worley_noise_float_0",type:"float",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),wO=IA(function(e){var t=C(e,3),n=t[0],r=t[1],i=t[2],a=BA(i).toVar(),o=FA(r).toVar(),s=VA(n).toVar(),u=BA().toVar(),l=BA().toVar(),c=VA(xD(s.x,u),xD(s.y,l)).toVar(),h=VA(1e6,1e6).toVar();return gR({start:-1,end:BA(1),name:"x",condition:"<="},function(e){var t=e.x;gR({start:-1,end:BA(1),name:"y",condition:"<="},function(e){var n=e.y,r=FA(SO(c,t,n,u,l,o,a)).toVar();LA(r.lessThan(h.x),function(){h.y.assign(h.x),h.x.assign(r)}).ElseIf(r.lessThan(h.y),function(){h.y.assign(r)})})}),LA(a.equal(BA(0)),function(){h.assign(IT(h))}),h}).setLayout({name:"mx_worley_noise_vec2_0",type:"vec2",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),TO=IA(function(e){var t=C(e,3),n=t[0],r=t[1],i=t[2],a=BA(i).toVar(),o=FA(r).toVar(),s=VA(n).toVar(),u=BA().toVar(),l=BA().toVar(),c=VA(xD(s.x,u),xD(s.y,l)).toVar(),h=jA(1e6,1e6,1e6).toVar();return gR({start:-1,end:BA(1),name:"x",condition:"<="},function(e){var t=e.x;gR({start:-1,end:BA(1),name:"y",condition:"<="},function(e){var n=e.y,r=FA(SO(c,t,n,u,l,o,a)).toVar();LA(r.lessThan(h.x),function(){h.z.assign(h.y),h.y.assign(h.x),h.x.assign(r)}).ElseIf(r.lessThan(h.y),function(){h.z.assign(h.y),h.y.assign(r)}).ElseIf(r.lessThan(h.z),function(){h.z.assign(r)})})}),LA(a.equal(BA(0)),function(){h.assign(IT(h))}),h}).setLayout({name:"mx_worley_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),MO=IA(function(e){var t=C(e,3),n=t[0],r=t[1],i=t[2],a=BA(i).toVar(),o=FA(r).toVar(),s=jA(n).toVar(),u=BA().toVar(),l=BA().toVar(),c=BA().toVar(),h=jA(xD(s.x,u),xD(s.y,l),xD(s.z,c)).toVar(),d=FA(1e6).toVar();return gR({start:-1,end:BA(1),name:"x",condition:"<="},function(e){var t=e.x;gR({start:-1,end:BA(1),name:"y",condition:"<="},function(e){var n=e.y;gR({start:-1,end:BA(1),name:"z",condition:"<="},function(e){var r=e.z,i=FA(SO(h,t,n,r,u,l,c,o,a)).toVar();d.assign(rM(d,i))})})}),LA(a.equal(BA(0)),function(){d.assign(IT(d))}),d}).setLayout({name:"mx_worley_noise_float_1",type:"float",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),EO=PN([AO,MO]),CO=IA(function(e){var t=C(e,3),n=t[0],r=t[1],i=t[2],a=BA(i).toVar(),o=FA(r).toVar(),s=jA(n).toVar(),u=BA().toVar(),l=BA().toVar(),c=BA().toVar(),h=jA(xD(s.x,u),xD(s.y,l),xD(s.z,c)).toVar(),d=VA(1e6,1e6).toVar();return gR({start:-1,end:BA(1),name:"x",condition:"<="},function(e){var t=e.x;gR({start:-1,end:BA(1),name:"y",condition:"<="},function(e){var n=e.y;gR({start:-1,end:BA(1),name:"z",condition:"<="},function(e){var r=e.z,i=FA(SO(h,t,n,r,u,l,c,o,a)).toVar();LA(i.lessThan(d.x),function(){d.y.assign(d.x),d.x.assign(i)}).ElseIf(i.lessThan(d.y),function(){d.y.assign(i)})})})}),LA(a.equal(BA(0)),function(){d.assign(IT(d))}),d}).setLayout({name:"mx_worley_noise_vec2_1",type:"vec2",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),kO=PN([wO,CO]),RO=IA(function(e){var t=C(e,3),n=t[0],r=t[1],i=t[2],a=BA(i).toVar(),o=FA(r).toVar(),s=jA(n).toVar(),u=BA().toVar(),l=BA().toVar(),c=BA().toVar(),h=jA(xD(s.x,u),xD(s.y,l),xD(s.z,c)).toVar(),d=jA(1e6,1e6,1e6).toVar();return gR({start:-1,end:BA(1),name:"x",condition:"<="},function(e){var t=e.x;gR({start:-1,end:BA(1),name:"y",condition:"<="},function(e){var n=e.y;gR({start:-1,end:BA(1),name:"z",condition:"<="},function(e){var r=e.z,i=FA(SO(h,t,n,r,u,l,c,o,a)).toVar();LA(i.lessThan(d.x),function(){d.z.assign(d.y),d.y.assign(d.x),d.x.assign(i)}).ElseIf(i.lessThan(d.y),function(){d.z.assign(d.y),d.y.assign(i)}).ElseIf(i.lessThan(d.z),function(){d.z.assign(i)})})})}),LA(a.equal(BA(0)),function(){d.assign(IT(d))}),d}).setLayout({name:"mx_worley_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),IO=PN([TO,RO]),NO=IA(function(e){var t=C(e,1)[0],n=t.y,r=t.z,i=jA().toVar();return LA(n.lessThan(1e-4),function(){i.assign(jA(r,r,r))}).Else(function(){var e=t.x;e=e.sub(PT(e)).mul(6).toVar();var a=BA(JT(e)),o=e.sub(FA(a)),s=r.mul(n.oneMinus()),u=r.mul(n.mul(o).oneMinus()),l=r.mul(n.mul(o.oneMinus()).oneMinus());LA(a.equal(BA(0)),function(){i.assign(jA(r,l,s))}).ElseIf(a.equal(BA(1)),function(){i.assign(jA(u,r,s))}).ElseIf(a.equal(BA(2)),function(){i.assign(jA(s,r,l))}).ElseIf(a.equal(BA(3)),function(){i.assign(jA(s,u,r))}).ElseIf(a.equal(BA(4)),function(){i.assign(jA(l,s,r))}).Else(function(){i.assign(jA(r,s,u))})}),i}).setLayout({name:"mx_hsvtorgb",type:"vec3",inputs:[{name:"hsv",type:"vec3"}]}),PO=IA(function(e){var t=C(e,1)[0],n=jA(t).toVar(),r=FA(n.x).toVar(),i=FA(n.y).toVar(),a=FA(n.z).toVar(),o=FA(rM(r,rM(i,a))).toVar(),s=FA(iM(r,iM(i,a))).toVar(),u=FA(s.sub(o)).toVar(),l=FA().toVar(),c=FA().toVar(),h=FA().toVar();return h.assign(s),LA(s.greaterThan(0),function(){c.assign(u.div(s))}).Else(function(){c.assign(0)}),LA(c.lessThanEqual(0),function(){l.assign(0)}).Else(function(){LA(r.greaterThanEqual(s),function(){l.assign(i.sub(a).div(u))}).ElseIf(i.greaterThanEqual(s),function(){l.assign(Kw(2,a.sub(r).div(u)))}).Else(function(){l.assign(Kw(4,r.sub(i).div(u)))}),l.mulAssign(1/6),LA(l.lessThan(0),function(){l.addAssign(1)})}),jA(l,c,h)}).setLayout({name:"mx_rgbtohsv",type:"vec3",inputs:[{name:"c",type:"vec3"}]}),LO=IA(function(e){var t=C(e,1)[0],n=jA(t).toVar(),r=XA(iT(n,jA(.04045))).toVar(),i=jA(n.div(12.92)).toVar(),a=jA(dM(iM(n.add(jA(.055)),jA(0)).div(1.055),jA(2.4))).toVar();return _M(i,a,r)}).setLayout({name:"mx_srgb_texture_to_lin_rec709",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),DO=function(e,t){e=FA(e),t=FA(t);var n=VA(t.dFdx(),t.dFdy()).length().mul(.7071067811865476);return AM(e.sub(n),e.add(n),t)},OO=function(e,t,n,r){return _M(e,t,n[r].clamp())},FO=function(e,t,n,r,i){return _M(e,t,DO(n,r[i]))},BO=IA(function(e){var t=C(e,3),n=t[0],r=t[1],i=t[2],a=DT(n).toVar("nDir"),o=Zw(FA(.5).mul(r.sub(i)),vC).div(a).toVar("rbmax"),s=Zw(FA(-.5).mul(r.sub(i)),vC).div(a).toVar("rbmin"),u=jA().toVar("rbminmax");u.x=a.x.greaterThan(FA(0)).select(o.x,s.x),u.y=a.y.greaterThan(FA(0)).select(o.y,s.y),u.z=a.z.greaterThan(FA(0)).select(o.z,s.z);var l=rM(rM(u.x,u.y),u.z).toVar("correction");return vC.add(a.mul(l)).toVar("boxIntersection").sub(i)}),UO=IA(function(e){var t=C(e,2),n=t[0],r=t[1],i=n.x,a=n.y,o=n.z,s=r.element(0).mul(.886227);return s=(s=(s=(s=(s=(s=(s=(s=s.add(r.element(1).mul(1.023328).mul(a))).add(r.element(2).mul(1.023328).mul(o))).add(r.element(3).mul(1.023328).mul(i))).add(r.element(4).mul(.858086).mul(i).mul(a))).add(r.element(5).mul(.858086).mul(a).mul(o))).add(r.element(6).mul(o.mul(o).mul(.743125).sub(.247708)))).add(r.element(7).mul(.858086).mul(i).mul(o))).add(r.element(8).mul(.429043).mul(Jw(i,i).sub(Jw(a,a))))}),zO=Object.freeze({__proto__:null,BRDF_GGX:TI,BRDF_Lambert:gI,BasicShadowFilter:aD,Break:yR,Const:zM,Continue:function(){return xE("continue").append()},DFGApprox:MI,D_GGX:SI,Discard:SE,EPSILON:_T,F_Schlick:mI,Fn:IA,INFINITY:bT,If:LA,Loop:gR,NodeAccess:bS,NodeShaderStage:yS,NodeType:{BOOLEAN:"bool",INTEGER:"int",FLOAT:"float",VECTOR2:"vec2",VECTOR3:"vec3",VECTOR4:"vec4",MATRIX2:"mat2",MATRIX3:"mat3",MATRIX4:"mat4"},NodeUpdateType:_S,PCFShadowFilter:oD,PCFSoftShadowFilter:sD,PI:xT,PI2:ST,Return:function(){return xE("return").append()},Schlick_to_F0:EI,ScriptableNodeResources:_L,ShaderNode:TA,TBNViewMatrix:ik,VSMShadowFilter:uD,V_GGX_SmithCorrelated:bI,Var:UM,abs:WT,acesFilmicToneMapping:aL,acos:VT,add:Kw,addMethodChaining:zS,addNodeElement:function(e){console.warn("THREE.TSLBase: AddNodeElement has been removed in favor of tree-shaking. Trying add",e)},agxToneMapping:lL,all:AT,alphaT:Cw,and:sT,anisotropy:kw,anisotropyB:Iw,anisotropyT:Rw,any:wT,append:DA,array:aw,arrayBuffer:function(e){return MA(new OS(e,"ArrayBuffer"))},asin:zT,assign:Qw,atan:HT,atan2:CM,atomicAdd:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return GL(VL.ATOMIC_ADD,e,t,n)},atomicAnd:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return GL(VL.ATOMIC_AND,e,t,n)},atomicFunc:GL,atomicLoad:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return GL(VL.ATOMIC_LOAD,e,null,t)},atomicMax:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return GL(VL.ATOMIC_MAX,e,t,n)},atomicMin:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return GL(VL.ATOMIC_MIN,e,t,n)},atomicOr:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return GL(VL.ATOMIC_OR,e,t,n)},atomicStore:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return GL(VL.ATOMIC_STORE,e,t,n)},atomicSub:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return GL(VL.ATOMIC_SUB,e,t,n)},atomicXor:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return GL(VL.ATOMIC_XOR,e,t,n)},attenuationColor:Ww,attenuationDistance:Hw,attribute:ME,attributeArray:function(e){var t,n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"float";!0===r.isStruct?(t=r.layout.getLength(),n=hS("float")):(t=dS(r),n=hS(r));var i=new yP(e,t,n);return SP(i,r,e)},backgroundBlurriness:CP,backgroundIntensity:kP,backgroundRotation:RP,batch:dR,billboarding:UN,bitAnd:hT,bitNot:dT,bitOr:fT,bitXor:pT,bitangentGeometry:JC,bitangentLocal:$C,bitangentView:ek,bitangentWorld:tk,bitcast:tM,blendBurn:BP,blendColor:HP,blendDodge:UP,blendOverlay:VP,blendScreen:zP,blur:iN,bool:zA,buffer:DE,bufferAttribute:uE,bumpMap:fk,burn:function(){console.warn('THREE.TSL: "burn" has been renamed. Use "blendBurn" instead.');for(var e=arguments.length,t=new Array(e),n=0;n1?t-1:0),r=1;r1&&void 0!==arguments[1]?arguments[1]:"float";!0===r.isStruct?(t=r.layout.getLength(),n=hS("float")):(t=dS(r),n=hS(r));var i=new gP(e,t,n);return SP(i,r,e)},instancedBufferAttribute:cE,instancedDynamicBufferAttribute:hE,instancedMesh:cR,int:BA,inverseSqrt:NT,inversesqrt:RM,invocationLocalIndex:oR,invocationSubgroupIndex:aR,ior:Uw,iridescence:Tw,iridescenceIOR:Mw,iridescenceThickness:Ew,ivec2:HA,ivec3:QA,ivec4:KA,js:function(e,t){return dL(e,t,"js")},label:OM,length:jT,lengthSq:yM,lessThan:rT,lessThanEqual:aT,lightPosition:qL,lightProjectionUV:function(e){var t=jL(e);if(void 0===t.projectionUV){var n=QL(e).mul(vC);t.projectionUV=n.xyz.div(n.w)}return t.projectionUV},lightShadowMatrix:QL,lightTargetDirection:function(e){return GE.transformDirection(qL(e).sub(XL(e)))},lightTargetPosition:XL,lightViewPosition:function(e){var t=jL(e);return t.viewPosition||(t.viewPosition=fw(new ph).setGroup(cw).onRenderUpdate(function(t,n){var r=t.camera;n.value=n.value||new ph,n.value.setFromMatrixPosition(e.matrixWorld),n.value.applyMatrix4(r.matrixWorldInverse)}))},lightingContext:kR,lights:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return MA(new ZL).setLights(e)},linearDepth:nI,linearToneMapping:tL,localId:DL,log:kT,log2:RT,logarithmicDepthToViewZ:function(e,t,n){var r=e.mul(kT(n.div(t)));return FA(Math.E).pow(r).mul(t).negate()},loop:function(){return console.warn("TSL.LoopNode: loop() has been renamed to Loop()."),gR.apply(void 0,arguments)},luminance:qP,mat2:$A,mat3:ew,mat4:tw,matcapUV:hN,materialAO:Jk,materialAlphaTest:mk,materialAnisotropy:Dk,materialAnisotropyVector:$k,materialAttenuationColor:Wk,materialAttenuationDistance:Hk,materialClearcoat:kk,materialClearcoatNormal:Ik,materialClearcoatRoughness:Rk,materialColor:gk,materialDispersion:Kk,materialEmissive:_k,materialIOR:Vk,materialIridescence:Ok,materialIridescenceIOR:Fk,materialIridescenceThickness:Bk,materialLightMap:Zk,materialLineDashOffset:Xk,materialLineDashSize:jk,materialLineGapSize:Qk,materialLineScale:Gk,materialLineWidth:qk,materialMetalness:Ek,materialNormal:Ck,materialOpacity:bk,materialPointSize:Yk,materialReference:GC,materialReflectivity:Tk,materialRefractionRatio:NC,materialRotation:Nk,materialRoughness:Mk,materialSheen:Pk,materialSheenRoughness:Lk,materialShininess:yk,materialSpecular:xk,materialSpecularColor:Ak,materialSpecularIntensity:Sk,materialSpecularStrength:wk,materialThickness:zk,materialTransmission:Uk,max:iM,maxMipLevel:RE,mediumpModelViewMatrix:lC,metalness:bw,min:rM,mix:_M,mixElement:MM,mod:aM,modInt:eT,modelDirection:tC,modelNormalMatrix:oC,modelPosition:rC,modelScale:iC,modelViewMatrix:uC,modelViewPosition:aC,modelViewProjection:eR,modelWorldMatrix:nC,modelWorldMatrixInverse:sC,morphReference:TR,mrt:TN,mul:Jw,mx_aastep:DO,mx_cell_noise_float:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:EE();return cO(e.convert("vec2|vec3"))},mx_contrast:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.5;return FA(e).sub(n).mul(t).add(n)},mx_fractal_noise_float:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:EE(),t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:2,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:.5,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1;return mO(e,BA(arguments.length>1&&void 0!==arguments[1]?arguments[1]:3),t,n).mul(r)},mx_fractal_noise_vec2:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:EE(),t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:2,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:.5,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1;return yO(e,BA(arguments.length>1&&void 0!==arguments[1]?arguments[1]:3),t,n).mul(r)},mx_fractal_noise_vec3:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:EE(),t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:2,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:.5,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1;return gO(e,BA(arguments.length>1&&void 0!==arguments[1]?arguments[1]:3),t,n).mul(r)},mx_fractal_noise_vec4:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:EE(),t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:2,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:.5,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1;return _O(e,BA(arguments.length>1&&void 0!==arguments[1]?arguments[1]:3),t,n).mul(r)},mx_hsvtorgb:NO,mx_noise_float:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:EE(),t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return nO(e.convert("vec2|vec3")).mul(t).add(n)},mx_noise_vec3:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:EE(),t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return aO(e.convert("vec2|vec3")).mul(t).add(n)},mx_noise_vec4:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:EE(),t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return e=e.convert("vec2|vec3"),YA(aO(e),nO(e.add(VA(19,73)))).mul(t).add(n)},mx_ramplr:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:EE();return OO(e,t,n,"x")},mx_ramptb:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:EE();return OO(e,t,n,"y")},mx_rgbtohsv:PO,mx_safepower:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return(e=FA(e)).abs().pow(t).mul(e.sign())},mx_splitlr:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:EE();return FO(e,t,n,r,"x")},mx_splittb:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:EE();return FO(e,t,n,r,"y")},mx_srgb_texture_to_lin_rec709:LO,mx_transform_uv:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return(arguments.length>2&&void 0!==arguments[2]?arguments[2]:EE()).mul(e).add(t)},mx_worley_noise_float:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:EE(),t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return EO(e.convert("vec2|vec3"),t,BA(1))},mx_worley_noise_vec2:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:EE(),t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return kO(e.convert("vec2|vec3"),t,BA(1))},mx_worley_noise_vec3:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:EE(),t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return IO(e.convert("vec2|vec3"),t,BA(1))},negate:QT,neutralToneMapping:cL,nodeArray:CA,nodeImmutable:RA,nodeObject:MA,nodeObjects:EA,nodeProxy:kA,normalFlat:wC,normalGeometry:SC,normalLocal:AC,normalMap:lk,normalView:TC,normalWorld:MC,normalize:DT,not:lT,notEqual:nT,numWorkgroups:NL,objectDirection:YE,objectGroup:hw,objectPosition:ZE,objectScale:JE,objectViewPosition:$E,objectWorldMatrix:KE,oneMinus:qT,or:uT,orthographicDepthToViewZ:function(e,t,n){return t.sub(n).mul(e).sub(t)},oscSawtooth:function(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:LN).fract()},oscSine:function(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:LN).add(.75).mul(2*Math.PI).sin().mul(.5).add(.5)},oscSquare:function(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:LN).fract().round()},oscTriangle:function(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:LN).add(.5).fract().mul(2).sub(1).abs()},output:Dw,outputStruct:SN,overlay:function(){console.warn('THREE.TSL: "overlay" has been renamed. Use "blendOverlay" instead.');for(var e=arguments.length,t=new Array(e),n=0;n0&&void 0!==arguments[0]?arguments[0]:"","string"))},struct:function(e){var t=new _N(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:null),n=function(){for(var n=null,r=arguments.length,i=new Array(r),a=0;a0)if(i[0].isNode){n={};for(var o=Object.keys(e),s=0;s0&&void 0!==arguments[0]?arguments[0]:1;return console.warn('TSL: timerDelta() is deprecated. Use "deltaTime" instead.'),DN.mul(e)},timerGlobal:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return console.warn('TSL: timerGlobal() is deprecated. Use "time" instead.'),LN.mul(e)},timerLocal:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return console.warn('TSL: timerLocal() is deprecated. Use "time" instead.'),LN.mul(e)},toOutputColorSpace:KM,toWorkingColorSpace:ZM,toneMapping:aE,toneMappingExposure:oE,toonOutlinePass:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new Od(0,0,0),r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:.003,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1;return MA(new eL(e,t,MA(n),MA(r),MA(i)))},transformDirection:mM,transformNormal:RC,transformNormalToView:IC,transformedBentNormalView:ok,transformedBitangentView:nk,transformedBitangentWorld:rk,transformedClearcoatNormalView:kC,transformedNormalView:EC,transformedNormalWorld:CC,transformedTangentView:YC,transformedTangentWorld:KC,transmission:zw,transpose:eM,triNoise3D:RN,triplanarTexture:function(){return GN.apply(void 0,arguments)},triplanarTextures:GN,trunc:JT,tslFn:function(){return console.warn("TSL.ShaderNode: tslFn() has been renamed to Fn()."),IA.apply(void 0,arguments)},uint:UA,uniform:fw,uniformArray:BE,uniformGroup:sw,uniforms:function(e,t){return console.warn("TSL.UniformArrayNode: uniforms() has been renamed to uniformArray()."),MA(new FE(e,t))},userData:function(e,t,n){return MA(new PP(e,t,n))},uv:EE,uvec2:WA,uvec3:qA,uvec4:ZA,varying:WM,varyingProperty:mw,vec2:VA,vec3:jA,vec4:YA,vectorComponents:AS,velocity:FP,vertexColor:function(e){return MA(new AP(e))},vertexIndex:nR,vertexStage:GM,vibrance:jP,viewZToLogarithmicDepth:$R,viewZToOrthographicDepth:KR,viewZToPerspectiveDepth:ZR,viewport:DR,viewportBottomLeft:VR,viewportCoordinate:FR,viewportDepthTexture:XR,viewportLinearDepth:rI,viewportMipTexture:jR,viewportResolution:UR,viewportSafeUV:zN,viewportSharedTexture:fI,viewportSize:OR,viewportTexture:GR,viewportTopLeft:zR,viewportUV:BR,wgsl:function(e,t){return dL(e,t,"wgsl")},wgslFn:function(e,t){return pL(e,t,"wgsl")},workgroupArray:function(e,t){return MA(new zL("Workgroup",e,t))},workgroupBarrier:function(){return BL("workgroup").append()},workgroupId:PL,workingToColorSpace:JM,xor:cT}),VO=eN(EE(),ME("faceIndex")).normalize();VO.x,VO.y,VO.z;var HO="undefined"!=typeof self?self.GPUShaderStage:{VERTEX:1,FRAGMENT:2,COMPUTE:4};M(M(M({},bS.READ_ONLY,"read"),bS.WRITE_ONLY,"write"),bS.READ_WRITE,"read_write"),HO&&HO.VERTEX,HO&&HO.FRAGMENT,HO&&HO.COMPUTE;var WO={tsl_xor:new hL("fn tsl_xor( a : bool, b : bool ) -> bool { return ( a || b ) && !( a && b ); }"),mod_float:new hL("fn tsl_mod_float( x : f32, y : f32 ) -> f32 { return x - y * floor( x / y ); }"),mod_vec2:new hL("fn tsl_mod_vec2( x : vec2f, y : vec2f ) -> vec2f { return x - y * floor( x / y ); }"),mod_vec3:new hL("fn tsl_mod_vec3( x : vec3f, y : vec3f ) -> vec3f { return x - y * floor( x / y ); }"),mod_vec4:new hL("fn tsl_mod_vec4( x : vec4f, y : vec4f ) -> vec4f { return x - y * floor( x / y ); }"),equals_bool:new hL("fn tsl_equals_bool( a : bool, b : bool ) -> bool { return a == b; }"),equals_bvec2:new hL("fn tsl_equals_bvec2( a : vec2f, b : vec2f ) -> vec2 { return vec2( a.x == b.x, a.y == b.y ); }"),equals_bvec3:new hL("fn tsl_equals_bvec3( a : vec3f, b : vec3f ) -> vec3 { return vec3( a.x == b.x, a.y == b.y, a.z == b.z ); }"),equals_bvec4:new hL("fn tsl_equals_bvec4( a : vec4f, b : vec4f ) -> vec4 { return vec4( a.x == b.x, a.y == b.y, a.z == b.z, a.w == b.w ); }"),repeatWrapping_float:new hL("fn tsl_repeatWrapping_float( coord: f32 ) -> f32 { return fract( coord ); }"),mirrorWrapping_float:new hL("fn tsl_mirrorWrapping_float( coord: f32 ) -> f32 { let mirrored = fract( coord * 0.5 ) * 2.0; return 1.0 - abs( 1.0 - mirrored ); }"),clampWrapping_float:new hL("fn tsl_clampWrapping_float( coord: f32 ) -> f32 { return clamp( coord, 0.0, 1.0 ); }"),biquadraticTexture:new hL("\nfn tsl_biquadraticTexture( map : texture_2d, coord : vec2f, iRes : vec2u, level : u32 ) -> vec4f {\n\n\tlet res = vec2f( iRes );\n\n\tlet uvScaled = coord * res;\n\tlet uvWrapping = ( ( uvScaled % res ) + res ) % res;\n\n\t// https://www.shadertoy.com/view/WtyXRy\n\n\tlet uv = uvWrapping - 0.5;\n\tlet iuv = floor( uv );\n\tlet f = fract( uv );\n\n\tlet rg1 = textureLoad( map, vec2u( iuv + vec2( 0.5, 0.5 ) ) % iRes, level );\n\tlet rg2 = textureLoad( map, vec2u( iuv + vec2( 1.5, 0.5 ) ) % iRes, level );\n\tlet rg3 = textureLoad( map, vec2u( iuv + vec2( 0.5, 1.5 ) ) % iRes, level );\n\tlet rg4 = textureLoad( map, vec2u( iuv + vec2( 1.5, 1.5 ) ) % iRes, level );\n\n\treturn mix( mix( rg1, rg2, f.x ), mix( rg3, rg4, f.x ), f.y );\n\n}\n")};"undefined"!=typeof navigator&&/Windows/g.test(navigator.userAgent)&&(WO.pow_float=new hL("fn tsl_pow_float( a : f32, b : f32 ) -> f32 { return select( -pow( -a, b ), pow( a, b ), a > 0.0 ); }"),WO.pow_vec2=new hL("fn tsl_pow_vec2( a : vec2f, b : vec2f ) -> vec2f { return vec2f( tsl_pow_float( a.x, b.x ), tsl_pow_float( a.y, b.y ) ); }",[WO.pow_float]),WO.pow_vec3=new hL("fn tsl_pow_vec3( a : vec3f, b : vec3f ) -> vec3f { return vec3f( tsl_pow_float( a.x, b.x ), tsl_pow_float( a.y, b.y ), tsl_pow_float( a.z, b.z ) ); }",[WO.pow_float]),WO.pow_vec4=new hL("fn tsl_pow_vec4( a : vec4f, b : vec4f ) -> vec4f { return vec4f( tsl_pow_float( a.x, b.x ), tsl_pow_float( a.y, b.y ), tsl_pow_float( a.z, b.z ), tsl_pow_float( a.w, b.w ) ); }",[WO.pow_float])) /** * @license * Copyright 2010-2025 Three.js Authors * SPDX-License-Identifier: MIT */,zO.BRDF_GGX,zO.BRDF_Lambert,zO.BasicShadowFilter,zO.Break,zO.Continue,zO.DFGApprox,zO.D_GGX,zO.Discard,zO.EPSILON,zO.F_Schlick,zO.Fn,zO.INFINITY,zO.If,zO.Loop,zO.NodeShaderStage,zO.NodeType,zO.NodeUpdateType,zO.NodeAccess,zO.PCFShadowFilter,zO.PCFSoftShadowFilter,zO.PI,zO.PI2,zO.Return,zO.Schlick_to_F0,zO.ScriptableNodeResources,zO.ShaderNode,zO.TBNViewMatrix,zO.VSMShadowFilter,zO.V_GGX_SmithCorrelated,zO.abs,zO.acesFilmicToneMapping,zO.acos,zO.add,zO.addNodeElement,zO.agxToneMapping,zO.all,zO.alphaT,zO.and,zO.anisotropy,zO.anisotropyB,zO.anisotropyT,zO.any,zO.append,zO.array,zO.arrayBuffer,zO.asin,zO.assign,zO.atan,zO.atan2,zO.atomicAdd,zO.atomicAnd,zO.atomicFunc,zO.atomicMax,zO.atomicMin,zO.atomicOr,zO.atomicStore,zO.atomicSub,zO.atomicXor,zO.atomicLoad,zO.attenuationColor,zO.attenuationDistance,zO.attribute,zO.attributeArray,zO.backgroundBlurriness,zO.backgroundIntensity,zO.backgroundRotation,zO.batch,zO.billboarding,zO.bitAnd,zO.bitNot,zO.bitOr,zO.bitXor,zO.bitangentGeometry,zO.bitangentLocal,zO.bitangentView,zO.bitangentWorld,zO.bitcast,zO.blendBurn,zO.blendColor,zO.blendDodge,zO.blendOverlay,zO.blendScreen,zO.blur,zO.bool,zO.buffer,zO.bufferAttribute,zO.bumpMap,zO.burn,zO.bvec2,zO.bvec3,zO.bvec4,zO.bypass,zO.cache,zO.call,zO.cameraFar,zO.cameraIndex,zO.cameraNear,zO.cameraNormalMatrix,zO.cameraPosition,zO.cameraProjectionMatrix,zO.cameraProjectionMatrixInverse,zO.cameraViewMatrix,zO.cameraWorldMatrix,zO.cbrt,zO.cdl,zO.ceil,zO.checker,zO.cineonToneMapping,zO.clamp,zO.clearcoat,zO.clearcoatRoughness,zO.code,zO.color,zO.colorSpaceToWorking,zO.colorToDirection,zO.compute,zO.cond,zO.Const,zO.context,zO.convert,zO.convertColorSpace,zO.convertToTexture,zO.cos,zO.cross,zO.cubeTexture,zO.dFdx,zO.dFdy,zO.dashSize,zO.defaultBuildStages,zO.defaultShaderStages,zO.defined,zO.degrees,zO.deltaTime,zO.densityFog,zO.densityFogFactor,zO.depth,zO.depthPass,zO.difference,zO.diffuseColor,zO.directPointLight,zO.directionToColor,zO.dispersion,zO.distance,zO.div,zO.dodge,zO.dot,zO.drawIndex,zO.dynamicBufferAttribute,zO.element,zO.emissive,zO.equal,zO.equals,zO.equirectUV,zO.exp,zO.exp2,zO.expression,zO.faceDirection,zO.faceForward,zO.faceforward,zO.float,zO.floor,zO.fog,zO.fract,zO.frameGroup,zO.frameId,zO.frontFacing,zO.fwidth,zO.gain,zO.gapSize,zO.getConstNodeType,zO.getCurrentStack,zO.getDirection,zO.getDistanceAttenuation,zO.getGeometryRoughness,zO.getNormalFromDepth,zO.getParallaxCorrectNormal,zO.getRoughness,zO.getScreenPosition,zO.getShIrradianceAt,zO.getTextureIndex,zO.getViewPosition,zO.glsl,zO.glslFn,zO.grayscale,zO.greaterThan,zO.greaterThanEqual,zO.hash,zO.highpModelNormalViewMatrix,zO.highpModelViewMatrix,zO.hue,zO.instance,zO.instanceIndex,zO.instancedArray,zO.instancedBufferAttribute,zO.instancedDynamicBufferAttribute,zO.instancedMesh,zO.int,zO.inverseSqrt,zO.inversesqrt,zO.invocationLocalIndex,zO.invocationSubgroupIndex,zO.ior,zO.iridescence,zO.iridescenceIOR,zO.iridescenceThickness,zO.ivec2,zO.ivec3,zO.ivec4,zO.js,zO.label,zO.length,zO.lengthSq,zO.lessThan,zO.lessThanEqual,zO.lightPosition,zO.lightTargetDirection,zO.lightTargetPosition,zO.lightViewPosition,zO.lightingContext,zO.lights,zO.linearDepth,zO.linearToneMapping,zO.localId,zO.globalId,zO.log,zO.log2,zO.logarithmicDepthToViewZ,zO.loop,zO.luminance,zO.mediumpModelViewMatrix,zO.mat2,zO.mat3,zO.mat4,zO.matcapUV,zO.materialAO,zO.materialAlphaTest,zO.materialAnisotropy,zO.materialAnisotropyVector,zO.materialAttenuationColor,zO.materialAttenuationDistance,zO.materialClearcoat,zO.materialClearcoatNormal,zO.materialClearcoatRoughness,zO.materialColor,zO.materialDispersion,zO.materialEmissive,zO.materialIOR,zO.materialIridescence,zO.materialIridescenceIOR,zO.materialIridescenceThickness,zO.materialLightMap,zO.materialLineDashOffset,zO.materialLineDashSize,zO.materialLineGapSize,zO.materialLineScale,zO.materialLineWidth,zO.materialMetalness,zO.materialNormal,zO.materialOpacity,zO.materialPointSize,zO.materialReference,zO.materialReflectivity,zO.materialRefractionRatio,zO.materialRotation,zO.materialRoughness,zO.materialSheen,zO.materialSheenRoughness,zO.materialShininess,zO.materialSpecular,zO.materialSpecularColor,zO.materialSpecularIntensity,zO.materialSpecularStrength,zO.materialThickness,zO.materialTransmission,zO.max,zO.maxMipLevel,zO.metalness,zO.min,zO.mix,zO.mixElement,zO.mod,zO.modInt,zO.modelDirection,zO.modelNormalMatrix,zO.modelPosition,zO.modelScale,zO.modelViewMatrix,zO.modelViewPosition,zO.modelViewProjection,zO.modelWorldMatrix,zO.modelWorldMatrixInverse,zO.morphReference,zO.mrt,zO.mul,zO.mx_aastep,zO.mx_cell_noise_float,zO.mx_contrast,zO.mx_fractal_noise_float,zO.mx_fractal_noise_vec2,zO.mx_fractal_noise_vec3,zO.mx_fractal_noise_vec4,zO.mx_hsvtorgb,zO.mx_noise_float,zO.mx_noise_vec3,zO.mx_noise_vec4,zO.mx_ramplr,zO.mx_ramptb,zO.mx_rgbtohsv,zO.mx_safepower,zO.mx_splitlr,zO.mx_splittb,zO.mx_srgb_texture_to_lin_rec709,zO.mx_transform_uv,zO.mx_worley_noise_float,zO.mx_worley_noise_vec2,zO.mx_worley_noise_vec3,zO.negate,zO.neutralToneMapping,zO.nodeArray,zO.nodeImmutable,zO.nodeObject,zO.nodeObjects,zO.nodeProxy,zO.normalFlat,zO.normalGeometry,zO.normalLocal,zO.normalMap,zO.normalView,zO.normalWorld,zO.normalize,zO.not,zO.notEqual,zO.numWorkgroups,zO.objectDirection,zO.objectGroup,zO.objectPosition,zO.objectScale,zO.objectViewPosition,zO.objectWorldMatrix,zO.oneMinus,zO.or,zO.orthographicDepthToViewZ,zO.oscSawtooth,zO.oscSine,zO.oscSquare,zO.oscTriangle,zO.output,zO.outputStruct,zO.overlay,zO.overloadingFn,zO.parabola,zO.parallaxDirection,zO.parallaxUV,zO.parameter,zO.pass,zO.passTexture,zO.pcurve,zO.perspectiveDepthToViewZ,zO.pmremTexture,zO.pointUV,zO.pointWidth,zO.positionGeometry,zO.positionLocal,zO.positionPrevious,zO.positionView,zO.positionViewDirection,zO.positionWorld,zO.positionWorldDirection,zO.posterize,zO.pow,zO.pow2,zO.pow3,zO.pow4,zO.property,zO.radians,zO.rand,zO.range,zO.rangeFog,zO.rangeFogFactor,zO.reciprocal,zO.reference,zO.referenceBuffer,zO.reflect,zO.reflectVector,zO.reflectView,zO.reflector,zO.refract,zO.refractVector,zO.refractView,zO.reinhardToneMapping,zO.remainder,zO.remap,zO.remapClamp,zO.renderGroup,zO.renderOutput,zO.rendererReference,zO.rotate,zO.rotateUV,zO.roughness,zO.round,zO.rtt,zO.sRGBTransferEOTF,zO.sRGBTransferOETF,zO.sampler,zO.saturate,zO.saturation,zO.screen,zO.screenCoordinate,zO.screenSize,zO.screenUV,zO.scriptable,zO.scriptableValue,zO.select,zO.setCurrentStack,zO.shaderStages,zO.shadow,zO.shadowPositionWorld,zO.sharedUniformGroup,zO.shapeCircle,zO.sheen,zO.sheenRoughness,zO.shiftLeft,zO.shiftRight,zO.shininess,zO.sign,zO.sin,zO.sinc,zO.skinning,zO.skinningReference,zO.smoothstep,zO.smoothstepElement,zO.specularColor,zO.specularF90,zO.spherizeUV,zO.split,zO.spritesheetUV,zO.sqrt,zO.stack,zO.step,zO.storage,zO.storageBarrier,zO.storageObject,zO.storageTexture,zO.string,zO.struct,zO.sub,zO.subgroupIndex,zO.subgroupSize,zO.tan,zO.tangentGeometry,zO.tangentLocal,zO.tangentView,zO.tangentWorld,zO.temp,zO.texture,zO.texture3D,zO.textureBarrier,zO.textureBicubic,zO.textureCubeUV,zO.textureLoad,zO.textureSize,zO.textureStore,zO.thickness,zO.threshold,zO.time,zO.timerDelta,zO.timerGlobal,zO.timerLocal,zO.toOutputColorSpace,zO.toWorkingColorSpace,zO.toneMapping,zO.toneMappingExposure,zO.toonOutlinePass,zO.transformDirection,zO.transformNormal,zO.transformNormalToView,zO.transformedBentNormalView,zO.transformedBitangentView,zO.transformedBitangentWorld,zO.transformedClearcoatNormalView,zO.transformedNormalView,zO.transformedNormalWorld,zO.transformedTangentView,zO.transformedTangentWorld,zO.transmission,zO.transpose,zO.tri,zO.tri3,zO.triNoise3D,zO.triplanarTexture,zO.triplanarTextures,zO.trunc,zO.tslFn,zO.uint,zO.uniform,zO.uniformArray,zO.uniformGroup,zO.uniforms,zO.userData,zO.uv,zO.uvec2,zO.uvec3,zO.uvec4,zO.Var,zO.varying,zO.varyingProperty,zO.vec2,zO.vec3,zO.vec4,zO.vectorComponents,zO.velocity,zO.vertexColor,zO.vertexIndex,zO.vibrance,zO.viewZToLogarithmicDepth,zO.viewZToOrthographicDepth,zO.viewZToPerspectiveDepth,zO.viewport,zO.viewportBottomLeft,zO.viewportCoordinate,zO.viewportDepthTexture,zO.viewportLinearDepth,zO.viewportMipTexture,zO.viewportResolution,zO.viewportSafeUV,zO.viewportSharedTexture,zO.viewportSize,zO.viewportTexture,zO.viewportTopLeft,zO.viewportUV,zO.wgsl,zO.wgslFn,zO.workgroupArray,zO.workgroupBarrier,zO.workgroupId,zO.workingToColorSpace,zO.xor;var GO,jO=function(){function e(){var t,n,r,i,a,o,s,u,l,c,h,d=this,f=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(A(this,e),M(this,"tempForward",new ph),M(this,"tempMatrixLeft",new Gh),M(this,"tempMatrixRight",new Gh),M(this,"onKeyDown",function(e){switch(d.tempForward.set(0,0,-1),d.tempForward.transformDirection(d.camera.matrixWorld),d.tempMatrixLeft.makeRotationAxis(d.tempForward,Math.PI/128),d.tempMatrixRight.makeRotationAxis(d.tempForward,-Math.PI/128),e.code){case"KeyG":d.focalAdjustment+=.02,d.forceRenderNextFrame();break;case"KeyF":d.focalAdjustment-=.02,d.forceRenderNextFrame();break;case"ArrowLeft":d.camera.up.transformDirection(d.tempMatrixLeft);break;case"ArrowRight":d.camera.up.transformDirection(d.tempMatrixRight);break;case"KeyC":d.showMeshCursor=!d.showMeshCursor;break;case"KeyU":d.showControlPlane=!d.showControlPlane;break;case"KeyI":d.showInfo=!d.showInfo,d.showInfo;break;case"KeyO":d.usingExternalCamera||d.setOrthographicMode(!d.camera.isOrthographicCamera);break;case"KeyP":d.usingExternalCamera||d.splatMesh.setPointCloudModeEnabled(!d.splatMesh.getPointCloudModeEnabled());break;case"Equal":d.usingExternalCamera||d.splatMesh.setSplatScale(d.splatMesh.getSplatScale()+.05);break;case"Minus":d.usingExternalCamera||d.splatMesh.setSplatScale(Math.max(d.splatMesh.getSplatScale()-.05,0))}}),M(this,"onMouseUp",(t=new Vc,function(e){t.copy(this.mousePosition).sub(this.mouseDownPosition),Pu()-this.mouseDownTime<.5&&t.length()<2&&this.onMouseClick(e)})),M(this,"checkPointRenderDimensions",new Vc),M(this,"checkPointToNewFocalPoint",new ph),M(this,"checkPointOutHits",[]),M(this,"checkForFocalPointChange",function(){if(!d.transitioningCameraTarget&&(d.getRenderDimensions(d.checkPointRenderDimensions),d.checkPointOutHits.length=0,d.raycaster.setFromCameraAndScreenPosition(d.camera,d.mousePosition,d.checkPointRenderDimensions),d.raycaster.intersectSplatMesh(d.splatMesh,d.checkPointOutHits),d.checkPointOutHits.length>0)){var e=d.checkPointOutHits[0].origin;d.checkPointToNewFocalPoint.copy(e).sub(d.camera.position),d.checkPointToNewFocalPoint.length()>.75&&(d.previousCameraTarget.copy(d.controls.target),d.nextCameraTarget.copy(e),d.transitioningCameraTarget=!0,d.transitioningCameraTargetStartTime=Pu())}}),M(this,"updateSplatMesh",(n=new Vc,function(){if(this.splatMesh&&this.splatMesh.getSplatCount()>0){this.splatMesh.updateVisibleRegionFadeDistance(this.sceneRevealMode),this.splatMesh.updateTransforms(),this.getRenderDimensions(n);var e=.5*this.camera.projectionMatrix.elements[0]*this.devicePixelRatio*n.x,t=.5*this.camera.projectionMatrix.elements[5]*this.devicePixelRatio*n.y,r=this.camera.isOrthographicCamera?1/this.devicePixelRatio:1,i=this.focalAdjustment*r,a=1/i;this.adjustForWebXRStereo(n),this.splatMesh.updateUniforms(n,e*i,t*i,this.camera.isOrthographicCamera,this.camera.zoom||1,a)}})),M(this,"addSplatBuffers",function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],i=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],a=arguments.length>5&&void 0!==arguments[5]&&arguments[5],o=arguments.length>6&&void 0!==arguments[6]&&arguments[6],s=!(arguments.length>7&&void 0!==arguments[7])||arguments[7];if(d.isDisposingOrDisposed())return Promise.resolve();var u=null,l=function(){null!==u&&(d.loadingSpinner.removeTask(u),u=null)};return d.splatRenderReady=!1,new Promise(function(c){r&&(u=d.loadingSpinner.addTask("Processing splats...")),Du(function(){if(d.isDisposingOrDisposed())c();else{var r=d.addSplatBuffersToMesh(e,t,n,i,a,s),u=d.splatMesh.getMaxSplatCount();d.sortWorker&&d.sortWorker.maxSplatCount!==u&&d.disposeSortWorker(),d.gpuAcceleratedSort||d.preSortMessages.push({centers:r.centers.buffer,sceneIndexes:r.sceneIndexes.buffer,range:{from:r.from,to:r.to,count:r.count}}),(!d.sortWorker&&u>0?d.setupSortWorker(d.splatMesh):Promise.resolve()).then(function(){d.isDisposingOrDisposed()||d.runSplatSort(!0,!0).then(function(e){d.sortWorker&&e?(o?d.splatRenderReady=!0:d.runAfterNextSort.push(function(){d.splatRenderReady=!0}),d.runAfterNextSort.push(function(){l(),c()})):(d.splatRenderReady=!0,l(),c())})})}},!0)})}),M(this,"addSplatBuffersToMesh",function(e,t){var n,i,a=this,o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],s=arguments.length>3&&void 0!==arguments[3]&&arguments[3],u=arguments.length>4&&void 0!==arguments[4]&&arguments[4],l=!(arguments.length>5&&void 0!==arguments[5])||arguments[5];if(!this.isDisposingOrDisposed()){var c=[],h=[];u||(c=this.splatMesh.scenes.map(function(e){return e.splatBuffer})||[],h=this.splatMesh.sceneOptions?this.splatMesh.sceneOptions.map(function(e){return e}):[]),(n=c).push.apply(n,I(e)),(i=h).push.apply(i,I(t)),this.renderer&&this.splatMesh.setRenderer(this.renderer);var d=this.splatMesh.build(c,h,!0,o,function(e){if(!a.isDisposingOrDisposed()){var t=a.splatMesh.getSplatCount();s&&t>=15e5&&(e||r||(a.loadingSpinner.setMinimized(!0,!0),r=a.loadingSpinner.addTask("Optimizing data structures...")))}},function(e){a.isDisposingOrDisposed()||e&&r&&(a.loadingSpinner.removeTask(r),r=null)},l);return o&&this.freeIntermediateSplatData&&this.splatMesh.freeIntermediateSplatData(),d}}),M(this,"vsyncNum",4),M(this,"shouldRender",(i=0,a=new ph,o=new fh,s=1e-4,function(){if(!this.initialized||!this.splatRenderReady||this.isDisposingOrDisposed())return!1;var e,t=!1;if(this.camera){var n=this.camera.position,r=this.camera.quaternion;t=Math.abs(n.x-a.x)>s||Math.abs(n.y-a.y)>s||Math.abs(n.z-a.z)>s||Math.abs(r.x-o.x)>s||Math.abs(r.y-o.y)>s||Math.abs(r.z-o.z)>s||Math.abs(r.w-o.w)>s}return e=this.renderMode!==tS&&(0===i||this.splatMesh.visibleRegionChanging||t||this.renderMode===eS||!0===this.dynamicMode||this.renderNextFrame),this.camera&&(a.copy(this.camera.position),o.copy(this.camera.quaternion)),i++,e})),M(this,"render",function(){if(this.initialized&&this.splatRenderReady&&!this.isDisposingOrDisposed()){var e=this.renderer.autoClear;(function(e){var t,n=L(e.children);try{for(n.s();!(t=n.n()).done;)if(t.value.visible)return!0}catch(r){n.e(r)}finally{n.f()}return!1})(this.threeScene)&&(this.renderer.render(this.threeScene,this.camera),this.renderer.autoClear=!1),this.renderer.render(this.splatMesh,this.camera),this.renderer.autoClear=!1,this.sceneHelper.getFocusMarkerOpacity()>0&&this.renderer.render(this.sceneHelper.focusMarker,this.camera),this.showControlPlane&&this.renderer.render(this.sceneHelper.controlPlane,this.camera),this.renderer.autoClear=e}}),M(this,"sortedIndexes",void 0),M(this,"lastCalcTime",Pu()),M(this,"fpsFrameCount",0),M(this,"updateFPS",function(){if(d.consecutiveRenderFrames>60){var e=Pu();e-d.lastCalcTime>=1?(d.currentFPS=d.fpsFrameCount,d.fpsFrameCount=0,d.lastCalcTime=e):d.fpsFrameCount++}else d.currentFPS=null}),M(this,"updateForRendererSizeChanges",(l=new Vc,c=new Vc,function(){this.usingExternalCamera||(this.renderer.getSize(c),void 0!==u&&u===this.camera.isOrthographicCamera&&c.x===l.x&&c.y===l.y||(this.camera.isOrthographicCamera?(this.camera.left=-c.x/2,this.camera.right=c.x/2,this.camera.top=c.y/2,this.camera.bottom=-c.y/2):this.camera.aspect=c.x/c.y,this.camera.updateProjectionMatrix(),l.copy(c),u=this.camera.isOrthographicCamera))})),M(this,"timingSensitiveUpdates",function(){var e=Pu();h||(h=e);var t=e-h;this.updateCameraTransition(e),this.updateFocusMarker(t),h=e}),M(this,"tempCameraTarget",new ph),M(this,"toPreviousTarget",new ph),M(this,"toNextTarget",new ph),M(this,"updateCameraTransition",function(e){if(d.transitioningCameraTarget){d.toPreviousTarget.copy(d.previousCameraTarget).sub(d.camera.position).normalize(),d.toNextTarget.copy(d.nextCameraTarget).sub(d.camera.position).normalize();var t=Math.acos(d.toPreviousTarget.dot(d.toNextTarget)),n=(t/(Math.PI/3)*.65+.3)/t*(e-d.transitioningCameraTargetStartTime);d.tempCameraTarget.copy(d.previousCameraTarget).lerp(d.nextCameraTarget,n),d.camera.lookAt(d.tempCameraTarget),d.controls.target.copy(d.tempCameraTarget),n>=1&&(d.transitioningCameraTarget=!1)}}),M(this,"updateFocusMarker",function(){var e=new Vc,t=!1;return function(n){if(this.getRenderDimensions(e),this.transitioningCameraTarget){this.sceneHelper.setFocusMarkerVisibility(!0);var r=Math.max(this.sceneHelper.getFocusMarkerOpacity(),0),i=Math.min(r+10*n,1);this.sceneHelper.setFocusMarkerOpacity(i),this.sceneHelper.updateFocusMarker(this.nextCameraTarget,this.camera,e),t=!0,this.forceRenderNextFrame()}else{var a;if((a=t?1:Math.min(this.sceneHelper.getFocusMarkerOpacity(),1))>0){this.sceneHelper.updateFocusMarker(this.nextCameraTarget,this.camera,e);var o=Math.max(a-2.5*n,0);this.sceneHelper.setFocusMarkerOpacity(o),0===o&&this.sceneHelper.setFocusMarkerVisibility(!1)}a>0&&this.forceRenderNextFrame(),t=!1}}}()),M(this,"updateMeshCursor",function(){var e=[],t=new Vc;return function(){this.showMeshCursor?(this.forceRenderNextFrame(),this.getRenderDimensions(t),e.length=0,this.raycaster.setFromCameraAndScreenPosition(this.camera,this.mousePosition,t),this.raycaster.intersectSplatMesh(this.splatMesh,e),e.length>0?(this.sceneHelper.setMeshCursorVisibility(!0),this.sceneHelper.positionAndOrientMeshCursor(e[0].origin,this.camera)):this.sceneHelper.setMeshCursorVisibility(!1)):(this.sceneHelper.getMeschCursorVisibility()&&this.forceRenderNextFrame(),this.sceneHelper.setMeshCursorVisibility(!1))}}()),M(this,"updateInfoPanel",function(){var e=new Vc;return function(){if(this.showInfo){var t=this.splatMesh.getSplatCount();this.getRenderDimensions(e),this.controls&&this.controls.target,this.showMeshCursor&&this.sceneHelper.meshCursor.position,t>0&&this.splatRenderCount}}}()),M(this,"mvpMatrix",new Gh),M(this,"cameraPositionArray",[]),M(this,"lastSortViewDir",new ph(0,0,-1)),M(this,"sortViewDir",new ph(0,0,-1)),M(this,"lastSortViewPos",new ph),M(this,"sortViewOffset",new ph),M(this,"queuedSorts",[]),M(this,"partialSorts",[{angleThreshold:.55,sortFractions:[.125,.33333,.75]},{angleThreshold:.65,sortFractions:[.33333,.66667]},{angleThreshold:.8,sortFractions:[.5]}]),M(this,"runSplatSort",function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!d.initialized)return Promise.resolve(!1);if(d.sortRunning)return Promise.resolve(!0);if(d.splatMesh.getSplatCount()<=0)return d.splatRenderCount=0,Promise.resolve(!1);var n,r,i=!1,a=!1;if(d.sortViewDir.set(0,0,-1).applyQuaternion(d.camera.quaternion),n=d.sortViewDir.dot(d.lastSortViewDir),r=d.sortViewOffset.copy(d.camera.position).sub(d.lastSortViewPos).length(),!(e||d.splatMesh.dynamicMode||0!==d.queuedSorts.length||(n<=.99&&(i=!0),r>=1&&(a=!0),i||a)))return Promise.resolve(!1);d.sortRunning=!0;var o=d.gatherSceneNodesForSort(),s=o.splatRenderCount,u=o.shouldSortAll;u=u||t,d.splatRenderCount=s,d.mvpMatrix.copy(d.camera.matrixWorld).invert();var l=d.perspectiveCamera||d.camera;d.mvpMatrix.premultiply(l.projectionMatrix),d.splatMesh.dynamicMode||d.mvpMatrix.multiply(d.splatMesh.matrixWorld);var c=Promise.resolve(!0);return d.gpuAcceleratedSort&&(d.queuedSorts.length<=1||d.queuedSorts.length%2==0)&&(c=d.splatMesh.computeDistancesOnGPU(d.mvpMatrix,d.sortWorkerPrecomputedDistances)),c.then(function(){if(0===d.queuedSorts.length)if(d.splatMesh.dynamicMode||u)d.queuedSorts.push(d.splatRenderCount);else{var e,t=L(partialSorts);try{for(t.s();!(e=t.n()).done;){var r=e.value;if(n0&&(d.preSortMessages.forEach(function(e){d.sortWorker.postMessage(e)}),d.preSortMessages=[]),d.sortWorker.postMessage({sort:l}),0===d.queuedSorts.length&&(d.lastSortViewPos.copy(d.camera.position),d.lastSortViewDir.copy(d.sortViewDir)),!0}),c}),M(this,"gatherSceneNodesForSort",function(){var e=[],t=null,n=new ph,r=new ph,i=new ph,a=new Gh,o=new Gh,s=new Gh,u=new ph,l=new ph(0,0,-1),c=new ph,h=function(e){return c.copy(e.max).sub(e.min).length()};return function(){var c=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.getRenderDimensions(u);var d=u.y/2/Math.tan(this.camera.fov/2*zc.DEG2RAD),f=Math.atan(u.x/2/d),p=Math.atan(u.y/2/d),v=Math.cos(f),m=Math.cos(p),g=this.splatMesh.getSplatTree();if(g){o.copy(this.camera.matrixWorld).invert(),this.splatMesh.dynamicMode||o.multiply(this.splatMesh.matrixWorld);for(var y=0,_=0,b=0;bC||(_+=w.data.indexes.length,e[y]=w,w.data.distanceToNode=T,y++)}}}e.length=y,e.sort(function(e,t){return e.data.distanceToNode0||null!==this.splatSceneDownloadAndBuildPromise||null!==this.splatSceneRemovalPromise}},{key:"isDisposingOrDisposed",value:function(){return this.disposing||this.disposed}},{key:"addSplatSceneDownloadPromise",value:function(e){this.splatSceneDownloadPromises[e.id]=e}},{key:"removeSplatSceneDownloadPromise",value:function(e){delete this.splatSceneDownloadPromises[e.id]}},{key:"setSplatSceneDownloadAndBuildPromise",value:function(e){this.splatSceneDownloadAndBuildPromise=e}},{key:"clearSplatSceneDownloadAndBuildPromise",value:function(){this.splatSceneDownloadAndBuildPromise=null}},{key:"addSplatScene",value:function(t){var n=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.isLoadingOrUnloading())throw new Error("Cannot add splat scene while another load or unload is already in progress.");if(this.isDisposingOrDisposed())throw new Error("Cannot add splat scene after dispose() is called.");r.progressiveLoad&&this.splatMesh.scenes&&this.splatMesh.scenes.length>0&&(console.log('addSplatScene(): "progressiveLoad" option ignore because there are multiple splat scenes'),r.progressiveLoad=!1);var i=void 0!==r.format&&null!==r.format?r.format:ox(t),a=e.isProgressivelyLoadable(i)&&r.progressiveLoad,o=void 0===r.showLoadingUI||null===r.showLoadingUI||r.showLoadingUI,s=null;o&&(this.loadingSpinner.removeAllTasks(),s=this.loadingSpinner.addTask("Downloading..."));var u=!1,l=0;return(a?this.downloadAndBuildSingleSplatSceneProgressiveLoad.bind(this):this.downloadAndBuildSingleSplatSceneStandardLoad.bind(this))(t,i,r.splatAlphaRemovalThreshold,function(e,t,i){!a&&r.onProgress&&r.onProgress(0,"0%",Wb);var c={rotation:r.rotation||r.orientation,position:r.position,scale:r.scale,splatAlphaRemovalThreshold:r.splatAlphaRemovalThreshold};return n.addSplatBuffers([e],[c],i,t&&o,o,a,a).then(function(){!a&&r.onProgress&&r.onProgress(100,"100%",Wb),function(e,t){o&&((e&&a||t&&!a)&&(n.loadingSpinner.removeTask(s),t||u||n.loadingProgressBar.show()),a&&(t?(u=!0,n.loadingProgressBar.hide()):n.loadingProgressBar.setProgress(l)))}(t,i)})}.bind(this),function(e,t,i){l=e,function(e,t,r){if(o)if(r===Hb)if(100==e)n.loadingSpinner.setMessageForTask(s,"Download complete!");else if(a)n.loadingSpinner.setMessageForTask(s,"Downloading splats...");else{var i=t?": ".concat(t):"...";n.loadingSpinner.setMessageForTask(s,"Downloading".concat(i))}else r===Wb&&(console.log("loaderStatus === LoaderStatus.Processing"),n.loadingSpinner.setMessageForTask(s,"Processing splats..."))}(e,t,i),r.onProgress&&r.onProgress(e,t,i)},function(){n.loadingProgressBar.hide(),n.loadingSpinner.removeAllTasks()}.bind(this),r.headers)}},{key:"downloadAndBuildSingleSplatSceneStandardLoad",value:function(e,t,n,r,i,a,o){var s=this,u=this.downloadSplatSceneToSplatBuffer(e,n,i,!1,void 0,t,o),l=Bu(u.abortHandler);return u.then(function(e){return s.removeSplatSceneDownloadPromise(u),r(e,!0,!0).then(function(){l.resolve(),s.clearSplatSceneDownloadAndBuildPromise()})}).catch(function(t){a&&a(),s.clearSplatSceneDownloadAndBuildPromise(),s.removeSplatSceneDownloadPromise(u);var n=t instanceof Cu?t:new Error("Viewer::addSplatScene -> Could not load file ".concat(e));l.reject(n)}),this.addSplatSceneDownloadPromise(u),this.setSplatSceneDownloadAndBuildPromise(l.promise),l.promise}},{key:"downloadAndBuildSingleSplatSceneProgressiveLoad",value:function(e,t,n,r,i,a,o){var s=this,u=0,l=!1,c=[],h=function(){if(c.length>0&&!l&&!s.isDisposingOrDisposed()){l=!0;var e=c.shift();r(e.splatBuffer,e.firstBuild,e.finalBuild).then(function(){l=!1,e.firstBuild?f.resolve():e.finalBuild&&(p.resolve(),s.clearSplatSceneDownloadAndBuildPromise()),c.length>0&&Du(function(){return h()})})}},d=this.downloadSplatSceneToSplatBuffer(e,n,i,!0,function(e,t){s.isDisposingOrDisposed()||(t||0===c.length||e.getSplatCount()>c[0].splatBuffer.getSplatCount())&&(c.push({splatBuffer:e,firstBuild:0===u,finalBuild:t}),u++,h())},t,o),f=Bu(d.abortHandler),p=Bu();return this.addSplatSceneDownloadPromise(d),this.setSplatSceneDownloadAndBuildPromise(p.promise),d.then(function(){s.removeSplatSceneDownloadPromise(d)}).catch(function(e){s.clearSplatSceneDownloadAndBuildPromise(),s.removeSplatSceneDownloadPromise(d);var t=e instanceof Cu?e:new Error("Viewer::addSplatScene -> Could not load one or more scenes");f.reject(t),a&&a(t)}),f.promise}},{key:"addSplatScenes",value:function(e){var t=this,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;if(this.isLoadingOrUnloading())throw new Error("Cannot add splat scene while another load or unload is already in progress.");if(this.isDisposingOrDisposed())throw new Error("Cannot add splat scene after dispose() is called.");var i,a=e.length,o=[];n&&(this.loadingSpinner.removeAllTasks(),i=this.loadingSpinner.addTask("Downloading..."));for(var s=function(e,s,u,l){o[e]=s;for(var c=0,h=0;h Could not load one or more splat scenes.");o(r)}).finally(function(){t.removeSplatSceneDownloadPromise(p)})},function(e){for(var t=0,n=u;t1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0,r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:void 0,a=arguments.length>5?arguments[5]:void 0,o=arguments.length>6?arguments[6]:void 0,s=!r&&this.optimizeSplatData;try{if(a===rx)return tx.loadFromURL(e,n,r,i,t,this.inMemoryCompressionLevel,s,o);if(a===ix)return nx.loadFromURL(e,n,r,i,o);if(a===ax)return Zb.loadFromURL(e,n,r,i,t,this.inMemoryCompressionLevel,s,this.sphericalHarmonicsDegree,o)}catch(HJ){throw HJ instanceof jb?new Error("File type or server does not support progressive loading."):HJ}throw new Error("Viewer::downloadSplatSceneToSplatBuffer -> File format not supported: ".concat(e))}},{key:"setupSortWorker",value:(n=v(d().m(function e(t){var n=this;return d().w(function(e){for(;;)switch(e.n){case 0:if(!this.isDisposingOrDisposed()){e.n=1;break}return e.a(2);case 1:return e.a(2,new Promise(function(){var e=v(d().m(function e(r){var i,a,o;return d().w(function(e){for(;;)switch(e.n){case 0:return i=n.integerBasedSort?Int32Array:Float32Array,a=t.getSplatCount(),o=t.getMaxSplatCount(),e.n=1,Xx(o,n.sharedMemoryForWorkers,n.enableSIMDInSort,n.integerBasedSort,n.splatMesh.dynamicMode,n.splatSortDistanceMapPrecision);case 1:n.sortWorker=e.v,n.sortWorker.onmessage=function(e){if(e.data.sortDone){if(n.sortRunning=!1,Array.from({length:n.gaussianSplatCount},function(e,t){return t}),n.sharedMemoryForWorkers)n.splatMesh.updateRenderIndexes(n.sortWorkerSortedIndexes,e.data.splatRenderCount);else{var t=new Uint32Array(e.data.sortedIndexes.buffer,0,e.data.splatRenderCount);n.splatMesh.updateRenderIndexes(t,e.data.splatRenderCount)}n.lastSplatSortCount=n.splatSortCount,n.lastSortTime=e.data.sortTime,n.sortPromiseResolver(),n.sortPromiseResolver=null,n.forceRenderNextFrame(),n.runAfterNextSort.length>0&&(n.runAfterNextSort.forEach(function(e){e()}),n.runAfterNextSort.length=0)}else if(e.data.sortCanceled)n.sortRunning=!1;else if(e.data.sortSetupPhase1Complete){n.logLevel>=Vx&&console.log("Sorting web worker WASM setup complete."),n.sharedMemoryForWorkers?(n.sortWorkerSortedIndexes=new Uint32Array(e.data.sortedIndexesBuffer,e.data.sortedIndexesOffset,o),n.sortWorkerIndexesToSort=new Uint32Array(e.data.indexesToSortBuffer,e.data.indexesToSortOffset,o),n.sortWorkerPrecomputedDistances=new i(e.data.precomputedDistancesBuffer,e.data.precomputedDistancesOffset,o),n.sortWorkerTransforms=new Float32Array(e.data.transformsBuffer,e.data.transformsOffset,16*zy.MaxScenes)):(n.sortWorkerIndexesToSort=new Uint32Array(o),n.sortWorkerPrecomputedDistances=new i(o),n.sortWorkerTransforms=new Float32Array(16*zy.MaxScenes));for(var s=0;s=Vx){console.log("Sorting web worker ready.");var u=n.splatMesh.getSplatDataTextures(),l=u.covariances.size,c=u.centerColors.size;console.log("Covariances texture size: "+l.x+" x "+l.y),console.log("Centers/colors texture size: "+c.x+" x "+c.y)}r()}};case 2:return e.a(2)}},e)}));return function(t){return e.apply(this,arguments)}}()))}},e,this)})),function(e){return n.apply(this,arguments)})},{key:"disposeSortWorker",value:function(){this.sortWorker&&this.sortWorker.terminate(),this.sortWorker=null,this.sortPromise=null,this.sortPromiseResolver&&(this.sortPromiseResolver(),this.sortPromiseResolver=null),this.preSortMessages=[],this.sortRunning=!1}},{key:"removeSplatScene",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this.removeSplatScenes([e],t)}},{key:"removeSplatScenes",value:function(e){var t=this,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.isLoadingOrUnloading())throw new Error("Cannot remove splat scene while another load or unload is already in progress.");if(this.isDisposingOrDisposed())throw new Error("Cannot remove splat scene after dispose() is called.");return this.splatSceneRemovalPromise=new Promise(function(r,i){var a;n&&(t.loadingSpinner.removeAllTasks(),t.loadingSpinner.show(),a=t.loadingSpinner.addTask("Removing splat scene..."));var o=function(){n&&(t.loadingSpinner.hide(),t.loadingSpinner.removeTask(a))},s=function(e){o(),t.splatSceneRemovalPromise=null,e?i(e):r()},u=function(){return!!t.isDisposingOrDisposed()&&(s(),!0)};(t.sortPromise||Promise.resolve()).then(function(){if(!u()){for(var n=[],r=[],i=[],a=0;a=this.totalFrames&&(this.frame=0),this.dropInMode&&this.updateForDropInMode(t,n),this.initialized&&this.splatRenderReady&&!this.isDisposingOrDisposed()&&(this.controls&&(this.controls.update(),this.camera.isOrthographicCamera&&!this.usingExternalCamera&&e.setCameraPositionFromZoom(this.camera,this.camera,this.controls)),this.runMorphUpdate(),this.runSplatSort(!0,!0),this.updateForRendererSizeChanges(),this.updateSplatMesh(),this.updateMeshCursor(),this.updateFPS(),this.timingSensitiveUpdates(),this.updateControlPlane())}},{key:"updateForDropInMode",value:function(e,t){this.renderer=e,this.splatMesh&&this.splatMesh.setRenderer(this.renderer),this.camera=t,this.controls&&(this.controls.object=t),this.init()}},{key:"updateControlPlane",value:function(){this.showControlPlane?(this.sceneHelper.setControlPlaneVisibility(!0),this.sceneHelper.positionAndOrientControlPlane(this.controls.target,this.camera.up)):this.sceneHelper.setControlPlaneVisibility(!1)}},{key:"getSplatMesh",value:function(){return this.splatMesh}},{key:"getSplatScene",value:function(e){return this.splatMesh.getScene(e)}},{key:"getSceneCount",value:function(){return this.splatMesh.getSceneCount()}},{key:"isMobile",value:function(){return navigator.userAgent.includes("Mobi")}},{key:"createBonesFromJson",value:function(e){var t=[];function n(e){var r,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,a=new Zf;return a.name=e.name,i&&i.add(a),(r=a.position).set.apply(r,I(e.position)),t.push(a),e.children&&e.children.forEach(function(e){return n(e,a)}),a}return e.forEach(function(e){return n(e)}),t}},{key:"updateMorphTarget",value:function(e){if(this.avatarMesh=e,this.splatMesh.flameModel=e,this.splatMesh.useFlameModel=this.useFlame,1==this.useFlame){this.bones=this.createBonesFromJson(this.bone_tree.bones);var t=[new ph(this.bones[0].position.x,this.bones[0].position.y,this.bones[0].position.z),new ph(this.bones[1].position.x,this.bones[1].position.y,this.bones[1].position.z),new ph(this.bones[2].position.x,this.bones[2].position.y,this.bones[2].position.z),new ph(this.bones[3].position.x,this.bones[3].position.y,this.bones[3].position.z),new ph(this.bones[4].position.x,this.bones[4].position.y,this.bones[4].position.z)];this.bones[1].position.copy(new ph(t[1].x-t[0].x,t[1].y-t[0].y,t[1].z-t[0].z)),this.bones[2].position.copy(new ph(t[2].x-t[1].x,t[2].y-t[1].y,t[2].z-t[1].z)),this.bones[3].position.copy(new ph(t[3].x-t[1].x,t[3].y-t[1].y,t[3].z-t[1].z)),this.bones[4].position.copy(new ph(t[4].x-t[1].x,t[4].y-t[1].y,t[4].z-t[1].z)),this.bones[0].updateMatrixWorld(!0);var n=[this.bones[0].matrixWorld.clone().invert(),this.bones[1].matrixWorld.clone().invert(),this.bones[2].matrixWorld.clone().invert(),this.bones[3].matrixWorld.clone().invert(),this.bones[4].matrixWorld.clone().invert()];this.skeleton=new tp(this.bones,n)}this.runMorphUpdate(),this.splatMesh.gaussianSplatCount=this.gaussianSplatCount}},{key:"updatedBoneMatrices",value:function(e){for(var t=this,n=[],r=function(){!function(e,t){for(var n=e.elements,r=0;r2&&void 0!==arguments[2]&&arguments[2]))n=new fh(t[0],t[1],t[2],t[3]);else{var r=new ph(t[0],t[1],t[2]),i=r.length(),a=r.normalize();n=(new fh).setFromAxisAngle(a,i)}e.quaternion.copy(n),e.updateMatrixWorld(!0)}this.splatMesh.bsWeight=this.flame_params.expr[this.frame];var t=this.flame_params.rotation[this.frame];e(this.skeleton.bones[0],t),t=this.flame_params.neck_pose[this.frame],e(this.skeleton.bones[1],t),t=this.flame_params.jaw_pose[this.frame],e(this.skeleton.bones[2],t),t=this.flame_params.eyes_pose[this.frame],e(this.skeleton.bones[3],t),e(this.skeleton.bones[4],[t[3],t[4],t[5]]),this.skeleton.update();var n=this.updatedBoneMatrices(5);this.splatMesh.bonesMatrix=n,this.splatMesh.bonesNum=5,this.splatMesh.bonesWeight=this.lbs_weight_80k}}],[{key:"isProgressivelyLoadable",value:function(e){return e===rx||e===ix||e===ax}}]);var t,n}();function QO(e,t,n,r){return new(n||(n=Promise))(function(i,a){function o(e){try{u(r.next(e))}catch(HJ){a(HJ)}}function s(e){try{u(r.throw(e))}catch(HJ){a(HJ)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,s)}u((r=r.apply(e,t||[])).next())})}function qO(e,t){return function(){return e.apply(t,arguments)}}M(jO,"setCameraPositionFromZoom",(GO=new ph,function(e,t,n){var r=1/(.001*t.zoom);GO.copy(n.target).sub(e.position).normalize().multiplyScalar(r).negate(),e.position.copy(n.target).add(GO)})),M(jO,"setCameraZoomFromPosition",function(){var e=new ph;return function(t,n,r){var i=e.copy(r.target).sub(n.position).length();t.zoom=1/(.001*i)}}()),"function"==typeof SuppressedError&&SuppressedError;var XO=Object.prototype.toString,YO=Object.getPrototypeOf,KO=function(e){return function(t){var n=XO.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())}}(Object.create(null)),ZO=function(e){return e=e.toLowerCase(),function(t){return KO(t)===e}},JO=function(e){return function(t){return P(t)===e}},$O=Array.isArray,eF=JO("undefined");var tF=ZO("ArrayBuffer");var nF=JO("string"),rF=JO("function"),iF=JO("number"),aF=function(e){return null!==e&&"object"===P(e)},oF=function(e){if("object"!==KO(e))return!1;var t=YO(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)},sF=ZO("Date"),uF=ZO("File"),lF=ZO("Blob"),cF=ZO("FileList"),hF=ZO("URLSearchParams"),dF=C(["ReadableStream","Request","Response","Headers"].map(ZO),4),fF=dF[0],pF=dF[1],vF=dF[2],mF=dF[3];function gF(e,t){var n,r,i=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}).allOwnKeys,a=void 0!==i&&i;if(null!=e)if("object"!==P(e)&&(e=[e]),$O(e))for(n=0,r=e.length;n0;)if(t===(n=r[i]).toLowerCase())return n;return null}var _F="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,bF=function(e){return!eF(e)&&e!==_F};var xF,SF=(xF="undefined"!=typeof Uint8Array&&YO(Uint8Array),function(e){return xF&&e instanceof xF}),AF=ZO("HTMLFormElement"),wF=function(){var e=Object.prototype.hasOwnProperty;return function(t,n){return e.call(t,n)}}(),TF=ZO("RegExp"),MF=function(e,t){var n=Object.getOwnPropertyDescriptors(e),r={};gF(n,function(n,i){var a;!1!==(a=t(n,i,e))&&(r[i]=a||n)}),Object.defineProperties(e,r)};var EF,CF,kF=ZO("AsyncFunction"),RF=(EF="function"==typeof setImmediate,CF=rF(_F.postMessage),EF?setImmediate:CF?function(e,t){return _F.addEventListener("message",function(n){var r=n.source,i=n.data;r===_F&&i===e&&t.length&&t.shift()()},!1),function(n){t.push(n),_F.postMessage(e,"*")}}("axios@".concat(Math.random()),[]):function(e){return setTimeout(e)}),IF="undefined"!=typeof queueMicrotask?queueMicrotask.bind(_F):"undefined"!=typeof process&&process.nextTick||RF,NF={isArray:$O,isArrayBuffer:tF,isBuffer:function(e){return null!==e&&!eF(e)&&null!==e.constructor&&!eF(e.constructor)&&rF(e.constructor.isBuffer)&&e.constructor.isBuffer(e)},isFormData:function(e){var t;return e&&("function"==typeof FormData&&e instanceof FormData||rF(e.append)&&("formdata"===(t=KO(e))||"object"===t&&rF(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&tF(e.buffer)},isString:nF,isNumber:iF,isBoolean:function(e){return!0===e||!1===e},isObject:aF,isPlainObject:oF,isReadableStream:fF,isRequest:pF,isResponse:vF,isHeaders:mF,isUndefined:eF,isDate:sF,isFile:uF,isBlob:lF,isRegExp:TF,isFunction:rF,isStream:function(e){return aF(e)&&rF(e.pipe)},isURLSearchParams:hF,isTypedArray:SF,isFileList:cF,forEach:gF,merge:function e(){for(var t=(bF(this)&&this||{}).caseless,n={},r=function(r,i){var a=t&&yF(n,i)||i;oF(n[a])&&oF(r)?n[a]=e(n[a],r):oF(r)?n[a]=e({},r):$O(r)?n[a]=r.slice():n[a]=r},i=0,a=arguments.length;i3&&void 0!==arguments[3]?arguments[3]:{}).allOwnKeys}),e},trim:function(e){return e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")},stripBOM:function(e){return 65279===e.charCodeAt(0)&&(e=e.slice(1)),e},inherits:function(e,t,n,r){e.prototype=Object.create(t.prototype,r),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},toFlatObject:function(e,t,n,r){var i,a,o,s={};if(t=t||{},null==e)return t;do{for(a=(i=Object.getOwnPropertyNames(e)).length;a-- >0;)o=i[a],r&&!r(o,e,t)||s[o]||(t[o]=e[o],s[o]=!0);e=!1!==n&&YO(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},kindOf:KO,kindOfTest:ZO,endsWith:function(e,t,n){e=String(e),(void 0===n||n>e.length)&&(n=e.length),n-=t.length;var r=e.indexOf(t,n);return-1!==r&&r===n},toArray:function(e){if(!e)return null;if($O(e))return e;var t=e.length;if(!iF(t))return null;for(var n=new Array(t);t-- >0;)n[t]=e[t];return n},forEachEntry:function(e,t){for(var n,r=(e&&e[Symbol.iterator]).call(e);(n=r.next())&&!n.done;){var i=n.value;t.call(e,i[0],i[1])}},matchAll:function(e,t){for(var n,r=[];null!==(n=e.exec(t));)r.push(n);return r},isHTMLForm:AF,hasOwnProperty:wF,hasOwnProp:wF,reduceDescriptors:MF,freezeMethods:function(e){MF(e,function(t,n){if(rF(e)&&-1!==["arguments","caller","callee"].indexOf(n))return!1;var r=e[n];rF(r)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=function(){throw Error("Can not rewrite read-only method '"+n+"'")}))})},toObjectSet:function(e,t){var n={},r=function(e){e.forEach(function(e){n[e]=!0})};return $O(e)?r(e):r(String(e).split(t)),n},toCamelCase:function(e){return e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(e,t,n){return t.toUpperCase()+n})},noop:function(){},toFiniteNumber:function(e,t){return null!=e&&Number.isFinite(e=+e)?e:t},findKey:yF,global:_F,isContextDefined:bF,isSpecCompliantForm:function(e){return!!(e&&rF(e.append)&&"FormData"===e[Symbol.toStringTag]&&e[Symbol.iterator])},toJSONObject:function(e){var t=new Array(10),n=function(e,r){if(aF(e)){if(t.indexOf(e)>=0)return;if(!("toJSON"in e)){t[r]=e;var i=$O(e)?[]:{};return gF(e,function(e,t){var a=n(e,r+1);!eF(a)&&(i[t]=a)}),t[r]=void 0,i}}return e};return n(e,0)},isAsyncFn:kF,isThenable:function(e){return e&&(aF(e)||rF(e))&&rF(e.then)&&rF(e.catch)},setImmediate:RF,asap:IF};function PF(e,t,n,r,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),i&&(this.response=i,this.status=i.status?i.status:null)}NF.inherits(PF,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:NF.toJSONObject(this.config),code:this.code,status:this.status}}});var LF=PF.prototype,DF={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(function(e){DF[e]={value:e}}),Object.defineProperties(PF,DF),Object.defineProperty(LF,"isAxiosError",{value:!0}),PF.from=function(e,t,n,r,i,a){var o=Object.create(LF);return NF.toFlatObject(e,o,function(e){return e!==Error.prototype},function(e){return"isAxiosError"!==e}),PF.call(o,e.message,t,n,r,i),o.cause=e,o.name=e.name,a&&Object.assign(o,a),o};function OF(e){return NF.isPlainObject(e)||NF.isArray(e)}function FF(e){return NF.endsWith(e,"[]")?e.slice(0,-2):e}function BF(e,t,n){return e?e.concat(t).map(function(e,t){return e=FF(e),!n&&t?"["+e+"]":e}).join(n?".":""):t}var UF=NF.toFlatObject(NF,{},null,function(e){return/^is[A-Z]/.test(e)});function zF(e,t,n){if(!NF.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;var r=(n=NF.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!NF.isUndefined(t[e])})).metaTokens,i=n.visitor||l,a=n.dots,o=n.indexes,s=(n.Blob||"undefined"!=typeof Blob&&Blob)&&NF.isSpecCompliantForm(t);if(!NF.isFunction(i))throw new TypeError("visitor must be a function");function u(e){if(null===e)return"";if(NF.isDate(e))return e.toISOString();if(!s&&NF.isBlob(e))throw new PF("Blob is not supported. Use a Buffer instead.");return NF.isArrayBuffer(e)||NF.isTypedArray(e)?s&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function l(e,n,i){var s=e;if(e&&!i&&"object"===P(e))if(NF.endsWith(n,"{}"))n=r?n:n.slice(0,-2),e=JSON.stringify(e);else if(NF.isArray(e)&&function(e){return NF.isArray(e)&&!e.some(OF)}(e)||(NF.isFileList(e)||NF.endsWith(n,"[]"))&&(s=NF.toArray(e)))return n=FF(n),s.forEach(function(e,r){!NF.isUndefined(e)&&null!==e&&t.append(!0===o?BF([n],r,a):null===o?n:n+"[]",u(e))}),!1;return!!OF(e)||(t.append(BF(i,n,a),u(e)),!1)}var c=[],h=Object.assign(UF,{defaultVisitor:l,convertValue:u,isVisitable:OF});if(!NF.isObject(e))throw new TypeError("data must be an object");return function e(n,r){if(!NF.isUndefined(n)){if(-1!==c.indexOf(n))throw Error("Circular reference detected in "+r.join("."));c.push(n),NF.forEach(n,function(n,a){!0===(!(NF.isUndefined(n)||null===n)&&i.call(t,n,NF.isString(a)?a.trim():a,r,h))&&e(n,r?r.concat(a):[a])}),c.pop()}}(e),t}function VF(e){var t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(e){return t[e]})}function HF(e,t){this._pairs=[],e&&zF(e,this,t)}var WF=HF.prototype;function GF(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function jF(e,t,n){if(!t)return e;var r=n&&n.encode||GF;NF.isFunction(n)&&(n={serialize:n});var i,a=n&&n.serialize;if(i=a?a(t,n):NF.isURLSearchParams(t)?t.toString():new HF(t,n).toString(r)){var o=e.indexOf("#");-1!==o&&(e=e.slice(0,o)),e+=(-1===e.indexOf("?")?"?":"&")+i}return e}WF.append=function(e,t){this._pairs.push([e,t])},WF.toString=function(e){var t=e?function(t){return e.call(this,t,VF)}:VF;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};var QF=function(){return T(function e(){A(this,e),this.handlers=[]},[{key:"use",value:function(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1}},{key:"eject",value:function(e){this.handlers[e]&&(this.handlers[e]=null)}},{key:"clear",value:function(){this.handlers&&(this.handlers=[])}},{key:"forEach",value:function(e){NF.forEach(this.handlers,function(t){null!==t&&e(t)})}}])}(),qF={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},XF={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:HF,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]},YF="undefined"!=typeof window&&"undefined"!=typeof document,KF="object"===("undefined"==typeof navigator?"undefined":P(navigator))&&navigator||void 0,ZF=YF&&(!KF||["ReactNative","NativeScript","NS"].indexOf(KF.product)<0),JF="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,$F=YF&&window.location.href||"http://localhost",eB=s(s({},Object.freeze({__proto__:null,hasBrowserEnv:YF,hasStandardBrowserEnv:ZF,hasStandardBrowserWebWorkerEnv:JF,navigator:KF,origin:$F})),XF);function tB(e){function t(e,n,r,i){var a=e[i++];if("__proto__"===a)return!0;var o=Number.isFinite(+a),s=i>=e.length;return a=!a&&NF.isArray(r)?r.length:a,s?(NF.hasOwnProp(r,a)?r[a]=[r[a],n]:r[a]=n,!o):(r[a]&&NF.isObject(r[a])||(r[a]=[]),t(e,n,r[a],i)&&NF.isArray(r[a])&&(r[a]=function(e){var t,n,r={},i=Object.keys(e),a=i.length;for(t=0;t-1,a=NF.isObject(e);if(a&&NF.isHTMLForm(e)&&(e=new FormData(e)),NF.isFormData(e))return i?JSON.stringify(tB(e)):e;if(NF.isArrayBuffer(e)||NF.isBuffer(e)||NF.isStream(e)||NF.isFile(e)||NF.isBlob(e)||NF.isReadableStream(e))return e;if(NF.isArrayBufferView(e))return e.buffer;if(NF.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();if(a){if(r.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return zF(e,new eB.classes.URLSearchParams,Object.assign({visitor:function(e,t,n,r){return eB.isNode&&NF.isBuffer(e)?(this.append(t,e.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)}},t))}(e,this.formSerializer).toString();if((n=NF.isFileList(e))||r.indexOf("multipart/form-data")>-1){var o=this.env&&this.env.FormData;return zF(n?{"files[]":e}:e,o&&new o,this.formSerializer)}}return a||i?(t.setContentType("application/json",!1),function(e,t,n){if(NF.isString(e))try{return(t||JSON.parse)(e),NF.trim(e)}catch(HJ){if("SyntaxError"!==HJ.name)throw HJ}return(n||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){var t=this.transitional||nB.transitional,n=t&&t.forcedJSONParsing,r="json"===this.responseType;if(NF.isResponse(e)||NF.isReadableStream(e))return e;if(e&&NF.isString(e)&&(n&&!this.responseType||r)){var i=!(t&&t.silentJSONParsing)&&r;try{return JSON.parse(e)}catch(HJ){if(i){if("SyntaxError"===HJ.name)throw PF.from(HJ,PF.ERR_BAD_RESPONSE,this,null,this.response);throw HJ}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:eB.classes.FormData,Blob:eB.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};NF.forEach(["delete","get","head","post","put","patch"],function(e){nB.headers[e]={}});var rB=NF.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),iB=Symbol("internals");function aB(e){return e&&String(e).trim().toLowerCase()}function oB(e){return!1===e||null==e?e:NF.isArray(e)?e.map(oB):String(e)}function sB(e,t,n,r,i){return NF.isFunction(r)?r.call(this,t,n):(i&&(t=n),NF.isString(t)?NF.isString(r)?-1!==t.indexOf(r):NF.isRegExp(r)?r.test(t):void 0:void 0)}var uB=function(){return T(function e(t){A(this,e),t&&this.set(t)},[{key:"set",value:function(e,t,n){var r=this;function i(e,t,n){var i=aB(t);if(!i)throw new Error("header name must be a non-empty string");var a=NF.findKey(r,i);(!a||void 0===r[a]||!0===n||void 0===n&&!1!==r[a])&&(r[a||t]=oB(e))}var a=function(e,t){return NF.forEach(e,function(e,n){return i(e,n,t)})};if(NF.isPlainObject(e)||e instanceof this.constructor)a(e,t);else if(NF.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))a(function(e){var t,n,r,i={};return e&&e.split("\n").forEach(function(e){r=e.indexOf(":"),t=e.substring(0,r).trim().toLowerCase(),n=e.substring(r+1).trim(),!t||i[t]&&rB[t]||("set-cookie"===t?i[t]?i[t].push(n):i[t]=[n]:i[t]=i[t]?i[t]+", "+n:n)}),i}(e),t);else if(NF.isHeaders(e)){var o,s=L(e.entries());try{for(s.s();!(o=s.n()).done;){var u=C(o.value,2),l=u[0];i(u[1],l,n)}}catch(c){s.e(c)}finally{s.f()}}else null!=e&&i(t,e,n);return this}},{key:"get",value:function(e,t){if(e=aB(e)){var n=NF.findKey(this,e);if(n){var r=this[n];if(!t)return r;if(!0===t)return function(e){for(var t,n=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;t=r.exec(e);)n[t[1]]=t[2];return n}(r);if(NF.isFunction(t))return t.call(this,r,n);if(NF.isRegExp(t))return t.exec(r);throw new TypeError("parser must be boolean|regexp|function")}}}},{key:"has",value:function(e,t){if(e=aB(e)){var n=NF.findKey(this,e);return!(!n||void 0===this[n]||t&&!sB(0,this[n],n,t))}return!1}},{key:"delete",value:function(e,t){var n=this,r=!1;function i(e){if(e=aB(e)){var i=NF.findKey(n,e);!i||t&&!sB(0,n[i],i,t)||(delete n[i],r=!0)}}return NF.isArray(e)?e.forEach(i):i(e),r}},{key:"clear",value:function(e){for(var t=Object.keys(this),n=t.length,r=!1;n--;){var i=t[n];e&&!sB(0,this[i],i,e,!0)||(delete this[i],r=!0)}return r}},{key:"normalize",value:function(e){var t=this,n={};return NF.forEach(this,function(r,i){var a=NF.findKey(n,i);if(a)return t[a]=oB(r),void delete t[i];var o=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,function(e,t,n){return t.toUpperCase()+n})}(i):String(i).trim();o!==i&&delete t[i],t[o]=oB(r),n[o]=!0}),this}},{key:"concat",value:function(){for(var e,t=arguments.length,n=new Array(t),r=0;r1?n-1:0),i=1;i2&&void 0!==arguments[2]?arguments[2]:3,r=0,i=function(e,t){e=e||10;var n,r=new Array(e),i=new Array(e),a=0,o=0;return t=void 0!==t?t:1e3,function(s){var u=Date.now(),l=i[o];n||(n=u),r[a]=s,i[a]=u;for(var c=o,h=0;c!==a;)h+=r[c++],c%=e;if((a=(a+1)%e)===o&&(o=(o+1)%e),!(u-n1&&void 0!==arguments[1]?arguments[1]:Date.now();i=a,n=null,r&&(clearTimeout(r),r=null),e.apply(null,t)};return[function(){for(var e=Date.now(),t=e-i,s=arguments.length,u=new Array(s),l=0;l=a?o(u,e):(n=u,r||(r=setTimeout(function(){r=null,o(n)},a-t)))},function(){return n&&o(n)}]}(function(n){var a=n.loaded,o=n.lengthComputable?n.total:void 0,s=a-r,u=i(s);r=a;var l=M({loaded:a,total:o,progress:o?a/o:void 0,bytes:s,rate:u||void 0,estimated:u&&o&&a<=o?(o-a)/u:void 0,event:n,lengthComputable:null!=o},t?"download":"upload",!0);e(l)},n)},pB=function(e,t){var n=null!=e;return[function(r){return t[0]({lengthComputable:n,total:e,loaded:r})},t[1]]},vB=function(e){return function(){for(var t=arguments.length,n=new Array(t),r=0;r1?t-1:0),r=1;r1?"since :\n"+s.map(VB).join("\n"):" "+VB(s[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return n};function GB(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new hB(null,e)}function jB(e){return GB(e),e.headers=uB.from(e.headers),e.data=lB.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1),WB(e.adapter||nB.adapter)(e).then(function(t){return GB(e),t.data=lB.call(e,e.transformResponse,t),t.headers=uB.from(t.headers),t},function(t){return cB(t)||(GB(e),t&&t.response&&(t.response.data=lB.call(e,e.transformResponse,t.response),t.response.headers=uB.from(t.response.headers))),Promise.reject(t)})}var QB="1.8.4",qB={};["object","boolean","number","function","string","symbol"].forEach(function(e,t){qB[e]=function(n){return P(n)===e||"a"+(t<1?"n ":" ")+e}});var XB={};qB.transitional=function(e,t,n){function r(e,t){return"[Axios v1.8.4] Transitional option '"+e+"'"+t+(n?". "+n:"")}return function(n,i,a){if(!1===e)throw new PF(r(i," has been removed"+(t?" in "+t:"")),PF.ERR_DEPRECATED);return t&&!XB[i]&&(XB[i]=!0,console.warn(r(i," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(n,i,a)}},qB.spelling=function(e){return function(t,n){return console.warn("".concat(n," is likely a misspelling of ").concat(e)),!0}};var YB={assertOptions:function(e,t,n){if("object"!==P(e))throw new PF("options must be an object",PF.ERR_BAD_OPTION_VALUE);for(var r=Object.keys(e),i=r.length;i-- >0;){var a=r[i],o=t[a];if(o){var s=e[a],u=void 0===s||o(s,a,e);if(!0!==u)throw new PF("option "+a+" must be "+u,PF.ERR_BAD_OPTION_VALUE)}else if(!0!==n)throw new PF("Unknown option "+a,PF.ERR_BAD_OPTION)}},validators:qB},KB=YB.validators,ZB=function(){return T(function e(t){A(this,e),this.defaults=t,this.interceptors={request:new QF,response:new QF}},[{key:"request",value:(e=v(d().m(function e(t,n){var r,i,a;return d().w(function(e){for(;;)switch(e.n){case 0:return e.p=0,e.n=1,this._request(t,n);case 1:return e.a(2,e.v);case 2:if(e.p=2,(a=e.v)instanceof Error){r={},Error.captureStackTrace?Error.captureStackTrace(r):r=new Error,i=r.stack?r.stack.replace(/^.+\n/,""):"";try{a.stack?i&&!String(a.stack).endsWith(i.replace(/^.+\n.+\n/,""))&&(a.stack+="\n"+i):a.stack=i}catch(HJ){}}throw a;case 3:return e.a(2)}},e,this,[[0,2]])})),function(t,n){return e.apply(this,arguments)})},{key:"_request",value:function(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{};var n=t=bB(this.defaults,t),r=n.transitional,i=n.paramsSerializer,a=n.headers;void 0!==r&&YB.assertOptions(r,{silentJSONParsing:KB.transitional(KB.boolean),forcedJSONParsing:KB.transitional(KB.boolean),clarifyTimeoutError:KB.transitional(KB.boolean)},!1),null!=i&&(NF.isFunction(i)?t.paramsSerializer={serialize:i}:YB.assertOptions(i,{encode:KB.function,serialize:KB.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),YB.assertOptions(t,{baseUrl:KB.spelling("baseURL"),withXsrfToken:KB.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();var o=a&&NF.merge(a.common,a[t.method]);a&&NF.forEach(["delete","get","head","post","put","patch","common"],function(e){delete a[e]}),t.headers=uB.concat(o,a);var s=[],u=!0;this.interceptors.request.forEach(function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(u=u&&e.synchronous,s.unshift(e.fulfilled,e.rejected))});var l,c=[];this.interceptors.response.forEach(function(e){c.push(e.fulfilled,e.rejected)});var h,d=0;if(!u){var f=[jB.bind(this),void 0];for(f.unshift.apply(f,s),f.push.apply(f,c),h=f.length,l=Promise.resolve(t);d0;)r._listeners[t](e);r._listeners=null}}),this.promise.then=function(e){var t,n=new Promise(function(e){r.subscribe(e),t=e}).then(e);return n.cancel=function(){r.unsubscribe(t)},n},t(function(e,t,i){r.reason||(r.reason=new hB(e,t,i),n(r.reason))})}return T(e,[{key:"throwIfRequested",value:function(){if(this.reason)throw this.reason}},{key:"subscribe",value:function(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}},{key:"unsubscribe",value:function(e){if(this._listeners){var t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}}},{key:"toAbortSignal",value:function(){var e=this,t=new AbortController,n=function(e){t.abort(e)};return this.subscribe(n),t.signal.unsubscribe=function(){return e.unsubscribe(n)},t.signal}}],[{key:"source",value:function(){var t,n=new e(function(e){t=e});return{token:n,cancel:t}}}])}();var $B={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries($B).forEach(function(e){var t=C(e,2),n=t[0],r=t[1];$B[r]=n});var eU=function e(t){var n=new ZB(t),r=qO(ZB.prototype.request,n);return NF.extend(r,ZB.prototype,n,{allOwnKeys:!0}),NF.extend(r,n,null,{allOwnKeys:!0}),r.create=function(n){return e(bB(t,n))},r}(nB);eU.Axios=ZB,eU.CanceledError=hB,eU.CancelToken=JB,eU.isCancel=cB,eU.VERSION=QB,eU.toFormData=zF,eU.AxiosError=PF,eU.Cancel=eU.CanceledError,eU.all=function(e){return Promise.all(e)},eU.spread=function(e){return function(t){return e.apply(null,t)}},eU.isAxiosError=function(e){return NF.isObject(e)&&!0===e.isAxiosError},eU.mergeConfig=bB,eU.AxiosHeaders=uB,eU.formToJSON=function(e){return tB(NF.isHTMLForm(e)?new FormData(e):e)},eU.getAdapter=WB,eU.HttpStatusCode=$B,eU.default=eU;eU.Axios,eU.AxiosError,eU.CanceledError,eU.isCancel,eU.CancelToken,eU.VERSION,eU.all,eU.Cancel,eU.isAxiosError,eU.spread,eU.toFormData,eU.AxiosHeaders,eU.HttpStatusCode,eU.formToJSON,eU.getAdapter,eU.mergeConfig;var tU="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function nU(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function rU(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var iU,aU={exports:{}};var oU,sU,uU=(iU||(iU=1,function(e){e.exports=function e(t,n,r){function i(o,s){if(!n[o]){if(!t[o]){if(!s&&rU)return rU(o);if(a)return a(o,!0);var u=new Error("Cannot find module '"+o+"'");throw u.code="MODULE_NOT_FOUND",u}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){return i(t[o][1][e]||e)},l,l.exports,e,t,n,r)}return n[o].exports}for(var a=rU,o=0;o>2,s=(3&t)<<4|n>>4,u=1>6:64,l=2>4,n=(15&o)<<4|(s=a.indexOf(e.charAt(l++)))>>2,r=(3&s)<<6|(u=a.indexOf(e.charAt(l++))),d[c++]=t,64!==s&&(d[c++]=n),64!==u&&(d[c++]=r);return d}},{"./support":30,"./utils":32}],2:[function(e,t,n){var r=e("./external"),i=e("./stream/DataWorker"),a=e("./stream/Crc32Probe"),o=e("./stream/DataLengthProbe");function s(e,t,n,r,i){this.compressedSize=e,this.uncompressedSize=t,this.crc32=n,this.compression=r,this.compressedContent=i}s.prototype={getContentWorker:function(){var e=new i(r.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new o("data_length")),t=this;return e.on("end",function(){if(this.streamInfo.data_length!==t.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),e},getCompressedWorker:function(){return new i(r.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},s.createWorkerFrom=function(e,t,n){return e.pipe(new a).pipe(new o("uncompressedSize")).pipe(t.compressWorker(n)).pipe(new o("compressedSize")).withStreamInfo("compression",t)},t.exports=s},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(e,t,n){var r=e("./stream/GenericWorker");n.STORE={magic:"\0\0",compressWorker:function(){return new r("STORE compression")},uncompressWorker:function(){return new r("STORE decompression")}},n.DEFLATE=e("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(e,t,n){var r=e("./utils"),i=function(){for(var e,t=[],n=0;n<256;n++){e=n;for(var r=0;r<8;r++)e=1&e?3988292384^e>>>1:e>>>1;t[n]=e}return t}();t.exports=function(e,t){return void 0!==e&&e.length?"string"!==r.getTypeOf(e)?function(e,t,n,r){var a=i,o=r+n;e^=-1;for(var s=r;s>>8^a[255&(e^t[s])];return-1^e}(0|t,e,e.length,0):function(e,t,n,r){var a=i,o=r+n;e^=-1;for(var s=r;s>>8^a[255&(e^t.charCodeAt(s))];return-1^e}(0|t,e,e.length,0):0}},{"./utils":32}],5:[function(e,t,n){n.base64=!1,n.binary=!1,n.dir=!1,n.createFolders=!0,n.date=null,n.compression=null,n.compressionOptions=null,n.comment=null,n.unixPermissions=null,n.dosPermissions=null},{}],6:[function(e,t,n){var r=null;r="undefined"!=typeof Promise?Promise:e("lie"),t.exports={Promise:r}},{lie:37}],7:[function(e,t,n){var r="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array,i=e("pako"),a=e("./utils"),o=e("./stream/GenericWorker"),s=r?"uint8array":"array";function u(e,t){o.call(this,"FlateWorker/"+e),this._pako=null,this._pakoAction=e,this._pakoOptions=t,this.meta={}}n.magic="\b\0",a.inherits(u,o),u.prototype.processChunk=function(e){this.meta=e.meta,null===this._pako&&this._createPako(),this._pako.push(a.transformTo(s,e.data),!1)},u.prototype.flush=function(){o.prototype.flush.call(this),null===this._pako&&this._createPako(),this._pako.push([],!0)},u.prototype.cleanUp=function(){o.prototype.cleanUp.call(this),this._pako=null},u.prototype._createPako=function(){this._pako=new i[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var e=this;this._pako.onData=function(t){e.push({data:t,meta:e.meta})}},n.compressWorker=function(e){return new u("Deflate",e)},n.uncompressWorker=function(){return new u("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(e,t,n){function r(e,t){var n,r="";for(n=0;n>>=8;return r}function i(e,t,n,i,o,c){var h,d,f=e.file,p=e.compression,v=c!==s.utf8encode,m=a.transformTo("string",c(f.name)),g=a.transformTo("string",s.utf8encode(f.name)),y=f.comment,_=a.transformTo("string",c(y)),b=a.transformTo("string",s.utf8encode(y)),x=g.length!==f.name.length,S=b.length!==y.length,A="",w="",T="",M=f.dir,E=f.date,C={crc32:0,compressedSize:0,uncompressedSize:0};t&&!n||(C.crc32=e.crc32,C.compressedSize=e.compressedSize,C.uncompressedSize=e.uncompressedSize);var k=0;t&&(k|=8),v||!x&&!S||(k|=2048);var R=0,I=0;M&&(R|=16),"UNIX"===o?(I=798,R|=function(e,t){var n=e;return e||(n=t?16893:33204),(65535&n)<<16}(f.unixPermissions,M)):(I=20,R|=function(e){return 63&(e||0)}(f.dosPermissions)),h=E.getUTCHours(),h<<=6,h|=E.getUTCMinutes(),h<<=5,h|=E.getUTCSeconds()/2,d=E.getUTCFullYear()-1980,d<<=4,d|=E.getUTCMonth()+1,d<<=5,d|=E.getUTCDate(),x&&(w=r(1,1)+r(u(m),4)+g,A+="up"+r(w.length,2)+w),S&&(T=r(1,1)+r(u(_),4)+b,A+="uc"+r(T.length,2)+T);var N="";return N+="\n\0",N+=r(k,2),N+=p.magic,N+=r(h,2),N+=r(d,2),N+=r(C.crc32,4),N+=r(C.compressedSize,4),N+=r(C.uncompressedSize,4),N+=r(m.length,2),N+=r(A.length,2),{fileRecord:l.LOCAL_FILE_HEADER+N+m+A,dirRecord:l.CENTRAL_FILE_HEADER+r(I,2)+N+r(_.length,2)+"\0\0\0\0"+r(R,4)+r(i,4)+m+A+_}}var a=e("../utils"),o=e("../stream/GenericWorker"),s=e("../utf8"),u=e("../crc32"),l=e("../signature");function c(e,t,n,r){o.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=t,this.zipPlatform=n,this.encodeFileName=r,this.streamFiles=e,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}a.inherits(c,o),c.prototype.push=function(e){var t=e.meta.percent||0,n=this.entriesCount,r=this._sources.length;this.accumulate?this.contentBuffer.push(e):(this.bytesWritten+=e.data.length,o.prototype.push.call(this,{data:e.data,meta:{currentFile:this.currentFile,percent:n?(t+100*(n-r-1))/n:100}}))},c.prototype.openedSource=function(e){this.currentSourceOffset=this.bytesWritten,this.currentFile=e.file.name;var t=this.streamFiles&&!e.file.dir;if(t){var n=i(e,t,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:n.fileRecord,meta:{percent:0}})}else this.accumulate=!0},c.prototype.closedSource=function(e){this.accumulate=!1;var t=this.streamFiles&&!e.file.dir,n=i(e,t,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(n.dirRecord),t)this.push({data:function(e){return l.DATA_DESCRIPTOR+r(e.crc32,4)+r(e.compressedSize,4)+r(e.uncompressedSize,4)}(e),meta:{percent:100}});else for(this.push({data:n.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},c.prototype.flush=function(){for(var e=this.bytesWritten,t=0;t=this.index;t--)n=(n<<8)+this.byteAt(t);return this.index+=e,n},readString:function(e){return r.transformTo("string",this.readData(e))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var e=this.readInt(4);return new Date(Date.UTC(1980+(e>>25&127),(e>>21&15)-1,e>>16&31,e>>11&31,e>>5&63,(31&e)<<1))}},t.exports=i},{"../utils":32}],19:[function(e,t,n){var r=e("./Uint8ArrayReader");function i(e){r.call(this,e)}e("../utils").inherits(i,r),i.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=i},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(e,t,n){var r=e("./DataReader");function i(e){r.call(this,e)}e("../utils").inherits(i,r),i.prototype.byteAt=function(e){return this.data.charCodeAt(this.zero+e)},i.prototype.lastIndexOfSignature=function(e){return this.data.lastIndexOf(e)-this.zero},i.prototype.readAndCheckSignature=function(e){return e===this.readData(4)},i.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=i},{"../utils":32,"./DataReader":18}],21:[function(e,t,n){var r=e("./ArrayReader");function i(e){r.call(this,e)}e("../utils").inherits(i,r),i.prototype.readData=function(e){if(this.checkOffset(e),0===e)return new Uint8Array(0);var t=this.data.subarray(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=i},{"../utils":32,"./ArrayReader":17}],22:[function(e,t,n){var r=e("../utils"),i=e("../support"),a=e("./ArrayReader"),o=e("./StringReader"),s=e("./NodeBufferReader"),u=e("./Uint8ArrayReader");t.exports=function(e){var t=r.getTypeOf(e);return r.checkSupport(t),"string"!==t||i.uint8array?"nodebuffer"===t?new s(e):i.uint8array?new u(r.transformTo("uint8array",e)):new a(r.transformTo("array",e)):new o(e)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(e,t,n){n.LOCAL_FILE_HEADER="PK",n.CENTRAL_FILE_HEADER="PK",n.CENTRAL_DIRECTORY_END="PK",n.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK",n.ZIP64_CENTRAL_DIRECTORY_END="PK",n.DATA_DESCRIPTOR="PK\b"},{}],24:[function(e,t,n){var r=e("./GenericWorker"),i=e("../utils");function a(e){r.call(this,"ConvertWorker to "+e),this.destType=e}i.inherits(a,r),a.prototype.processChunk=function(e){this.push({data:i.transformTo(this.destType,e.data),meta:e.meta})},t.exports=a},{"../utils":32,"./GenericWorker":28}],25:[function(e,t,n){var r=e("./GenericWorker"),i=e("../crc32");function a(){r.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}e("../utils").inherits(a,r),a.prototype.processChunk=function(e){this.streamInfo.crc32=i(e.data,this.streamInfo.crc32||0),this.push(e)},t.exports=a},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(e,t,n){var r=e("../utils"),i=e("./GenericWorker");function a(e){i.call(this,"DataLengthProbe for "+e),this.propName=e,this.withStreamInfo(e,0)}r.inherits(a,i),a.prototype.processChunk=function(e){if(e){var t=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=t+e.data.length}i.prototype.processChunk.call(this,e)},t.exports=a},{"../utils":32,"./GenericWorker":28}],27:[function(e,t,n){var r=e("../utils"),i=e("./GenericWorker");function a(e){i.call(this,"DataWorker");var t=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,e.then(function(e){t.dataIsReady=!0,t.data=e,t.max=e&&e.length||0,t.type=r.getTypeOf(e),t.isPaused||t._tickAndRepeat()},function(e){t.error(e)})}r.inherits(a,i),a.prototype.cleanUp=function(){i.prototype.cleanUp.call(this),this.data=null},a.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,r.delay(this._tickAndRepeat,[],this)),!0)},a.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(r.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},a.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var e=null,t=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":e=this.data.substring(this.index,t);break;case"uint8array":e=this.data.subarray(this.index,t);break;case"array":case"nodebuffer":e=this.data.slice(this.index,t)}return this.index=t,this.push({data:e,meta:{percent:this.max?this.index/this.max*100:0}})},t.exports=a},{"../utils":32,"./GenericWorker":28}],28:[function(e,t,n){function r(e){this.name=e||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}r.prototype={push:function(e){this.emit("data",e)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(e){this.emit("error",e)}return!0},error:function(e){return!this.isFinished&&(this.isPaused?this.generatedError=e:(this.isFinished=!0,this.emit("error",e),this.previous&&this.previous.error(e),this.cleanUp()),!0)},on:function(e,t){return this._listeners[e].push(t),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(e,t){if(this._listeners[e])for(var n=0;n "+e:e}},t.exports=r},{}],29:[function(e,t,n){var r=e("../utils"),i=e("./ConvertWorker"),a=e("./GenericWorker"),o=e("../base64"),s=e("../support"),u=e("../external"),l=null;if(s.nodestream)try{l=e("../nodejs/NodejsStreamOutputAdapter")}catch(e){}function c(e,t){return new u.Promise(function(n,i){var a=[],s=e._internalType,u=e._outputType,l=e._mimeType;e.on("data",function(e,n){a.push(e),t&&t(n)}).on("error",function(e){a=[],i(e)}).on("end",function(){try{var e=function(e,t,n){switch(e){case"blob":return r.newBlob(r.transformTo("arraybuffer",t),n);case"base64":return o.encode(t);default:return r.transformTo(e,t)}}(u,function(e,t){var n,r=0,i=null,a=0;for(n=0;n>>6:(n<65536?t[o++]=224|n>>>12:(t[o++]=240|n>>>18,t[o++]=128|n>>>12&63),t[o++]=128|n>>>6&63),t[o++]=128|63&n);return t}(e)},n.utf8decode=function(e){return i.nodebuffer?r.transformTo("nodebuffer",e).toString("utf-8"):function(e){var t,n,i,a,o=e.length,u=new Array(2*o);for(t=n=0;t>10&1023,u[n++]=56320|1023&i)}return u.length!==n&&(u.subarray?u=u.subarray(0,n):u.length=n),r.applyFromCharCode(u)}(e=r.transformTo(i.uint8array?"uint8array":"array",e))},r.inherits(l,o),l.prototype.processChunk=function(e){var t=r.transformTo(i.uint8array?"uint8array":"array",e.data);if(this.leftOver&&this.leftOver.length){if(i.uint8array){var a=t;(t=new Uint8Array(a.length+this.leftOver.length)).set(this.leftOver,0),t.set(a,this.leftOver.length)}else t=this.leftOver.concat(t);this.leftOver=null}var o=function(e,t){var n;for((t=t||e.length)>e.length&&(t=e.length),n=t-1;0<=n&&128==(192&e[n]);)n--;return n<0||0===n?t:n+s[e[n]]>t?n:t}(t),u=t;o!==t.length&&(i.uint8array?(u=t.subarray(0,o),this.leftOver=t.subarray(o,t.length)):(u=t.slice(0,o),this.leftOver=t.slice(o,t.length))),this.push({data:n.utf8decode(u),meta:e.meta})},l.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:n.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},n.Utf8DecodeWorker=l,r.inherits(c,o),c.prototype.processChunk=function(e){this.push({data:n.utf8encode(e.data),meta:e.meta})},n.Utf8EncodeWorker=c},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(e,t,n){var r=e("./support"),i=e("./base64"),a=e("./nodejsUtils"),o=e("./external");function s(e){return e}function u(e,t){for(var n=0;n>8;this.dir=!!(16&this.externalFileAttributes),0==e&&(this.dosPermissions=63&this.externalFileAttributes),3==e&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||"/"!==this.fileNameStr.slice(-1)||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var e=r(this.extraFields[1].value);this.uncompressedSize===i.MAX_VALUE_32BITS&&(this.uncompressedSize=e.readInt(8)),this.compressedSize===i.MAX_VALUE_32BITS&&(this.compressedSize=e.readInt(8)),this.localHeaderOffset===i.MAX_VALUE_32BITS&&(this.localHeaderOffset=e.readInt(8)),this.diskNumberStart===i.MAX_VALUE_32BITS&&(this.diskNumberStart=e.readInt(4))}},readExtraFields:function(e){var t,n,r,i=e.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});e.index+4>>6:(n<65536?t[o++]=224|n>>>12:(t[o++]=240|n>>>18,t[o++]=128|n>>>12&63),t[o++]=128|n>>>6&63),t[o++]=128|63&n);return t},n.buf2binstring=function(e){return u(e,e.length)},n.binstring2buf=function(e){for(var t=new r.Buf8(e.length),n=0,i=t.length;n>10&1023,l[r++]=56320|1023&i)}return u(l,r)},n.utf8border=function(e,t){var n;for((t=t||e.length)>e.length&&(t=e.length),n=t-1;0<=n&&128==(192&e[n]);)n--;return n<0||0===n?t:n+o[e[n]]>t?n:t}},{"./common":41}],43:[function(e,t,n){t.exports=function(e,t,n,r){for(var i=65535&e,a=e>>>16&65535,o=0;0!==n;){for(n-=o=2e3>>1:e>>>1;t[n]=e}return t}();t.exports=function(e,t,n,i){var a=r,o=i+n;e^=-1;for(var s=i;s>>8^a[255&(e^t[s])];return-1^e}},{}],46:[function(e,t,n){var r,i=e("../utils/common"),a=e("./trees"),o=e("./adler32"),s=e("./crc32"),u=e("./messages"),l=0,c=4,h=0,d=-2,f=-1,p=4,v=2,m=8,g=9,y=286,_=30,b=19,x=2*y+1,S=15,A=3,w=258,T=w+A+1,M=42,E=113,C=1,k=2,R=3,I=4;function N(e,t){return e.msg=u[t],t}function P(e){return(e<<1)-(4e.avail_out&&(n=e.avail_out),0!==n&&(i.arraySet(e.output,t.pending_buf,t.pending_out,n,e.next_out),e.next_out+=n,t.pending_out+=n,e.total_out+=n,e.avail_out-=n,t.pending-=n,0===t.pending&&(t.pending_out=0))}function O(e,t){a._tr_flush_block(e,0<=e.block_start?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,D(e.strm)}function F(e,t){e.pending_buf[e.pending++]=t}function B(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function U(e,t){var n,r,i=e.max_chain_length,a=e.strstart,o=e.prev_length,s=e.nice_match,u=e.strstart>e.w_size-T?e.strstart-(e.w_size-T):0,l=e.window,c=e.w_mask,h=e.prev,d=e.strstart+w,f=l[a+o-1],p=l[a+o];e.prev_length>=e.good_match&&(i>>=2),s>e.lookahead&&(s=e.lookahead);do{if(l[(n=t)+o]===p&&l[n+o-1]===f&&l[n]===l[a]&&l[++n]===l[a+1]){a+=2,n++;do{}while(l[++a]===l[++n]&&l[++a]===l[++n]&&l[++a]===l[++n]&&l[++a]===l[++n]&&l[++a]===l[++n]&&l[++a]===l[++n]&&l[++a]===l[++n]&&l[++a]===l[++n]&&au&&0!=--i);return o<=e.lookahead?o:e.lookahead}function z(e){var t,n,r,a,u,l,c,h,d,f,p=e.w_size;do{if(a=e.window_size-e.lookahead-e.strstart,e.strstart>=p+(p-T)){for(i.arraySet(e.window,e.window,p,p,0),e.match_start-=p,e.strstart-=p,e.block_start-=p,t=n=e.hash_size;r=e.head[--t],e.head[t]=p<=r?r-p:0,--n;);for(t=n=p;r=e.prev[--t],e.prev[t]=p<=r?r-p:0,--n;);a+=p}if(0===e.strm.avail_in)break;if(l=e.strm,c=e.window,h=e.strstart+e.lookahead,f=void 0,(d=a)<(f=l.avail_in)&&(f=d),n=0===f?0:(l.avail_in-=f,i.arraySet(c,l.input,l.next_in,f,h),1===l.state.wrap?l.adler=o(l.adler,c,f,h):2===l.state.wrap&&(l.adler=s(l.adler,c,f,h)),l.next_in+=f,l.total_in+=f,f),e.lookahead+=n,e.lookahead+e.insert>=A)for(u=e.strstart-e.insert,e.ins_h=e.window[u],e.ins_h=(e.ins_h<=A&&(e.ins_h=(e.ins_h<=A)if(r=a._tr_tally(e,e.strstart-e.match_start,e.match_length-A),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=A){for(e.match_length--;e.strstart++,e.ins_h=(e.ins_h<=A&&(e.ins_h=(e.ins_h<=A&&e.match_length<=e.prev_length){for(i=e.strstart+e.lookahead-A,r=a._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-A),e.lookahead-=e.prev_length-1,e.prev_length-=2;++e.strstart<=i&&(e.ins_h=(e.ins_h<e.pending_buf_size-5&&(n=e.pending_buf_size-5);;){if(e.lookahead<=1){if(z(e),0===e.lookahead&&t===l)return C;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var r=e.block_start+n;if((0===e.strstart||e.strstart>=r)&&(e.lookahead=e.strstart-r,e.strstart=r,O(e,!1),0===e.strm.avail_out))return C;if(e.strstart-e.block_start>=e.w_size-T&&(O(e,!1),0===e.strm.avail_out))return C}return e.insert=0,t===c?(O(e,!0),0===e.strm.avail_out?R:I):(e.strstart>e.block_start&&(O(e,!1),e.strm.avail_out),C)}),new W(4,4,8,4,V),new W(4,5,16,8,V),new W(4,6,32,32,V),new W(4,4,16,16,H),new W(8,16,32,32,H),new W(8,16,128,128,H),new W(8,32,128,256,H),new W(32,128,258,1024,H),new W(32,258,258,4096,H)],n.deflateInit=function(e,t){return q(e,t,m,15,8,0)},n.deflateInit2=q,n.deflateReset=Q,n.deflateResetKeep=j,n.deflateSetHeader=function(e,t){return e&&e.state?2!==e.state.wrap?d:(e.state.gzhead=t,h):d},n.deflate=function(e,t){var n,i,o,u;if(!e||!e.state||5>8&255),F(i,i.gzhead.time>>16&255),F(i,i.gzhead.time>>24&255),F(i,9===i.level?2:2<=i.strategy||i.level<2?4:0),F(i,255&i.gzhead.os),i.gzhead.extra&&i.gzhead.extra.length&&(F(i,255&i.gzhead.extra.length),F(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(e.adler=s(e.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=69):(F(i,0),F(i,0),F(i,0),F(i,0),F(i,0),F(i,9===i.level?2:2<=i.strategy||i.level<2?4:0),F(i,3),i.status=E);else{var f=m+(i.w_bits-8<<4)<<8;f|=(2<=i.strategy||i.level<2?0:i.level<6?1:6===i.level?2:3)<<6,0!==i.strstart&&(f|=32),f+=31-f%31,i.status=E,B(i,f),0!==i.strstart&&(B(i,e.adler>>>16),B(i,65535&e.adler)),e.adler=1}if(69===i.status)if(i.gzhead.extra){for(o=i.pending;i.gzindex<(65535&i.gzhead.extra.length)&&(i.pending!==i.pending_buf_size||(i.gzhead.hcrc&&i.pending>o&&(e.adler=s(e.adler,i.pending_buf,i.pending-o,o)),D(e),o=i.pending,i.pending!==i.pending_buf_size));)F(i,255&i.gzhead.extra[i.gzindex]),i.gzindex++;i.gzhead.hcrc&&i.pending>o&&(e.adler=s(e.adler,i.pending_buf,i.pending-o,o)),i.gzindex===i.gzhead.extra.length&&(i.gzindex=0,i.status=73)}else i.status=73;if(73===i.status)if(i.gzhead.name){o=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>o&&(e.adler=s(e.adler,i.pending_buf,i.pending-o,o)),D(e),o=i.pending,i.pending===i.pending_buf_size)){u=1;break}u=i.gzindexo&&(e.adler=s(e.adler,i.pending_buf,i.pending-o,o)),0===u&&(i.gzindex=0,i.status=91)}else i.status=91;if(91===i.status)if(i.gzhead.comment){o=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>o&&(e.adler=s(e.adler,i.pending_buf,i.pending-o,o)),D(e),o=i.pending,i.pending===i.pending_buf_size)){u=1;break}u=i.gzindexo&&(e.adler=s(e.adler,i.pending_buf,i.pending-o,o)),0===u&&(i.status=103)}else i.status=103;if(103===i.status&&(i.gzhead.hcrc?(i.pending+2>i.pending_buf_size&&D(e),i.pending+2<=i.pending_buf_size&&(F(i,255&e.adler),F(i,e.adler>>8&255),e.adler=0,i.status=E)):i.status=E),0!==i.pending){if(D(e),0===e.avail_out)return i.last_flush=-1,h}else if(0===e.avail_in&&P(t)<=P(n)&&t!==c)return N(e,-5);if(666===i.status&&0!==e.avail_in)return N(e,-5);if(0!==e.avail_in||0!==i.lookahead||t!==l&&666!==i.status){var p=2===i.strategy?function(e,t){for(var n;;){if(0===e.lookahead&&(z(e),0===e.lookahead)){if(t===l)return C;break}if(e.match_length=0,n=a._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(O(e,!1),0===e.strm.avail_out))return C}return e.insert=0,t===c?(O(e,!0),0===e.strm.avail_out?R:I):e.last_lit&&(O(e,!1),0===e.strm.avail_out)?C:k}(i,t):3===i.strategy?function(e,t){for(var n,r,i,o,s=e.window;;){if(e.lookahead<=w){if(z(e),e.lookahead<=w&&t===l)return C;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=A&&0e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=A?(n=a._tr_tally(e,1,e.match_length-A),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=a._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),n&&(O(e,!1),0===e.strm.avail_out))return C}return e.insert=0,t===c?(O(e,!0),0===e.strm.avail_out?R:I):e.last_lit&&(O(e,!1),0===e.strm.avail_out)?C:k}(i,t):r[i.level].func(i,t);if(p!==R&&p!==I||(i.status=666),p===C||p===R)return 0===e.avail_out&&(i.last_flush=-1),h;if(p===k&&(1===t?a._tr_align(i):5!==t&&(a._tr_stored_block(i,0,0,!1),3===t&&(L(i.head),0===i.lookahead&&(i.strstart=0,i.block_start=0,i.insert=0))),D(e),0===e.avail_out))return i.last_flush=-1,h}return t!==c?h:i.wrap<=0?1:(2===i.wrap?(F(i,255&e.adler),F(i,e.adler>>8&255),F(i,e.adler>>16&255),F(i,e.adler>>24&255),F(i,255&e.total_in),F(i,e.total_in>>8&255),F(i,e.total_in>>16&255),F(i,e.total_in>>24&255)):(B(i,e.adler>>>16),B(i,65535&e.adler)),D(e),0=n.w_size&&(0===s&&(L(n.head),n.strstart=0,n.block_start=0,n.insert=0),f=new i.Buf8(n.w_size),i.arraySet(f,t,p-n.w_size,n.w_size,0),t=f,p=n.w_size),u=e.avail_in,l=e.next_in,c=e.input,e.avail_in=p,e.next_in=0,e.input=t,z(n);n.lookahead>=A;){for(r=n.strstart,a=n.lookahead-(A-1);n.ins_h=(n.ins_h<>>=b=_>>>24,p-=b,0==(b=_>>>16&255))M[a++]=65535&_;else{if(!(16&b)){if(!(64&b)){_=v[(65535&_)+(f&(1<>>=b,p-=b),p<15&&(f+=T[r++]<>>=b=_>>>24,p-=b,!(16&(b=_>>>16&255))){if(!(64&b)){_=m[(65535&_)+(f&(1<>>=b,p-=b,(b=a-o)>3,f&=(1<<(p-=x<<3))-1,e.next_in=r,e.next_out=a,e.avail_in=r>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function m(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new r.Buf16(320),this.work=new r.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function g(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=d,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new r.Buf32(f),t.distcode=t.distdyn=new r.Buf32(p),t.sane=1,t.back=-1,c):h}function y(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,g(e)):h}function _(e,t){var n,r;return e&&e.state?(r=e.state,t<0?(n=0,t=-t):(n=1+(t>>4),t<48&&(t&=15)),t&&(t<8||15=o.wsize?(r.arraySet(o.window,t,n-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):(i<(a=o.wsize-o.wnext)&&(a=i),r.arraySet(o.window,t,n-i,a,o.wnext),(i-=a)?(r.arraySet(o.window,t,n-i,i,0),o.wnext=i,o.whave=o.wsize):(o.wnext+=a,o.wnext===o.wsize&&(o.wnext=0),o.whave>>8&255,n.check=a(n.check,z,2,0),x=b=0,n.mode=2;break}if(n.flags=0,n.head&&(n.head.done=!1),!(1&n.wrap)||(((255&b)<<8)+(b>>8))%31){e.msg="incorrect header check",n.mode=30;break}if(8!=(15&b)){e.msg="unknown compression method",n.mode=30;break}if(x-=4,D=8+(15&(b>>>=4)),0===n.wbits)n.wbits=D;else if(D>n.wbits){e.msg="invalid window size",n.mode=30;break}n.dmax=1<>8&1),512&n.flags&&(z[0]=255&b,z[1]=b>>>8&255,n.check=a(n.check,z,2,0)),x=b=0,n.mode=3;case 3:for(;x<32;){if(0===y)break e;y--,b+=f[m++]<>>8&255,z[2]=b>>>16&255,z[3]=b>>>24&255,n.check=a(n.check,z,4,0)),x=b=0,n.mode=4;case 4:for(;x<16;){if(0===y)break e;y--,b+=f[m++]<>8),512&n.flags&&(z[0]=255&b,z[1]=b>>>8&255,n.check=a(n.check,z,2,0)),x=b=0,n.mode=5;case 5:if(1024&n.flags){for(;x<16;){if(0===y)break e;y--,b+=f[m++]<>>8&255,n.check=a(n.check,z,2,0)),x=b=0}else n.head&&(n.head.extra=null);n.mode=6;case 6:if(1024&n.flags&&(y<(M=n.length)&&(M=y),M&&(n.head&&(D=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Array(n.head.extra_len)),r.arraySet(n.head.extra,f,m,M,D)),512&n.flags&&(n.check=a(n.check,f,M,m)),y-=M,m+=M,n.length-=M),n.length))break e;n.length=0,n.mode=7;case 7:if(2048&n.flags){if(0===y)break e;for(M=0;D=f[m+M++],n.head&&D&&n.length<65536&&(n.head.name+=String.fromCharCode(D)),D&&M>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=12;break;case 10:for(;x<32;){if(0===y)break e;y--,b+=f[m++]<>>=7&x,x-=7&x,n.mode=27;break}for(;x<3;){if(0===y)break e;y--,b+=f[m++]<>>=1)){case 0:n.mode=14;break;case 1:if(w(n),n.mode=20,6!==t)break;b>>>=2,x-=2;break e;case 2:n.mode=17;break;case 3:e.msg="invalid block type",n.mode=30}b>>>=2,x-=2;break;case 14:for(b>>>=7&x,x-=7&x;x<32;){if(0===y)break e;y--,b+=f[m++]<>>16^65535)){e.msg="invalid stored block lengths",n.mode=30;break}if(n.length=65535&b,x=b=0,n.mode=15,6===t)break e;case 15:n.mode=16;case 16:if(M=n.length){if(y>>=5,x-=5,n.ndist=1+(31&b),b>>>=5,x-=5,n.ncode=4+(15&b),b>>>=4,x-=4,286>>=3,x-=3}for(;n.have<19;)n.lens[V[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,F={bits:n.lenbits},O=s(0,n.lens,0,19,n.lencode,0,n.work,F),n.lenbits=F.bits,O){e.msg="invalid code lengths set",n.mode=30;break}n.have=0,n.mode=19;case 19:for(;n.have>>16&255,I=65535&U,!((k=U>>>24)<=x);){if(0===y)break e;y--,b+=f[m++]<>>=k,x-=k,n.lens[n.have++]=I;else{if(16===I){for(B=k+2;x>>=k,x-=k,0===n.have){e.msg="invalid bit length repeat",n.mode=30;break}D=n.lens[n.have-1],M=3+(3&b),b>>>=2,x-=2}else if(17===I){for(B=k+3;x>>=k)),b>>>=3,x-=3}else{for(B=k+7;x>>=k)),b>>>=7,x-=7}if(n.have+M>n.nlen+n.ndist){e.msg="invalid bit length repeat",n.mode=30;break}for(;M--;)n.lens[n.have++]=D}}if(30===n.mode)break;if(0===n.lens[256]){e.msg="invalid code -- missing end-of-block",n.mode=30;break}if(n.lenbits=9,F={bits:n.lenbits},O=s(u,n.lens,0,n.nlen,n.lencode,0,n.work,F),n.lenbits=F.bits,O){e.msg="invalid literal/lengths set",n.mode=30;break}if(n.distbits=6,n.distcode=n.distdyn,F={bits:n.distbits},O=s(l,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,F),n.distbits=F.bits,O){e.msg="invalid distances set",n.mode=30;break}if(n.mode=20,6===t)break e;case 20:n.mode=21;case 21:if(6<=y&&258<=_){e.next_out=g,e.avail_out=_,e.next_in=m,e.avail_in=y,n.hold=b,n.bits=x,o(e,A),g=e.next_out,p=e.output,_=e.avail_out,m=e.next_in,f=e.input,y=e.avail_in,b=n.hold,x=n.bits,12===n.mode&&(n.back=-1);break}for(n.back=0;R=(U=n.lencode[b&(1<>>16&255,I=65535&U,!((k=U>>>24)<=x);){if(0===y)break e;y--,b+=f[m++]<>N)])>>>16&255,I=65535&U,!(N+(k=U>>>24)<=x);){if(0===y)break e;y--,b+=f[m++]<>>=N,x-=N,n.back+=N}if(b>>>=k,x-=k,n.back+=k,n.length=I,0===R){n.mode=26;break}if(32&R){n.back=-1,n.mode=12;break}if(64&R){e.msg="invalid literal/length code",n.mode=30;break}n.extra=15&R,n.mode=22;case 22:if(n.extra){for(B=n.extra;x>>=n.extra,x-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=23;case 23:for(;R=(U=n.distcode[b&(1<>>16&255,I=65535&U,!((k=U>>>24)<=x);){if(0===y)break e;y--,b+=f[m++]<>N)])>>>16&255,I=65535&U,!(N+(k=U>>>24)<=x);){if(0===y)break e;y--,b+=f[m++]<>>=N,x-=N,n.back+=N}if(b>>>=k,x-=k,n.back+=k,64&R){e.msg="invalid distance code",n.mode=30;break}n.offset=I,n.extra=15&R,n.mode=24;case 24:if(n.extra){for(B=n.extra;x>>=n.extra,x-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg="invalid distance too far back",n.mode=30;break}n.mode=25;case 25:if(0===_)break e;if(M=A-_,n.offset>M){if((M=n.offset-M)>n.whave&&n.sane){e.msg="invalid distance too far back",n.mode=30;break}E=M>n.wnext?(M-=n.wnext,n.wsize-M):n.wnext-M,M>n.length&&(M=n.length),C=n.window}else C=p,E=g-n.offset,M=n.length;for(_y?(b=F[B+h[w]],P[L+h[w]]):(b=96,0),f=1<>k)+(p-=f)]=_<<24|b<<16|x,0!==p;);for(f=1<>=1;if(0!==f?(N&=f-1,N+=f):N=0,w++,0==--D[A]){if(A===M)break;A=t[n+h[w]]}if(E>>7)]}function F(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function B(e,t,n){e.bi_valid>v-n?(e.bi_buf|=t<>v-e.bi_valid,e.bi_valid+=n-v):(e.bi_buf|=t<>>=1,n<<=1,0<--t;);return n>>>1}function V(e,t,n){var r,i,a=new Array(p+1),o=0;for(r=1;r<=p;r++)a[r]=o=o+n[r-1]<<1;for(i=0;i<=t;i++){var s=e[2*i+1];0!==s&&(e[2*i]=z(a[s]++,s))}}function H(e){var t;for(t=0;t>1;1<=n;n--)j(e,a,n);for(i=u;n=e.heap[1],e.heap[1]=e.heap[e.heap_len--],j(e,a,1),r=e.heap[1],e.heap[--e.heap_max]=n,e.heap[--e.heap_max]=r,a[2*i]=a[2*n]+a[2*r],e.depth[i]=(e.depth[n]>=e.depth[r]?e.depth[n]:e.depth[r])+1,a[2*n+1]=a[2*r+1]=i,e.heap[1]=i++,j(e,a,1),2<=e.heap_len;);e.heap[--e.heap_max]=e.heap[1],function(e,t){var n,r,i,a,o,s,u=t.dyn_tree,l=t.max_code,c=t.stat_desc.static_tree,h=t.stat_desc.has_stree,d=t.stat_desc.extra_bits,v=t.stat_desc.extra_base,m=t.stat_desc.max_length,g=0;for(a=0;a<=p;a++)e.bl_count[a]=0;for(u[2*e.heap[e.heap_max]+1]=0,n=e.heap_max+1;n>=7;r>>=1)if(1&n&&0!==e.dyn_ltree[2*t])return i;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return a;for(t=32;t>>3,(s=e.static_len+3+7>>>3)<=o&&(o=s)):o=s=n+5,n+4<=o&&-1!==t?Z(e,t,n,r):4===e.strategy||s===o?(B(e,2+(r?1:0),3),Q(e,T,M)):(B(e,4+(r?1:0),3),function(e,t,n,r){var i;for(B(e,t-257,5),B(e,n-1,5),B(e,r-4,4),i=0;i>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&n,e.last_lit++,0===t?e.dyn_ltree[2*n]++:(e.matches++,t--,e.dyn_ltree[2*(C[n]+l+1)]++,e.dyn_dtree[2*O(t)]++),e.last_lit===e.lit_bufsize-1},n._tr_align=function(e){B(e,2,3),U(e,g,T),function(e){16===e.bi_valid?(F(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):8<=e.bi_valid&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}(e)}},{"../utils/common":41}],53:[function(e,t,n){t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(e,t,n){(function(e){!function(e,t){if(!e.setImmediate){var n,r,i,a,o=1,s={},u=!1,l=e.document,c=Object.getPrototypeOf&&Object.getPrototypeOf(e);c=c&&c.setTimeout?c:e,n="[object process]"==={}.toString.call(e.process)?function(e){process.nextTick(function(){d(e)})}:function(){if(e.postMessage&&!e.importScripts){var t=!0,n=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=n,t}}()?(a="setImmediate$"+Math.random()+"$",e.addEventListener?e.addEventListener("message",f,!1):e.attachEvent("onmessage",f),function(t){e.postMessage(a+t,"*")}):e.MessageChannel?((i=new MessageChannel).port1.onmessage=function(e){d(e.data)},function(e){i.port2.postMessage(e)}):l&&"onreadystatechange"in l.createElement("script")?(r=l.documentElement,function(e){var t=l.createElement("script");t.onreadystatechange=function(){d(e),t.onreadystatechange=null,r.removeChild(t),t=null},r.appendChild(t)}):function(e){setTimeout(d,0,e)},c.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),r=0;r=2&&(n=n.slice(2)):d(a)?n=i[4]:a?s&&(n=n.slice(2)):c>=2&&d(t.protocol)&&(n=i[4]),{protocol:a,slashes:s||d(a),slashesCount:c,rest:n}}function p(n,i,a){if(n=(n=u(n)).replace(r,""),!(this instanceof p))return new p(n,i,a);var o,c,v,m,g,y,_=l.slice(),b=P(i),x=this,S=0;for("object"!==b&&"string"!==b&&(a=i,i=null),a&&"function"!=typeof a&&(a=t.parse),o=!(c=f(n||"",i=h(i))).protocol&&!c.slashes,x.slashes=c.slashes||o&&i.slashes,x.protocol=c.protocol||i.protocol||"",n=c.rest,("file:"===c.protocol&&(2!==c.slashesCount||s.test(n))||!c.slashes&&(c.protocol||c.slashesCount<2||!d(x.protocol)))&&(_[3]=[/(.*)/,"pathname"]);S<_.length;S++)"function"!=typeof(m=_[S])?(v=m[0],y=m[1],v!=v?x[y]=n:"string"==typeof v?~(g="@"===v?n.lastIndexOf(v):n.indexOf(v))&&("number"==typeof m[2]?(x[y]=n.slice(0,g),n=n.slice(g+m[2])):(x[y]=n.slice(g),n=n.slice(0,g))):(g=v.exec(n))&&(x[y]=g[1],n=n.slice(0,g.index)),x[y]=x[y]||o&&m[3]&&i[y]||"",m[4]&&(x[y]=x[y].toLowerCase())):n=m(n,x);a&&(x.query=a(x.query)),o&&i.slashes&&"/"!==x.pathname.charAt(0)&&(""!==x.pathname||""!==i.pathname)&&(x.pathname=function(e,t){if(""===e)return t;for(var n=(t||"/").split("/").slice(0,-1).concat(e.split("/")),r=n.length,i=n[r-1],a=!1,o=0;r--;)"."===n[r]?n.splice(r,1):".."===n[r]?(n.splice(r,1),o++):o&&(0===r&&(a=!0),n.splice(r,1),o--);return a&&n.unshift(""),"."!==i&&".."!==i||n.push(""),n.join("/")}(x.pathname,i.pathname)),"/"!==x.pathname.charAt(0)&&d(x.protocol)&&(x.pathname="/"+x.pathname),e(x.port,x.protocol)||(x.host=x.hostname,x.port=""),x.username=x.password="",x.auth&&(~(g=x.auth.indexOf(":"))?(x.username=x.auth.slice(0,g),x.username=encodeURIComponent(decodeURIComponent(x.username)),x.password=x.auth.slice(g+1),x.password=encodeURIComponent(decodeURIComponent(x.password))):x.username=encodeURIComponent(decodeURIComponent(x.auth)),x.auth=x.password?x.username+":"+x.password:x.username),x.origin="file:"!==x.protocol&&d(x.protocol)&&x.host?x.protocol+"//"+x.host:"null",x.href=x.toString()}return p.prototype={set:function(n,r,i){var o=this;switch(n){case"query":"string"==typeof r&&r.length&&(r=(i||t.parse)(r)),o[n]=r;break;case"port":o[n]=r,e(r,o.protocol)?r&&(o.host=o.hostname+":"+r):(o.host=o.hostname,o[n]="");break;case"hostname":o[n]=r,o.port&&(r+=":"+o.port),o.host=r;break;case"host":o[n]=r,a.test(r)?(r=r.split(":"),o.port=r.pop(),o.hostname=r.join(":")):(o.hostname=r,o.port="");break;case"protocol":o.protocol=r.toLowerCase(),o.slashes=!i;break;case"pathname":case"hash":if(r){var s="pathname"===n?"/":"#";o[n]=r.charAt(0)!==s?s+r:r}else o[n]=r;break;case"username":case"password":o[n]=encodeURIComponent(r);break;case"auth":var u=r.indexOf(":");~u?(o.username=r.slice(0,u),o.username=encodeURIComponent(decodeURIComponent(o.username)),o.password=r.slice(u+1),o.password=encodeURIComponent(decodeURIComponent(o.password))):o.username=encodeURIComponent(decodeURIComponent(r))}for(var c=0;c
'};function i(e,t,n){return en?n:e}function a(e){return 100*(-1+e)}function o(e,t,n){var i;return(i="translate3d"===r.positionUsing?{transform:"translate3d("+a(e)+"%,0,0)"}:"translate"===r.positionUsing?{transform:"translate("+a(e)+"%,0)"}:{"margin-left":a(e)+"%"}).transition="all "+t+"ms "+n,i}n.configure=function(e){var t,n;for(t in e)void 0!==(n=e[t])&&e.hasOwnProperty(t)&&(r[t]=n);return this},n.status=null,n.set=function(e){var t=n.isStarted();e=i(e,r.minimum,1),n.status=1===e?null:e;var a=n.render(!t),l=a.querySelector(r.barSelector),c=r.speed,h=r.easing;return a.offsetWidth,s(function(t){""===r.positionUsing&&(r.positionUsing=n.getPositioningCSS()),u(l,o(e,c,h)),1===e?(u(a,{transition:"none",opacity:1}),a.offsetWidth,setTimeout(function(){u(a,{transition:"all "+c+"ms linear",opacity:0}),setTimeout(function(){n.remove(),t()},c)},c)):setTimeout(t,c)}),this},n.isStarted=function(){return"number"==typeof n.status},n.start=function(){n.status||n.set(0);var e=function(){setTimeout(function(){n.status&&(n.trickle(),e())},r.trickleSpeed)};return r.trickle&&e(),this},n.done=function(e){return e||n.status?n.inc(.3+.5*Math.random()).set(1):this},n.inc=function(e){var t=n.status;return t?("number"!=typeof e&&(e=(1-t)*i(Math.random()*t,.1,.95)),t=i(t+e,0,.994),n.set(t)):n.start()},n.trickle=function(){return n.inc(Math.random()*r.trickleRate)},e=0,t=0,n.promise=function(r){return r&&"resolved"!==r.state()?(0===t&&n.start(),e++,t++,r.always(function(){0===--t?(e=0,n.done()):n.set((e-t)/e)}),this):this},n.render=function(e){if(n.isRendered())return document.getElementById("nprogress");c(document.documentElement,"nprogress-busy");var t=document.createElement("div");t.id="nprogress",t.innerHTML=r.template;var i,o=t.querySelector(r.barSelector),s=e?"-100":a(n.status||0),l=document.querySelector(r.parent);return u(o,{transition:"all 0 linear",transform:"translate3d("+s+"%,0,0)"}),r.showSpinner||(i=t.querySelector(r.spinnerSelector))&&f(i),l!=document.body&&c(l,"nprogress-custom-parent"),l.appendChild(t),t},n.remove=function(){h(document.documentElement,"nprogress-busy"),h(document.querySelector(r.parent),"nprogress-custom-parent");var e=document.getElementById("nprogress");e&&f(e)},n.isRendered=function(){return!!document.getElementById("nprogress")},n.getPositioningCSS=function(){var e=document.body.style,t="WebkitTransform"in e?"Webkit":"MozTransform"in e?"Moz":"msTransform"in e?"ms":"OTransform"in e?"O":"";return t+"Perspective"in e?"translate3d":t+"Transform"in e?"translate":"margin"};var s=function(){var e=[];function t(){var n=e.shift();n&&n(t)}return function(n){e.push(n),1==e.length&&t()}}(),u=function(){var e=["Webkit","O","Moz","ms"],t={};function n(e){return e.replace(/^-ms-/,"ms-").replace(/-([\da-z])/gi,function(e,t){return t.toUpperCase()})}function r(t){var n=document.body.style;if(t in n)return t;for(var r,i=e.length,a=t.charAt(0).toUpperCase()+t.slice(1);i--;)if((r=e[i]+a)in n)return r;return t}function i(e){return e=n(e),t[e]||(t[e]=r(e))}function a(e,t,n){t=i(t),e.style[t]=n}return function(e,t){var n,r,i=arguments;if(2==i.length)for(n in t)void 0!==(r=t[n])&&t.hasOwnProperty(n)&&a(e,n,r);else a(e,i[1],i[2])}}();function l(e,t){return("string"==typeof e?e:d(e)).indexOf(" "+t+" ")>=0}function c(e,t){var n=d(e),r=n+t;l(n,t)||(e.className=r.substring(1))}function h(e,t){var n,r=d(e);l(e,t)&&(n=r.replace(" "+t+" "," "),e.className=n.substring(1,n.length-1))}function d(e){return(" "+(e.className||"")+" ").replace(/\s+/gi," ")}function f(e){e&&e.parentNode&&e.parentNode.removeChild(e)}return n}()}(mU)),mU.exports),AU=nU(SU);!function(e){e.Idle="Idle",e.Listening="Listening",e.Responding="Responding",e.Thinking="Thinking"}(gU||(gU={})),function(e){e.cpu="cpu",e.gpu="gpu"}(yU||(yU={})),function(e){e.High="High",e.Low="Low",e.Standard="Standard"}(_U||(_U={})),function(e){e.GAUSSIAN_SPLATTING_3D="GAUSSIAN_SPLATTING_3D",e.REALTIME_AVATAR_3D="REALTIME_AVATAR_3D",e.REALTIME_AVATAR_LIVE2D="REALTIME_AVATAR_LIVE2D",e.REALTIME_AVATAR_MOBILE2D="REALTIME_AVATAR_MOBILE2D"}(bU||(bU={})),function(e){e.Idle="idle",e.Listening="listen",e.Responding="speak",e.Thinking="think"}(xU||(xU={}));var wU=function(){function e(t,n,r){A(this,e);var i=[],a=[],o=[],s=[],u=[];this.mixer=t;for(var l=r.hello.size,c=r.idle.size+l,h=r.listen.size+c,d=r.speak.size+h,f=r.think.size+d,p=0;p0&&void 0!==arguments[0]&&arguments[0];switch(this.curPlaying()){case gU.Idle:e.LastAction=this.hello.actions[this.hello.stage];break;case gU.Listening:e.LastAction=this.listen.actions[this.listen.stage];break;case gU.Thinking:e.LastAction=this.think.actions[this.think.stage];break;case gU.Responding:e.LastAction=this.speak.actions[this.speak.stage];break;default:e.LastAction=void 0}e.LastAction&&(e.LastAction.loop=lc,e.LastAction.clampWhenFinished=!0,e.SetWeight(e.LastAction,1)),t&&(e.PauseAllActions(),e.actions.forEach(function(t){t.time=0,e.SetWeight(t,0)}),e.LastAction=void 0),this.hello.isPlaying=!1,this.idle.isPlaying=!1,this.listen.isPlaying=!1,this.think.isPlaying=!1,this.speak.isPlaying=!1}},{key:"update",value:function(t){if(!e.IsBlending)if(e.CurPlaying=this.curPlaying(),null==e.CurPlaying)switch(t){case gU.Idle:this.idle.update(t);break;case gU.Listening:this.listen.update(t);break;case gU.Thinking:this.think.update(t);break;case gU.Responding:this.speak.update(t);break;default:this.idle.update(t)}else switch(e.CurPlaying){case gU.Idle:this.idle.update(t);break;case gU.Listening:this.listen.update(t);break;case gU.Thinking:this.think.update(t);break;case gU.Responding:this.speak.update(t);break;default:this.idle.update(t)}}},{key:"updateBS",value:function(e){var t={browDownLeft:0,browDownRight:0,browInnerUp:0,browOuterUpLeft:0,browOuterUpRight:0,mouthCheekPuff:0,cheekSquintLeft:0,cheekSquintRight:0,eyeBlinkLeft:0,eyeBlinkRight:0,eyeLookDownLeft:0,eyeLookDownRight:0,eyeLookInLeft:0,eyeLookInRight:0,eyeLookOutLeft:0,eyeLookOutRight:0,eyeLookUpLeft:0,eyeLookUpRight:0,eyeSquintLeft:0,eyeSquintRight:0,eyeWideLeft:0,eyeWideRight:0,jawForward:0,jawLeft:0,jawOpen:0,jawRight:0,mouthClose:0,mouthDimpleLeft:0,mouthDimpleRight:0,mouthFrownLeft:0,mouthFrownRight:0,mouthFunnel:0,mouthLeft:0,mouthLowerDownLeft:0,mouthLowerDownRight:0,mouthPressLeft:0,mouthPressRight:0,mouthPucker:0,mouthRight:0,mouthRollLower:0,mouthRollUpper:0,mouthShrugLower:0,mouthShrugUpper:0,mouthSmileLeft:0,mouthSmileRight:0,mouthStretchLeft:0,mouthStretchRight:0,mouthUpperUpLeft:0,mouthUpperUpRight:0,noseSneerLeft:0,noseSneerRight:0,tongueOut:0};return null!=e&&(t=e),t}}],[{key:"SetWeight",value:function(e,t){e.enabled=!0,e.setEffectiveTimeScale(1),e.setEffectiveWeight(t)}},{key:"PrepareCrossFade",value:function(t,n,r){var i=r;e.UnPauseAllActions(),e.ExecuteCrossFade(t,n,i),e.IsBlending=!0,setTimeout(function(){e.IsBlending=!1},r+.1)}},{key:"PauseAllActions",value:function(){e.actions.forEach(function(e){e.paused=!0})}},{key:"UnPauseAllActions",value:function(){e.actions.forEach(function(e){e.paused=!1})}},{key:"ExecuteCrossFade",value:function(t,n,r){e.SetWeight(n,1),n.time=0,t.crossFadeTo(n,r,!0)}}])}();wU.IsBlending=!1,wU.actions=[],wU.NeedReset=!1,wU.NeedFullReset=!1;var TU=function(){return T(function e(t,n){A(this,e),this.isPlaying=!1,this.stage=0,this.actions=[],this.blendingTime=.5,this.isGroup=!1,this.actions=t,this.isGroup=n},[{key:"dispose",value:function(){this.actions=[]}},{key:"update",value:function(e){}}])}(),MU=function(e){function t(e,n){return A(this,t),y(this,t,[e,n])}return x(t,e),T(t,[{key:"update",value:function(e){if(null==wU.CurPlaying&&e==gU.Idle&&0==this.isPlaying&&(this.stage=0,this.actions[this.stage].time=0,wU.SetWeight(this.actions[this.stage],1),this.actions[this.stage].loop=cc,this.actions[this.stage].clampWhenFinished=!1,this.actions[this.stage].paused=!1,this.actions[this.stage].play(),null!=wU.LastAction&&wU.PrepareCrossFade(wU.LastAction,this.actions[this.stage],this.blendingTime),this.isPlaying=!0),wU.CurPlaying==gU.Idle&&e==gU.Idle&&1==this.isPlaying&&this.actions[this.stage].time>this.actions[this.stage].getClip().duration-this.blendingTime){var t=this.stage+1;t>=this.actions.length&&(t=0),this.actions[t].time=0,wU.SetWeight(this.actions[t],1),this.actions[t].loop=cc,this.actions[t].play(),wU.PrepareCrossFade(this.actions[this.stage],this.actions[t],this.blendingTime),this.stage=t}}}])}(TU),EU=function(e){function t(e,n){return A(this,t),y(this,t,[e,n])}return x(t,e),T(t,[{key:"update",value:function(e){null==wU.CurPlaying&&e==gU.Idle&&0==this.isPlaying&&(this.stage=0,this.actions[this.stage].time=0,wU.SetWeight(this.actions[this.stage],1),this.actions[this.stage].loop=cc,this.actions[this.stage].clampWhenFinished=!1,this.actions[this.stage].paused=!1,this.actions[this.stage].play(),null!=wU.LastAction&&wU.PrepareCrossFade(wU.LastAction,this.actions[this.stage],this.blendingTime),this.isPlaying=!0),wU.CurPlaying==gU.Idle&&e!=gU.Idle&&1==this.isPlaying&&0==this.stage&&(this.actions[this.stage].loop=lc,this.actions[this.stage].clampWhenFinished=!0,this.isPlaying=!1,wU.LastAction=this.actions[this.stage])}}])}(TU),CU=function(e){function t(e,n){return A(this,t),y(this,t,[e,n])}return x(t,e),T(t,[{key:"update",value:function(e){null==wU.CurPlaying&&e==gU.Listening&&0==this.isPlaying&&(this.stage=0,this.actions[this.stage].time=0,this.actions[this.stage].play(),wU.SetWeight(this.actions[this.stage],1),this.actions[this.stage].loop=this.isGroup?lc:cc,this.actions[this.stage].clampWhenFinished=!!this.isGroup,null!=wU.LastAction&&wU.PrepareCrossFade(wU.LastAction,this.actions[this.stage],this.blendingTime),this.isPlaying=!0),this.isGroup&&(wU.CurPlaying==gU.Listening&&e==gU.Listening&&1==this.isPlaying&&0==this.stage&&this.actions[this.stage].time>this.actions[this.stage].getClip().duration-this.blendingTime&&(this.actions[this.stage+1].time=0,wU.SetWeight(this.actions[this.stage+1],1),this.actions[this.stage+1].loop=cc,this.actions[this.stage+1].play(),wU.PrepareCrossFade(this.actions[this.stage],this.actions[this.stage+1],this.blendingTime),this.stage=1),wU.CurPlaying!=gU.Listening||e==gU.Listening||1!=this.isPlaying||0!=this.stage&&1!=this.stage||(this.actions[2].time=0,this.actions[2].play(),wU.SetWeight(this.actions[2],1),this.actions[2].loop=lc,wU.PrepareCrossFade(this.actions[this.stage],this.actions[2],this.blendingTime),this.stage=2)),wU.CurPlaying==gU.Listening&&e!=gU.Listening&&1==this.isPlaying&&this.stage==(this.isGroup?this.actions.length-1:0)&&(this.actions[this.stage].loop=lc,this.actions[this.stage].clampWhenFinished=!0,this.isPlaying=!1,wU.LastAction=this.actions[this.stage])}}])}(TU),kU=function(e){function t(e,n){return A(this,t),y(this,t,[e,n])}return x(t,e),T(t,[{key:"update",value:function(e){null==wU.CurPlaying&&e==gU.Thinking&&0==this.isPlaying&&(this.stage=0,this.actions[this.stage].time=0,this.actions[this.stage].play(),wU.SetWeight(this.actions[this.stage],1),this.actions[this.stage].loop=lc,null!=wU.LastAction&&wU.PrepareCrossFade(wU.LastAction,this.actions[this.stage],this.blendingTime),this.isPlaying=!0),this.isGroup&&(wU.CurPlaying==gU.Thinking&&e==gU.Thinking&&1==this.isPlaying&&0==this.stage&&this.actions[this.stage].time>this.actions[this.stage].getClip().duration-this.blendingTime&&(this.actions[this.stage+1].time=0,this.actions[this.stage+1].play(),wU.SetWeight(this.actions[this.stage+1],1),this.actions[this.stage+1].loop=cc,wU.PrepareCrossFade(this.actions[this.stage],this.actions[this.stage+1],this.blendingTime),this.stage=1),wU.CurPlaying!=gU.Thinking||e==gU.Thinking||1!=this.isPlaying||0!=this.stage&&1!=this.stage||(this.actions[2].time=0,this.actions[2].play(),wU.SetWeight(this.actions[2],1),this.actions[2].loop=lc,wU.PrepareCrossFade(this.actions[this.stage],this.actions[2],this.blendingTime),this.stage=2)),wU.CurPlaying==gU.Thinking&&e!=gU.Thinking&&1==this.isPlaying&&this.stage==(this.isGroup?this.actions.length-1:0)&&(this.actions[this.stage].loop=lc,this.actions[this.stage].clampWhenFinished=!0,this.actions[this.stage].time>this.actions[this.stage].getClip().duration-.3&&(this.isPlaying=!1,wU.LastAction=this.actions[this.stage]))}}])}(TU),RU=function(e){function t(e,n){return A(this,t),y(this,t,[e,n])}return x(t,e),T(t,[{key:"getRandonNumber",value:function(e,t){var n=e-t;return t+Math.round(Math.random()*n)}},{key:"update",value:function(e){if(null==wU.CurPlaying&&e==gU.Responding&&0==this.isPlaying&&(this.stage=Math.ceil(this.getRandonNumber(0,this.actions.length-1)),this.actions[this.stage].time=0,this.actions[this.stage].play(),wU.SetWeight(this.actions[this.stage],1),this.actions[this.stage].loop=lc,this.actions[this.stage].clampWhenFinished=!0,null!=wU.LastAction&&wU.PrepareCrossFade(wU.LastAction,this.actions[this.stage],this.blendingTime),this.isPlaying=!0),wU.CurPlaying==gU.Responding&&e==gU.Responding&&1==this.isPlaying&&this.actions[this.stage].time>=this.actions[this.stage].getClip().duration-this.blendingTime){var t=this.actions[this.stage];this.stage=(this.stage+Math.ceil(this.getRandonNumber(1,this.actions.length-1)))%this.actions.length,this.actions[this.stage].time=0,this.actions[this.stage].play(),wU.SetWeight(this.actions[this.stage],1),this.actions[this.stage].loop=lc,this.actions[this.stage].clampWhenFinished=!0,wU.PrepareCrossFade(t,this.actions[this.stage],this.blendingTime)}wU.CurPlaying==gU.Responding&&e!=gU.Responding&&1==this.isPlaying&&(this.actions[this.stage].loop=lc,this.actions[this.stage].clampWhenFinished=!0,this.isPlaying=!1,wU.LastAction=this.actions[this.stage])}}])}(TU);function IU(e,t){if(0===t)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),e;if(2===t||1===t){var n=e.getIndex();if(null===n){var r=[],i=e.getAttribute("position");if(void 0===i)return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),e;for(var a=0;a=2.0 are supported."));else{var u=new Cz(i,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});u.fileLoader.setRequestHeader(this.requestHeader);for(var l=0;l=0&&void 0===o[d]&&console.warn('THREE.GLTFLoader: Unknown extension "'+d+'".')}}u.setExtensions(a),u.setPlugins(o),u.parse(n,r)}}},{key:"parseAsync",value:function(e,t){var n=this;return new Promise(function(r,i){n.parse(e,t,r,i)})}}])}(mv);function PU(){var e={};return{get:function(t){return e[t]},add:function(t,n){e[t]=n},remove:function(t){delete e[t]},removeAll:function(){e={}}}}var LU={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_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",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",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"},DU=function(){return T(function e(t){A(this,e),this.parser=t,this.name=LU.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}},[{key:"_markDefs",value:function(){for(var e=this.parser,t=this.parser.json.nodes||[],n=0,r=t.length;n=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,i.source,a)}}])}(),YU=function(){return T(function e(t){A(this,e),this.parser=t,this.name=LU.EXT_TEXTURE_WEBP,this.isSupported=null},[{key:"loadTexture",value:function(e){var t=this.name,n=this.parser,r=n.json,i=r.textures[e];if(!i.extensions||!i.extensions[t])return null;var a=i.extensions[t],o=r.images[a.source],s=n.textureLoader;if(o.uri){var u=n.options.manager.getHandler(o.uri);null!==u&&(s=u)}return this.detectSupport().then(function(i){if(i)return n.loadTextureImage(e,a.source,s);if(r.extensionsRequired&&r.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return n.loadTexture(e)})}},{key:"detectSupport",value:function(){return this.isSupported||(this.isSupported=new Promise(function(e){var t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(1===t.height)}})),this.isSupported}}])}(),KU=function(){return T(function e(t){A(this,e),this.parser=t,this.name=LU.EXT_TEXTURE_AVIF,this.isSupported=null},[{key:"loadTexture",value:function(e){var t=this.name,n=this.parser,r=n.json,i=r.textures[e];if(!i.extensions||!i.extensions[t])return null;var a=i.extensions[t],o=r.images[a.source],s=n.textureLoader;if(o.uri){var u=n.options.manager.getHandler(o.uri);null!==u&&(s=u)}return this.detectSupport().then(function(i){if(i)return n.loadTextureImage(e,a.source,s);if(r.extensionsRequired&&r.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return n.loadTexture(e)})}},{key:"detectSupport",value:function(){return this.isSupported||(this.isSupported=new Promise(function(e){var t=new Image;t.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",t.onload=t.onerror=function(){e(1===t.height)}})),this.isSupported}}])}(),ZU=function(){return T(function e(t){A(this,e),this.name=LU.EXT_MESHOPT_COMPRESSION,this.parser=t},[{key:"loadBufferView",value:function(e){var t=this.parser.json,n=t.bufferViews[e];if(n.extensions&&n.extensions[this.name]){var r=n.extensions[this.name],i=this.parser.getDependency("buffer",r.buffer),a=this.parser.options.meshoptDecoder;if(!a||!a.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return i.then(function(e){var t=r.byteOffset||0,n=r.byteLength||0,i=r.count,o=r.byteStride,s=new Uint8Array(e,t,n);return a.decodeGltfBufferAsync?a.decodeGltfBufferAsync(i,o,s,r.mode,r.filter).then(function(e){return e.buffer}):a.ready.then(function(){var e=new ArrayBuffer(i*o);return a.decodeGltfBuffer(new Uint8Array(e),i,o,s,r.mode,r.filter),e})})}return null}}])}(),JU=function(){return T(function e(t){A(this,e),this.name=LU.EXT_MESH_GPU_INSTANCING,this.parser=t},[{key:"createNodeMesh",value:function(e){var t=this,n=this.parser.json,r=n.nodes[e];if(!r.extensions||!r.extensions[this.name]||void 0===r.mesh)return null;var i,a=L(n.meshes[r.mesh].primitives);try{for(a.s();!(i=a.n()).done;){var o=i.value;if(o.mode!==lz.TRIANGLES&&o.mode!==lz.TRIANGLE_STRIP&&o.mode!==lz.TRIANGLE_FAN&&void 0!==o.mode)return null}}catch(d){a.e(d)}finally{a.f()}var s=r.extensions[this.name].attributes,u=[],l={},c=function(e){u.push(t.parser.getDependency("accessor",s[e]).then(function(t){return l[e]=t,l[e]}))};for(var h in s)c(h);return u.length<1?null:(u.push(this.parser.createNodeMesh(e)),Promise.all(u).then(function(e){var n,r=e.pop(),i=r.isGroup?r.children:[r],a=e[0].count,o=[],s=L(i);try{for(s.s();!(n=s.n()).done;){for(var u=n.value,c=new Gh,h=new ph,f=new fh,p=new ph(1,1,1),v=new cp(u.geometry,u.material,a),m=0;m0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};A(this,e),this.json=t,this.extensions={},this.plugins={},this.options=n,this.cache=new PU,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};var r=!1,i=-1,a=!1,o=-1;if("undefined"!=typeof navigator){var s=navigator.userAgent;r=!0===/^((?!chrome|android).)*safari/i.test(s);var u=s.match(/Version\/(\d+)/);i=r&&u?parseInt(u[1],10):-1,o=(a=s.indexOf("Firefox")>-1)?s.match(/Firefox\/([0-9]+)\./)[1]:-1}"undefined"==typeof createImageBitmap||r&&i<17||a&&o<98?this.textureLoader=new xv(this.options.manager):this.textureLoader=new Uv(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new _v(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)},[{key:"setExtensions",value:function(e){this.extensions=e}},{key:"setPlugins",value:function(e){this.plugins=e}},{key:"parse",value:function(e,t){var n=this,r=this.json,i=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(e){return e._markDefs&&e._markDefs()}),Promise.all(this._invokeAll(function(e){return e.beforeRoot&&e.beforeRoot()})).then(function(){return Promise.all([n.getDependencies("scene"),n.getDependencies("animation"),n.getDependencies("camera")])}).then(function(t){var a={scene:t[0][r.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:r.asset,parser:n,userData:{}};return xz(i,a,r),Sz(a,r),Promise.all(n._invokeAll(function(e){return e.afterRoot&&e.afterRoot(a)})).then(function(){var t,n=L(a.scenes);try{for(n.s();!(t=n.n()).done;){t.value.updateMatrixWorld()}}catch(r){n.e(r)}finally{n.f()}e(a)})}).catch(t)}},{key:"_markDefs",value:function(){for(var e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[],r=0,i=t.length;r=2&&a.setY(T,S[A*s+1]),s>=3&&a.setZ(T,S[A*s+2]),s>=4&&a.setW(T,S[A*s+3]),s>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}a.normalized=f}return a})}},{key:"loadTexture",value:function(e){var t=this.json,n=this.options,r=t.textures[e].source,i=t.images[r],a=this.textureLoader;if(i.uri){var o=n.manager.getHandler(i.uri);null!==o&&(a=o)}return this.loadTextureImage(e,r,a)}},{key:"loadTextureImage",value:function(e,t,n){var r=this,i=this.json,a=i.textures[e],o=i.images[t],s=(o.uri||o.bufferView)+":"+a.sampler;if(this.textureCache[s])return this.textureCache[s];var u=this.loadImageSource(t,n).then(function(t){t.flipY=!1,t.name=a.name||o.name||"",""===t.name&&"string"==typeof o.uri&&!1===o.uri.startsWith("data:image/")&&(t.name=o.uri);var n=(i.samplers||{})[a.sampler]||{};return t.magFilter=hz[n.magFilter]||ll,t.minFilter=hz[n.minFilter]||hl,t.wrapS=dz[n.wrapS]||il,t.wrapT=dz[n.wrapT]||il,t.generateMipmaps=!t.isCompressedTexture&&t.minFilter!==sl&&t.minFilter!==ll,r.associations.set(t,{textures:e}),t}).catch(function(){return null});return this.textureCache[s]=u,u}},{key:"loadImageSource",value:function(e,t){var n=this.json,r=this.options;if(void 0!==this.sourceCache[e])return this.sourceCache[e].then(function(e){return e.clone()});var i=n.images[e],a=self.URL||self.webkitURL,o=i.uri||"",s=!1;if(void 0!==i.bufferView)o=this.getDependency("bufferView",i.bufferView).then(function(e){s=!0;var t=new Blob([e],{type:i.mimeType});return o=a.createObjectURL(t)});else if(void 0===i.uri)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");var u=Promise.resolve(o).then(function(e){return new Promise(function(n,i){var a=n;!0===t.isImageBitmapLoader&&(a=function(e){var t=new sh(e);t.needsUpdate=!0,n(t)}),t.load(Fv.resolveURL(e,r.path),a,void 0,i)})}).then(function(e){var t;return!0===s&&a.revokeObjectURL(o),Sz(e,i),e.userData.mimeType=i.mimeType||((t=i.uri).search(/\.jpe?g($|\?)/i)>0||0===t.search(/^data\:image\/jpeg/)?"image/jpeg":t.search(/\.webp($|\?)/i)>0||0===t.search(/^data\:image\/webp/)?"image/webp":t.search(/\.ktx2($|\?)/i)>0||0===t.search(/^data\:image\/ktx2/)?"image/ktx2":"image/png"),e}).catch(function(e){throw console.error("THREE.GLTFLoader: Couldn't load texture",o),e});return this.sourceCache[e]=u,u}},{key:"assignTexture",value:function(e,t,n,r){var i=this;return this.getDependency("texture",n.index).then(function(a){if(!a)return null;if(void 0!==n.texCoord&&n.texCoord>0&&((a=a.clone()).channel=n.texCoord),i.extensions[LU.KHR_TEXTURE_TRANSFORM]){var o=void 0!==n.extensions?n.extensions[LU.KHR_TEXTURE_TRANSFORM]:void 0;if(o){var s=i.associations.get(a);a=i.extensions[LU.KHR_TEXTURE_TRANSFORM].extendTexture(a,o),i.associations.set(a,s)}}return void 0!==r&&(a.colorSpace=r),e[t]=a,a})}},{key:"assignFinalMaterial",value:function(e){var t=e.geometry,n=e.material,r=void 0===t.attributes.tangent,i=void 0!==t.attributes.color,a=void 0===t.attributes.normal;if(e.isPoints){var o="PointsMaterial:"+n.uuid,s=this.cache.get(o);s||(s=new Np,Ud.prototype.copy.call(s,n),s.color.copy(n.color),s.map=n.map,s.sizeAttenuation=!1,this.cache.add(o,s)),n=s}else if(e.isLine){var u="LineBasicMaterial:"+n.uuid,l=this.cache.get(u);l||(l=new yp,Ud.prototype.copy.call(l,n),l.color.copy(n.color),l.map=n.map,this.cache.add(u,l)),n=l}if(r||i||a){var c="ClonedMaterial:"+n.uuid+":";r&&(c+="derivative-tangents:"),i&&(c+="vertex-colors:"),a&&(c+="flat-shading:");var h=this.cache.get(c);h||(h=n.clone(),i&&(h.vertexColors=!0),a&&(h.flatShading=!0),r&&(h.normalScale&&(h.normalScale.y*=-1),h.clearcoatNormalScale&&(h.clearcoatNormalScale.y*=-1)),this.cache.add(c,h),this.associations.set(h,this.associations.get(n))),n=h}e.material=n}},{key:"getMaterialType",value:function(){return jp}},{key:"loadMaterial",value:function(e){var t,n=this,r=this.json,i=this.extensions,a=r.materials[e],o={},s=[];if((a.extensions||{})[LU.KHR_MATERIALS_UNLIT]){var u=i[LU.KHR_MATERIALS_UNLIT];t=u.getMaterialType(),s.push(u.extendParams(o,a,n))}else{var l=a.pbrMetallicRoughness||{};if(o.color=new Od(1,1,1),o.opacity=1,Array.isArray(l.baseColorFactor)){var c=l.baseColorFactor;o.color.setRGB(c[0],c[1],c[2],bc),o.opacity=c[3]}void 0!==l.baseColorTexture&&s.push(n.assignTexture(o,"map",l.baseColorTexture,_c)),o.metalness=void 0!==l.metallicFactor?l.metallicFactor:1,o.roughness=void 0!==l.roughnessFactor?l.roughnessFactor:1,void 0!==l.metallicRoughnessTexture&&(s.push(n.assignTexture(o,"metalnessMap",l.metallicRoughnessTexture)),s.push(n.assignTexture(o,"roughnessMap",l.metallicRoughnessTexture))),t=this._invokeOne(function(t){return t.getMaterialType&&t.getMaterialType(e)}),s.push(Promise.all(this._invokeAll(function(t){return t.extendMaterialParams&&t.extendMaterialParams(e,o)})))}!0===a.doubleSided&&(o.side=2);var h=a.alphaMode||gz;if(h===_z?(o.transparent=!0,o.depthWrite=!1):(o.transparent=!1,h===yz&&(o.alphaTest=void 0!==a.alphaCutoff?a.alphaCutoff:.5)),void 0!==a.normalTexture&&t!==zd&&(s.push(n.assignTexture(o,"normalMap",a.normalTexture)),o.normalScale=new Vc(1,1),void 0!==a.normalTexture.scale)){var d=a.normalTexture.scale;o.normalScale.set(d,d)}if(void 0!==a.occlusionTexture&&t!==zd&&(s.push(n.assignTexture(o,"aoMap",a.occlusionTexture)),void 0!==a.occlusionTexture.strength&&(o.aoMapIntensity=a.occlusionTexture.strength)),void 0!==a.emissiveFactor&&t!==zd){var f=a.emissiveFactor;o.emissive=(new Od).setRGB(f[0],f[1],f[2],bc)}return void 0!==a.emissiveTexture&&t!==zd&&s.push(n.assignTexture(o,"emissiveMap",a.emissiveTexture,_c)),Promise.all(s).then(function(){var r=new t(o);return a.name&&(r.name=a.name),Sz(r,a),n.associations.set(r,{materials:e}),a.extensions&&xz(i,r,a),r})}},{key:"createUniqueName",value:function(e){var t=Zv.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}},{key:"loadGeometries",value:function(e){var t=this,n=this.extensions,r=this.primitiveCache;function i(e){return n[LU.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,t).then(function(n){return kz(n,e,t)})}for(var a=[],o=0,s=e.length;o0&&Az(f,i),f.name=t.createUniqueName(i.name||"mesh_"+e),Sz(f,i),d.extensions&&xz(r,f,d),t.assignFinalMaterial(f),u.push(f)}for(var v=0,m=u.length;v1?new Lf:1===t.length?t[0]:new gd)!==t[0])for(var s=0,u=t.length;s0){var r=t.morphTargetDictionary;for(var i in r){var a=r[i],o=e.expressionData[i];void 0!==o&&(t.morphTargetInfluences[a]=Math.max(0,Math.min(1,o)))}}}})}},{key:"loadFlameModel",value:function(e,t){return QO(this,void 0,void 0,d().m(function n(){var r,i,a,o,s,u,l,c,h;return d().w(function(n){for(;;)switch(n.n){case 0:return n.n=1,Promise.all([this.unpackAndLoadGlb(e+"/skin.glb"),this.unpackAndLoadJson(e+"/lbs_weight_20k.json"),this.unpackAndLoadJson(e+"/flame_params.json"),this.unpackAndLoadJson(e+"/vertex_order.json"),this.unpackAndLoadJson(e+"/bone_tree.json")]);case 1:if(r=n.v,i=C(r,5),a=i[0],o=i[1],s=i[2],u=i[3],l=i[4],this.viewer){n.n=2;break}throw new Error("render viewer is not initialized");case 2:a.traverse(function(e){e.isSkinnedMesh&&(c=e),e instanceof Zf&&"hip"==e.name&&(h=e)}),this.viewer.sortedIndexes=u,this.viewer.flame_params=s,this.viewer.lbs_weight_80k=o,this.viewer.bone_tree=l,this.viewer.totalFrames=s.expr.length,null!=c&&(this.viewer.gaussianSplatCount=c.geometry.attributes.position.count),this.viewer.avatarMesh=a,this.viewer.skinModel=c,this.viewer.boneRoot=h,this.motioncfg=t,null!=c&&this.viewer.updateMorphTarget(c),this.viewer.threeScene.add(a),a.visible=!1,null!=c&&c.skeleton.computeBoneTexture();case 3:return n.a(2)}},n,this)}))}},{key:"loadModel",value:function(e,t,n){return QO(this,void 0,void 0,d().m(function r(){var i,a,o,s,u,l,c;return d().w(function(r){for(;;)switch(r.n){case 0:return r.n=1,Promise.all([this.unpackAndLoadGlb(e+"/skin.glb"),this.unpackAndLoadGlb(e+"/animation.glb"),this.unpackAndLoadJson(e+"/vertex_order.json")]);case 1:if(i=r.v,a=C(i,3),o=a[0],s=a[1],u=a[2],this.viewer){r.n=2;break}throw new Error("render viewer is not initialized");case 2:o.traverse(function(e){e.isSkinnedMesh&&(l=e),e instanceof Zf&&"hip"==e.name&&(c=e)}),this.viewer.sortedIndexes=u,null!=l&&(this.viewer.gaussianSplatCount=l.geometry.attributes.position.count),this.viewer.avatarMesh=o,this.viewer.skinModel=l,this.viewer.boneRoot=c,this.mixer=new em(o),this.animManager=new wU(this.mixer,s,t),this.motioncfg=n,null!=l&&this.viewer.updateMorphTarget(l),this.viewer.threeScene.add(o),o.visible=!1,null!=l&&l.skeleton.computeBoneTexture();case 3:return r.a(2)}},r,this)}))}},{key:"unpackFileAsBlob",value:function(e){var t,n;return QO(this,void 0,void 0,d().m(function r(){var i,a;return d().w(function(r){for(;;)switch(r.n){case 0:if(this.zipUrls.urls.has(e)){r.n=2;break}return r.n=1,null===(n=null===(t=this.zipUrls.zip)||void 0===t?void 0:t.file(e))||void 0===n?void 0:n.async("blob");case 1:i=r.v,a=URL.createObjectURL(i),this.zipUrls.urls.set(e,a);case 2:return r.a(2,this.zipUrls.urls.get(e))}},r,this)}))}},{key:"unpackAndLoadGlb",value:function(e){var t,n;return QO(this,void 0,void 0,d().m(function r(){var i,a,o;return d().w(function(r){for(;;)switch(r.n){case 0:if(this.zipUrls.urls.has(e)){r.n=2;break}return r.n=1,null===(n=null===(t=this.zipUrls.zip)||void 0===t?void 0:t.file(e))||void 0===n?void 0:n.async("arraybuffer");case 1:i=r.v,a=new Blob([i],{type:"model/gltf-binary"}),o=URL.createObjectURL(a),this.zipUrls.urls.set(e,o);case 2:return r.a(2,this.LoadGLTF(this.zipUrls.urls.get(e)))}},r,this)}))}},{key:"unpackAndLoadJson",value:function(e){var t,n;return QO(this,void 0,void 0,d().m(function r(){var i;return d().w(function(r){for(;;)switch(r.n){case 0:return r.n=1,null===(n=null===(t=this.zipUrls.zip)||void 0===t?void 0:t.file(e))||void 0===n?void 0:n.async("string");case 1:return i=r.v,r.a(2,JSON.parse(i))}},r,this)}))}},{key:"LoadGLTF",value:function(e){return QO(this,void 0,void 0,d().m(function t(){return d().w(function(t){for(;;)if(0===t.n)return t.a(2,new Promise(function(t,n){new NU(void 0).load(e,function(e){e.animations.length>0?t(e.animations):t(e.scene)},void 0,function(e){n(e)})}))},t)}))}}],[{key:"getInstance",value:function(t,n,r){var i,a,o,s,u,l;return QO(this,void 0,void 0,d().m(function c(){var h,f,p,v,m,g,y,_,b,x,S,A,w,T;return d().w(function(c){for(;;)switch(c.n){case 0:if(null==this.instance){c.n=1;break}return c.a(2,this.instance);case 1:if(c.p=1,f=vU(h=n),p=f.pathname,v=p.match(/\/([^/]+?)\.zip/),v&&v[1]){c.n=2;break}throw new Error("character model is not found");case 2:return AU.start(),c.n=3,eU.get(h,{responseType:"arraybuffer",timeout:1e5,onDownloadProgress:function(e){if(e.lengthComputable&&e&&e.total){var t=e.loaded/e.total;AU.set(t),(null==r?void 0:r.downloadProgress)&&(null==r||r.downloadProgress(t))}}});case 3:return m=c.v,(null==r?void 0:r.loadProgress)&&(null==r||r.loadProgress(.1)),AU.done(),console.log("download completed:",m.data),g=m.data,c.n=4,uU.loadAsync(g);case 4:if(y=c.v,_="",Object.values(y.files).forEach(function(e){var t,n;e.dir&&(_=null===(t=e.name)||void 0===t?void 0:t.slice(0,(null===(n=e.name)||void 0===n?void 0:n.length)-1))}),_){c.n=5;break}throw new Error("file fold is not found");case 5:if(b=new e(t,y),(x=new ph).x=(null===(i=Nz)||void 0===i?void 0:i.x)||0,x.y=(null===(a=Nz)||void 0===a?void 0:a.y)||0,x.z=(null===(o=Nz)||void 0===o?void 0:o.z)||1,(S=new ph).x=(null===(s=Pz)||void 0===s?void 0:s.x)||0,S.y=(null===(u=Pz)||void 0===u?void 0:u.y)||0,S.z=(null===(l=Pz)||void 0===l?void 0:l.z)||0,A=16777215,Lz&&(A=parseInt(Lz,16)),r&&r.backgroundColor&&b.isHexColorStrict(r.backgroundColor)&&(A=parseInt(r.backgroundColor,16)),b.getChatState=null==r?void 0:r.getChatState,b.getExpressionData=null==r?void 0:r.getExpressionData,Dz&&(b.useFlame="false"!=Dz),console.log(x,A),b.viewer=new jO({rootElement:t,threejsCanvas:e._canvas,cameraUp:[0,1,0],initialCameraPosition:[x.x,x.y,x.z],initialCameraRotation:[S.x,S.y,S.z],sphericalHarmonicsDegree:0,backgroundColor:A}),b.viewer.useFlame=b.useFlame,1!=b.viewer.useFlame){c.n=7;break}return c.n=6,b.loadFlameModel(_,Rz);case 6:c.n=8;break;case 7:return c.n=8,b.loadModel(_,Iz,Rz);case 8:return(null==r?void 0:r.loadProgress)&&(null==r||r.loadProgress(.2)),c.n=9,b.unpackFileAsBlob(_+"/offset.ply");case 9:return w=c.v,(null==r?void 0:r.loadProgress)&&(null==r||r.loadProgress(.3)),b.viewer.addSplatScene(w,{progressiveLoad:!0,sharedMemoryForWorkers:!1,showLoadingUI:!1,format:ax}).then(function(){b.render(),(null==r?void 0:r.loadProgress)&&(null==r||r.loadProgress(1))}),c.a(2,b);case 10:c.p=10,T=c.v,console.error(T);case 11:return c.a(2)}},c,this,[[1,10]])}))}}])}();Oz._canvas=document.createElement("canvas");var Fz=function(e){function t(e){var n;A(this,t);var r=e.container,i=e.assetsPath,a=e.ws,o=e.downloadProgress,s=e.loadProgress;return M(n=y(this,t),"_avatarDivEle",void 0),M(n,"_assetsPath",""),M(n,"_ws",void 0),M(n,"_downloadProgress",void 0),M(n,"_loadProgress",void 0),M(n,"_loadPercent",0),M(n,"_downloadPercent",0),M(n,"_processor",void 0),M(n,"_renderer",void 0),M(n,"_audioMute",!1),M(n,"curState",vs.Idle),n._avatarDivEle=r,n._assetsPath=i,n._ws=a,n._downloadProgress=o?function(e){n._downloadPercent=e,o(e)}:function(e){n._downloadPercent=e},n._loadProgress=s?function(e){n._loadPercent=e,s(e)}:function(e){n._loadPercent=e},n._init(),n}return x(t,e),T(t,[{key:"_init",value:function(){if(!this._avatarDivEle||!this._assetsPath||!this._ws)throw new Error("Lack of necessary initialization parameters for gaussian render");this._processor=new Tu(this),this._bindEventTypes()}},{key:"start",value:function(){this.getData(),this.render()}},{key:"getData",value:(r=v(d().m(function e(){var t=this;return d().w(function(e){for(;;)switch(e.n){case 0:this._ws.on(hs.WS_MESSAGE,function(e){t._downloadPercent<1||t._loadPercent<1||(t.emit(cs.MessageReceived,t.curState),t._processor.add({avatar_motion_data:{first_package:!0,segment_num:1,binary_size:e.size,use_binary_frame:!1}}),t._processor.add({avatar_motion_data:{first_package:!1,motion_data_slice:e,is_audio_mute:t._audioMute}}))});case 1:return e.a(2)}},e,this)})),function(){return r.apply(this,arguments)})},{key:"render",value:(n=v(d().m(function e(){return d().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,Oz.getInstance(this._avatarDivEle,this._assetsPath,{getChatState:this.getChatState.bind(this),getExpressionData:this.getArkitFaceFrame.bind(this),downloadProgress:this._downloadProgress.bind(this),loadProgress:this._loadProgress.bind(this)});case 1:this._renderer=e.v;case 2:return e.a(2)}},e,this)})),function(){return n.apply(this,arguments)})},{key:"setAvatarMute",value:function(e){this._processor.setMute(e),this._audioMute=e}},{key:"getChatState",value:function(){return this.curState}},{key:"getArkitFaceFrame",value:function(){var e;return null===(e=this._processor)||void 0===e?void 0:e.getArkitFaceFrame().arkitFace}},{key:"interrupt",value:function(){var e;this._ws.send("%interrupt%"),null===(e=this._processor)||void 0===e||e.interrupt(),this.curState=vs.Idle,this.emit(cs.StateChanged,this.curState)}},{key:"sendSpeech",value:function(e){var t;this._ws.send(e),this.curState=vs.Listening,this.emit(cs.StateChanged,this.curState),null===(t=this._processor)||void 0===t||t.clear()}},{key:"exit",value:function(){var e,t;null===(e=this._renderer)||void 0===e||e.dispose(),this.curState=vs.Idle,this._downloadPercent=0,this._loadPercent=0,null===(t=this._processor)||void 0===t||t.clear(),this.removeAllListeners()}},{key:"_bindEventTypes",value:function(){var e=this;this.on(ds.Player_StartSpeaking,function(t){console.log("startSpeach"),e.curState=vs.Responding,e.emit(cs.StateChanged,e.curState),e._ws.send(JSON.stringify({header:{name:cs.StartSpeech},payload:{}}))}),this.on(ds.Player_EndSpeaking,function(t){console.log("endSpeach"),e.curState=vs.Idle,e.emit(cs.StateChanged,e.curState),e._ws.send(JSON.stringify({header:{name:cs.EndSpeech},payload:{}}))}),this.on(cs.ErrorReceived,function(t){console.log("ErrorReceived",t),e.curState=vs.Idle,e.emit(cs.StateChanged,e.curState),e._ws.send(JSON.stringify({header:{name:cs.ErrorReceived},payload:s({},t)}))}),this._ws.on(hs.WS_CLOSE,function(){e.exit()})}}]);var n,r}(ls);function Bz(){return navigator.mediaDevices.enumerateDevices()}function Uz(e,t,n){return zz.apply(this,arguments)}function zz(){return zz=v(d().m(function e(t,n,r){var i,a,o;return d().w(function(e){for(;;)if(0===e.n)return i=(null==r?void 0:r.video)||r||{width:{ideal:500},height:{ideal:500}},a=(null==r?void 0:r.audio)||r||{echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0},o={video:"object"===P(n)?s(s({},n),i):n,audio:"object"===P(t)?s(s({},t),a):t},console.log(o,"constraints"),e.a(2,navigator.mediaDevices.getUserMedia(o).then(function(e){return console.log(e),e}))},e)})),zz.apply(this,arguments)}function Vz(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"videoinput";return e.filter(function(e){return e.kind===t})}var Hz=null,Wz=null;function Gz(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=document.createElement("canvas");document.body.appendChild(n),n.width=e||500,n.height=t||500,n.style.width="1px",n.style.height="1px",n.style.position="fixed",n.style.visibility="hidden";var r=n.getContext("2d");r.fillStyle="hsl(0,0, 0, 1)",r.fillRect(0,0,n.width,n.height),function e(){r.fillStyle="rgb(255, 255, 255)",r.fillRect(0,0,n.width,n.height),requestAnimationFrame(e)}();var i=n.captureStream(30);return(Hz=i.getVideoTracks()[0]).stop=function(){n.remove()},Hz.onended=function(){var e;null===(e=Hz)||void 0===e||e.stop()},Hz}function jz(){if(Wz)return Wz;var e=new(window.AudioContext||window.webkitAudioContext),t=e.createOscillator();t.frequency.setValueAtTime(0,e.currentTime);var n=e.createGain();n.gain.setValueAtTime(0,e.currentTime);var r=e.createMediaStreamDestination();return t.connect(n),n.connect(r),t.start(),(Wz=r.stream.getAudioTracks()[0]).stop=function(){e.close()},Wz.onended=function(){var e;null===(e=Wz)||void 0===e||e.stop()},Wz}function Qz(e){console.debug("Stopping peer connection"),e.getTransceivers&&e.getTransceivers().forEach(function(e){e.stop&&e.stop()}),e.getSenders()&&e.getSenders().forEach(function(e){console.log("sender",e),e.track&&e.track.stop&&e.track.stop()}),setTimeout(function(){e.close()},500)}function qz(e,t,n){return Xz.apply(this,arguments)}function Xz(){return Xz=v(d().m(function e(t,n,r){var i,a,o,s,u;return d().w(function(e){for(;;)switch(e.n){case 0:return t.getTracks().forEach(function(){var e=v(d().m(function e(r){return d().w(function(e){for(;;)switch(e.n){case 0:n.addTrack(r,t);case 1:return e.a(2)}},e)}));return function(t){return e.apply(this,arguments)}}()),n.addEventListener("track",function(e){r&&r.srcObject!==e.streams[0]&&(r.srcObject=e.streams[0])}),i=n.createDataChannel("text"),e.n=1,n.createOffer();case 1:return a=e.v,e.n=2,n.setLocalDescription(a);case 2:return o=Math.random().toString(36).substring(7),n.onicecandidate=function(e){var t=e.candidate;t&&(console.debug("Sending ICE candidate",t),fetch("/webrtc/offer",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({candidate:t.toJSON(),webrtc_id:o,type:"ice-candidate"})}))},e.n=3,fetch("/webrtc/offer",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sdp:a.sdp,type:a.type,webrtc_id:o})});case 3:return s=e.v,e.n=4,s.json();case 4:return u=e.v,e.n=5,n.setRemoteDescription(u);case 5:return e.a(2,[i,o])}},e)})),Xz.apply(this,arguments)}function Yz(e){return Yz="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Yz(e)}function Kz(e){var t=function(e,t){if("object"!=Yz(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t);if("object"!=Yz(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==Yz(t)?t:t+""}function Zz(e,t,n){return(t=Kz(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Jz(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function $z(e){for(var t=1;t2?arguments[2]:void 0;return"function"==typeof e?e(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}):null!=e?e:t}function aV(){for(var e=[],t=0;t0&&void 0!==arguments[0]?arguments[0]:[]).forEach(function(t){Array.isArray(t)?e.push.apply(e,I(t)):(null==t?void 0:t.type)===Bi?e.push.apply(e,I(oV(t.children))):e.push(t)}),e.filter(function(e){return!function(e){return e&&(e.type===zi||e.type===Bi&&0===e.children.length||e.type===Ui&&""===e.children.trim())}(e)})}var sV=function(e){var t=e;return t.install=function(n){n.component(t.displayName||t.name,e)},e};function uV(e){return{type:Object,default:e}}function lV(e){return{type:Boolean,default:e}}function cV(e,t){var n={validator:function(){return!0},default:e};return n}function hV(e){return{type:Array,default:e}}function dV(e){return{type:String,default:e}}var fV="anticon",pV=Symbol("GlobalFormContextKey"),vV=Symbol("configProvider"),mV={getPrefixCls:function(e,t){return t||(e?"ant-".concat(e):"ant")},iconPrefixCls:Ea(function(){return fV}),getPopupContainer:Ea(function(){return function(){return document.body}}),direction:Ea(function(){return"ltr"})},gV=function(){return ei(vV,mV)},yV=Symbol("DisabledContextKey"),_V=function(){return ei(yV,tn(void 0))},bV={placeholder:"Select time",rangePlaceholder:["Start time","End time"]},xV={lang:eV({placeholder:"Select date",yearPlaceholder:"Select year",quarterPlaceholder:"Select quarter",monthPlaceholder:"Select month",weekPlaceholder:"Select week",rangePlaceholder:["Start date","End date"],rangeYearPlaceholder:["Start year","End year"],rangeQuarterPlaceholder:["Start quarter","End quarter"],rangeMonthPlaceholder:["Start month","End month"],rangeWeekPlaceholder:["Start week","End week"]},{locale:"en_US",today:"Today",now:"Now",backToToday:"Back to today",ok:"Ok",clear:"Clear",month:"Month",year:"Year",timeSelect:"select time",dateSelect:"select date",weekSelect:"Choose a week",monthSelect:"Choose a month",yearSelect:"Choose a year",decadeSelect:"Choose a decade",yearFormat:"YYYY",dateFormat:"M/D/YYYY",dayFormat:"D",dateTimeFormat:"M/D/YYYY HH:mm:ss",monthBeforeYear:!0,previousMonth:"Previous month (PageUp)",nextMonth:"Next month (PageDown)",previousYear:"Last year (Control + left)",nextYear:"Next year (Control + right)",previousDecade:"Last decade",nextDecade:"Next decade",previousCentury:"Last century",nextCentury:"Next century"}),timePickerLocale:eV({},bV)},SV="${label} is not a valid ${type}",AV={locale:"en",Pagination:{items_per_page:"/ page",jump_to:"Go to",jump_to_confirm:"confirm",page:"",prev_page:"Previous Page",next_page:"Next Page",prev_5:"Previous 5 Pages",next_5:"Next 5 Pages",prev_3:"Previous 3 Pages",next_3:"Next 3 Pages"},DatePicker:xV,TimePicker:bV,Calendar:xV,global:{placeholder:"Please select"},Table:{filterTitle:"Filter menu",filterConfirm:"OK",filterReset:"Reset",filterEmptyText:"No filters",filterCheckall:"Select all items",filterSearchPlaceholder:"Search in filters",emptyText:"No data",selectAll:"Select current page",selectInvert:"Invert current page",selectNone:"Clear all data",selectionAll:"Select all data",sortTitle:"Sort",expand:"Expand row",collapse:"Collapse row",triggerDesc:"Click to sort descending",triggerAsc:"Click to sort ascending",cancelSort:"Click to cancel sorting"},Tour:{Next:"Next",Previous:"Previous",Finish:"Finish"},Modal:{okText:"OK",cancelText:"Cancel",justOkText:"OK"},Popconfirm:{okText:"OK",cancelText:"Cancel"},Transfer:{titles:["",""],searchPlaceholder:"Search here",itemUnit:"item",itemsUnit:"items",remove:"Remove",selectCurrent:"Select current page",removeCurrent:"Remove current page",selectAll:"Select all data",removeAll:"Remove all data",selectInvert:"Invert current page"},Upload:{uploading:"Uploading...",removeFile:"Remove file",uploadError:"Upload error",previewFile:"Preview file",downloadFile:"Download file"},Empty:{description:"No data"},Icon:{icon:"icon"},Text:{edit:"Edit",copy:"Copy",copied:"Copied",expand:"Expand"},PageHeader:{back:"Back"},Form:{optional:"(optional)",defaultValidateMessages:{default:"Field validation error for ${label}",required:"Please enter ${label}",enum:"${label} must be one of [${enum}]",whitespace:"${label} cannot be a blank character",date:{format:"${label} date format is invalid",parse:"${label} cannot be converted to a date",invalid:"${label} is an invalid date"},types:{string:SV,method:SV,array:SV,object:SV,number:SV,date:SV,boolean:SV,integer:SV,float:SV,regexp:SV,email:SV,url:SV,hex:SV},string:{len:"${label} must be ${len} characters",min:"${label} must be at least ${min} characters",max:"${label} must be up to ${max} characters",range:"${label} must be between ${min}-${max} characters"},number:{len:"${label} must be equal to ${len}",min:"${label} must be minimum ${min}",max:"${label} must be maximum ${max}",range:"${label} must be between ${min}-${max}"},array:{len:"Must be ${len} ${label}",min:"At least ${min} ${label}",max:"At most ${max} ${label}",range:"The amount of ${label} must be between ${min}-${max}"},pattern:{mismatch:"${label} does not match the pattern ${pattern}"}}},Image:{preview:"Preview"},QRCode:{expired:"QR code expired",refresh:"Refresh",scanned:"Scanned"}},wV=ar({compatConfig:{MODE:3},name:"LocaleReceiver",props:{componentName:String,defaultLocale:{type:[Object,Function]},children:{type:Function}},setup:function(e,t){var n=t.slots,r=ei("localeData",{}),i=Ea(function(){var t=e.componentName,n=void 0===t?"global":t,i=e.defaultLocale||AV[n||"global"],a=r.antLocale,o=n&&a?a[n]:{};return eV(eV({},"function"==typeof i?i():i),o||{})}),a=Ea(function(){var e=r.antLocale,t=e&&e.locale;return e&&e.exist&&!t?AV.locale:t});return function(){var t=e.children||n.default,o=r.antLocale;return null==t?void 0:t(i.value,a.value,o)}}});function TV(e){for(var t,n=0,r=0,i=e.length;i>=4;++r,i-=4)t=1540483477*(65535&(t=255&e.charCodeAt(r)|(255&e.charCodeAt(++r))<<8|(255&e.charCodeAt(++r))<<16|(255&e.charCodeAt(++r))<<24))+(59797*(t>>>16)<<16),n=1540483477*(65535&(t^=t>>>24))+(59797*(t>>>16)<<16)^1540483477*(65535&n)+(59797*(n>>>16)<<16);switch(i){case 3:n^=(255&e.charCodeAt(r+2))<<16;case 2:n^=(255&e.charCodeAt(r+1))<<8;case 1:n=1540483477*(65535&(n^=255&e.charCodeAt(r)))+(59797*(n>>>16)<<16)}return(((n=1540483477*(65535&(n^=n>>>13))+(59797*(n>>>16)<<16))^n>>>15)>>>0).toString(36)}var MV=function(){return T(function e(t){A(this,e),this.cache=new Map,this.instanceId=t},[{key:"get",value:function(e){return this.cache.get(Array.isArray(e)?e.join("%"):e)||null}},{key:"update",value:function(e,t){var n=Array.isArray(e)?e.join("%"):e,r=t(this.cache.get(n));null===r?this.cache.delete(n):this.cache.set(n,r)}}])}(),EV="data-token-hash",CV="data-css-hash",kV="__cssinjs_instance__";function RV(){var e=Math.random().toString(12).slice(2);if("undefined"!=typeof document&&document.head&&document.body){var t=document.body.querySelectorAll("style[".concat(CV,"]"))||[],n=document.head.firstChild;Array.from(t).forEach(function(t){t[kV]=t[kV]||e,t[kV]===e&&document.head.insertBefore(t,n)});var r={};Array.from(document.querySelectorAll("style[".concat(CV,"]"))).forEach(function(t){var n,i=t.getAttribute(CV);r[i]?t[kV]===e&&(null===(n=t.parentNode)||void 0===n||n.removeChild(t)):r[i]=!0})}return new MV(e)}var IV,NV,PV=Symbol("StyleContextKey"),LV={cache:RV(),defaultCache:!0,hashPriority:"low"},DV=function(){var e=function(){var e,t,n,r,i=va();if(i&&i.appContext){var a=null===(n=null===(t=null===(e=i.appContext)||void 0===e?void 0:e.config)||void 0===t?void 0:t.globalProperties)||void 0===n?void 0:n.__ANTDV_CSSINJS_CACHE__;a?r=a:(r=RV(),i.appContext.config.globalProperties&&(i.appContext.config.globalProperties.__ANTDV_CSSINJS_CACHE__=r))}else r=RV();return r}();return ei(PV,nn(eV(eV({},LV),{cache:e})))};function OV(e,t,n,r){var i=DV(),a=nn(""),o=nn();wi(function(){a.value=[e].concat(I(t.value)).join("%")});var s=function(e){i.value.cache.update(e,function(e){var t=C(e||[],2),n=t[0],i=void 0===n?0:n,a=t[1];return 0===i-1?(null==r||r(a,!1),null):[i-1,a]})};return Ti(a,function(e,t){t&&s(t),i.value.cache.update(e,function(e){var t=C(e||[],2),r=t[0];return[(void 0===r?0:r)+1,t[1]||n()]}),o.value=i.value.cache.get(a.value)[1]},{immediate:!0}),xr(function(){s(a.value)}),o}function FV(){return!("undefined"==typeof window||!window.document||!window.document.createElement)}sV(ar({name:"AStyleProvider",inheritAttrs:!1,props:{autoClear:lV(),mock:dV(),cache:uV(),defaultCache:lV(),hashPriority:dV(),container:IV?{type:IV,default:NV}:cV(NV),ssrInline:lV(),transformers:hV(),linters:hV()},setup:function(e,t){var n=t.slots;return function(e){var t=DV(),n=nn(eV(eV({},LV),{cache:RV()}));Ti([function(){return on(e)},t],function(){var r=eV({},t.value),i=on(e);Object.keys(i).forEach(function(e){var t=i[e];void 0!==i[e]&&(r[e]=t)});var a=i.cache;r.cache=r.cache||RV(),r.defaultCache=!a&&t.value.defaultCache,n.value=r},{immediate:!0}),$r(PV,n)}(e),function(){var e;return null===(e=n.default)||void 0===e?void 0:e.call(n)}}}));var BV="data-vc-order",UV=new Map;function zV(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).mark;return e?e.startsWith("data-")?e:"data-".concat(e):"vc-util-key"}function VV(e){return e.attachTo?e.attachTo:document.querySelector("head")||document.body}function HV(e){return Array.from((UV.get(e)||e).children).filter(function(e){return"STYLE"===e.tagName})}function WV(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!FV())return null;var n=t.csp,r=t.prepend,i=document.createElement("style");i.setAttribute(BV,function(e){return"queue"===e?"prependQueue":e?"prepend":"append"}(r)),(null==n?void 0:n.nonce)&&(i.nonce=null==n?void 0:n.nonce),i.innerHTML=e;var a=VV(t),o=a.firstChild;if(r){if("queue"===r){var s=HV(a).filter(function(e){return["prepend","prependQueue"].includes(e.getAttribute(BV))});if(s.length)return a.insertBefore(i,s[s.length-1].nextSibling),i}a.insertBefore(i,o)}else a.appendChild(i);return i}function GV(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return HV(VV(t)).find(function(n){return n.getAttribute(zV(t))===e})}function jV(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=GV(e,t);n&&VV(t).removeChild(n)}function QV(e,t){var n,r,i,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!function(e,t){var n=UV.get(e);if(!n||!function(e,t){return!!e&&!!e.contains&&e.contains(t)}(document,n)){var r=WV("",t),i=r.parentNode;UV.set(e,i),e.removeChild(r)}}(VV(a),a);var o=GV(t,a);if(o)return(null===(n=a.csp)||void 0===n?void 0:n.nonce)&&o.nonce!==(null===(r=a.csp)||void 0===r?void 0:r.nonce)&&(o.nonce=null===(i=a.csp)||void 0===i?void 0:i.nonce),o.innerHTML!==e&&(o.innerHTML=e),o;var s=WV(e,a);return s.setAttribute(zV(a),t),s}var qV=function(){function e(){A(this,e),this.cache=new Map,this.keys=[],this.cacheCallTimes=0}return T(e,[{key:"size",value:function(){return this.keys.length}},{key:"internalGet",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n={map:this.cache};return e.forEach(function(e){var t;n=n?null===(t=null==n?void 0:n.map)||void 0===t?void 0:t.get(e):void 0}),(null==n?void 0:n.value)&&t&&(n.value[1]=this.cacheCallTimes++),null==n?void 0:n.value}},{key:"get",value:function(e){var t;return null===(t=this.internalGet(e,!0))||void 0===t?void 0:t[0]}},{key:"has",value:function(e){return!!this.internalGet(e)}},{key:"set",value:function(t,n){var r=this;if(!this.has(t)){if(this.size()+1>e.MAX_CACHE_SIZE+e.MAX_CACHE_OFFSET){var i=this.keys.reduce(function(e,t){var n=C(e,2)[1];return r.internalGet(t)[1]0),YV+=1},[{key:"getDerivativeToken",value:function(e){return this.derivatives.reduce(function(t,n){return n(e,t)},void 0)}}])}(),ZV=new qV;function JV(e){var t=Array.isArray(e)?e:[e];return ZV.has(t)||ZV.set(t,new KV(t)),ZV.get(t)}var $V=new WeakMap;function eH(e){var t=$V.get(e)||"";return t||(Object.keys(e).forEach(function(n){var r=e[n];t+=n,r instanceof KV?t+=r.id:r&&"object"===P(r)?t+=eH(r):t+=r}),$V.set(e,t)),t}var tH="random-".concat(Date.now(),"-").concat(Math.random()).replace(/\./g,""),nH="_bAmBoO_";var rH=void 0;function iH(){return void 0===rH&&(rH=function(e,t,n){var r,i;if(FV()){QV(e,tH);var a=document.createElement("div");a.style.position="fixed",a.style.left="0",a.style.top="0",null==t||t(a),document.body.appendChild(a);var o=n?n(a):null===(r=getComputedStyle(a).content)||void 0===r?void 0:r.includes(nH);return null===(i=a.parentNode)||void 0===i||i.removeChild(a),jV(tH),o}return!1}("@layer ".concat(tH," { .").concat(tH,' { content: "').concat(nH,'"!important; } }'),function(e){e.className=tH})),rH}var aH={},oH=new Map;function sH(e,t){oH.set(e,(oH.get(e)||0)-1);var n=Array.from(oH.keys()),r=n.filter(function(e){return(oH.get(e)||0)<=0});n.length-r.length>0&&r.forEach(function(e){!function(e,t){"undefined"!=typeof document&&document.querySelectorAll("style[".concat(EV,'="').concat(e,'"]')).forEach(function(e){var n;e[kV]===t&&(null===(n=e.parentNode)||void 0===n||n.removeChild(e))})}(e,t),oH.delete(e)})}function uH(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:tn({}),r=DV(),i=Ea(function(){return eV.apply(void 0,[{}].concat(I(t.value)))}),a=Ea(function(){return eH(i.value)}),o=Ea(function(){return eH(n.value.override||aH)}),s=OV("token",Ea(function(){return[n.value.salt||"",e.value.id,a.value,o.value]}),function(){var t=n.value,r=t.salt,a=void 0===r?"":r,o=t.override,s=void 0===o?aH:o,u=t.formatToken,l=t.getComputedToken,c=l?l(i.value,s,e.value):function(e,t,n,r){var i=eV(eV({},n.getDerivativeToken(e)),t);return r&&(i=r(i)),i}(i.value,s,e.value,u),h=function(e,t){return TV("".concat(t,"_").concat(eH(e)))}(c,a);c._tokenKey=h,function(e){oH.set(e,(oH.get(e)||0)+1)}(h);var d="".concat("css","-").concat(TV(h));return c._hashId=d,[c,d]},function(e){var t;sH(e[0]._tokenKey,null===(t=r.value)||void 0===t?void 0:t.cache.instanceId)});return s}var lH={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},cH="comm",hH="rule",dH="decl",fH=Math.abs,pH=String.fromCharCode;function vH(e){return e.trim()}function mH(e,t,n){return e.replace(t,n)}function gH(e,t,n){return e.indexOf(t,n)}function yH(e,t){return 0|e.charCodeAt(t)}function _H(e,t,n){return e.slice(t,n)}function bH(e){return e.length}function xH(e,t){return t.push(e),e}var SH=1,AH=1,wH=0,TH=0,MH=0,EH="";function CH(e,t,n,r,i,a,o,s){return{value:e,root:t,parent:n,type:r,props:i,children:a,line:SH,column:AH,length:o,return:"",siblings:s}}function kH(){return MH=TH>0?yH(EH,--TH):0,AH--,10===MH&&(AH=1,SH--),MH}function RH(){return MH=TH2||LH(MH)>3?"":" "}function FH(e,t){for(;--t&&RH()&&!(MH<48||MH>102||MH>57&&MH<65||MH>70&&MH<97););return PH(e,NH()+(t<6&&32==IH()&&32==RH()))}function BH(e){for(;RH();)switch(MH){case e:return TH;case 34:case 39:34!==e&&39!==e&&BH(MH);break;case 40:41===e&&BH(e);break;case 92:RH()}return TH}function UH(e,t){for(;RH()&&e+MH!==57&&(e+MH!==84||47!==IH()););return"/*"+PH(t,TH-1)+"*"+pH(47===e?e:RH())}function zH(e){for(;!LH(IH());)RH();return PH(e,TH)}function VH(e){return function(e){return EH="",e}(HH("",null,null,null,[""],e=function(e){return SH=AH=1,wH=bH(EH=e),TH=0,[]}(e),0,[0],e))}function HH(e,t,n,r,i,a,o,s,u){for(var l=0,c=0,h=o,d=0,f=0,p=0,v=1,m=1,g=1,y=0,_="",b=i,x=a,S=r,A=_;m;)switch(p=y,y=RH()){case 40:if(108!=p&&58==yH(A,h-1)){-1!=gH(A+=mH(DH(y),"&","&\f"),"&\f",fH(l?s[l-1]:0))&&(g=-1);break}case 34:case 39:case 91:A+=DH(y);break;case 9:case 10:case 13:case 32:A+=OH(p);break;case 92:A+=FH(NH()-1,7);continue;case 47:switch(IH()){case 42:case 47:xH(GH(UH(RH(),NH()),t,n,u),u),5!=LH(p||1)&&5!=LH(IH()||1)||!bH(A)||" "===_H(A,-1,void 0)||(A+=" ");break;default:A+="/"}break;case 123*v:s[l++]=bH(A)*g;case 125*v:case 59:case 0:switch(y){case 0:case 125:m=0;case 59+c:-1==g&&(A=mH(A,/\f/g,"")),f>0&&(bH(A)-h||0===v&&47===p)&&xH(f>32?jH(A+";",r,n,h-1,u):jH(mH(A," ","")+";",r,n,h-2,u),u);break;case 59:A+=";";default:if(xH(S=WH(A,t,n,l,c,i,s,_,b=[],x=[],h,a),a),123===y)if(0===c)HH(A,t,S,S,b,a,h,s,x);else{switch(d){case 99:if(110===yH(A,3))break;case 108:if(97===yH(A,2))break;default:c=0;case 100:case 109:case 115:}c?HH(e,S,S,r&&xH(WH(e,S,S,0,0,i,s,_,i,b=[],h,x),x),i,x,h,s,r?b:x):HH(A,S,S,S,[""],x,0,s,x)}}l=c=f=0,v=g=1,_=A="",h=o;break;case 58:h=1+bH(A),f=p;default:if(v<1)if(123==y)--v;else if(125==y&&0==v++&&125==kH())continue;switch(A+=pH(y),y*v){case 38:g=c>0?1:(A+="\f",-1);break;case 44:s[l++]=(bH(A)-1)*g,g=1;break;case 64:45===IH()&&(A+=DH(RH())),d=IH(),c=h=bH(_=A+=zH(NH())),y++;break;case 45:45===p&&2==bH(A)&&(v=0)}}return a}function WH(e,t,n,r,i,a,o,s,u,l,c,h){for(var d=i-1,f=0===i?a:[""],p=function(e){return e.length}(f),v=0,m=0,g=0;v0?f[y]+" "+_:mH(_,/&\f/g,f[y])))&&(u[g++]=b);return CH(e,t,n,0===i?hH:s,u,l,c,h)}function GH(e,t,n,r){return CH(e,t,n,cH,pH(MH),_H(e,2,-2),0,r)}function jH(e,t,n,r,i){return CH(e,t,n,dH,_H(e,0,r),_H(e,r+1,-1),r,i)}function QH(e,t){for(var n="",r=0;r1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{root:!0,parentSelectors:[]},r=n.root,i=n.injectHash,a=n.parentSelectors,o=t.hashId,s=t.layer,u=(t.path,t.hashPriority),l=t.transformers,c=void 0===l?[]:l,h=(t.linters,""),d={};function f(e){var n=e.getName(o);if(!d[n]){var r=C(nW(e.style,t,{root:!1,parentSelectors:a}),1)[0];d[n]="@keyframes ".concat(e.getName(o)).concat(r)}}var p=function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return t.forEach(function(t){Array.isArray(t)?e(t,n):t&&n.push(t)}),n}(Array.isArray(e)?e:[e]);if(p.forEach(function(e){var n="string"!=typeof e||r?e:{};if("string"==typeof n)h+="".concat(n,"\n");else if(n._keyframe)f(n);else{var s=c.reduce(function(e,t){var n;return(null===(n=null==t?void 0:t.visit)||void 0===n?void 0:n.call(t,e))||e},n);Object.keys(s).forEach(function(e){var n,l=s[e];if("object"!==P(l)||!l||"animationName"===e&&l._keyframe||function(e){return"object"===P(e)&&e&&("_skip_check_"in e||$H in e)}(l)){var c=function(e,t){var n=e.replace(/[A-Z]/g,function(e){return"-".concat(e.toLowerCase())}),r=t;lH[e]||"number"!=typeof r||0===r||(r="".concat(r,"px")),"animationName"===e&&(null==t?void 0:t._keyframe)&&(f(t),r=t.getName(o)),h+="".concat(n,":").concat(r,";")},p=null!==(n=null==l?void 0:l.value)&&void 0!==n?n:l;"object"===P(l)&&(null==l?void 0:l[$H])&&Array.isArray(p)?p.forEach(function(t){c(e,t)}):c(e,p)}else{var v=!1,m=e.trim(),g=!1;(r||i)&&o?m.startsWith("@")?v=!0:m=function(e,t,n){if(!t)return e;var r=".".concat(t),i="low"===n?":where(".concat(r,")"):r,a=e.split(",").map(function(e){var t,n=e.trim().split(/\s+/),r=n[0]||"",a=(null===(t=r.match(/^\w+/))||void 0===t?void 0:t[0])||"";return[r="".concat(a).concat(i).concat(r.slice(a.length))].concat(I(n.slice(1))).join(" ")});return a.join(",")}(e,o,u):!r||o||"&"!==m&&""!==m||(m="",g=!0);var y=C(nW(l,t,{root:g,injectHash:v,parentSelectors:[].concat(I(a),[m])}),2),_=y[0],b=y[1];d=eV(eV({},d),b),h+="".concat(m).concat(_)}})}}),r){if(s&&iH()){var v=s.split(","),m=v[v.length-1].trim();h="@layer ".concat(m," {").concat(h,"}"),v.length>1&&(h="@layer ".concat(s,"{%%%:%}").concat(h))}}else h="{".concat(h,"}");return[h,d]};function rW(e,t){var n=DV(),r=Ea(function(){return e.value.token._tokenKey}),i=Ea(function(){return[r.value].concat(I(e.value.path))}),a=JH;return OV("style",i,function(){var o=e.value,s=o.path,u=o.hashId,l=o.layer,c=o.nonce,h=o.clientOnly,d=o.order,f=void 0===d?0:d,p=i.value.join("|");if(ZH(p)){var v=function(e){var t=XH[e],n=null;if(t&&FV())if(KH)n="_FILE_STYLE__";else{var r=document.querySelector("style[".concat(CV,'="').concat(XH[e],'"]'));r?n=r.innerHTML:delete XH[e]}return[n,t]}(p),m=C(v,2),g=m[0],y=m[1];if(g)return[g,r.value,y,{},h,f]}var _=t(),b=n.value,x=b.hashPriority,S=b.container,A=b.transformers,w=b.linters,T=b.cache,M=C(nW(_,{hashId:u,hashPriority:x,layer:l,path:s.join("-"),transformers:A,linters:w}),2),E=M[0],k=M[1],R=eW(E),I=function(e,t){return TV("".concat(e.join("%")).concat(t))}(i.value,R);if(a){var N={mark:CV,prepend:"queue",attachTo:S,priority:f},P="function"==typeof c?c():c;P&&(N.csp={nonce:P});var L=QV(R,I,N);L[kV]=T.instanceId,L.setAttribute(EV,r.value),Object.keys(k).forEach(function(e){tW.has(e)||(tW.add(e),QV(eW(k[e]),"_effect-".concat(e),{mark:CV,prepend:"queue",attachTo:S}))})}return[R,r.value,I,k,h,f]},function(e,t){var r=C(e,3)[2];(t||n.value.autoClear)&&JH&&jV(r,{mark:CV})}),function(e){return e}}var iW=function(){return T(function e(t,n){A(this,e),this._keyframe=!0,this.name=t,this.style=n},[{key:"getName",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return e?"".concat(e,"-").concat(this.name):this.name}}])}();function aW(e,t){(function(e){return"string"==typeof e&&-1!==e.indexOf(".")&&1===parseFloat(e)})(e)&&(e="100%");var n=function(e){return"string"==typeof e&&-1!==e.indexOf("%")}(e);return e=360===t?e:Math.min(t,Math.max(0,parseFloat(e))),n&&(e=parseInt(String(e*t),10)/100),Math.abs(e-t)<1e-6?1:e=360===t?(e<0?e%t+t:e%t)/parseFloat(String(t)):e%t/parseFloat(String(t))}function oW(e){return Math.min(1,Math.max(0,e))}function sW(e){return e=parseFloat(e),(isNaN(e)||e<0||e>1)&&(e=1),e}function uW(e){return e<=1?"".concat(100*Number(e),"%"):e}function lW(e){return 1===e.length?"0"+e:String(e)}function cW(e,t,n){e=aW(e,255),t=aW(t,255),n=aW(n,255);var r=Math.max(e,t,n),i=Math.min(e,t,n),a=0,o=0,s=(r+i)/2;if(r===i)o=0,a=0;else{var u=r-i;switch(o=s>.5?u/(2-r-i):u/(r+i),r){case e:a=(t-n)/u+(t1&&(n-=1),n<1/6?e+6*n*(t-e):n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function dW(e,t,n){e=aW(e,255),t=aW(t,255),n=aW(n,255);var r=Math.max(e,t,n),i=Math.min(e,t,n),a=0,o=r,s=r-i,u=0===r?0:s/r;if(r===i)a=0;else{switch(r){case e:a=(t-n)/s+(t>16,g:(65280&e)>>8,b:255&e}}(t)),this.originalInput=t;var i=yW(t);this.originalInput=t,this.r=i.r,this.g=i.g,this.b=i.b,this.a=i.a,this.roundA=Math.round(100*this.a)/100,this.format=null!==(r=n.format)&&void 0!==r?r:i.format,this.gradientType=n.gradientType,this.r<1&&(this.r=Math.round(this.r)),this.g<1&&(this.g=Math.round(this.g)),this.b<1&&(this.b=Math.round(this.b)),this.isValid=i.ok}return e.prototype.isDark=function(){return this.getBrightness()<128},e.prototype.isLight=function(){return!this.isDark()},e.prototype.getBrightness=function(){var e=this.toRgb();return(299*e.r+587*e.g+114*e.b)/1e3},e.prototype.getLuminance=function(){var e=this.toRgb(),t=e.r/255,n=e.g/255,r=e.b/255;return.2126*(t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4))+.7152*(n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4))+.0722*(r<=.03928?r/12.92:Math.pow((r+.055)/1.055,2.4))},e.prototype.getAlpha=function(){return this.a},e.prototype.setAlpha=function(e){return this.a=sW(e),this.roundA=Math.round(100*this.a)/100,this},e.prototype.isMonochrome=function(){return 0===this.toHsl().s},e.prototype.toHsv=function(){var e=dW(this.r,this.g,this.b);return{h:360*e.h,s:e.s,v:e.v,a:this.a}},e.prototype.toHsvString=function(){var e=dW(this.r,this.g,this.b),t=Math.round(360*e.h),n=Math.round(100*e.s),r=Math.round(100*e.v);return 1===this.a?"hsv(".concat(t,", ").concat(n,"%, ").concat(r,"%)"):"hsva(".concat(t,", ").concat(n,"%, ").concat(r,"%, ").concat(this.roundA,")")},e.prototype.toHsl=function(){var e=cW(this.r,this.g,this.b);return{h:360*e.h,s:e.s,l:e.l,a:this.a}},e.prototype.toHslString=function(){var e=cW(this.r,this.g,this.b),t=Math.round(360*e.h),n=Math.round(100*e.s),r=Math.round(100*e.l);return 1===this.a?"hsl(".concat(t,", ").concat(n,"%, ").concat(r,"%)"):"hsla(".concat(t,", ").concat(n,"%, ").concat(r,"%, ").concat(this.roundA,")")},e.prototype.toHex=function(e){return void 0===e&&(e=!1),fW(this.r,this.g,this.b,e)},e.prototype.toHexString=function(e){return void 0===e&&(e=!1),"#"+this.toHex(e)},e.prototype.toHex8=function(e){return void 0===e&&(e=!1),function(e,t,n,r,i){var a=[lW(Math.round(e).toString(16)),lW(Math.round(t).toString(16)),lW(Math.round(n).toString(16)),lW(pW(r))];return i&&a[0].startsWith(a[0].charAt(1))&&a[1].startsWith(a[1].charAt(1))&&a[2].startsWith(a[2].charAt(1))&&a[3].startsWith(a[3].charAt(1))?a[0].charAt(0)+a[1].charAt(0)+a[2].charAt(0)+a[3].charAt(0):a.join("")}(this.r,this.g,this.b,this.a,e)},e.prototype.toHex8String=function(e){return void 0===e&&(e=!1),"#"+this.toHex8(e)},e.prototype.toHexShortString=function(e){return void 0===e&&(e=!1),1===this.a?this.toHexString(e):this.toHex8String(e)},e.prototype.toRgb=function(){return{r:Math.round(this.r),g:Math.round(this.g),b:Math.round(this.b),a:this.a}},e.prototype.toRgbString=function(){var e=Math.round(this.r),t=Math.round(this.g),n=Math.round(this.b);return 1===this.a?"rgb(".concat(e,", ").concat(t,", ").concat(n,")"):"rgba(".concat(e,", ").concat(t,", ").concat(n,", ").concat(this.roundA,")")},e.prototype.toPercentageRgb=function(){var e=function(e){return"".concat(Math.round(100*aW(e,255)),"%")};return{r:e(this.r),g:e(this.g),b:e(this.b),a:this.a}},e.prototype.toPercentageRgbString=function(){var e=function(e){return Math.round(100*aW(e,255))};return 1===this.a?"rgb(".concat(e(this.r),"%, ").concat(e(this.g),"%, ").concat(e(this.b),"%)"):"rgba(".concat(e(this.r),"%, ").concat(e(this.g),"%, ").concat(e(this.b),"%, ").concat(this.roundA,")")},e.prototype.toName=function(){if(0===this.a)return"transparent";if(this.a<1)return!1;for(var e="#"+fW(this.r,this.g,this.b,!1),t=0,n=Object.entries(gW);t=0;return t||!r||!e.startsWith("hex")&&"name"!==e?("rgb"===e&&(n=this.toRgbString()),"prgb"===e&&(n=this.toPercentageRgbString()),"hex"!==e&&"hex6"!==e||(n=this.toHexString()),"hex3"===e&&(n=this.toHexString(!0)),"hex4"===e&&(n=this.toHex8String(!0)),"hex8"===e&&(n=this.toHex8String()),"name"===e&&(n=this.toName()),"hsl"===e&&(n=this.toHslString()),"hsv"===e&&(n=this.toHsvString()),n||this.toHexString()):"name"===e&&0===this.a?this.toName():this.toRgbString()},e.prototype.toNumber=function(){return(Math.round(this.r)<<16)+(Math.round(this.g)<<8)+Math.round(this.b)},e.prototype.clone=function(){return new e(this.toString())},e.prototype.lighten=function(t){void 0===t&&(t=10);var n=this.toHsl();return n.l+=t/100,n.l=oW(n.l),new e(n)},e.prototype.brighten=function(t){void 0===t&&(t=10);var n=this.toRgb();return n.r=Math.max(0,Math.min(255,n.r-Math.round(-t/100*255))),n.g=Math.max(0,Math.min(255,n.g-Math.round(-t/100*255))),n.b=Math.max(0,Math.min(255,n.b-Math.round(-t/100*255))),new e(n)},e.prototype.darken=function(t){void 0===t&&(t=10);var n=this.toHsl();return n.l-=t/100,n.l=oW(n.l),new e(n)},e.prototype.tint=function(e){return void 0===e&&(e=10),this.mix("white",e)},e.prototype.shade=function(e){return void 0===e&&(e=10),this.mix("black",e)},e.prototype.desaturate=function(t){void 0===t&&(t=10);var n=this.toHsl();return n.s-=t/100,n.s=oW(n.s),new e(n)},e.prototype.saturate=function(t){void 0===t&&(t=10);var n=this.toHsl();return n.s+=t/100,n.s=oW(n.s),new e(n)},e.prototype.greyscale=function(){return this.desaturate(100)},e.prototype.spin=function(t){var n=this.toHsl(),r=(n.h+t)%360;return n.h=r<0?360+r:r,new e(n)},e.prototype.mix=function(t,n){void 0===n&&(n=50);var r=this.toRgb(),i=new e(t).toRgb(),a=n/100;return new e({r:(i.r-r.r)*a+r.r,g:(i.g-r.g)*a+r.g,b:(i.b-r.b)*a+r.b,a:(i.a-r.a)*a+r.a})},e.prototype.analogous=function(t,n){void 0===t&&(t=6),void 0===n&&(n=30);var r=this.toHsl(),i=360/n,a=[this];for(r.h=(r.h-(i*t>>1)+720)%360;--t;)r.h=(r.h+i)%360,a.push(new e(r));return a},e.prototype.complement=function(){var t=this.toHsl();return t.h=(t.h+180)%360,new e(t)},e.prototype.monochromatic=function(t){void 0===t&&(t=6);for(var n=this.toHsv(),r=n.h,i=n.s,a=n.v,o=[],s=1/t;t--;)o.push(new e({h:r,s:i,v:a})),a=(a+s)%1;return o},e.prototype.splitcomplement=function(){var t=this.toHsl(),n=t.h;return[this,new e({h:(n+72)%360,s:t.s,l:t.l}),new e({h:(n+216)%360,s:t.s,l:t.l})]},e.prototype.onBackground=function(t){var n=this.toRgb(),r=new e(t).toRgb(),i=n.a+r.a*(1-n.a);return new e({r:(n.r*n.a+r.r*r.a*(1-n.a))/i,g:(n.g*n.a+r.g*r.a*(1-n.a))/i,b:(n.b*n.a+r.b*r.a*(1-n.a))/i,a:i})},e.prototype.triad=function(){return this.polyad(3)},e.prototype.tetrad=function(){return this.polyad(4)},e.prototype.polyad=function(t){for(var n=this.toHsl(),r=n.h,i=[this],a=360/t,o=1;o=60&&Math.round(e.h)<=240?n?Math.round(e.h)-2*t:Math.round(e.h)+2*t:n?Math.round(e.h)+2*t:Math.round(e.h)-2*t)<0?r+=360:r>=360&&(r-=360),r}function kW(e,t,n){return 0===e.h&&0===e.s?e.s:((r=n?e.s-.16*t:4===t?e.s+.16:e.s+.05*t)>1&&(r=1),n&&5===t&&r>.1&&(r=.1),r<.06&&(r=.06),Number(r.toFixed(2)));var r}function RW(e,t,n){var r;return(r=n?e.v+.05*t:e.v-.15*t)>1&&(r=1),Number(r.toFixed(2))}function IW(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=[],r=yW(e),i=5;i>0;i-=1){var a=MW(r),o=EW(yW({h:CW(a,i,!0),s:kW(a,i,!0),v:RW(a,i,!0)}));n.push(o)}n.push(EW(r));for(var s=1;s<=4;s+=1){var u=MW(r),l=EW(yW({h:CW(u,s),s:kW(u,s),v:RW(u,s)}));n.push(l)}return"dark"===t.theme?TW.map(function(e){var r=e.index,i=e.opacity,a=EW(function(e,t,n){var r=n/100;return{r:(t.r-e.r)*r+e.r,g:(t.g-e.g)*r+e.g,b:(t.b-e.b)*r+e.b}}(yW(t.backgroundColor||"#141414"),yW(n[r]),100*i));return a}):n}var NW={red:"#F5222D",volcano:"#FA541C",orange:"#FA8C16",gold:"#FAAD14",yellow:"#FADB14",lime:"#A0D911",green:"#52C41A",cyan:"#13C2C2",blue:"#1890FF",geekblue:"#2F54EB",purple:"#722ED1",magenta:"#EB2F96",grey:"#666666"},PW={},LW={};Object.keys(NW).forEach(function(e){PW[e]=IW(NW[e]),PW[e].primary=PW[e][5],LW[e]=IW(NW[e],{theme:"dark",backgroundColor:"#141414"}),LW[e].primary=LW[e][5]});var DW=PW.blue;var OW={blue:"#1677ff",purple:"#722ED1",cyan:"#13C2C2",green:"#52C41A",magenta:"#EB2F96",pink:"#eb2f96",red:"#F5222D",orange:"#FA8C16",yellow:"#FADB14",volcano:"#FA541C",geekblue:"#2F54EB",gold:"#FAAD14",lime:"#A0D911"},FW=eV(eV({},OW),{colorPrimary:"#1677ff",colorSuccess:"#52c41a",colorWarning:"#faad14",colorError:"#ff4d4f",colorInfo:"#1677ff",colorTextBase:"",colorBgBase:"",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial,\n'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol',\n'Noto Color Emoji'",fontSize:14,lineWidth:1,lineType:"solid",motionUnit:.1,motionBase:0,motionEaseOutCirc:"cubic-bezier(0.08, 0.82, 0.17, 1)",motionEaseInOutCirc:"cubic-bezier(0.78, 0.14, 0.15, 0.86)",motionEaseOut:"cubic-bezier(0.215, 0.61, 0.355, 1)",motionEaseInOut:"cubic-bezier(0.645, 0.045, 0.355, 1)",motionEaseOutBack:"cubic-bezier(0.12, 0.4, 0.29, 1.46)",motionEaseInBack:"cubic-bezier(0.71, -0.46, 0.88, 0.6)",motionEaseInQuint:"cubic-bezier(0.755, 0.05, 0.855, 0.06)",motionEaseOutQuint:"cubic-bezier(0.23, 1, 0.32, 1)",borderRadius:6,sizeUnit:4,sizeStep:4,sizePopupArrow:16,controlHeight:32,zIndexBase:0,zIndexPopupBase:1e3,opacityImage:1,wireframe:!1});var BW=function(e,t){return new wW(e).setAlpha(t).toRgbString()},UW=function(e,t){return new wW(e).darken(t).toHexString()},zW=function(e){var t=IW(e);return{1:t[0],2:t[1],3:t[2],4:t[3],5:t[4],6:t[5],7:t[6],8:t[4],9:t[5],10:t[6]}},VW=function(e,t){var n=e||"#fff",r=t||"#000";return{colorBgBase:n,colorTextBase:r,colorText:BW(r,.88),colorTextSecondary:BW(r,.65),colorTextTertiary:BW(r,.45),colorTextQuaternary:BW(r,.25),colorFill:BW(r,.15),colorFillSecondary:BW(r,.06),colorFillTertiary:BW(r,.04),colorFillQuaternary:BW(r,.02),colorBgLayout:UW(n,4),colorBgContainer:UW(n,0),colorBgElevated:UW(n,0),colorBgSpotlight:BW(r,.85),colorBorder:UW(n,15),colorBorderSecondary:UW(n,6)}};var HW=function(e){var t=function(e){var t=new Array(10).fill(null).map(function(t,n){var r=n-1,i=e*Math.pow(2.71828,r/5),a=n>1?Math.floor(i):Math.ceil(i);return 2*Math.floor(a/2)});return t[1]=e,t.map(function(e){return{size:e,lineHeight:(e+8)/e}})}(e),n=t.map(function(e){return e.size}),r=t.map(function(e){return e.lineHeight});return{fontSizeSM:n[0],fontSize:n[1],fontSizeLG:n[2],fontSizeXL:n[3],fontSizeHeading1:n[6],fontSizeHeading2:n[5],fontSizeHeading3:n[4],fontSizeHeading4:n[3],fontSizeHeading5:n[2],lineHeight:r[1],lineHeightLG:r[2],lineHeightSM:r[0],lineHeightHeading1:r[6],lineHeightHeading2:r[5],lineHeightHeading3:r[4],lineHeightHeading4:r[3],lineHeightHeading5:r[2]}};function WW(e){return e>=0&&e<=255}function GW(e,t){var n=new wW(e).toRgb(),r=n.r,i=n.g,a=n.b;if(n.a<1)return e;for(var o=new wW(t).toRgb(),s=o.r,u=o.g,l=o.b,c=.01;c<=1;c+=.01){var h=Math.round((r-s*(1-c))/c),d=Math.round((i-u*(1-c))/c),f=Math.round((a-l*(1-c))/c);if(WW(h)&&WW(d)&&WW(f))return new wW({r:h,g:d,b:f,a:Math.round(100*c)/100}).toRgbString()}return new wW({r:r,g:i,b:a,a:1}).toRgbString()}var jW=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i=5?n=t+1:t<16&&t>=6?n=t+2:t>=16&&(n=16),t<7&&t>=5?r=4:t<8&&t>=7?r=5:t<14&&t>=8?r=6:t<16&&t>=14?r=7:t>=16&&(r=8),t<6&&t>=2?i=1:t>=6&&(i=2),t>4&&t<8?a=4:t>=8&&(a=6),{borderRadius:t>16?16:t,borderRadiusXS:i,borderRadiusSM:r,borderRadiusLG:n,borderRadiusOuter:a}))}(e))}),nG={token:FW,hashed:!0},rG=Symbol("DesignTokenContext"),iG=nn(),aG=ar({props:{value:uV()},setup:function(e,t){var n,r=t.slots;return n=Ea(function(){return e.value}),$r(rG,n),Ti(n,function(){var e;iG.value=on(n),(e=iG).dep&&e.dep.trigger()},{immediate:!0,deep:!0}),function(){var e;return null===(e=r.default)||void 0===e?void 0:e.call(r)}}});function oG(){var e=ei(rG,Ea(function(){return iG.value||nG})),t=Ea(function(){return"".concat("4.2.6","-").concat(e.value.hashed||"")}),n=Ea(function(){return e.value.theme||tG}),r=uH(n,Ea(function(){return[FW,e.value.token]}),Ea(function(){return{salt:t.value,override:eV({override:e.value.token},e.value.components),formatToken:QW}}));return[n,Ea(function(){return r.value[0]}),Ea(function(){return e.value.hashed?r.value[1]:""})]}var sG=ar({compatConfig:{MODE:3},setup:function(){var e=C(oG(),2)[1],t=Ea(function(){return new wW(e.value.colorBgBase).toHsl().l<.5?{opacity:.65}:{}});return function(){return ta("svg",{style:t.value,width:"184",height:"152",viewBox:"0 0 184 152",xmlns:"http://www.w3.org/2000/svg"},[ta("g",{fill:"none","fill-rule":"evenodd"},[ta("g",{transform:"translate(24 31.67)"},[ta("ellipse",{"fill-opacity":".8",fill:"#F5F5F7",cx:"67.797",cy:"106.89",rx:"67.797",ry:"12.668"},null),ta("path",{d:"M122.034 69.674L98.109 40.229c-1.148-1.386-2.826-2.225-4.593-2.225h-51.44c-1.766 0-3.444.839-4.592 2.225L13.56 69.674v15.383h108.475V69.674z",fill:"#AEB8C2"},null),ta("path",{d:"M101.537 86.214L80.63 61.102c-1.001-1.207-2.507-1.867-4.048-1.867H31.724c-1.54 0-3.047.66-4.048 1.867L6.769 86.214v13.792h94.768V86.214z",fill:"url(#linearGradient-1)",transform:"translate(13.56)"},null),ta("path",{d:"M33.83 0h67.933a4 4 0 0 1 4 4v93.344a4 4 0 0 1-4 4H33.83a4 4 0 0 1-4-4V4a4 4 0 0 1 4-4z",fill:"#F5F5F7"},null),ta("path",{d:"M42.678 9.953h50.237a2 2 0 0 1 2 2V36.91a2 2 0 0 1-2 2H42.678a2 2 0 0 1-2-2V11.953a2 2 0 0 1 2-2zM42.94 49.767h49.713a2.262 2.262 0 1 1 0 4.524H42.94a2.262 2.262 0 0 1 0-4.524zM42.94 61.53h49.713a2.262 2.262 0 1 1 0 4.525H42.94a2.262 2.262 0 0 1 0-4.525zM121.813 105.032c-.775 3.071-3.497 5.36-6.735 5.36H20.515c-3.238 0-5.96-2.29-6.734-5.36a7.309 7.309 0 0 1-.222-1.79V69.675h26.318c2.907 0 5.25 2.448 5.25 5.42v.04c0 2.971 2.37 5.37 5.277 5.37h34.785c2.907 0 5.277-2.421 5.277-5.393V75.1c0-2.972 2.343-5.426 5.25-5.426h26.318v33.569c0 .617-.077 1.216-.221 1.789z",fill:"#DCE0E6"},null)]),ta("path",{d:"M149.121 33.292l-6.83 2.65a1 1 0 0 1-1.317-1.23l1.937-6.207c-2.589-2.944-4.109-6.534-4.109-10.408C138.802 8.102 148.92 0 161.402 0 173.881 0 184 8.102 184 18.097c0 9.995-10.118 18.097-22.599 18.097-4.528 0-8.744-1.066-12.28-2.902z",fill:"#DCE0E6"},null),ta("g",{transform:"translate(149.65 15.383)",fill:"#FFF"},[ta("ellipse",{cx:"20.654",cy:"3.167",rx:"2.849",ry:"2.815"},null),ta("path",{d:"M5.698 5.63H0L2.898.704zM9.259.704h4.985V5.63H9.259z"},null)])])])}}});sG.PRESENTED_IMAGE_DEFAULT=!0;var uG=ar({compatConfig:{MODE:3},setup:function(){var e=C(oG(),2)[1],t=Ea(function(){var t=e.value,n=t.colorFill,r=t.colorFillTertiary,i=t.colorFillQuaternary,a=t.colorBgContainer;return{borderColor:new wW(n).onBackground(a).toHexString(),shadowColor:new wW(r).onBackground(a).toHexString(),contentColor:new wW(i).onBackground(a).toHexString()}});return function(){return ta("svg",{width:"64",height:"41",viewBox:"0 0 64 41",xmlns:"http://www.w3.org/2000/svg"},[ta("g",{transform:"translate(0 1)",fill:"none","fill-rule":"evenodd"},[ta("ellipse",{fill:t.value.shadowColor,cx:"32",cy:"33",rx:"32",ry:"7"},null),ta("g",{"fill-rule":"nonzero",stroke:t.value.borderColor},[ta("path",{d:"M55 12.76L44.854 1.258C44.367.474 43.656 0 42.907 0H21.093c-.749 0-1.46.474-1.947 1.257L9 12.761V22h46v-9.24z"},null),ta("path",{d:"M41.613 15.931c0-1.605.994-2.93 2.227-2.931H55v18.137C55 33.26 53.68 35 52.05 35h-40.1C10.32 35 9 33.259 9 31.137V13h11.16c1.233 0 2.227 1.323 2.227 2.928v.022c0 1.605 1.005 2.901 2.237 2.901h14.752c1.232 0 2.237-1.308 2.237-2.913v-.007z",fill:t.value.contentColor},null)])])])}}});uG.PRESENTED_IMAGE_SIMPLE=!0;var lG=function(e){var t=e.componentCls,n=e.margin,r=e.marginXS,i=e.marginXL;return M({},t,M(M(M(M({marginInline:r,fontSize:e.fontSize,lineHeight:e.lineHeight,textAlign:"center"},"".concat(t,"-image"),{height:e.emptyImgHeight,marginBottom:r,opacity:e.opacityImage,img:{height:"100%"},svg:{height:"100%",margin:"auto"}}),"".concat(t,"-footer"),{marginTop:n}),"&-normal",M({marginBlock:i,color:e.colorTextDisabled},"".concat(t,"-image"),{height:e.emptyImgHeightMD})),"&-small",M({marginBlock:r,color:e.colorTextDisabled},"".concat(t,"-image"),{height:e.emptyImgHeightSM})))},cG=KW("Empty",function(e){var t=e.componentCls,n=e.controlHeightLG,r=$W(e,{emptyImgCls:"".concat(t,"-img"),emptyImgHeight:2.5*n,emptyImgHeightMD:n,emptyImgHeightSM:.875*n});return[lG(r)]}),hG=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i=0||(i[n]=e[n]);return i}function AG(e){return 1==(null!=(t=e)&&"object"==P(t)&&!1===Array.isArray(t))&&"[object Object]"===Object.prototype.toString.call(e);var t}var wG=Object.prototype,TG=wG.toString,MG=wG.hasOwnProperty,EG=/^\s*function (\w+)/;function CG(e){var t,n=null!==(t=null==e?void 0:e.type)&&void 0!==t?t:e;if(n){var r=n.toString().match(EG);return r?r[1]:""}return""}var kG=function(e){var t,n;return!1!==AG(e)&&"function"==typeof(t=e.constructor)&&!1!==AG(n=t.prototype)&&!1!==n.hasOwnProperty("isPrototypeOf")},RG=function(e){return e},IG=function(e,t){return MG.call(e,t)},NG=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e},PG=Array.isArray||function(e){return"[object Array]"===TG.call(e)},LG=function(e){return"[object Function]"===TG.call(e)},DG=function(e){return kG(e)&&IG(e,"_vueTypes_name")},OG=function(e){return kG(e)&&(IG(e,"type")||["_vueTypes_name","validator","default","required"].some(function(t){return IG(e,t)}))};function FG(e,t){return Object.defineProperty(e.bind(t),"__original",{value:e})}function BG(e,t,n){var r,i=!0,a="";r=kG(e)?e:{type:e};var o=DG(r)?r._vueTypes_name+" - ":"";if(OG(r)&&null!==r.type){if(void 0===r.type||!0===r.type)return i;if(!r.required&&void 0===t)return i;PG(r.type)?(i=r.type.some(function(e){return!0===BG(e,t)}),a=r.type.map(function(e){return CG(e)}).join(" or ")):i="Array"===(a=CG(r))?PG(t):"Object"===a?kG(t):"String"===a||"Number"===a||"Boolean"===a||"Function"===a?function(e){if(null==e)return"";var t=e.constructor.toString().match(EG);return t?t[1]:""}(t)===a:t instanceof r.type}if(!i)return o+'value "'+t+'" should be of type "'+a+'"';if(IG(r,"validator")&&LG(r.validator)){var s=RG,u=[];if(RG=function(e){u.push(e)},i=r.validator(t),RG=s,!i){var l=(u.length>1?"* ":"")+u.join("\n* ");return u.length=0,l}}return i}function UG(e,t){var n=Object.defineProperties(t,{_vueTypes_name:{value:e,writable:!0},isRequired:{get:function(){return this.required=!0,this}},def:{value:function(e){return void 0!==e||this.default?LG(e)||!0===BG(this,e)?(this.default=PG(e)?function(){return[].concat(e)}:kG(e)?function(){return Object.assign({},e)}:e,this):(RG(this._vueTypes_name+' - invalid default value: "'+e+'"'),this):this}}}),r=n.validator;return LG(r)&&(n.validator=FG(r,n)),n}function zG(e,t){var n=UG(e,t);return Object.defineProperty(n,"validate",{value:function(e){return LG(this.validator)&&RG(this._vueTypes_name+" - calling .validate() will overwrite the current custom validator function. Validator info:\n"+JSON.stringify(this)),this.validator=FG(e,this),this}})}function VG(e,t,n){var r,i,a=(r=t,i={},Object.getOwnPropertyNames(r).forEach(function(e){i[e]=Object.getOwnPropertyDescriptor(r,e)}),Object.defineProperties({},i));if(a._vueTypes_name=e,!kG(n))return a;var o,s,u=n.validator,l=SG(n,["validator"]);if(LG(u)){var c=a.validator;c&&(c=null!==(s=(o=c).__original)&&void 0!==s?s:o),a.validator=FG(c?function(e){return c.call(this,e)&&u.call(this,e)}:u,a)}return Object.assign(a,l)}function HG(e){return e.replace(/^(?!\s*$)/gm," ")}var WG=function(){function e(){}return e.extend=function(e){var t=this;if(PG(e))return e.forEach(function(e){return t.extend(e)}),this;var n=e.name,r=e.validate,i=void 0!==r&&r,a=e.getter,o=void 0!==a&&a,s=SG(e,["name","validate","getter"]);if(IG(this,n))throw new TypeError('[VueTypes error]: Type "'+n+'" already defined');var u,l=s.type;return DG(l)?(delete s.type,Object.defineProperty(this,n,o?{get:function(){return VG(n,l,s)}}:{value:function(){var e,t=VG(n,l,s);return t.validator&&(t.validator=(e=t.validator).bind.apply(e,[t].concat([].slice.call(arguments)))),t}})):(u=o?{get:function(){var e=Object.assign({},s);return i?zG(n,e):UG(n,e)},enumerable:!0}:{value:function(){var e,t,r=Object.assign({},s);return e=i?zG(n,r):UG(n,r),r.validator&&(e.validator=(t=r.validator).bind.apply(t,[e].concat([].slice.call(arguments)))),e},enumerable:!0},Object.defineProperty(this,n,u))},_G(e,0,[{key:"any",get:function(){return zG("any",{})}},{key:"func",get:function(){return zG("function",{type:Function}).def(this.defaults.func)}},{key:"bool",get:function(){return zG("boolean",{type:Boolean}).def(this.defaults.bool)}},{key:"string",get:function(){return zG("string",{type:String}).def(this.defaults.string)}},{key:"number",get:function(){return zG("number",{type:Number}).def(this.defaults.number)}},{key:"array",get:function(){return zG("array",{type:Array}).def(this.defaults.array)}},{key:"object",get:function(){return zG("object",{type:Object}).def(this.defaults.object)}},{key:"integer",get:function(){return UG("integer",{type:Number,validator:function(e){return NG(e)}}).def(this.defaults.integer)}},{key:"symbol",get:function(){return UG("symbol",{validator:function(e){return"symbol"==P(e)}})}}]),e}();function GG(e){var t;return void 0===e&&(e={func:function(){},bool:!0,string:"",number:0,array:function(){return[]},object:function(){return{}},integer:0}),(t=function(t){function n(){return t.apply(this,arguments)||this}return xG(n,t),_G(n,0,[{key:"sensibleDefaults",get:function(){return bG({},this.defaults)},set:function(t){this.defaults=!1!==t?bG({},!0!==t?t:e):{}}}]),n}(WG)).defaults=bG({},e),t}WG.defaults={},WG.custom=function(e,t){if(void 0===t&&(t="custom validation failed"),"function"!=typeof e)throw new TypeError("[VueTypes error]: You must provide a function as argument");return UG(e.name||"<>",{validator:function(n){var r=e(n);return r||RG(this._vueTypes_name+" - "+t),r}})},WG.oneOf=function(e){if(!PG(e))throw new TypeError("[VueTypes error]: You must provide an array as argument.");var t='oneOf - value should be one of "'+e.join('", "')+'".',n=e.reduce(function(e,t){if(null!=t){var n=t.constructor;-1===e.indexOf(n)&&e.push(n)}return e},[]);return UG("oneOf",{type:n.length>0?n:void 0,validator:function(n){var r=-1!==e.indexOf(n);return r||RG(t),r}})},WG.instanceOf=function(e){return UG("instanceOf",{type:e})},WG.oneOfType=function(e){if(!PG(e))throw new TypeError("[VueTypes error]: You must provide an array as argument");for(var t=!1,n=[],r=0;r0&&n.some(function(e){return-1===a.indexOf(e)})){var o=n.filter(function(e){return-1===a.indexOf(e)});return RG(1===o.length?'shape - required property "'+o[0]+'" is not defined.':'shape - required properties "'+o.join('", "')+'" are not defined.'),!1}return a.every(function(n){if(-1===t.indexOf(n))return!0===i._vueTypes_isLoose||(RG('shape - shape definition does not include a "'+n+'" property. Allowed keys: "'+t.join('", "')+'".'),!1);var a=BG(e[n],r[n]);return"string"==typeof a&&RG('shape - "'+n+'" property validation error:\n '+HG(a)),!0===a})}});return Object.defineProperty(r,"_vueTypes_isLoose",{writable:!0,value:!1}),Object.defineProperty(r,"loose",{get:function(){return this._vueTypes_isLoose=!0,this}}),r},WG.utils={validate:function(e,t){return!0===BG(t,e)},toType:function(e,t,n){return void 0===n&&(n=!1),n?zG(e,t):UG(e,t)}},function(e){function t(){return e.apply(this,arguments)||this}xG(t,e)}(GG());var jG=GG({func:void 0,bool:void 0,string:void 0,number:void 0,array:void 0,object:void 0,integer:void 0});jG.extend([{name:"looseBool",getter:!0,type:Boolean,default:void 0},{name:"style",getter:!0,type:[String,Object],default:void 0},{name:"VueNode",getter:!0,type:null}]),function(){for(var e=arguments.length,t=new Array(e),n=0;n1&&void 0!==arguments[1]?arguments[1]:{};return eV(e?{name:e,appear:!0,appearActiveClass:"".concat(e),appearToClass:"".concat(e,"-appear ").concat(e,"-appear-active"),enterFromClass:"".concat(e,"-appear ").concat(e,"-enter ").concat(e,"-appear-prepare ").concat(e,"-enter-prepare"),enterActiveClass:"".concat(e),enterToClass:"".concat(e,"-enter ").concat(e,"-appear ").concat(e,"-appear-active ").concat(e,"-enter-active"),leaveActiveClass:"".concat(e," ").concat(e,"-leave"),leaveToClass:"".concat(e,"-leave-active")}:{css:!1},t)},qG=Symbol("PortalContextKey"),XG=function(){!function(e){$r(qG,{inTriggerContext:(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{inTriggerContext:!0}).inTriggerContext,shouldRender:Ea(function(){var t=e||{},n=t.sPopupVisible,r=t.popupRef,i=t.forceRender,a=t.autoDestroy,o=!1;return(n||r||i)&&(o=!0),!n&&a&&(o=!1),o})})}({},{inTriggerContext:!1});var e=ei(qG,{shouldRender:Ea(function(){return!1}),inTriggerContext:!1});return{shouldRender:Ea(function(){return e.shouldRender.value||!1===e.inTriggerContext})}},YG=ar({compatConfig:{MODE:3},name:"Portal",inheritAttrs:!1,props:{getContainer:jG.func.isRequired,didUpdate:Function},setup:function(e,t){var n,r=t.slots,i=!0,a=XG().shouldRender;function o(){a.value&&(n=e.getContainer())}gr(function(){i=!1,o()}),yr(function(){n||o()});var s=Ti(a,function(){a.value&&!n&&(n=e.getContainer()),n&&s()});return br(function(){Cn(function(){var t;a.value&&(null===(t=e.didUpdate)||void 0===t||t.call(e,e))})}),function(){var e;return a.value?i?null===(e=r.default)||void 0===e?void 0:e.call(r):n?ta(Yn,{to:n},r):null:null}}}),KG=Symbol("iconContext"),ZG=function(){return ei(KG,{prefixCls:tn("anticon"),rootClassName:tn(""),csp:tn()})};function JG(){return!("undefined"==typeof window||!window.document||!window.document.createElement)}var $G="data-vc-order",ej=new Map;function tj(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).mark;return e?e.startsWith("data-")?e:"data-".concat(e):"vc-icon-key"}function nj(e){return e.attachTo?e.attachTo:document.querySelector("head")||document.body}function rj(e){return Array.from((ej.get(e)||e).children).filter(function(e){return"STYLE"===e.tagName})}function ij(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!JG())return null;var n=t.csp,r=t.prepend,i=document.createElement("style");i.setAttribute($G,function(e){return"queue"===e?"prependQueue":e?"prepend":"append"}(r)),n&&n.nonce&&(i.nonce=n.nonce),i.innerHTML=e;var a=nj(t),o=a.firstChild;if(r){if("queue"===r){var s=rj(a).filter(function(e){return["prepend","prependQueue"].includes(e.getAttribute($G))});if(s.length)return a.insertBefore(i,s[s.length-1].nextSibling),i}a.insertBefore(i,o)}else a.appendChild(i);return i}function aj(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!function(e,t){var n=ej.get(e);if(!n||!function(e,t){return!!e&&!!e.contains&&e.contains(t)}(document,n)){var r=ij("",t),i=r.parentNode;ej.set(e,i),e.removeChild(r)}}(nj(n),n);var r=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return rj(nj(t)).find(function(n){return n.getAttribute(tj(t))===e})}(t,n);if(r)return n.csp&&n.csp.nonce&&r.nonce!==n.csp.nonce&&(r.nonce=n.csp.nonce),r.innerHTML!==e&&(r.innerHTML=e),r;var i=ij(e,n);return i.setAttribute(tj(n),t),i}function oj(e){for(var t=1;t=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function mj(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=new Array(t);n * {\n line-height: 1;\n}\n\n.anticon svg {\n display: inline-block;\n}\n\n.anticon::before {\n display: none;\n}\n\n.anticon .anticon-icon {\n display: block;\n}\n\n.anticon[tabindex] {\n cursor: pointer;\n}\n\n.anticon-spin::before,\n.anticon-spin {\n display: inline-block;\n -webkit-animation: loadingCircle 1s infinite linear;\n animation: loadingCircle 1s infinite linear;\n}\n\n@-webkit-keyframes loadingCircle {\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n}\n\n@keyframes loadingCircle {\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n}\n",t&&(i=i.replace(/anticon/g,t.value)),Cn(function(){if(JG()){var e=fj(r.vnode.el);aj(i,"@ant-design-vue-icons",{prepend:!0,csp:n.value,attachTo:e})}}),function(){return null}}}),wj=["class","icon","spin","rotate","tabindex","twoToneColor","onClick"];function Tj(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,i,a=[],o=!0,s=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(u){s=!0,i=u}finally{try{o||null==n.return||n.return()}finally{if(s)throw i}}return a}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return Mj(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Mj(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Mj(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}Sj(DW.primary);var Rj=function(e,t){var n,r=Ej({},e,t.attrs),i=r.class,a=r.icon,o=r.spin,s=r.rotate,u=r.tabindex,l=r.twoToneColor,c=r.onClick,h=kj(r,wj),d=ZG(),f=d.prefixCls,p=d.rootClassName,v=(Cj(n={},p.value,!!p.value),Cj(n,f.value,!0),Cj(n,"".concat(f.value,"-").concat(a.name),Boolean(a.name)),Cj(n,"".concat(f.value,"-spin"),!!o||"loading"===a.name),n),m=u;void 0===m&&c&&(m=-1);var g=s?{msTransform:"rotate(".concat(s,"deg)"),transform:"rotate(".concat(s,"deg)")}:void 0,y=Tj(hj(l),2),_=y[0],b=y[1];return ta("span",Ej({role:"img","aria-label":a.name},h,{onClick:c,class:[v,i],tabindex:m}),[ta(_j,{icon:a,primaryColor:_,secondaryColor:b,style:g},null),ta(Aj,null,null)])};Rj.props={spin:Boolean,rotate:Number,icon:Object,twoToneColor:[String,Array]},Rj.displayName="AntdIcon",Rj.inheritAttrs=!1,Rj.getTwoToneColor=function(){var e=_j.getTwoToneColors();return e.calculated?[e.primaryColor,e.secondaryColor]:e.primaryColor},Rj.setTwoToneColor=Sj;var Ij={icon:{tag:"svg",attrs:{viewBox:"0 0 1024 1024",focusable:"false"},children:[{tag:"path",attrs:{d:"M988 548c-19.9 0-36-16.1-36-36 0-59.4-11.6-117-34.6-171.3a440.45 440.45 0 00-94.3-139.9 437.71 437.71 0 00-139.9-94.3C629 83.6 571.4 72 512 72c-19.9 0-36-16.1-36-36s16.1-36 36-36c69.1 0 136.2 13.5 199.3 40.3C772.3 66 827 103 874 150c47 47 83.9 101.8 109.7 162.7 26.7 63.1 40.2 130.2 40.2 199.3.1 19.9-16 36-35.9 36z"}}]},name:"loading",theme:"outlined"};function Nj(e){for(var t=1;t=a&&(i.key=u[0].notice.key,i.updateMark=TQ(),i.userPassKey=r,u.shift()),u.push({notice:i,holderCallback:n})),o.value=u},remove:u,notices:o}),function(){var t,r=e.prefixCls,l=e.closeIcon,c=void 0===l?null===(t=i.closeIcon)||void 0===t?void 0:t.call(i,{prefixCls:r}):l,h=o.value.map(function(t,n){var i=t.notice,s=t.holderCallback,l=n===o.value.length-1?i.updateMark:void 0,h=i.key,d=i.userPassKey,f=i.content,p=eV(eV(eV({prefixCls:r,closeIcon:"function"==typeof c?c({prefixCls:r}):c},i),i.props),{key:h,noticeKey:d||h,updateMark:l,onClose:function(e){var t;u(e),null===(t=i.onClose)||void 0===t||t.call(i)},onClick:i.onClick});return s?ta("div",{key:h,class:"".concat(r,"-hook-holder"),ref:function(e){void 0!==h&&(e?(a.set(h,e),s(e,p)):a.delete(h))}},null):ta(xQ,$z($z({},p),{},{class:aV(p.class,e.hashId)}),{default:function(){return["function"==typeof f?f({prefixCls:r}):f]}})}),d=M(M(M({},r,1),n.class,!!n.class),e.hashId,!0);return ta("div",{class:d,style:n.style||{top:"65px",left:"50%"}},[ta(Eo,$z({tag:"div"},s.value),{default:function(){return[h]}})])}}});MQ.newInstance=function(e,t){var n=e||{},r=n.name,i=void 0===r?"notification":r,a=n.getContainer,o=n.appContext,s=n.prefixCls,u=n.rootPrefixCls,l=n.transitionName,c=n.hasTransitionName,h=n.useStyle,d=SQ(n,["name","getContainer","appContext","prefixCls","rootPrefixCls","transitionName","hasTransitionName","useStyle"]),f=document.createElement("div");a?a().appendChild(f):document.body.appendChild(f);var p=ar({compatConfig:{MODE:3},name:"NotificationWrapper",setup:function(e,n){var r=n.attrs,a=nn(),o=Ea(function(){return Iq.getPrefixCls(i,s)}),d=C(h(o),2)[1];return yr(function(){t({notice:function(e){var t;null===(t=a.value)||void 0===t||t.add(e)},removeNotice:function(e){var t;null===(t=a.value)||void 0===t||t.remove(e)},destroy:function(){Bo(null,f),f.parentNode&&f.parentNode.removeChild(f)},component:a})}),function(){var e=Iq,t=e.getRootPrefixCls(u,o.value),n=c?l:"".concat(o.value,"-").concat(l);return ta(Pq,$z($z({},e),{},{prefixCls:t}),{default:function(){return[ta(MQ,$z($z({ref:a},r),{},{prefixCls:o.value,transitionName:n,hashId:d.value}),null)]}})}}}),v=ta(p,d);v.appContext=o||v.appContext,Bo(v,f)};var EQ=0,CQ=Date.now();function kQ(){var e=EQ;return EQ+=1,"rcNotification_".concat(CQ,"_").concat(e)}var RQ=ar({name:"HookNotification",inheritAttrs:!1,props:["prefixCls","transitionName","animation","maxCount","closeIcon","hashId","remove","notices","getStyles","getClassName","onAllRemoved","getContainer"],setup:function(e,t){var n=t.attrs,r=t.slots,i=new Map,a=Ea(function(){return e.notices}),o=Ea(function(){var t=e.transitionName;if(!t&&e.animation)switch(P(e.animation)){case"string":t=e.animation;break;case"function":t=e.animation().name;break;case"object":t=e.animation.name;break;default:t="".concat(e.prefixCls,"-fade")}return QG(t)}),s=tn({});Ti(a,function(){var t={};Object.keys(s.value).forEach(function(e){t[e]=[]}),e.notices.forEach(function(e){var n=e.notice.placement,r=void 0===n?"topRight":n;r&&(t[r]=t[r]||[],t[r].push(e))}),s.value=t});var u=Ea(function(){return Object.keys(s.value)});return function(){var t,l=e.prefixCls,c=e.closeIcon,h=void 0===c?null===(t=r.closeIcon)||void 0===t?void 0:t.call(r,{prefixCls:l}):c,d=u.value.map(function(t){var r,u,c=s.value[t],d=null===(r=e.getClassName)||void 0===r?void 0:r.call(e,t),f=null===(u=e.getStyles)||void 0===u?void 0:u.call(e,t),p=c.map(function(t,n){var r=t.notice,o=t.holderCallback,s=n===a.value.length-1?r.updateMark:void 0,u=r.key,c=r.userPassKey,d=r.content,f=eV(eV(eV({prefixCls:l,closeIcon:"function"==typeof h?h({prefixCls:l}):h},r),r.props),{key:u,noticeKey:c||u,updateMark:s,onClose:function(t){var n;!function(t){e.remove(t)}(t),null===(n=r.onClose)||void 0===n||n.call(r)},onClick:r.onClick});return o?ta("div",{key:u,class:"".concat(l,"-hook-holder"),ref:function(e){void 0!==u&&(e?(i.set(u,e),o(e,f)):i.delete(u))}},null):ta(xQ,$z($z({},f),{},{class:aV(f.class,e.hashId)}),{default:function(){return["function"==typeof d?d({prefixCls:l}):d]}})}),v=M(M(M(M(M({},l,1),"".concat(l,"-").concat(t),1),n.class,!!n.class),e.hashId,!0),d,!!d);return ta("div",{key:t,class:v,style:n.style||f||{top:"65px",left:"50%"}},[ta(Eo,$z($z({tag:"div"},o.value),{},{onAfterLeave:function(){var n;c.length>0||(Reflect.deleteProperty(s.value,t),null===(n=e.onAllRemoved)||void 0===n||n.call(e))}}),{default:function(){return[p]}})])});return ta(YG,{getContainer:e.getContainer},{default:function(){return[d]}})}}}),IQ=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i0&&void 0!==arguments[0]?arguments[0]:{},t=e.getContainer,n=void 0===t?NQ:t,r=e.motion,i=e.prefixCls,a=e.maxCount,o=e.getClassName,s=e.getStyles,u=e.onAllRemoved,l=IQ(e,["getContainer","motion","prefixCls","maxCount","getClassName","getStyles","onAllRemoved"]),c=nn([]),h=nn(),d=function(e){c.value=c.value.filter(function(t){var n=t.notice,r=n.key;return(n.userPassKey||r)!==e})},f=nn([]),p={open:function(e){var t=function(){for(var e={},t=arguments.length,n=new Array(t),r=0;r=a&&(r.key=o[0].notice.key,r.updateMark=kQ(),r.userPassKey=n,o.shift()),o.push({notice:r,holderCallback:t})),c.value=o}(e.config);break;case"close":d(e.key);break;case"destroy":c.value=[]}}),f.value=[])}),[p,function(){return ta(RQ,{ref:h,prefixCls:i,maxCount:a,notices:c.value,remove:d,getClassName:o,getStyles:s,animation:r,hashId:e.hashId,onAllRemoved:u,getContainer:n},null)}]}var DQ=function(e){var t=e.componentCls,n=e.iconCls,r=e.boxShadowSecondary,i=e.colorBgElevated,a=e.colorSuccess,o=e.colorError,s=e.colorWarning,u=e.colorInfo,l=e.fontSizeLG,c=e.motionEaseInOutCirc,h=e.motionDurationSlow,d=e.marginXS,f=e.paddingXS,p=e.borderRadiusLG,v=e.zIndexPopup,m=e.messageNoticeContentPadding,g=new iW("MessageMoveIn",{"0%":{padding:0,transform:"translateY(-100%)",opacity:0},"100%":{padding:f,transform:"translateY(0)",opacity:1}}),y=new iW("MessageMoveOut",{"0%":{maxHeight:e.height,padding:f,opacity:1},"100%":{maxHeight:0,padding:0,opacity:0}});return[M({},t,eV(eV({},qW(e)),M(M(M(M(M(M({position:"fixed",top:d,left:"50%",transform:"translateX(-50%)",width:"100%",pointerEvents:"none",zIndex:v},"".concat(t,"-move-up"),{animationFillMode:"forwards"}),"\n ".concat(t,"-move-up-appear,\n ").concat(t,"-move-up-enter\n "),{animationName:g,animationDuration:h,animationPlayState:"paused",animationTimingFunction:c}),"\n ".concat(t,"-move-up-appear").concat(t,"-move-up-appear-active,\n ").concat(t,"-move-up-enter").concat(t,"-move-up-enter-active\n "),{animationPlayState:"running"}),"".concat(t,"-move-up-leave"),{animationName:y,animationDuration:h,animationPlayState:"paused",animationTimingFunction:c}),"".concat(t,"-move-up-leave").concat(t,"-move-up-leave-active"),{animationPlayState:"running"}),"&-rtl",{direction:"rtl",span:{direction:"rtl"}}))),M({},"".concat(t,"-notice"),M(M(M(M(M(M({padding:f,textAlign:"center"},n,{verticalAlign:"text-bottom",marginInlineEnd:d,fontSize:l}),"".concat(t,"-notice-content"),{display:"inline-block",padding:m,background:i,borderRadius:p,boxShadow:r,pointerEvents:"all"}),"".concat(t,"-success ").concat(n),{color:a}),"".concat(t,"-error ").concat(n),{color:o}),"".concat(t,"-warning ").concat(n),{color:s}),"\n ".concat(t,"-info ").concat(n,",\n ").concat(t,"-loading ").concat(n),{color:u})),M({},"".concat(t,"-notice-pure-panel"),{padding:0,textAlign:"start"})]},OQ=KW("Message",function(e){var t=$W(e,{messageNoticeContentPadding:"".concat((e.controlHeightLG-e.fontSize*e.lineHeight)/2,"px ").concat(e.paddingSM,"px")});return[DQ(t)]},function(e){return{height:150,zIndexPopup:e.zIndexPopupBase+10}}),FQ={info:ta(mQ,null,null),success:ta(uQ,null,null),error:ta(Hj,null,null),warning:ta(dQ,null,null),loading:ta(Lj,null,null)},BQ=ar({name:"PureContent",inheritAttrs:!1,props:["prefixCls","type","icon"],setup:function(e,t){var n=t.slots;return function(){var t;return ta("div",{class:aV("".concat(e.prefixCls,"-custom-content"),"".concat(e.prefixCls,"-").concat(e.type))},[e.icon||FQ[e.type],ta("span",null,[null===(t=n.default)||void 0===t?void 0:t.call(n)])])}}}),UQ=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i *":{lineHeight:1},svg:{display:"inline-block"}}),M({},".".concat(e.value," .").concat(e.value,"-icon"),{display:"block"})))]})}(u),d=(n=Ea(function(){return e.theme}),r=Ea(function(){var e;return null===(e=s.theme)||void 0===e?void 0:e.value}),i=Ea(function(){return(null==n?void 0:n.value)||{}}),a=Ea(function(){return!1!==i.value.inherit&&(null==r?void 0:r.value)?r.value:nG}),Ea(function(){if(!(null==n?void 0:n.value))return null==r?void 0:r.value;var e=eV({},a.value.components);return Object.keys(n.value.components||{}).forEach(function(t){e[t]=eV(eV({},e[t]),n.value.components[t])}),eV(eV(eV({},a.value),i.value),{token:eV(eV({},a.value.token),i.value.token),components:e})})),f=Ea(function(){var t,n;return null!==(t=e.autoInsertSpaceInButton)&&void 0!==t?t:null===(n=s.autoInsertSpaceInButton)||void 0===n?void 0:n.value}),p=Ea(function(){var t;return e.locale||(null===(t=s.locale)||void 0===t?void 0:t.value)});Ti(p,function(){Rq.locale=p.value},{immediate:!0});var v,m,g,y,_=Ea(function(){var t;return e.direction||(null===(t=s.direction)||void 0===t?void 0:t.value)}),b=Ea(function(){var t,n;return null!==(t=e.space)&&void 0!==t?t:null===(n=s.space)||void 0===n?void 0:n.value}),x=Ea(function(){var t,n;return null!==(t=e.virtual)&&void 0!==t?t:null===(n=s.virtual)||void 0===n?void 0:n.value}),S=Ea(function(){var t,n;return null!==(t=e.dropdownMatchSelectWidth)&&void 0!==t?t:null===(n=s.dropdownMatchSelectWidth)||void 0===n?void 0:n.value}),A=Ea(function(){var t;return void 0!==e.getTargetContainer?e.getTargetContainer:null===(t=s.getTargetContainer)||void 0===t?void 0:t.value}),w=Ea(function(){var t;return void 0!==e.getPopupContainer?e.getPopupContainer:null===(t=s.getPopupContainer)||void 0===t?void 0:t.value}),T=Ea(function(){var t;return void 0!==e.pageHeader?e.pageHeader:null===(t=s.pageHeader)||void 0===t?void 0:t.value}),E=Ea(function(){var t;return void 0!==e.input?e.input:null===(t=s.input)||void 0===t?void 0:t.value}),k=Ea(function(){var t;return void 0!==e.pagination?e.pagination:null===(t=s.pagination)||void 0===t?void 0:t.value}),R=Ea(function(){var t;return void 0!==e.form?e.form:null===(t=s.form)||void 0===t?void 0:t.value}),I=Ea(function(){var t;return void 0!==e.select?e.select:null===(t=s.select)||void 0===t?void 0:t.value}),N=Ea(function(){return e.componentSize}),P=Ea(function(){return e.componentDisabled}),L=Ea(function(){var t,n;return null!==(t=e.wave)&&void 0!==t?t:null===(n=s.wave)||void 0===n?void 0:n.value}),D={csp:c,autoInsertSpaceInButton:f,locale:p,direction:_,space:b,virtual:x,dropdownMatchSelectWidth:S,getPrefixCls:function(t,n){var r=e.prefixCls;if(n)return n;var i=(void 0===r?"ant":r)||s.getPrefixCls("");return t?"".concat(i,"-").concat(t):i},iconPrefixCls:u,theme:Ea(function(){var e,t;return null!==(e=d.value)&&void 0!==e?e:null===(t=s.theme)||void 0===t?void 0:t.value}),renderEmpty:function(t){return(e.renderEmpty||o.renderEmpty||s.renderEmpty||vG)(t)},getTargetContainer:A,getPopupContainer:w,pageHeader:T,input:E,pagination:k,form:R,select:I,componentSize:N,componentDisabled:P,transformCellText:Ea(function(){return e.transformCellText}),wave:L},O=Ea(function(){var e=d.value||{},t=e.algorithm,n=e.token,r=Mq(e,["algorithm","token"]),i=t&&(!Array.isArray(t)||t.length>0)?JV(t):void 0;return eV(eV({},r),{theme:i,token:eV(eV({},FW),n)})}),F=Ea(function(){var t,n,r={};return p.value&&(r=(null===(t=p.value.Form)||void 0===t?void 0:t.defaultValidateMessages)||(null===(n=AV.Form)||void 0===n?void 0:n.defaultValidateMessages)||{}),e.form&&e.form.validateMessages&&(r=eV(eV({},r),e.form.validateMessages)),r});!function(e){$r(vV,e)}(D),$r(pV,{validateMessages:F}),v=N,m=gG(),$r(mG,Ea(function(){return v.value||m.value})),g=P,y=_V(),$r(yV,Ea(function(){var e;return null!==(e=g.value)&&void 0!==e?e:y.value}));return wi(function(){_.value&&(tq.config({rtl:"rtl"===_.value}),Aq.config({rtl:"rtl"===_.value}))}),function(){return ta(wV,{children:function(t,n,r){return function(t){var n,r,i=l.value?h(null===(n=o.default)||void 0===n?void 0:n.call(o)):null===(r=o.default)||void 0===r?void 0:r.call(o);if(e.theme){var a=i;i=ta(aG,{value:O.value},{default:function(){return[a]}})}return ta(bQ,{locale:p.value||t,ANT_MARK__:yQ},{default:function(){return[i]}})}(r)}},null)}}});Pq.config=function(e){kq&&kq(),kq=wi(function(){eV(Rq,Wt(e)),eV(Iq,Wt(e))}),e.theme&&Tq(Eq(),e.theme)},Pq.install=function(e){e.component(Pq.name,Pq)};var Lq={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M912 302.3L784 376V224c0-35.3-28.7-64-64-64H128c-35.3 0-64 28.7-64 64v576c0 35.3 28.7 64 64 64h592c35.3 0 64-28.7 64-64V648l128 73.7c21.3 12.3 48-3.1 48-27.6V330c0-24.6-26.7-40-48-27.7zM712 792H136V232h576v560zm176-167l-104-59.8V458.9L888 399v226zM208 360h112c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H208c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8z"}}]},name:"video-camera",theme:"outlined"};function Dq(e){for(var t=1;t1&&void 0!==arguments[1]&&arguments[1]?Symbol.for(e):Symbol(e)},Xq=function(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029").replace(/\u0027/g,"\\u0027")},Yq=function(e){return"number"==typeof e&&isFinite(e)},Kq=function(e){return"[object RegExp]"===hX(e)},Zq=function(e){return dX(e)&&0===Object.keys(e).length},Jq=Object.assign,$q=Object.create,eX=function(){return $q(arguments.length>0&&void 0!==arguments[0]?arguments[0]:null)},tX=function(){return Bq||(Bq="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:eX())};function nX(e){return e.replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}var rX=Object.prototype.hasOwnProperty;function iX(e,t){return rX.call(e,t)}var aX=Array.isArray,oX=function(e){return"function"==typeof e},sX=function(e){return"string"==typeof e},uX=function(e){return"boolean"==typeof e},lX=function(e){return null!==e&&"object"===P(e)},cX=Object.prototype.toString,hX=function(e){return cX.call(e)},dX=function(e){return"[object Object]"===hX(e)};function fX(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return e.reduce(function(e,n,r){return 0===r?e+n:e+t+n},"")}function pX(e,t){"undefined"!=typeof console&&(console.warn("[intlify] "+e),t&&console.warn(t.stack))}var vX=function(e){return!lX(e)||aX(e)};function mX(e,t){if(vX(e)||vX(t))throw new Error("Invalid value");for(var n=[{src:e,des:t}],r=function(){var e=n.pop(),t=e.src,r=e.des;Object.keys(t).forEach(function(e){"__proto__"!==e&&(lX(t[e])&&!lX(r[e])&&(r[e]=Array.isArray(t[e])?[]:eX()),vX(r[e])||vX(t[e])?r[e]=t[e]:n.push({src:t[e],des:r[e]}))})};n.length;)r()} /*! * message-compiler v11.1.9 * (c) 2025 kazuya kawaguchi * Released under the MIT License. */function gX(e,t,n){return{start:e,end:t}}var yX=1,_X=2,bX=3,xX=4,SX=5,AX=6,wX=7,TX=8,MX=9,EX=10,CX=11,kX=12,RX=13,IX=14;function NX(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.domain,i=(n.messages,n.args,new SyntaxError(String(e)));return i.code=e,t&&(i.location=t),i.domain=r,i}function PX(e){throw e}var LX=" ",DX="\n",OX=String.fromCharCode(8232),FX=String.fromCharCode(8233);function BX(e){var t=e,n=0,r=1,i=1,a=0,o=function(e){return"\r"===t[e]&&t[e+1]===DX},s=function(e){return t[e]===FX},u=function(e){return t[e]===OX},l=function(e){return o(e)||function(e){return t[e]===DX}(e)||s(e)||u(e)},c=function(e){return o(e)||s(e)||u(e)?DX:t[e]};function h(){return a=0,l(n)&&(r++,i=0),o(n)&&n++,n++,i++,t[n]}return{index:function(){return n},line:function(){return r},column:function(){return i},peekOffset:function(){return a},charAt:c,currentChar:function(){return c(n)},currentPeek:function(){return c(n+a)},next:h,peek:function(){return o(n+a)&&a++,a++,t[n+a]},reset:function(){n=0,r=1,i=1,a=0},resetPeek:function(){a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0},skipToPeek:function(){for(var e=n+a;e!==n;)h();a=0}}}var UX=void 0;function zX(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=!1!==t.location,r=BX(e),i=function(){return r.index()},a=function(){return function(e,t,n){return{line:e,column:t,offset:n}}(r.line(),r.column(),r.index())},o=a(),s=i(),u={currentType:13,offset:s,startLoc:o,endLoc:o,lastType:13,lastOffset:s,lastStartLoc:o,lastEndLoc:o,braceNest:0,inLinked:!1,text:""},l=function(){return u},c=t.onError;function h(e,t,r){var i=l();if(t.column+=r,t.offset+=r,c){for(var a=n?gX(i.startLoc,t):null,o=arguments.length,s=new Array(o>3?o-3:0),u=3;u=97&&t<=122||t>=65&&t<=90||95===t}function y(e,t){if(2!==t.currentType)return!1;v(e);var n=function(e){if(e===UX)return!1;var t=e.charCodeAt(0);return t>=48&&t<=57}("-"===e.currentPeek()?e.peek():e.currentPeek());return e.resetPeek(),n}function _(e){v(e);var t="|"===e.currentPeek();return e.resetPeek(),t}function b(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",i=e.currentPeek();return"{"===i?t:"@"!==i&&i?"|"===i?!(r===LX||r===DX):i===LX?(e.peek(),n(!0,LX)):i!==DX||(e.peek(),n(!0,DX)):t},r=n();return t&&e.resetPeek(),r}function x(e,t){var n=e.currentChar();return n===UX?UX:t(n)?(e.next(),n):null}function S(e){var t=e.charCodeAt(0);return t>=97&&t<=122||t>=65&&t<=90||t>=48&&t<=57||95===t||36===t}function A(e){return x(e,S)}function w(e){var t=e.charCodeAt(0);return t>=97&&t<=122||t>=65&&t<=90||t>=48&&t<=57||95===t||36===t||45===t}function T(e){return x(e,w)}function M(e){var t=e.charCodeAt(0);return t>=48&&t<=57}function E(e){return x(e,M)}function C(e){var t=e.charCodeAt(0);return t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102}function k(e){return x(e,C)}function R(e){for(var t="",n="";t=E(e);)n+=t;return n}function I(e){return"'"!==e&&e!==DX}function N(e){var t=e.currentChar();switch(t){case"\\":case"'":return e.next(),"\\".concat(t);case"u":return P(e,t,4);case"U":return P(e,t,6);default:return h(xX,a(),0,t),""}}function P(e,t,n){p(e,t);for(var r="",i=0;i=1&&h(MX,a(),0),e.next(),n=d(t,2,"{"),m(e),t.braceNest++,n;case"}":return t.braceNest>0&&2===t.currentType&&h(TX,a(),0),e.next(),n=d(t,3,"}"),t.braceNest--,t.braceNest>0&&m(e),t.inLinked&&0===t.braceNest&&(t.inLinked=!1),n;case"@":return t.braceNest>0&&h(wX,a(),0),n=F(e,t)||f(t),t.braceNest=0,n;default:var r,i,o;if(_(e))return t.braceNest>0&&h(wX,a(),0),n=d(t,1,D(e)),t.braceNest=0,t.inLinked=!1,n;if(t.braceNest>0&&(4===t.currentType||5===t.currentType||6===t.currentType))return h(wX,a(),0),t.braceNest=0,B(e,t);if(r=function(e,t){if(2!==t.currentType)return!1;v(e);var n=g(e.currentPeek());return e.resetPeek(),n}(e,t))return n=d(t,4,function(e){m(e);for(var t="",n="";t=T(e);)n+=t;return e.currentChar()===UX&&h(wX,a(),0),n}(e)),m(e),n;if(i=y(e,t))return n=d(t,5,function(e){m(e);var t="";return"-"===e.currentChar()?(e.next(),t+="-".concat(R(e))):t+=R(e),e.currentChar()===UX&&h(wX,a(),0),t}(e)),m(e),n;if(o=function(e,t){if(2!==t.currentType)return!1;v(e);var n="'"===e.currentPeek();return e.resetPeek(),n}(e,t))return n=d(t,6,function(e){m(e),p(e,"'");for(var t="",n="";t=x(e,I);)n+="\\"===t?N(e):t;var r=e.currentChar();return r===DX||r===UX?(h(bX,a(),0),r===DX&&(e.next(),p(e,"'")),n):(p(e,"'"),n)}(e)),m(e),n;if(!r&&!i&&!o)return n=d(t,12,function(e){m(e);for(var t="",n="";t=x(e,L);)n+=t;return n}(e)),h(_X,a(),0,n.value),m(e),n}return n}function F(e,t){var n=t.currentType,r=null,i=e.currentChar();switch(7!==n&&8!==n&&11!==n&&9!==n||i!==DX&&i!==LX||h(EX,a(),0),i){case"@":return e.next(),r=d(t,7,"@"),t.inLinked=!0,r;case".":return m(e),e.next(),d(t,8,".");case":":return m(e),e.next(),d(t,9,":");default:return _(e)?(r=d(t,1,D(e)),t.braceNest=0,t.inLinked=!1,r):function(e,t){if(7!==t.currentType)return!1;v(e);var n="."===e.currentPeek();return e.resetPeek(),n}(e,t)||function(e,t){var n=t.currentType;if(7!==n&&11!==n)return!1;v(e);var r=":"===e.currentPeek();return e.resetPeek(),r}(e,t)?(m(e),F(e,t)):function(e,t){if(8!==t.currentType)return!1;v(e);var n=g(e.currentPeek());return e.resetPeek(),n}(e,t)?(m(e),d(t,11,function(e){for(var t="",n="";t=A(e);)n+=t;return n}(e))):function(e,t){if(9!==t.currentType)return!1;var n=function(){var t=e.currentPeek();return"{"===t?g(e.peek()):!("@"===t||"|"===t||":"===t||"."===t||t===LX||!t)&&(t===DX?(e.peek(),n()):b(e,!1))},r=n();return e.resetPeek(),r}(e,t)?(m(e),"{"===i?O(e,t)||r:d(t,10,function(e){var t=function(n){var r=e.currentChar();return"{"!==r&&"@"!==r&&"|"!==r&&"("!==r&&")"!==r&&r?r===LX?n:(n+=r,e.next(),t(n)):n};return t("")}(e))):(7===n&&h(EX,a(),0),t.braceNest=0,t.inLinked=!1,B(e,t))}}function B(e,t){var n={type:13};if(t.braceNest>0)return O(e,t)||f(t);if(t.inLinked)return F(e,t)||f(t);switch(e.currentChar()){case"{":return O(e,t)||f(t);case"}":return h(AX,a(),0),e.next(),d(t,3,"}");case"@":return F(e,t)||f(t);default:if(_(e))return n=d(t,1,D(e)),t.braceNest=0,t.inLinked=!1,n;if(b(e))return d(t,0,function(e){for(var t="";;){var n=e.currentChar();if("{"===n||"}"===n||"@"===n||"|"===n||!n)break;if(n===LX||n===DX)if(b(e))t+=n,e.next();else{if(_(e))break;t+=n,e.next()}else t+=n,e.next()}return t}(e))}return n}return{nextToken:function(){var e=u.currentType,t=u.offset,n=u.startLoc,o=u.endLoc;return u.lastType=e,u.lastOffset=t,u.lastStartLoc=n,u.lastEndLoc=o,u.offset=i(),u.startLoc=a(),r.currentChar()===UX?d(u,13):B(r,u)},currentOffset:i,currentPosition:a,context:l}}var VX=/(?:\\\\|\\'|\\u([0-9a-fA-F]{4})|\\U([0-9a-fA-F]{6}))/g;function HX(e,t,n){switch(e){case"\\\\":return"\\";case"\\'":return"'";default:var r=parseInt(t||n,16);return r<=55295||r>=57344?String.fromCodePoint(r):"�"}}function WX(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=!1!==e.location,n=e.onError;function r(e,r,i,a){var o=e.currentPosition();if(o.offset+=a,o.column+=a,n){for(var s=t?gX(i,o):null,u=arguments.length,l=new Array(u>4?u-4:0),c=4;c10?t.slice(0,9)+"…":t}function jX(e,t){for(var n=0;n1){e.push("".concat(n("plural"),"([")),e.indent(r());for(var i=t.cases.length,a=0;a1&&void 0!==arguments[1]?arguments[1]:{}),n=!!t.jit,r=!!t.minify,i=null==t.optimize||t.optimize,a=WX(t).parse(e);return n?(i&&function(e){var t=e.body;2===t.type?XX(t):t.cases.forEach(function(e){return XX(e)})}(a),r&&YX(a),{ast:a,code:""}):(qX(a,t),function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=sX(t.mode)?t.mode:"normal",r=sX(t.filename)?t.filename:"message.intl";t.sourceMap;var i=null!=t.breakLineCode?t.breakLineCode:"arrow"===n?";":"\n",a=t.needIndent?t.needIndent:"arrow"!==n,o=e.helpers||[],s=function(e,t){var n=t.filename,r=t.breakLineCode,i=t.needIndent,a=!1!==t.location,o={filename:n,code:"",column:1,line:1,offset:0,map:void 0,breakLineCode:r,needIndent:i,indentLevel:0};function s(e,t){o.code+=e}function u(e){var t=arguments.length>1&&void 0!==arguments[1]&&!arguments[1]?"":r;s(i?t+" ".repeat(e):t)}return a&&e.loc&&(o.source=e.loc.source),{context:function(){return o},push:s,indent:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=++o.indentLevel;e&&u(t)},deindent:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=--o.indentLevel;e&&u(t)},newline:function(){u(o.indentLevel)},helper:function(e){return"_".concat(e)},needIndent:function(){return o.needIndent}}}(e,{filename:r,breakLineCode:i,needIndent:a});s.push("normal"===n?"function __msg__ (ctx) {":"(ctx) => {"),s.indent(a),o.length>0&&(s.push("const { ".concat(fX(o.map(function(e){return"".concat(e,": _").concat(e)}),", ")," } = ctx")),s.newline()),s.push("return "),KX(s,e),s.deindent(a),s.push("}"),delete e.helpers;var u=s.context(),l=u.code,c=u.map;return{ast:e,code:l,map:c?c.toJSON():void 0}}(a,t))} /*! * core-base v11.1.9 * (c) 2025 kazuya kawaguchi * Released under the MIT License. */function JX(e){return lX(e)&&0===iY(e)&&(iX(e,"b")||iX(e,"body"))}var $X=["b","body"];var eY=["c","cases"];var tY=["s","static"];var nY=["i","items"];var rY=["t","type"];function iY(e){return lY(e,rY)}var aY=["v","value"];function oY(e,t){var n=lY(e,aY);if(null!=n)return n;throw hY(t)}var sY=["m","modifier"];var uY=["k","key"];function lY(e,t,n){for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:{},t=oX(e.onWarn)?e.onWarn:pX,n=sX(e.version)?e.version:"11.1.9",r=sX(e.locale)||oX(e.locale)?e.locale:GY,i=oX(r)?GY:r,a=aX(e.fallbackLocale)||dX(e.fallbackLocale)||sX(e.fallbackLocale)||!1===e.fallbackLocale?e.fallbackLocale:i,o=dX(e.messages)?e.messages:JY(i),s=dX(e.datetimeFormats)?e.datetimeFormats:JY(i),u=dX(e.numberFormats)?e.numberFormats:JY(i),l=Jq(eX(),e.modifiers,{upper:function(e,t){return"text"===t&&sX(e)?e.toUpperCase():"vnode"===t&&lX(e)&&"__v_isVNode"in e?e.children.toUpperCase():e},lower:function(e,t){return"text"===t&&sX(e)?e.toLowerCase():"vnode"===t&&lX(e)&&"__v_isVNode"in e?e.children.toLowerCase():e},capitalize:function(e,t){return"text"===t&&sX(e)?jY(e):"vnode"===t&&lX(e)&&"__v_isVNode"in e?jY(e.children):e}}),c=e.pluralRules||eX(),h=oX(e.missing)?e.missing:null,d=!uX(e.missingWarn)&&!Kq(e.missingWarn)||e.missingWarn,f=!uX(e.fallbackWarn)&&!Kq(e.fallbackWarn)||e.fallbackWarn,p=!!e.fallbackFormat,v=!!e.unresolving,m=oX(e.postTranslation)?e.postTranslation:null,g=dX(e.processor)?e.processor:null,y=!uX(e.warnHtmlMessage)||e.warnHtmlMessage,_=!!e.escapeParameter,b=oX(e.messageCompiler)?e.messageCompiler:VY,x=oX(e.messageResolver)?e.messageResolver:HY||zY,S=oX(e.localeFallbacker)?e.localeFallbacker:WY||RY,A=lX(e.fallbackContext)?e.fallbackContext:void 0,w=e,T=lX(w.__datetimeFormatters)?w.__datetimeFormatters:new Map,M=lX(w.__numberFormatters)?w.__numberFormatters:new Map,E=lX(w.__meta)?w.__meta:{},C={version:n,cid:++KY,locale:r,fallbackLocale:a,messages:o,modifiers:l,pluralRules:c,missing:h,missingWarn:d,fallbackWarn:f,fallbackFormat:p,unresolving:v,postTranslation:m,processor:g,warnHtmlMessage:y,escapeParameter:_,messageCompiler:b,messageResolver:x,localeFallbacker:S,fallbackContext:A,onWarn:t,__meta:E};return C.datetimeFormats=s,C.numberFormats=u,C.__datetimeFormatters=T,C.__numberFormatters=M,__INTLIFY_PROD_DEVTOOLS__&&function(e,t,n){gY&&gY.emit("i18n:init",{timestamp:Date.now(),i18n:e,version:t,meta:n})}(C,n,E),C}var JY=function(e){return M({},e,eX())};function $Y(e,t,n,r,i){var a=e.missing;e.onWarn;if(null!==a){var o=a(e,n,t,i);return sX(o)?o:t}return t}function eK(e,t,n){e.__localeChainCache=new Map,e.localeFallbacker(e,n,t)}function tK(e,t){return e!==t&&e.split("-")[0]===t.split("-")[0]}function nK(e,t){var n=t.indexOf(e);if(-1===n)return!1;for(var r=n+1;r1?o-1:0),u=1;u1?o-1:0),u=1;u1?1:0:1:e?Math.min(e,2):0}function mK(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.locale,n=function(e){var t=Yq(e.pluralIndex)?e.pluralIndex:-1;return e.named&&(Yq(e.named.count)||Yq(e.named.n))?Yq(e.named.count)?e.named.count:Yq(e.named.n)?e.named.n:t:t}(e),r=lX(e.pluralRules)&&sX(t)&&oX(e.pluralRules[t])?e.pluralRules[t]:vK,i=lX(e.pluralRules)&&sX(t)&&oX(e.pluralRules[t])?vK:void 0,a=e.list||[],o=e.named||eX();Yq(e.pluralIndex)&&function(e,t){t.count||(t.count=e),t.n||(t.n=e)}(n,o);function s(t,n){var r=oX(e.messages)?e.messages(t,!!n):!!lX(e.messages)&&e.messages[t];return r||(e.parent?e.parent.message(t):dK)}var u=dX(e.processor)&&oX(e.processor.normalize)?e.processor.normalize:fK,l=dX(e.processor)&&oX(e.processor.interpolate)?e.processor.interpolate:pK,c=dX(e.processor)&&sX(e.processor.type)?e.processor.type:"text",h=M(M(M(M(M(M(M(M(M({},"list",function(e){return a[e]}),"named",function(e){return o[e]}),"plural",function(e){return e[r(n,e.length,i)]}),"linked",function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i1?s-1:0),l=1;l0&&void 0!==arguments[0]?arguments[0]:{},n=t.__root,r=t.__injectWithOption,i=void 0===n,a=t.flatJson,o=Qq?tn:nn,s=!uX(t.inheritLocale)||t.inheritLocale,u=o(n&&s?n.locale.value:sX(t.locale)?t.locale:GY),l=o(n&&s?n.fallbackLocale.value:sX(t.fallbackLocale)||aX(t.fallbackLocale)||dX(t.fallbackLocale)||!1===t.fallbackLocale?t.fallbackLocale:u.value),c=o(UK(u.value,t)),h=o(dX(t.datetimeFormats)?t.datetimeFormats:M({},u.value,{})),d=o(dX(t.numberFormats)?t.numberFormats:M({},u.value,{})),f=n?n.missingWarn:!uX(t.missingWarn)&&!Kq(t.missingWarn)||t.missingWarn,p=n?n.fallbackWarn:!uX(t.fallbackWarn)&&!Kq(t.fallbackWarn)||t.fallbackWarn,v=n?n.fallbackRoot:!uX(t.fallbackRoot)||t.fallbackRoot,m=!!t.fallbackFormat,g=oX(t.missing)?t.missing:null,y=oX(t.missing)?qK(t.missing):null,_=oX(t.postTranslation)?t.postTranslation:null,b=n?n.warnHtmlMessage:!uX(t.warnHtmlMessage)||t.warnHtmlMessage,x=!!t.escapeParameter,S=n?n.modifiers:dX(t.modifiers)?t.modifiers:{},A=t.pluralRules||n&&n.pluralRules;eK(e=function(){i&&YY(null);var n={version:"11.1.9",locale:u.value,fallbackLocale:l.value,messages:c.value,modifiers:S,pluralRules:A,missing:null===y?void 0:y,missingWarn:f,fallbackWarn:p,fallbackFormat:m,unresolving:!0,postTranslation:null===_?void 0:_,warnHtmlMessage:b,escapeParameter:x,messageResolver:t.messageResolver,messageCompiler:t.messageCompiler,__meta:{framework:"vue"}};n.datetimeFormats=h.value,n.numberFormats=d.value,n.__datetimeFormatters=dX(e)?e.__datetimeFormatters:void 0,n.__numberFormatters=dX(e)?e.__numberFormatters:void 0;var r=ZY(n);return i&&YY(r),r}(),u.value,l.value);var w=Ea({get:function(){return u.value},set:function(t){e.locale=t,u.value=t}}),T=Ea({get:function(){return l.value},set:function(t){e.fallbackLocale=t,l.value=t,eK(e,u.value,t)}}),E=Ea(function(){return c.value}),k=Ea(function(){return h.value}),R=Ea(function(){return d.value});var I=function(t,r,a,o,s,f){var p;u.value,l.value,c.value,h.value,d.value;try{__INTLIFY_PROD_DEVTOOLS__&&(QY=XK()),i||(e.fallbackContext=n?XY:void 0),p=t(e)}finally{__INTLIFY_PROD_DEVTOOLS__,i||(e.fallbackContext=void 0)}if("translate exists"!==a&&Yq(p)&&-1===p||"translate exists"===a&&!p){var m=C(r(),2),g=m[0];m[1];return n&&v?o(n):s(g)}if(f(p))return p;throw IK(AK)};function N(){for(var e=arguments.length,t=new Array(e),n=0;n0&&void 0!==arguments[0]?arguments[0]:{},t=YK(function(e){var t=sX(e.locale)?e.locale:GY,n=sX(e.fallbackLocale)||aX(e.fallbackLocale)||dX(e.fallbackLocale)||!1===e.fallbackLocale?e.fallbackLocale:t,r=oX(e.missing)?e.missing:void 0,i=!uX(e.silentTranslationWarn)&&!Kq(e.silentTranslationWarn)||!e.silentTranslationWarn,a=!uX(e.silentFallbackWarn)&&!Kq(e.silentFallbackWarn)||!e.silentFallbackWarn,o=!uX(e.fallbackRoot)||e.fallbackRoot,s=!!e.formatFallbackMessages,u=dX(e.modifiers)?e.modifiers:{},l=e.pluralizationRules,c=oX(e.postTranslation)?e.postTranslation:void 0,h=!sX(e.warnHtmlInMessage)||"off"!==e.warnHtmlInMessage,d=!!e.escapeParameterHtml,f=!uX(e.sync)||e.sync,p=e.messages;if(dX(e.sharedMessages)){var v=e.sharedMessages;p=Object.keys(v).reduce(function(e,t){var n=e[t]||(e[t]={});return Jq(n,v[t]),e},p||{})}var m=e.__i18n,g=e.__root,y=e.__injectWithOption,_=e.datetimeFormats,b=e.numberFormats;return{locale:t,fallbackLocale:n,messages:p,flatJson:e.flatJson,datetimeFormats:_,numberFormats:b,missing:r,missingWarn:i,fallbackWarn:a,fallbackRoot:o,fallbackFormat:s,modifiers:u,pluralRules:l,postTranslation:c,warnHtmlMessage:h,escapeParameter:d,messageResolver:e.messageResolver,inheritLocale:f,__i18n:m,__root:g,__injectWithOption:y}}(e)),n=e.__extender,r={id:t.id,get locale(){return t.locale.value},set locale(e){t.locale.value=e},get fallbackLocale(){return t.fallbackLocale.value},set fallbackLocale(e){t.fallbackLocale.value=e},get messages(){return t.messages.value},get datetimeFormats(){return t.datetimeFormats.value},get numberFormats(){return t.numberFormats.value},get availableLocales(){return t.availableLocales},get missing(){return t.getMissingHandler()},set missing(e){t.setMissingHandler(e)},get silentTranslationWarn(){return uX(t.missingWarn)?!t.missingWarn:t.missingWarn},set silentTranslationWarn(e){t.missingWarn=uX(e)?!e:e},get silentFallbackWarn(){return uX(t.fallbackWarn)?!t.fallbackWarn:t.fallbackWarn},set silentFallbackWarn(e){t.fallbackWarn=uX(e)?!e:e},get modifiers(){return t.modifiers},get formatFallbackMessages(){return t.fallbackFormat},set formatFallbackMessages(e){t.fallbackFormat=e},get postTranslation(){return t.getPostTranslationHandler()},set postTranslation(e){t.setPostTranslationHandler(e)},get sync(){return t.inheritLocale},set sync(e){t.inheritLocale=e},get warnHtmlInMessage(){return t.warnHtmlMessage?"warn":"off"},set warnHtmlInMessage(e){t.warnHtmlMessage="off"!==e},get escapeParameterHtml(){return t.escapeParameter},set escapeParameterHtml(e){t.escapeParameter=e},get pluralizationRules(){return t.pluralRules||{}},__composer:t,t:function(){for(var e=arguments.length,n=new Array(e),r=0;r0&&void 0!==arguments[0]?arguments[0]:{},t=va();if(null==t)throw IK(TK);if(!t.isCE&&null!=t.appContext.app&&!t.appContext.app.__VUE_I18N_SYMBOL__)throw IK(MK);var n=function(e){var t=ei(e.isCE?lZ:e.appContext.app.__VUE_I18N_SYMBOL__);if(!t)throw IK(e.isCE?kK:RK);return t}(t),r=function(e){return"composition"===e.mode?e.global:e.global.__composer}(n),i=zK(t),a=function(e,t){return Zq(e)?"__i18n"in t?"local":"global":e.useScope?e.useScope:"local"}(e,i);if("global"===a)return VK(r,e,i),r;if("parent"===a){var o=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=null,i=t.root,a=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(null==e)return null;return t&&e.vnode.ctx||e.parent}(t,n);for(;null!=a;){var o=e;if("composition"===e.mode)r=o.__getInstance(a);else if(__VUE_I18N_LEGACY_API__){var s=o.__getInstance(a);null!=s&&(r=s.__composer,n&&r&&!r[OK]&&(r=null))}if(null!=r)break;if(i===a)break;a=a.parent}return r}(n,t,e.__useComponent);return null==o&&(o=r),o}var s=n,u=s.__getInstance(t);if(null==u){var l=Jq({},e);"__i18n"in i&&(l.__i18n=i.__i18n),r&&(l.__root=r),u=YK(l),s.__composerExtend&&(u[FK]=s.__composerExtend(u)),function(e,t,n){yr(function(){},t),Sr(function(){var r=n;e.__deleteInstance(t);var i=r[FK];i&&(i(),delete r[FK])},t)}(s,t,u),s.__setInstance(t,u)}return u}var hZ=["locale","fallbackLocale","availableLocales"],dZ=["t","rt","d","n","tm","te"];function fZ(e,t){var n=Object.create(null);hZ.forEach(function(e){var r=Object.getOwnPropertyDescriptor(t,e);if(!r)throw IK(RK);var i=en(r.value)?{get:function(){return r.value.value},set:function(e){r.value.value=e}}:{get:function(){return r.get&&r.get()}};Object.defineProperty(n,e,i)}),e.config.globalProperties.$i18n=n,dZ.forEach(function(n){var r=Object.getOwnPropertyDescriptor(t,n);if(!r||!r.value)throw IK(RK);Object.defineProperty(e.config.globalProperties,"$".concat(n),r)});return function(){delete e.config.globalProperties.$i18n,dZ.forEach(function(t){delete e.config.globalProperties["$".concat(t)]})}}var pZ,vZ,mZ,gZ=ar({name:"i18n-d",props:Jq({value:{type:[Number,Date],required:!0},format:{type:[String,Object]}},$K),setup:function(e,t){var n=e.i18n||cZ({useScope:e.scope,__useComponent:!0});return rZ(e,t,iK,function(){return n[PK].apply(n,arguments)})}}),yZ=gZ;if("boolean"!=typeof __VUE_I18N_FULL_INSTALL__&&(tX().__VUE_I18N_FULL_INSTALL__=!0),"boolean"!=typeof __VUE_I18N_LEGACY_API__&&(tX().__VUE_I18N_LEGACY_API__=!0),"boolean"!=typeof __INTLIFY_DROP_MESSAGE_COMPILER__&&(tX().__INTLIFY_DROP_MESSAGE_COMPILER__=!1),"boolean"!=typeof __INTLIFY_PROD_DEVTOOLS__&&(tX().__INTLIFY_PROD_DEVTOOLS__=!1),pZ=function(e,t){if(!__INTLIFY_DROP_MESSAGE_COMPILER__&&sX(e)){!uX(t.warnHtmlMessage)||t.warnHtmlMessage;var n=(t.onCacheKey||vY)(e),r=mY[n];if(r)return r;var i=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=!1,r=t.onError||PX;return t.onError=function(e){n=!0,r(e)},s(s({},ZX(e,t)),{},{detectError:n})}(e,s(s({},t),{},{location:!1,jit:!0})),a=i.ast,o=i.detectError,u=dY(a);return o?u:mY[n]=u}var l=e.cacheKey;if(l){var c=mY[l];return c||(mY[l]=dY(e))}return dY(e)},VY=pZ,vZ=function(e,t){if(!lX(e))return null;var n=UY.get(t);if(n||(n=function(e){var t,n,r,i,a,o,s,u=[],l=-1,c=0,h=0,d=[];function f(){var t=e[l+1];if(5===c&&"'"===t||6===c&&'"'===t)return l++,r="\\"+t,d[0](),!0}for(d[0]=function(){void 0===n?n=r:n+=r},d[1]=function(){void 0!==n&&(u.push(n),n=void 0)},d[2]=function(){d[0](),h++},d[3]=function(){if(h>0)h--,c=4,d[0]();else{if(h=0,void 0===n)return!1;if(!1===(n=BY(n)))return!1;d[1]()}};null!==c;)if(l++,"\\"!==(t=e[l])||!f()){if(i=FY(t),8===(a=(s=DY[c])[i]||s.l||8))return;if(c=a[0],void 0!==a[1]&&(o=d[a[1]])&&(r=t,!1===o()))return;if(7===c)return u}}(t),n&&UY.set(t,n)),!n)return null;for(var r=n.length,i=e,a=0;a0&&void 0!==arguments[0]?arguments[0]:{},t=__VUE_I18N_LEGACY_API__&&uX(e.legacy)?e.legacy:__VUE_I18N_LEGACY_API__,n=!uX(e.globalInjection)||e.globalInjection,r=new Map,i=C(function(e,t){var n=De(),r=__VUE_I18N_LEGACY_API__&&t?n.run(function(){return KK(e)}):n.run(function(){return YK(e)});if(null==r)throw IK(RK);return[n,r]}(e,t),2),a=i[0],o=i[1],s=qq(""),u={get mode(){return __VUE_I18N_LEGACY_API__&&t?"legacy":"composition"},install:function(e){var r=arguments;return v(d().m(function i(){var a,l,c,h,f,p;return d().w(function(i){for(;;)switch(i.n){case 0:for(e.__VUE_I18N_SYMBOL__=s,e.provide(e.__VUE_I18N_SYMBOL__,u),a=r.length,l=new Array(a>1?a-1:0),c=1;c',2)]))}]]),IZ={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",fill:"none",version:"1.1",width:"20",height:"20",viewBox:"0 0 20 20"};var NZ=Gq({},[["render",function(e,t){return Gi(),Xi("svg",IZ,t[0]||(t[0]=[ia('',2)]))}]]),PZ={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",fill:"none",version:"1.1",width:"14.000000357627869",height:"10.000000357627869",viewBox:"0 0 14.000000357627869 10.000000357627869"};var LZ=Gq({},[["render",function(e,t){return Gi(),Xi("svg",PZ,t[0]||(t[0]=[ea("g",null,[ea("path",{d:"M13.802466686534881,1.1380186865348816Q13.89646668653488,1.0444176865348815,13.947366686534881,0.9218876865348815Q13.998366686534881,0.7993576865348816,13.998366686534881,0.6666666865348816Q13.998366686534881,0.6011698865348816,13.98556668653488,0.5369316865348817Q13.972766686534882,0.4726936865348816,13.947666686534882,0.4121826865348816Q13.922666686534882,0.3516706865348816,13.886266686534881,0.2972126865348816Q13.849866686534881,0.2427536865348816,13.803566686534882,0.19644068653488161Q13.757266686534882,0.15012768653488162,13.702766686534881,0.11373968653488165Q13.648366686534882,0.07735168653488156,13.587866686534882,0.052286686534881555Q13.527266686534881,0.02722268653488158,13.463066686534882,0.014444686534881623Q13.398866686534882,0.0016666865348815563,13.333366686534882,0.0016666865348815563Q13.201466686534882,0.0016666865348815563,13.079566686534882,0.051981686534881555Q12.957666686534882,0.10229768653488158,12.864266686534881,0.1953146865348816L12.863066686534882,0.19413268653488158L4.624996686534882,8.392776686534882L1.1369396865348815,4.921396686534882L1.1357636865348817,4.922586686534881Q1.0422996865348817,4.829566686534881,0.9204146865348816,4.779246686534882Q0.7985286865348816,4.728936686534881,0.6666666865348816,4.728936686534881Q0.6011698865348816,4.728936686534881,0.5369316865348817,4.741706686534882Q0.4726936865348816,4.754486686534881,0.4121826865348816,4.779556686534882Q0.3516706865348816,4.804616686534882,0.2972126865348816,4.8410066865348815Q0.2427536865348816,4.8773966865348815,0.19644068653488161,4.9237066865348815Q0.15012768653488162,4.970016686534882,0.11373968653488165,5.024476686534881Q0.07735168653488156,5.078936686534882,0.052286686534881555,5.139446686534882Q0.02722268653488158,5.199956686534882,0.014444686534881623,5.2641966865348815Q0.0016666865348815563,5.328436686534881,0.0016666865348815563,5.3939366865348815Q0.0016666865348815563,5.526626686534882,0.05259268653488158,5.649156686534882Q0.10351768653488158,5.771686686534881,0.1975696865348816,5.865286686534882L0.1963936865348816,5.866466686534881L4.1547266865348815,9.805866686534882Q4.201126686534882,9.852046686534882,4.255616686534882,9.888306686534882Q4.310106686534882,9.924576686534882,4.3706166865348814,9.949556686534882Q4.431126686534881,9.974536686534881,4.495326686534882,9.987266686534882Q4.559536686534882,9.999996686534882,4.624996686534882,9.999996686534882Q4.690456686534882,9.999996686534882,4.754666686534882,9.987266686534882Q4.818876686534882,9.974536686534881,4.879386686534882,9.949556686534882Q4.939886686534882,9.924576686534882,4.994386686534882,9.888306686534882Q5.048876686534881,9.852046686534882,5.0952766865348815,9.805866686534882L13.803566686534882,1.1392006865348816L13.802466686534881,1.1380186865348816Z","fill-rule":"evenodd",fill:"#E0E0FC","fill-opacity":"1",style:{"mix-blend-mode":"passthrough"}})],-1)]))}]]),DZ={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",fill:"none",version:"1.1",width:"20",height:"20",viewBox:"0 0 20 20"};var OZ=Gq({},[["render",function(e,t){return Gi(),Xi("svg",DZ,t[0]||(t[0]=[ia('',2)]))}]]),FZ={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",fill:"none",version:"1.1",width:"20",height:"20",viewBox:"0 0 20 20"};var BZ=Gq({},[["render",function(e,t){return Gi(),Xi("svg",FZ,t[0]||(t[0]=[ia('',2)]))}]]),UZ={class:"icon",viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg"};var zZ=Gq({},[["render",function(e,t){return Gi(),Xi("svg",UZ,t[0]||(t[0]=[ea("path",{d:"M899.925333 172.080762a48.761905 48.761905 0 0 1 0 28.525714l-207.969523 679.448381a48.761905 48.761905 0 0 1-81.115429 20.187429l-150.552381-150.552381-96.304762 96.329143a24.380952 24.380952 0 0 1-41.593905-17.237334v-214.966857l275.821715-243.370667-355.57181 161.596953-103.253333-103.228953a48.761905 48.761905 0 0 1 20.23619-81.091047L838.997333 139.702857a48.761905 48.761905 0 0 1 60.903619 32.353524z"},null,-1)]))}]]),VZ={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",fill:"none",version:"1.1",width:"20",height:"20",viewBox:"0 0 20 20"};var HZ=Gq({},[["render",function(e,t){return Gi(),Xi("svg",VZ,t[0]||(t[0]=[ia('',2)]))}]]),WZ={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",fill:"none",version:"1.1",width:"20",height:"20",viewBox:"0 0 20 20"};var GZ=Gq({},[["render",function(e,t){return Gi(),Xi("svg",WZ,t[0]||(t[0]=[ia('',2)]))}]]),jZ={t:"1744352112173",class:"icon",viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg","p-id":"16533","xmlns:xlink":"http://www.w3.org/1999/xlink",width:"200",height:"200"};var QZ=Gq({},[["render",function(e,t){return Gi(),Xi("svg",jZ,t[0]||(t[0]=[ea("path",{d:"M824 466.56V213.12q0-13.6512-5.2928-26.1632-5.104-12.064-14.3904-21.3536-9.2864-9.2864-21.3504-14.3872-12.5152-5.2928-26.1664-5.2928H246.4q-13.6512 0-26.1664 5.2928-12.064 5.1008-21.3504 14.3872-9.2864 9.2864-14.3904 21.3536Q179.2 199.4688 179.2 213.12v607.296q0 12.8448 5.0592 24.608 4.8576 11.2896 13.6704 19.9552 8.7616 8.6176 20.1184 13.344Q229.7792 883.2 242.56 883.2h217.6a28.8 28.8 0 0 0 0-57.6h-217.6q-2.528 0-4.2432-1.6864-1.5168-1.4912-1.5168-3.4976V213.12q0-3.9744 2.8128-6.784 2.8096-2.816 6.7872-2.816h510.4q3.9776 0 6.7872 2.816 2.8128 2.8096 2.8128 6.784v253.44a28.8 28.8 0 0 0 28.8 28.8 28.8 28.8 0 0 0 28.8-28.8zM466.0064 338.08l-130.2016 278.784A32 32 0 0 0 364.8 662.4h0.176a31.9904 31.9904 0 0 0 28.8192-18.4576L418.048 592h165.4976l15.2896 32.736q3.1008-3.4144 6.3904-6.704 20.3584-20.3616 45.4816-33.472l-115.1168-246.4832q-4.9408-10.5792-14.8704-16.5952-9.168-5.5552-19.9232-5.5552-10.7552 0-19.9232 5.5552-9.9296 6.016-14.8704 16.5952z m34.7936 76.7456L553.6576 528h-105.7152l52.8576-113.1776zM896 750.4c0 87.4816-70.9184 158.4-158.4 158.4S579.2 837.8816 579.2 750.4s70.9184-158.4 158.4-158.4 158.4 70.9184 158.4 158.4z m-116.3648-82.7648a28.9152 28.9152 0 0 1 7.1648-5.232q-5.8048-3.232-12.096-5.7248Q756.8256 649.6 737.6 649.6q-19.2256 0-37.104 7.0784-19.4112 7.6832-34.1728 22.448-14.7616 14.7616-22.4448 34.1696Q636.8 731.1744 636.8 750.4q0 19.232 7.0784 37.104 2.4896 6.2944 5.7248 12.096a28.7552 28.7552 0 0 1 5.232-7.1648l124.8-124.8zM838.4 750.4q0-19.2256-7.0784-37.104-2.4896-6.2912-5.7248-12.096a28.6944 28.6944 0 0 1-5.232 7.168l-124.8 124.8a28.7552 28.7552 0 0 1-7.1648 5.2288q5.8048 3.2352 12.096 5.728Q718.3744 851.2 737.6 851.2q19.2256 0 37.104-7.072 19.4112-7.6896 34.1728-22.4512 14.7616-14.7616 22.4448-34.1728Q838.4 769.632 838.4 750.4z","p-id":"16534"},null,-1)]))}]]),qZ={t:"1744352097285",class:"icon",viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg","p-id":"16380","data-spm-anchor-id":"a313x.manage_type_myprojects.0.i0.60b03a81nz0mun","xmlns:xlink":"http://www.w3.org/1999/xlink",width:"200",height:"200"};var XZ=Gq({},[["render",function(e,t){return Gi(),Xi("svg",qZ,t[0]||(t[0]=[ea("path",{d:"M833.6 213.12v253.44a28.8 28.8 0 0 1-28.8 28.8 28.8 28.8 0 0 1-28.8-28.8V213.12q0-3.9744-2.8128-6.784-2.8096-2.816-6.7872-2.816H256q-3.9776 0-6.7872 2.816Q246.4 209.1424 246.4 213.12v607.296q0 2.0064 1.5168 3.4976 1.7152 1.6864 4.2432 1.6864h217.6a28.8 28.8 0 0 1 0 57.6h-217.6q-12.7808 0-24.512-4.8768-11.3568-4.7232-20.1184-13.3408-8.8128-8.6656-13.6704-19.9584Q188.8 833.264 188.8 820.416V213.12q0-13.6512 5.2928-26.1632 5.104-12.064 14.3904-21.3536 9.2864-9.2864 21.3504-14.3872Q242.3456 145.92 256 145.92h510.4q13.6512 0 26.1664 5.2928 12.064 5.1008 21.3504 14.3872 9.2864 9.2864 14.3904 21.3536 5.2928 12.512 5.2928 26.1664zM345.408 613.664l130.1984-278.784q4.9408-10.5824 14.8704-16.5984 9.168-5.5552 19.9232-5.5552 10.7552 0 19.9232 5.5552 9.9296 6.016 14.8704 16.5952l130.2016 278.784a32 32 0 0 1-28.672 45.5392l-0.3232 0.0032c-12.4288 0-23.7344-7.2-28.9952-18.4608L593.1488 588.8h-165.4976l-24.256 51.9424a32.0064 32.0064 0 0 1-28.8192 18.4576l-0.176 0.0032a32 32 0 0 1-28.992-45.5424z m164.992-202.0416L457.5424 524.8h105.7152L510.4 411.6224z m120.2784 329.44l61.3216 61.5872 162.1248-162.8256a31.9936 31.9936 0 0 1 22.608-9.424H876.8a32 32 0 0 1 32 31.936v0.064a32 32 0 0 1-9.3216 22.5792l-184.8 185.6-0.0992 0.0992a31.9936 31.9936 0 0 1-45.2544-0.096l-83.984-84.352-0.016-0.016a31.9904 31.9904 0 0 1-9.2896-21.1104l30.496-33.4336c0.4896-0.0224 0.9792-0.032 1.4688-0.032h0.0704a32 32 0 0 1 22.608 9.4208z","p-id":"16381","data-spm-anchor-id":"a313x.manage_type_myprojects.0.i1.60b03a81nz0mun",class:"selected"},null,-1)]))}]]),YZ={class:"action-group"},KZ={key:0},ZZ=["onClick"],JZ={key:0,class:"active-icon"},$Z={key:1},eJ=["onClick"],tJ={key:0,class:"active-icon"},nJ={key:2},rJ=ar({__name:"ActionGroup",setup:function(e){var t=Vq(),n=Uq(),r=is(t),i=r.hasCamera,a=r.hasMic,o=r.cameraOff,s=r.micMuted,u=r.volumeMuted,l=r.showChatRecords,c=r.streamState,h=r.selectedAudioDevice,d=r.selectedVideoDevice,f=r.availableAudioDevices,p=r.availableVideoDevices,v=t.handleCameraOff,m=t.handleMicMuted,g=t.handleVolumeMute,y=t.handleDeviceChange,_=t.handleSubtitleToggle,b=is(n),x=b.wrapperRect,S=b.isLandscape,A=tn(!1),w=tn(!1);return function(e,t){var n=function(e){return kr("directives",e)}("click-outside");return Gi(),Xi("div",YZ,[on(i)?(Gi(),Xi("div",KZ,[Un((Gi(),Xi("div",{class:"action",onClick:t[1]||(t[1]=function(){return on(v)&&on(v).apply(void 0,arguments)})},[ta(on(CZ),{icon:on(o)?on(RZ):on(NZ)},null,8,["icon"]),"closed"===on(c)?(Gi(),Xi("div",{key:0,class:"corner",onClick:t[0]||(t[0]=Lo(function(){return w.value=!w.value},["stop","prevent"]))},t[6]||(t[6]=[ea("div",{class:"corner-inner"},null,-1)]))):aa("",!0),Un(ea("div",{class:Te(["selectors",{left:on(S)}])},[(Gi(!0),Xi(Bi,null,Ir(on(p),function(e){return Gi(),Xi("div",{key:e.deviceId,class:"selector",onClick:Lo(function(){on(y)(e.deviceId),w.value=!1},["stop"])},[ra(Ie(e.label)+" ",1),on(d)&&e.deviceId===on(d).deviceId?(Gi(),Xi("div",JZ,[ta(on(LZ))])):aa("",!0)],8,ZZ)}),128))],2),[[no,w.value&&"closed"===on(c)]])])),[[n,function(){return w.value=!1}]])])):aa("",!0),on(a)?(Gi(),Xi("div",$Z,[Un((Gi(),Xi("div",{class:"action",onClick:t[3]||(t[3]=function(){return on(m)&&on(m).apply(void 0,arguments)})},[ta(on(CZ),{icon:on(s)?on(OZ):on(BZ)},null,8,["icon"]),"closed"===on(c)?(Gi(),Xi("div",{key:0,class:"corner",onClick:t[2]||(t[2]=Lo(function(){return A.value=!A.value},["stop","prevent"]))},t[7]||(t[7]=[ea("div",{class:"corner-inner"},null,-1)]))):aa("",!0),Un(ea("div",{class:Te(["selectors",{left:on(S)}])},[(Gi(!0),Xi(Bi,null,Ir(on(f),function(e){return Gi(),Xi("div",{key:e.deviceId,class:"selector",onClick:Lo(function(t){on(y)(e.deviceId),A.value=!1},["stop"])},[ra(Ie(e.label)+" ",1),on(h)&&e.deviceId===on(h).deviceId?(Gi(),Xi("div",tJ,[ta(on(LZ))])):aa("",!0)],8,eJ)}),128))],2),[[no,A.value&&"closed"===on(c)]])])),[[n,function(){return A.value=!1}]])])):aa("",!0),ea("div",{class:"action",onClick:t[4]||(t[4]=function(){return on(g)&&on(g).apply(void 0,arguments)})},[ta(on(CZ),{icon:on(u)?on(HZ):on(GZ)},null,8,["icon"])]),on(x).width>300?(Gi(),Xi("div",nJ,[ea("div",{class:"action",onClick:t[5]||(t[5]=function(){return on(_)&&on(_).apply(void 0,arguments)})},[ta(on(CZ),{icon:on(l)?on(XZ):on(QZ)},null,8,["icon"])])])):aa("",!0)])}}}),iJ=Gq(rJ,[["__scopeId","data-v-1bca64ad"]]),aJ={class:"gradio-webrtc-waveContainer"},oJ=ar({__name:"AudioWave",props:{streamState:{default:ms.closed},audioSourceCallback:{},numBars:{default:16},icon:{},iconButtonColor:{default:"var(--color-accent)"},pulseColor:{default:"var(--color-accent)"},waveColor:{default:"var(--color-accent)"},pulseScale:{default:1}},emits:[],setup:function(e,t){t.emit;var n,r,i,a,o=e,s=Ea(function(){return o.icon?"128px":"calc((var(--boxSize) + var(--gutter)) * ".concat(o.numBars," + 80px)")});function u(){r.getByteFrequencyData(i);for(var e=document.querySelectorAll(".gradio-webrtc-waveContainer .gradio-webrtc-box"),t=0;t=t.length)throw new Error("Index must be between 0 and 15");return t[e]}return Ti(function(){return o.streamState},function(){console.log(111111),"open"===o.streamState&&function(){n=new(window.AudioContext||window.webkitAudioContext),r=n.createAnalyser();var e=o.audioSourceCallback();if(!e)return;n.createMediaStreamSource(e).connect(r),r.fftSize=64,r.smoothingTimeConstant=.8,i=new Uint8Array(r.frequencyBinCount),u()}()},{immediate:!0}),Sr(function(){a&&cancelAnimationFrame(a),n&&n.close()}),function(e,t){return Gi(),Xi("div",aJ,[ea("div",{class:"gradio-webrtc-boxContainer",style:be({width:s.value})},[(Gi(!0),Xi(Bi,null,Ir(Array(e.numBars/2),function(e,t){return Gi(),Xi("div",{key:t,class:"gradio-webrtc-box"})}),128)),t[0]||(t[0]=ea("div",{class:"split-container"},null,-1)),(Gi(!0),Xi(Bi,null,Ir(Array(e.numBars/2),function(e,t){return Gi(),Xi("div",{key:t,class:"gradio-webrtc-box"})}),128))],4)])}}}),sJ=Gq(oJ,[["__scopeId","data-v-ba6f2cef"]]),uJ={class:"player-controls"},lJ={key:0},cJ={key:1,class:"waiting-icon-text"},hJ={key:2,class:"stop-chat-inner"},dJ={key:0,class:"input-audio-wave"},fJ=ar({__name:"ChatBtn",props:{streamState:{default:ms.closed},onStartChat:{},audioSourceCallback:{},waveColor:{}},emits:[],setup:function(e,t){t.emit;return function(e,t){return Gi(),Xi("div",uJ,[ea("div",{class:Te(["chat-btn",e.streamState===on(ms).closed&&"start-chat",e.streamState===on(ms).open&&"stop-chat"]),onClick:t[0]||(t[0]=function(){return e.onStartChat&&e.onStartChat.apply(e,arguments)})},[e.streamState===on(ms).closed?(Gi(),Xi("span",lJ,"点击开始对话")):e.streamState===on(ms).waiting?(Gi(),Xi("div",cJ,t[1]||(t[1]=[ea("div",{class:"icon",title:"spinner"},null,-1),ea("span",null,"等待中",-1)]))):(Gi(),Xi("div",hJ))],2),e.streamState===on(ms).open?(Gi(),Xi("div",dJ,[ta(sJ,{audioSourceCallback:e.audioSourceCallback,streamState:e.streamState,waveColor:e.waveColor},null,8,["audioSourceCallback","streamState","waveColor"])])):aa("",!0)])}}}),pJ=Gq(fJ,[["__scopeId","data-v-b69ee979"]]);var vJ,mJ={class:"chat-input-container"},gJ={class:"chat-input-inner"},yJ={class:"chat-input-wrapper"},_J=ar({__name:"ChatInput",props:{replying:{type:Boolean}},emits:["send","stop","interrupt"],setup:function(e,t){var n=t.emit,r=24,i=sr("rowsDivRef"),a=sr("chatInputRef");function o(e){var t,n,r;"Enter"===e.key&&(e.altKey?a.value&&(a.value.value=(t=a.value.value,n="\n",(r=a.value.selectionStart||0)<0||r>t.length?(console.error("索引超出范围"),t):t.substring(0,r)+n+t.substring(r)),a.value.dispatchEvent(new InputEvent("input"))):(e.preventDefault(),s()))}function s(){return u.apply(this,arguments)}function u(){return(u=v(d().m(function e(){return d().w(function(e){for(;;)switch(e.n){case 0:a.value&&(n("send",a.value.value),a.value.value="");case 1:return e.a(2)}},e)}))).apply(this,arguments)}function l(e){i.value&&(i.value.textContent=e.target.value.replace(/\n$/,"\n\n"),r=i.value.offsetHeight)}function c(){n("stop")}function h(){n("interrupt")}return function(e,t){return Gi(),Xi("div",mJ,[ea("div",{class:"stop-chat-btn",onClick:c}),ea("div",gJ,[ea("div",yJ,[ea("textarea",{class:"chat-input",ref_key:"chatInputRef",ref:a,onKeydown:o,onInput:l,style:be("height:".concat(on(r),"px"))},null,36),ea("div",{class:"rowsDiv",ref_key:"rowsDivRef",ref:i},Ie(on("")),513)]),e.replying?(Gi(),Xi("button",{key:0,class:"interrupt-btn",onClick:h})):(Gi(),Xi("button",{key:1,class:"send-btn",onClick:s},[ta(on(CZ),{icon:on(zZ),color:"#fff"},null,8,["icon"])]))])])}}}),bJ=Gq(_J,[["__scopeId","data-v-32a58abc"]]),xJ={class:"answer-message-text"},SJ=Gq(ar({__name:"ChatMessage",props:{message:{},role:{},style:{}},setup:function(e){return function(e,t){return Gi(),Xi("div",{class:Te(["answer-message-container",e.role]),style:be(e.style)},[ea("div",xJ,Ie(e.message),1)],6)}}}),[["__scopeId","data-v-dde1c5d3"]]),AJ={class:"chat-records-inner"},wJ=ar({__name:"ChatRecords",props:{chatRecords:{}},setup:function(e,t){var n=t.expose,r=e,i=sr("containerRef");function a(){i.value&&(i.value.scrollTop=i.value.scrollHeight)}return Ti(function(){return r.chatRecords},function(e){r.chatRecords&&Cn().then(function(){a()})}),n({scrollToBottom:a}),function(e,t){return Gi(),Xi("div",{class:"chat-records",ref_key:"containerRef",ref:i},[ea("div",AJ,[(Gi(!0),Xi(Bi,null,Ir(e.chatRecords,function(e,t){return Gi(),Xi("div",{key:e.id,class:Te("chat-message ".concat(e.role))},[ta(SJ,{message:e.message,role:e.role},null,8,["message","role"])],2)}),128))])],512)}}}),TJ={class:"content-container"},MJ=["muted"],EJ={class:"actions"},CJ={key:0,class:"chat-records-container"},kJ=Gq(ar({__name:"index",setup:function(e){var t=Uq(),n=Vq(),r=tn(),i=tn(),a=tn(),o=tn(),s=tn(),u=tn("9 / 16"),l=function(){s.value&&(u.value="".concat(s.value.videoWidth," / ").concat(s.value.videoHeight))},c=function(){return n.localStream};yr(function(){var e=r.value;t.wrapperRef=e,e.getBoundingClientRect(),w.value.width=e.clientWidth,w.value.height=e.clientHeight,t.isLandscape=w.value.width>w.value.height,console.log(w),t.remoteVideoContainerRef=a.value,t.localVideoContainerRef=i.value,t.localVideoRef=o.value,t.remoteVideoRef=s.value,t.wrapperRef=r.value});var h=is(n),d=h.hasCamera,f=h.hasMic,p=h.micMuted,v=h.cameraOff,m=h.webcamAccessed,g=h.streamState,y=h.avatarType,_=h.volumeMuted,b=h.replying,x=h.showChatRecords,S=h.chatRecords,A=is(t),w=A.wrapperRect,T=A.isLandscape;function M(){n.startWebRTC().then(function(){!function(){if(!n.chatDataChannel)return;n.chatDataChannel.addEventListener("message",function(e){var t=JSON.parse(e.data);if("chat"===t.type){var r=n.chatRecords.findIndex(function(e){return e.id===t.id});if(-1!==r){var i=n.chatRecords[r];i.message+=t.message,n.chatRecords.splice(r,1,i),n.chatRecords=I(n.chatRecords)}else n.chatRecords=[].concat(I(n.chatRecords),[{id:t.id,role:t.role||"human",message:t.message}])}else"avatar_end"===t.type&&(n.replying=!1)})}()})}function E(){n.chatDataChannel&&n.chatDataChannel.send(JSON.stringify({type:"stop_chat"}))}var C=sr("chatRecordsInstanceRef");function k(e){var t;e&&n.chatDataChannel&&(n.chatDataChannel.send(JSON.stringify({type:"chat",data:e})),n.replying=!0,null===(t=C.value)||void 0===t||t.scrollToBottom())}return function(e,t){return Gi(),Xi("div",{class:"page-container",ref_key:"wrapRef",ref:r},[ea("div",TJ,[ea("div",{class:"video-container",style:be({visibility:on(m)?"visible":"hidden",aspectRatio:u.value})},[Un(ea("div",{class:Te("local-video-container ".concat("open"===on(g)?"scaled":"")),ref_key:"localVideoContainerRef",ref:i},[ea("video",{class:"local-video",ref_key:"localVideoRef",ref:o,autoplay:"",muted:"",playsinline:"",style:be({visibility:on(v)?"hidden":"visible",display:!on(d)||on(v)?"none":"block"})},null,4)],2),[[no,on(d)&&!on(v)]]),ea("div",{class:"remote-video-container",ref_key:"remoteVideoContainerRef",ref:a},[on(y)?aa("",!0):Un((Gi(),Xi("video",{key:0,class:"remote-video",onPlaying:l,ref_key:"remoteVideoRef",ref:s,autoplay:"",playsinline:"",muted:on(_)},null,40,MJ)),[[no,"open"===on(g)]]),"open"===on(g)&&on(x)&&!on(T)?(Gi(),Xi("div",{key:1,class:Te("chat-records-container inline"),style:be(!on(d)||on(v)?"width:80%;padding-bottom:12px;":"padding-bottom:12px;")},[ta(wJ,{ref_key:"chatRecordsInstanceRef",ref:C,chatRecords:on(S).filter(function(e,t){return t>=on(S).length-4})},null,8,["chatRecords"])],4)):aa("",!0)],512),ea("div",EJ,[ta(iJ)])],4),on(f)&&!on(p)||"open"!==on(g)?on(m)?(Gi(),Yi(pJ,{key:1,onStartChat:M,"audio-source-callback":c,streamState:on(g),"wave-color":"#7873F6"},null,8,["streamState"])):aa("",!0):(Gi(),Yi(bJ,{key:0,replying:on(b),onInterrupt:E,onSend:k,onStop:on(n).startWebRTC},null,8,["replying","onStop"]))]),"open"===on(g)&&on(x)&&on(T)?(Gi(),Xi("div",CJ,[ta(wJ,{ref_key:"chatRecordsInstanceRef",ref:C,chatRecords:on(S)},null,8,["chatRecords"])])):aa("",!0)],512)}}}),[["__scopeId","data-v-269b506f"]]),RJ={class:"wrap"},IJ=Gq(ar({__name:"App",setup:function(e){var t=Vq();return t.init(),function(e,n){return Gi(),Yi(on(Pq),{locale:on(TZ)[on(wZ)]},{default:Bn(function(){return[ea("div",RJ,[on(t).webcamAccessed?aa("",!0):(Gi(),Yi(jq,{key:0})),ta(kJ)])]}),_:1},8,["locale"])}}}),[["__scopeId","data-v-746907b0"]]),NJ={exports:{}};var PJ,LJ,DJ,OJ,FJ,BJ=(vJ||(vJ=1,function(e){e.exports=function(){var e="__v-click-outside",t="undefined"!=typeof window,n="undefined"!=typeof navigator,r=t&&("ontouchstart"in window||n&&navigator.msMaxTouchPoints>0)?["touchstart"]:["click"],i=function(e){var t=e.event,n=e.handler;(0,e.middleware)(t)&&n(t)},a=function(t,n){var a=function(e){var t="function"==typeof e;if(!t&&"object"!=P(e))throw new Error("v-click-outside: Binding value must be a function or an object");return{handler:t?e:e.handler,middleware:e.middleware||function(e){return e},events:e.events||r,isActive:!(!1===e.isActive),detectIframe:!(!1===e.detectIframe),capture:Boolean(e.capture)}}(n.value),o=a.handler,s=a.middleware,u=a.detectIframe,l=a.capture;if(a.isActive){if(t[e]=a.events.map(function(e){return{event:e,srcTarget:document.documentElement,handler:function(e){return function(e){var t=e.el,n=e.event,r=e.handler,a=e.middleware,o=n.path||n.composedPath&&n.composedPath();(o?o.indexOf(t)<0:!t.contains(n.target))&&i({event:n,handler:r,middleware:a})}({el:t,event:e,handler:o,middleware:s})},capture:l}}),u){var c={event:"blur",srcTarget:window,handler:function(e){return function(e){var t=e.el,n=e.event,r=e.handler,a=e.middleware;setTimeout(function(){var e=document.activeElement;e&&"IFRAME"===e.tagName&&!t.contains(e)&&i({event:n,handler:r,middleware:a})},0)}({el:t,event:e,handler:o,middleware:s})},capture:l};t[e]=[].concat(t[e],[c])}t[e].forEach(function(n){var r=n.event,i=n.srcTarget,a=n.handler;return setTimeout(function(){t[e]&&i.addEventListener(r,a,l)},0)})}},o=function(t){(t[e]||[]).forEach(function(e){return e.srcTarget.removeEventListener(e.event,e.handler,e.capture)}),delete t[e]},s=t?{beforeMount:a,updated:function(e,t){var n=t.value,r=t.oldValue;JSON.stringify(n)!==JSON.stringify(r)&&(o(e),a(e,{value:n}))},unmounted:o}:{};return{install:function(e){e.directive("click-outside",s)},directive:s}}()}(NJ)),NJ.exports),UJ=as(BJ),zJ=function(){var e,t=(e=Oo()).createApp.apply(e,arguments),n=t.mount;return t.mount=function(e){var r=function(e){if($(e)){return document.querySelector(e)}return e} /*! * pinia v3.0.3 * (c) 2025 Eduardo San Martin Morote * @license MIT */(e);if(r){var i=t._component;J(i)||i.render||i.template||(i.template=r.innerHTML),1===r.nodeType&&(r.textContent="");var a=n(r,!1,function(e){if(e instanceof SVGElement)return"svg";if("function"==typeof MathMLElement&&e instanceof MathMLElement)return"mathml"}(r));return r instanceof Element&&(r.removeAttribute("v-cloak"),r.setAttribute("data-v-app","")),a}},t}(IJ),VJ=(PJ=De(!0),LJ=PJ.run(function(){return tn({})}),OJ=[],FJ=Zt({install:function(e){Vo(FJ),FJ._a=e,e.provide(Ho,FJ),e.config.globalProperties.$pinia=FJ,OJ.forEach(function(e){return DJ.push(e)}),OJ=[]},use:function(e){return this._a?DJ.push(e):OJ.push(e),this},_p:DJ=[],_a:null,_e:PJ,_s:new Map,state:LJ}),FJ);zJ.use(VJ),zJ.use(EZ),zJ.use(UJ),zJ.mount("#app")}}})}();