run-scene-v2 0.0.86 → 0.0.88
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +1 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("axios"),require("js-funcs"),require("three"),require("@allex/md5")):"function"==typeof define&&define.amd?define(["axios","js-funcs","three","@allex/md5"],t):"object"==typeof exports?exports.RunScene=t(require("axios"),require("js-funcs"),require("three"),require("@allex/md5")):e.RunScene=t(e.axios,e["js-funcs"],e.three,e["@allex/md5"])}(self,((__WEBPACK_EXTERNAL_MODULE__3300__,__WEBPACK_EXTERNAL_MODULE__6001__,__WEBPACK_EXTERNAL_MODULE__8881__,__WEBPACK_EXTERNAL_MODULE__1129__)=>(()=>{"use strict";var __webpack_modules__={2958:(e,t,r)=>{function n(){return(n="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=l(e)););return e}(e,t);if(n)return(n=Object.getOwnPropertyDescriptor(n,t)).get?n.get.call(arguments.length<3?e:r):n.value}).apply(this,arguments)}function a(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&&i(e,t)}function i(e,t){return(i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function s(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=l(e);if(r=t?(r=l(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===f(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return o(n)}}function o(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function l(e){return(l=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function c(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function u(e,t,r){return t&&c(e.prototype,t),r&&c(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function h(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function d(e){return function(e){if(Array.isArray(e))return p(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return p(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Map"===(r="Object"===r&&e.constructor?e.constructor.name:r)||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?p(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function p(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function f(e){return(f="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})(e)}function m(e){return void 0===e}function g(){return"undefined"!=typeof window}function v(e){return Ge(e)||Ve(e)}function b(e){return(nt=k(e,rt))&&Sr}function y(e,t){return!t&&console.warn(e)}function x(e,t){return e&&(rt[e]=t)&&nt&&(nt[e]=t)||rt}function w(){return 0}function S(e,t,r){return(r=e[t])&&Ge(r)?e[t]():m(r)&&e.getAttribute&&e.getAttribute(t)||r}function M(e,t){(e=e.split(",")).forEach(t)}function T(e,t,r,n){st.length&>(),e.render(t,r,n),st.length&>()}function _(e){var t=parseFloat(e);return(t||0===t)&&(e+"").match(et).length<2?t:Ve(e)?e.trim():e}function E(e){return e}function k(e,t){for(var r in t)e[r]=t[r];return e}function D(e,t){for(var r in t)"__proto__"!==r&&"constructor"!==r&&"prototype"!==r&&(e[r]=We(t[r])?D(e[r]||(e[r]={}),t[r]):t[r]);return e}function O(e){var t,r=e.parent||le,n=e.keyframes?(t=Ze(e.keyframes),function(e,r){for(var n in r)n in e||"duration"===n&&t||"ease"===n||(e[n]=r[n])}):vt;if(Ke(e.inherit))for(;r;)n(e,r.vars.defaults),r=r.parent||r._dp;return e}function P(e){return!e||e._ts&&P(e.parent)}function A(e){return e._repeat?C(e._tTime,e=e.duration()+e._rDelay)*e:0}function C(e,t){return t=Math.floor(e/=t),e&&t===e?t-1:t}function R(e,t){return(e-t._start)*t._ts+(0<=t._ts?0:t._dirty?t.totalDuration():t._tDur)}function L(e,t){var r;if((t._time||t._initted&&!t._dur)&&(r=R(e.rawTime(),t),(!t._dur||H(0,t.totalDuration(),r)-t._tTime>Ie)&&t.render(r,!0)),wt(e,t)._dp&&e._initted&&e._time>=e._dur&&e._ts){if(e._dur<e.duration())for(r=e;r._dp;)0<=r.rawTime()&&r.totalTime(r._tTime),r=r._dp;e._zTime=-Ie}}function I(e,t,r,n){return t.parent&&xt(t),t._start=mt((He(r)?r:r||e!==le?V(e,r,t):e._time)+t._delay),t._end=mt(t._start+(t.totalDuration()/Math.abs(t.timeScale())||0)),function(e,t){var r,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:"_first",a=3<arguments.length&&void 0!==arguments[3]?arguments[3]:"_last",i=4<arguments.length?arguments[4]:void 0,s=e[a];if(i)for(r=t[i];s&&s[i]>r;)s=s._prev;s?(t._next=s._next,s._next=t):(t._next=e[n],e[n]=t),t._next?t._next._prev=t:e[a]=t,t._prev=s,t.parent=t._dp=e}(e,t,"_first","_last",e._sort?"_start":0),N(t)||(e._recent=t),n||L(e,t),e}function B(e,t){(rt.ScrollTrigger||at("scrollTrigger",t))&&rt.ScrollTrigger.create(t,e)}function j(e,t,r,n){return qt(e,t),e._initted?!r&&e._pt&&(e._dur&&!1!==e.vars.lazy||!e._dur&&e.vars.lazy)&&pe!==Ut.frame?(st.push(e),e._lazy=[t,n]):void 0:1}function U(e){return(e=e.parent)&&e._ts&&e._initted&&!e._lock&&(e.rawTime()<0||U(e))}function N(e){return"isFromStart"===(e=e.data)||"isStart"===e}function F(e,t,r,n){var a=e._repeat,i=mt(t)||0;return(t=e._tTime/e._tDur)&&!n&&(e._time*=i/e._dur),e._dur=i,e._tDur=a?a<0?1e10:mt(i*(a+1)+e._rDelay*a):i,0<t&&!n?Mt(e,e._tTime=e._tDur*t):e.parent&&St(e),r||wt(e.parent,e),e}function z(e){return e instanceof ir?wt(e):F(e,e._dur)}function V(e,t,r){var n,a,i,s=e.labels,o=e._recent||Tt,l=e.duration()>=Le?o.endTime(!1):e._dur;return Ve(t)&&(isNaN(t)||t in s)?(a=t.charAt(0),i="%"===t.substr(-1),n=t.indexOf("="),"<"===a||">"===a?(0<=n&&(t=t.replace(/=/,"")),("<"===a?o._start:o.endTime(0<=o._repeat))+(parseFloat(t.substr(1))||0)*(i?(n<0?o:r).totalDuration()/100:1)):n<0?(t in s||(s[t]=l),s[t]):(a=parseFloat(t.charAt(n-1)+t.substr(n+1)),i&&r&&(a=a/100*(Ze(r)?r[0]:r).totalDuration()),1<n?V(e,t.substr(0,n-1),r)+a:l+a)):null==t?l:+t}function G(e,t,r){var n,a,i=He(t[1]),s=(i?2:1)+(e<2?0:1),o=t[s];if(i&&(o.duration=t[1]),o.parent=r,e){for(n=o,a=r;a&&!("immediateRender"in n);)n=a.vars.defaults||{},a=Ke(a.vars.inherit)&&a.parent;o.immediateRender=Ke(n.immediateRender),e<2?o.runBackwards=1:o.startAt=t[s-1]}return new hr(t[0],o,t[1+s])}function H(e,t,r){return r<e?e:t<r?t:r}function W(e){if(Ge(e))return e;var t=We(e)?e:{each:e},r=Ht(t.ease),n=t.from||0,a=parseFloat(t.base)||0,i={},s=(e=0<n&&n<1,isNaN(n)||e),o=t.axis,l=n,c=n;return Ve(n)?l=c={center:.5,edges:.5,end:1}[n]||0:!e&&s&&(l=n[0],c=n[1]),function(e,u,h){var d,p,f,m,g,v,b,y,x=(h||t).length,w=i[x];if(!w){if(!(y="auto"===t.grid?0:(t.grid||[1,Le])[1])){for(v=-Le;v<(v=h[y++].getBoundingClientRect().left)&&y<x;);y--}for(w=i[x]=[],d=s?Math.min(y,x)*l-.5:n%y,p=y===Le?0:s?x*c/y-.5:n/y|0,b=Le,g=v=0;g<x;g++)m=g%y-d,f=p-(g/y|0),w[g]=m=o?Math.abs("y"===o?f:m):Ne(m*m+f*f),v<m&&(v=m),m<b&&(b=m);"random"===n&&Pt(w),w.max=v-b,w.min=b,w.v=x=(parseFloat(t.amount)||parseFloat(t.each)*(x<y?x-1:o?"y"===o?x/y:y:Math.max(y,x/y))||0)*("edges"===n?-1:1),w.b=x<0?a-x:a,w.u=Et(t.amount||t.each)||0,r=r&&x<0?Gt(r):r}return x=(w[e]-w.min)/w.max||0,mt(w.b+(r?r(x):x)*w.v)+w.u}}function K(e){var t=Math.pow(10,((e+"").split(".")[1]||"").length);return function(r){var n=Math.round(parseFloat(r)/e)*e*t;return(n-n%1)/t+(He(r)?0:Et(r))}}function q(e,t){var r,n,a=Ze(e);return!a&&We(e)&&(r=a=e.radius||Le,e.values?(e=Ot(e.values),(n=!He(e[0]))&&(r*=r)):e=K(e.increment)),_t(t,a?Ge(e)?function(t){return n=e(t),Math.abs(n-t)<=r?n:t}:function(t){for(var a,i,s=parseFloat(n?t.x:t),o=parseFloat(n?t.y:0),l=Le,c=0,u=e.length;u--;)(a=n?(a=e[u].x-s)*a+(i=e[u].y-o)*i:Math.abs(e[u]-s))<l&&(l=a,c=u);return c=!r||l<=r?e[c]:t,n||c===t||He(t)?c:c+Et(t)}:K(e))}function Z(e,t,r,n){return _t(Ze(e)?!t:!0===r?!!(r=0):!n,(function(){return Ze(e)?e[~~(Math.random()*e.length)]:(r=r||1e-5)&&(n=r<1?Math.pow(10,(r+"").length-2):1)&&Math.floor(Math.round((e-r/2+Math.random()*(t-e+.99*r))/r)*r*n)/n}))}function X(e,t,r){return _t(r,(function(r){return e[~~t(r)]}))}function Q(e,t,r,n,a){var i=t-e,s=n-r;return _t(a,(function(t){return r+((t-e)/i*s||0)}))}function Y(e,t,r){var n,a,i,s=e.labels,o=Le;for(n in s)(a=s[n]-t)<0==!!r&&a&&o>(a=Math.abs(a))&&(i=n,o=a);return i}function J(e,t,r){var n=e.vars,a=n[t];a&&(t=n[t+"Params"],n=n.callbackScope||e,r&&st.length&>(),t?a.apply(n,t):a.call(n))}function $(e){return xt(e),e.scrollTrigger&&e.scrollTrigger.kill(!1),e.progress()<1&&J(e,"onInterrupt"),e}function ee(e,t,r){return(6*(e+=e<0?1:1<e?-1:0)<1?t+(r-t)*e*6:e<.5?r:3*e<2?t+(r-t)*(2/3-e)*6:t)*Ct+.5|0}function te(e,t,r){var n,a,i,s,o="",l=(e+o).match(Bt),c=t?"hsla(":"rgba(",u=0;if(!l)return e;if(l=l.map((function(e){return(e=Lt(e,t,1))&&c+(t?e[0]+","+e[1]+"%,"+e[2]+"%,"+e[3]:e.join(","))+")"})),r&&(i=It(e),(n=r.c).join(o)!==i.c.join(o)))for(s=(a=e.replace(Bt,"1").split(Ye)).length-1;u<s;u++)o+=a[u]+(~n.indexOf(u)?l.shift()||c+"0,0,0,0)":(i.length?i:l.length?l:r).shift());if(!a)for(s=(a=e.split(Bt)).length-1;u<s;u++)o+=a[u]+l[u];return o+a[s]}function re(e,t){for(var r,n=e._first;n;)n instanceof ir?re(n,t):!n.vars.yoyoEase||n._yoyo&&n._repeat||n._yoyo===t||(n.timeline?re(n.timeline,t):(r=n._ease,n._ease=n._yEase,n._yEase=r,n._yoyo=t)),n=n._next}function ne(e,t){var r,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:function(e){return 1-t(1-e)},a={easeIn:t,easeOut:n,easeInOut:3<arguments.length&&void 0!==arguments[3]?arguments[3]:function(e){return e<.5?t(2*e)/2:1-t(2*(1-e))/2}};M(e,(function(e){for(var t in Ft[e]=rt[e]=a,Ft[r=e.toLowerCase()]=n,a)Ft[r+("easeIn"===t?".in":"easeOut"===t?".out":".inOut")]=Ft[e+"."+t]=a[t]}))}function ae(e){return function(t){return t<.5?(1-e(1-2*t))/2:.5+e(2*(t-.5))/2}}function ie(e,t,r){function n(e){return 1===e?1:a*Math.pow(2,-10*e)*ze((e-i)*s)+1}var a=1<=t?t:1,i=(s=(r||(e?.3:.45))/(t<1?t:1))/Be*(Math.asin(1/a)||0),s=(r="out"===e?n:"in"===e?function(e){return 1-n(1-e)}:ae(n),Be/s);return r.config=function(t,r){return ie(e,t,r)},r}function se(e){function t(e){return e?--e*e*((r+1)*e+r)+1:0}var r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1.70158,n="out"===e?t:"in"===e?function(e){return 1-t(1-e)}:ae(t);return n.config=function(t){return se(e,t)},n}r.d(t,{Q3:()=>hr});var oe,le,ce,ue,he,de,pe,fe,me,ge,ve,be,ye,xe,we,Se,Me,Te,_e,Ee,ke,De,Oe,Pe,Ae,Ce={autoSleep:120,force3D:"auto",nullTargetWarn:1,units:{lineHeight:""}},Re={duration:.5,overwrite:!1,delay:0},Le=1e8,Ie=1/Le,Be=2*Math.PI,je=Be/4,Ue=0,Ne=Math.sqrt,Fe=Math.cos,ze=Math.sin,Ve=function(e){return"string"==typeof e},Ge=function(e){return"function"==typeof e},He=function(e){return"number"==typeof e},We=function(e){return"object"==f(e)},Ke=function(e){return!1!==e},qe="function"==typeof ArrayBuffer&&ArrayBuffer.isView||function(){},Ze=Array.isArray,Xe=/(?:-?\.?\d|\.)+/gi,Qe=/[-+=.]*\d+[.e\-+]*\d*[e\-+]*\d*/g,Ye=/[-+=.]*\d+[.e-]*\d*[a-z%]*/g,Je=/[-+=.]*\d+\.?\d*(?:e-|e\+)?\d*/gi,$e=/[+-]=-?[.\d]+/,et=/[^,'"\[\]\s]+/gi,tt=/[\d.+\-=]+(?:e[-+]\d*)*/i,rt={},nt={},at=function(e,t){return console.warn("Invalid property",e,"set to",t,"Missing plugin? gsap.registerPlugin()")},it={},st=[],ot={},lt={},ct={},ut=30,ht=[],dt="",pt=function(e){var t,r,n=e[0];if(We(n)||Ge(n)||(e=[e]),!(t=(n._gsap||{}).harness)){for(r=ht.length;r--&&!ht[r].targetTest(n););t=ht[r]}for(r=e.length;r--;)e[r]&&(e[r]._gsap||(e[r]._gsap=new nr(e[r],t)))||e.splice(r,1);return e},ft=function(e){return e._gsap||pt(Ot(e))[0]._gsap},mt=function(e){return Math.round(1e7*e)/1e7||0},gt=function(){var e,t,r=st.length,n=st.slice(0);for(ot={},e=st.length=0;e<r;e++)(t=n[e])&&t._lazy&&(t.render(t._lazy[0],t._lazy[1],!0)._lazy=0)},vt=function(e,t){for(var r in t)r in e||(e[r]=t[r]);return e},bt=function(e,t){var r,n={};for(r in e)r in t||(n[r]=e[r]);return n},yt=function(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:"_first",n=3<arguments.length&&void 0!==arguments[3]?arguments[3]:"_last",a=t._prev,i=t._next;a?a._next=i:e[r]===t&&(e[r]=i),i?i._prev=a:e[n]===t&&(e[n]=a),t._next=t._prev=t.parent=null},xt=function(e,t){!e.parent||t&&!e.parent.autoRemoveChildren||e.parent.remove(e),e._act=0},wt=function(e,t){if(e&&(!t||t._end>e._dur||t._start<0))for(var r=e;r;)r._dirty=1,r=r.parent;return e},St=function(e){return e._end=mt(e._start+(e._tDur/Math.abs(e._ts||e._rts||Ie)||0))},Mt=function(e,t){var r=e._dp;return r&&r.smoothChildTiming&&e._ts&&(e._start=mt(r._time-(0<e._ts?t/e._ts:((e._dirty?e.totalDuration():e._tDur)-t)/-e._ts)),St(e),r._dirty||wt(r,e)),e},Tt={_start:0,endTime:w,totalDuration:w},_t=function(e,t){return e||0===e?t(e):t},Et=function(e,t){return Ve(e)&&(t=tt.exec(e))?e.substr(t.index+t[0].length):""},kt=[].slice,Dt=function(e,t){return e&&We(e)&&"length"in e&&(!t&&!e.length||e.length-1 in e&&We(e[0]))&&!e.nodeType&&e!==ce},Ot=function(e,t,r){return!Ve(e)||r||!ue&&Nt()?Ze(e)?function(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:[];return e.forEach((function(e){return Ve(e)&&!t||Dt(e,1)?r.push.apply(r,d(Ot(e))):r.push(e)}))||r}(e,r):Dt(e)?kt.call(e,0):e?[e]:[]:kt.call((t||he).querySelectorAll(e),0)},Pt=function(e){return e.sort((function(){return.5-Math.random()}))},At=function(e){for(var t,r,n,a,i=0,s="";~(t=e.indexOf("random(",i));)n=e.indexOf(")",t),a="["===e.charAt(t+7),r=e.substr(t+7,n-t-7).match(a?et:Xe),s+=e.substr(i,t-i)+Z(a?r:+r[0],a?0:+r[1],+r[2]||1e-5),i=n+1;return s+e.substr(i,e.length-i)},Ct=255,Rt={aqua:[0,Ct,Ct],lime:[0,Ct,0],silver:[192,192,192],black:[0,0,0],maroon:[128,0,0],teal:[0,128,128],blue:[0,0,Ct],navy:[0,0,128],white:[Ct,Ct,Ct],olive:[128,128,0],yellow:[Ct,Ct,0],orange:[Ct,165,0],gray:[128,128,128],purple:[128,0,128],green:[0,128,0],red:[Ct,0,0],pink:[Ct,192,203],cyan:[0,Ct,Ct],transparent:[Ct,Ct,Ct,0]},Lt=function(e,t,r){var n,a,i,s,o,l,c,u=e?He(e)?[e>>16,e>>8&Ct,e&Ct]:0:Rt.black;if(!u){if(","===e.substr(-1)&&(e=e.substr(0,e.length-1)),Rt[e])u=Rt[e];else if("#"===e.charAt(0)){if(9===(e=e.length<6?"#"+(n=e.charAt(1))+n+(a=e.charAt(2))+a+(i=e.charAt(3))+i+(5===e.length?e.charAt(4)+e.charAt(4):""):e).length)return[(u=parseInt(e.substr(1,6),16))>>16,u>>8&Ct,u&Ct,parseInt(e.substr(7),16)/255];u=[(e=parseInt(e.substr(1),16))>>16,e>>8&Ct,e&Ct]}else if("hsl"===e.substr(0,3))if(u=c=e.match(Xe),t){if(~e.indexOf("="))return u=e.match(Qe),r&&u.length<4&&(u[3]=1),u}else s=+u[0]%360/360,o=+u[1]/100,n=2*(l=+u[2]/100)-(a=l<=.5?l*(o+1):l+o-l*o),3<u.length&&(u[3]*=1),u[0]=ee(s+1/3,n,a),u[1]=ee(s,n,a),u[2]=ee(s-1/3,n,a);else u=e.match(Xe)||Rt.transparent;u=u.map(Number)}return t&&!c&&(n=u[0]/Ct,a=u[1]/Ct,i=u[2]/Ct,l=((e=Math.max(n,a,i))+(t=Math.min(n,a,i)))/2,e===t?s=o=0:(c=e-t,o=.5<l?c/(2-e-t):c/(e+t),s=e===n?(a-i)/c+(a<i?6:0):e===a?(i-n)/c+2:(n-a)/c+4,s*=60),u[0]=~~(s+.5),u[1]=~~(100*o+.5),u[2]=~~(100*l+.5)),r&&u.length<4&&(u[3]=1),u},It=function(e){var t=[],r=[],n=-1;return e.split(Bt).forEach((function(e){e=e.match(Ye)||[],t.push.apply(t,d(e)),r.push(n+=e.length+1)})),t.c=r,t},Bt=function(){var e,t="(?:\\b(?:(?:rgb|rgba|hsl|hsla)\\(.+?\\))|\\B#(?:[0-9a-f]{3,4}){1,2}\\b";for(e in Rt)t+="|"+e+"\\b";return new RegExp(t+")","gi")}(),jt=/hsl[a]?\(/,Ut=(we=Date.now,Se=500,Me=33,Te=we(),_e=Te,ke=Ee=1e3/240,Oe={time:0,frame:0,tick:function(){Wt(!0)},deltaRatio:function(e){return ye/(1e3/(e||60))},wake:function(){de&&(!ue&&g()&&(ce=ue=window,he=ce.document||{},rt.gsap=Sr,(ce.gsapVersions||(ce.gsapVersions=[])).push(Sr.version),b(nt||ce.GreenSockGlobals||!ce.gsap&&ce||{}),be=ce.requestAnimationFrame),ge&&Oe.sleep(),ve=be||function(e){return setTimeout(e,ke-1e3*Oe.time+1|0)},me=1,Wt(2))},sleep:function(){(be?ce.cancelAnimationFrame:clearTimeout)(ge),me=0,ve=w},lagSmoothing:function(e,t){Se=e||1/Ie,Me=Math.min(t,Se,0)},fps:function(e){Ee=1e3/(e||240),ke=1e3*Oe.time+Ee},add:function(e){De.indexOf(e)<0&&De.push(e),Nt()},remove:function(e,t){~(t=De.indexOf(e))&&De.splice(t,1)&&t<=xe&&xe--},_listeners:De=[]}),Nt=function(){return!me&&Ut.wake()},Ft={},zt=/^[\d.\-M][\d.\-,\s]/,Vt=/["']/g,Gt=function(e){return function(t){return 1-e(1-t)}},Ht=function(e,t){return e&&(Ge(e)?e:Ft[e]||function(e){var t,r,n,a=(e+"").split("("),i=Ft[a[0]];return i&&1<a.length&&i.config?i.config.apply(null,~e.indexOf("{")?[function(e){for(var t,r,n,a={},i=e.substr(1,e.length-3).split(":"),s=i[0],o=1,l=i.length;o<l;o++)r=i[o],t=o!==l-1?r.lastIndexOf(","):r.length,n=r.substr(0,t),a[s]=isNaN(n)?n.replace(Vt,"").trim():+n,s=r.substr(t+1).trim();return a}(a[1])]:(t=(a=e).indexOf("(")+1,r=a.indexOf(")"),n=a.indexOf("(",t),a.substring(t,~n&&n<r?a.indexOf(")",r+1):r).split(",").map(_))):Ft._CE&&zt.test(e)?Ft._CE("",e):i}(e))||t};function Wt(e){var t,r,n,a=we()-_e,i=!0===e;if(Se<a&&(Te+=a-Me),(0<(a=(r=(_e+=a)-Te)-ke)||i)&&(n=++Oe.frame,ye=r-1e3*Oe.time,Oe.time=r/=1e3,ke+=a+(Ee<=a?4:Ee-a),t=1),i||(ge=ve(Wt)),t)for(xe=0;xe<De.length;xe++)De[xe](r,ye,n,e)}function Kt(e){return e<Ae?Pe*e*e:e<.7272727272727273?Pe*Math.pow(e-1.5/2.75,2)+.75:e<.9090909090909092?Pe*(e-=2.25/2.75)*e+.9375:Pe*Math.pow(e-2.625/2.75,2)+.984375}function qt(e,t){var r,n,a,i,s,o,l,c,u,h,d,p,f,m=e.vars,g=m.ease,v=m.startAt,b=m.immediateRender,y=m.lazy,x=m.onUpdate,w=m.onUpdateParams,S=m.callbackScope,M=m.runBackwards,T=m.yoyoEase,_=m.keyframes,E=m.autoRevert,k=e._dur,D=e._startAt,O=e._targets,P=e.parent,A=P&&"nested"===P.data?P.parent._targets:O,C="auto"===e._overwrite&&!oe,R=e.timeline;if(e._ease=Ht(g=!R||_&&g?g:"none",Re.ease),e._yEase=T?Gt(Ht(!0===T?g:T,Re.ease)):0,T&&e._yoyo&&!e._repeat&&(T=e._yEase,e._yEase=e._ease,e._ease=T),e._from=!R&&!!m.runBackwards,!R||_&&!m.stagger){if(p=(c=O[0]?ft(O[0]).harness:0)&&m[c.prop],r=bt(m,it),D&&xt(D.render(-1,!0)),v)if(xt(e._startAt=hr.set(O,vt({data:"isStart",overwrite:!1,parent:P,immediateRender:!0,lazy:Ke(y),startAt:null,delay:0,onUpdate:x,onUpdateParams:w,callbackScope:S,stagger:0},v))),t<0&&!b&&!E&&e._startAt.render(-1,!0),b){if(0<t&&!E&&(e._startAt=0),k&&t<=0)return void(t&&(e._zTime=t))}else!1===E&&(e._startAt=0);else if(M&&k)if(D)E||(e._startAt=0);else if(a=vt({overwrite:!1,data:"isFromStart",lazy:(b=!t&&b)&&Ke(y),immediateRender:b,stagger:0,parent:P},r),p&&(a[c.prop]=p),xt(e._startAt=hr.set(O,a)),t<0&&e._startAt.render(-1,!0),e._zTime=t,b){if(!t)return}else qt(e._startAt,Ie);for(e._pt=0,y=k&&Ke(y)||y&&!k,n=0;n<O.length;n++){if(l=(s=O[n])._gsap||pt(O)[n]._gsap,e._ptLookup[n]=h={},ot[l.id]&&st.length&>(),d=A===O?n:A.indexOf(s),c&&!1!==(u=new c).init(s,p||r,e,d,A)&&(e._pt=i=new yr(e._pt,s,u.name,0,1,u.render,u,0,u.priority),u._props.forEach((function(e){h[e]=i})),u.priority&&(o=1)),!c||p)for(a in r)lt[a]&&(u=lr(a,r,e,d,s,A))?u.priority&&(o=1):h[a]=i=or.call(e,s,a,"get",r[a],d,A,0,m.stringFilter);e._op&&e._op[n]&&e.kill(s,e._op[n]),C&&e._pt&&(rr=e,le.killTweensOf(s,h,e.globalTime(t)),f=!e.parent,rr=0),e._pt&&y&&(ot[l.id]=1)}o&&br(e),e._onInit&&e._onInit(e)}e._onUpdate=x,e._initted=(!e._op||e._pt)&&!f,_&&t<=0&&R.render(Le,!0,!0)}function Zt(e,t,r,n,a){return Ge(e)?e.call(t,r,n,a):Ve(e)&&~e.indexOf("random(")?At(e):e}function Xt(e,t,r){return e.setAttribute(t,r)}function Qt(e,t){var r=t._pt,n="";if(!e&&t.b)n=t.b;else if(1===e&&t.e)n=t.e;else{for(;r;)n=r.p+(r.m?r.m(r.s+r.c*e):Math.round(1e4*(r.s+r.c*e))/1e4)+n,r=r._next;n+=t.c}t.set(t.t,t.p,n,t)}function Yt(e,t){for(var r=t._pt;r;)r.r(e,r.d),r=r._next}function Jt(e,t,r,n){for(var a,i=this._pt;i;)a=i._next,i.p===n&&i.modifier(e,t,r),i=a}function $t(e){for(var t,r,n=this._pt;n;)r=n._next,n.p===e&&!n.op||n.op===e?yt(this,n,"_pt"):n.dep||(t=1),n=r;return!t}function er(e,t,r,n){n.mSet(e,t,n.m.call(n.tween,r,n.mt),n)}function tr(e,t){return{name:e,rawVars:1,init:function(e,r,n){n._onInit=function(e){var n,a;if(Ve(r)&&(n={},M(r,(function(e){return n[e]=1})),r=n),t){for(a in n={},r)n[a]=t(r[a]);r=n}var i,s,o,l=e,c=r,u=l._targets;for(i in c)for(s=u.length;s--;)(o=(o=l._ptLookup[s][i])&&o.d)&&(o=o._pt?wr(o,i):o)&&o.modifier&&o.modifier(c[i],l,u[s],i)}}}}M("Linear,Quad,Cubic,Quart,Quint,Strong",(function(e,t){var r=t<5?t+1:t;ne(e+",Power"+(r-1),t?function(e){return Math.pow(e,r)}:function(e){return e},(function(e){return 1-Math.pow(1-e,r)}),(function(e){return e<.5?Math.pow(2*e,r)/2:1-Math.pow(2*(1-e),r)/2}))})),Ft.Linear.easeNone=Ft.none=Ft.Linear.easeIn,ne("Elastic",ie("in"),ie("out"),ie()),Pe=7.5625,Ae=1/2.75,ne("Bounce",(function(e){return 1-Kt(1-e)}),Kt),ne("Expo",(function(e){return e?Math.pow(2,10*(e-1)):0})),ne("Circ",(function(e){return-(Ne(1-e*e)-1)})),ne("Sine",(function(e){return 1===e?1:1-Fe(e*je)})),ne("Back",se("in"),se("out"),se()),Ft.SteppedEase=Ft.steps=rt.SteppedEase={config:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:1,t=1<arguments.length?arguments[1]:void 0,r=1/e,n=e+(t?0:1),a=t?1:0,i=1-Ie;return function(e){return((n*H(0,i,e)|0)+a)*r}}},Re.ease=Ft["quad.out"],M("onComplete,onUpdate,onStart,onRepeat,onReverseComplete,onInterrupt",(function(e){return dt+=e+","+e+"Params,"}));var rr,nr=u((function e(t,r){h(this,e),this.id=Ue++,(t._gsap=this).target=t,this.harness=r,this.get=r?r.get:S,this.set=r?r.getSetter:mr})),ar=function(){function e(t){h(this,e),this.vars=t,this._delay=+t.delay||0,(this._repeat=t.repeat===1/0?-2:t.repeat||0)&&(this._rDelay=t.repeatDelay||0,this._yoyo=!!t.yoyo||!!t.yoyoEase),this._ts=1,F(this,+t.duration,1,1),this.data=t.data,me||Ut.wake()}return u(e,[{key:"delay",value:function(e){return e||0===e?(this.parent&&this.parent.smoothChildTiming&&this.startTime(this._start+e-this._delay),this._delay=e,this):this._delay}},{key:"duration",value:function(e){return arguments.length?this.totalDuration(0<this._repeat?e+(e+this._rDelay)*this._repeat:e):this.totalDuration()&&this._dur}},{key:"totalDuration",value:function(e){return arguments.length?(this._dirty=0,F(this,this._repeat<0?e:(e-this._repeat*this._rDelay)/(this._repeat+1))):this._tDur}},{key:"totalTime",value:function(e,t){if(Nt(),!arguments.length)return this._tTime;var r=this._dp;if(r&&r.smoothChildTiming&&this._ts){for(Mt(this,e),r._dp&&!r.parent&&L(r,this);r&&r.parent;)r.parent._time!==r._start+(0<=r._ts?r._tTime/r._ts:(r.totalDuration()-r._tTime)/-r._ts)&&r.totalTime(r._tTime,!0),r=r.parent;!this.parent&&this._dp.autoRemoveChildren&&(0<this._ts&&e<this._tDur||this._ts<0&&0<e||!this._tDur&&!e)&&I(this._dp,this,this._start-this._delay)}return(this._tTime!==e||!this._dur&&!t||this._initted&&Math.abs(this._zTime)===Ie||!e&&!this._initted&&(this.add||this._ptLookup))&&(this._ts||(this._pTime=e),T(this,e,t)),this}},{key:"time",value:function(e,t){return arguments.length?this.totalTime(Math.min(this.totalDuration(),e+A(this))%(this._dur+this._rDelay)||(e?this._dur:0),t):this._time}},{key:"totalProgress",value:function(e,t){return arguments.length?this.totalTime(this.totalDuration()*e,t):this.totalDuration()?Math.min(1,this._tTime/this._tDur):this.ratio}},{key:"progress",value:function(e,t){return arguments.length?this.totalTime(this.duration()*(!this._yoyo||1&this.iteration()?e:1-e)+A(this),t):this.duration()?Math.min(1,this._time/this._dur):this.ratio}},{key:"iteration",value:function(e,t){var r=this.duration()+this._rDelay;return arguments.length?this.totalTime(this._time+(e-1)*r,t):this._repeat?C(this._tTime,r)+1:1}},{key:"timeScale",value:function(e){if(!arguments.length)return this._rts===-Ie?0:this._rts;if(this._rts===e)return this;for(var t=this.parent&&this._ts?R(this.parent._time,this):this._tTime,r=(this._rts=+e||0,this._ts=this._ps||e===-Ie?0:this._rts,e=this.totalTime(H(-this._delay,this._tDur,t),!0)).parent;r&&r.parent;)r._dirty=1,r.totalDuration(),r=r.parent;return St(this),this}},{key:"paused",value:function(e){return arguments.length?(this._ps!==e&&((this._ps=e)?(this._pTime=this._tTime||Math.max(-this._delay,this.rawTime()),this._ts=this._act=0):(Nt(),this._ts=this._rts,this.totalTime(this.parent&&!this.parent.smoothChildTiming?this.rawTime():this._tTime||this._pTime,1===this.progress()&&Math.abs(this._zTime)!==Ie&&(this._tTime-=Ie)))),this):this._ps}},{key:"startTime",value:function(e){var t;return arguments.length?(this._start=e,!(t=this.parent||this._dp)||!t._sort&&this.parent||I(t,this,e-this._delay),this):this._start}},{key:"endTime",value:function(e){return this._start+(Ke(e)?this.totalDuration():this.duration())/Math.abs(this._ts||1)}},{key:"rawTime",value:function(e){var t=this.parent||this._dp;return t?e&&(!this._ts||this._repeat&&this._time&&this.totalProgress()<1)?this._tTime%(this._dur+this._rDelay):this._ts?R(t.rawTime(e),this):this._tTime:this._tTime}},{key:"globalTime",value:function(e){for(var t=this,r=arguments.length?e:t.rawTime();t;)r=t._start+r/(t._ts||1),t=t._dp;return r}},{key:"repeat",value:function(e){return arguments.length?(this._repeat=e===1/0?-2:e,z(this)):-2===this._repeat?1/0:this._repeat}},{key:"repeatDelay",value:function(e){var t;return arguments.length?(t=this._time,this._rDelay=e,z(this),t?this.time(t):this):this._rDelay}},{key:"yoyo",value:function(e){return arguments.length?(this._yoyo=e,this):this._yoyo}},{key:"seek",value:function(e,t){return this.totalTime(V(this,e),Ke(t))}},{key:"restart",value:function(e,t){return this.play().totalTime(e?-this._delay:0,Ke(t))}},{key:"play",value:function(e,t){return null!=e&&this.seek(e,t),this.reversed(!1).paused(!1)}},{key:"reverse",value:function(e,t){return null!=e&&this.seek(e||this.totalDuration(),t),this.reversed(!0).paused(!1)}},{key:"pause",value:function(e,t){return null!=e&&this.seek(e,t),this.paused(!0)}},{key:"resume",value:function(){return this.paused(!1)}},{key:"reversed",value:function(e){return arguments.length?(!!e!==this.reversed()&&this.timeScale(-this._rts||(e?-Ie:0)),this):this._rts<0}},{key:"invalidate",value:function(){return this._initted=this._act=0,this._zTime=-Ie,this}},{key:"isActive",value:function(){var e=this.parent||this._dp,t=this._start;return!(e&&!(this._ts&&this._initted&&e.isActive()&&(e=e.rawTime(!0))>=t&&e<this.endTime(!0)-Ie))}},{key:"eventCallback",value:function(e,t,r){var n=this.vars;return 1<arguments.length?(t?(n[e]=t,r&&(n[e+"Params"]=r),"onUpdate"===e&&(this._onUpdate=t)):delete n[e],this):n[e]}},{key:"then",value:function(e){var t=this;return new Promise((function(r){function n(){var e=t.then;t.then=null,Ge(a)&&(a=a(t))&&(a.then||a===t)&&(t.then=e),r(a),t.then=e}var a=Ge(e)?e:E;t._initted&&1===t.totalProgress()&&0<=t._ts||!t._tTime&&t._ts<0?n():t._prom=n}))}},{key:"kill",value:function(){$(this)}}]),e}(),ir=(vt(ar.prototype,{_time:0,_start:0,_end:0,_tTime:0,_tDur:0,_dirty:0,_repeat:0,_yoyo:!1,parent:null,_initted:!1,_rDelay:0,_ts:1,_dp:0,ratio:0,_zTime:-Ie,_prom:0,_ps:!1,_rts:1}),function(){a(t,ar);var e=s(t);function t(){var r,n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},a=1<arguments.length?arguments[1]:void 0;return h(this,t),(r=e.call(this,n)).labels={},r.smoothChildTiming=!!n.smoothChildTiming,r.autoRemoveChildren=!!n.autoRemoveChildren,r._sort=Ke(n.sortChildren),le&&I(n.parent||le,o(r),a),n.reversed&&r.reverse(),n.paused&&r.paused(!0),n.scrollTrigger&&B(o(r),n.scrollTrigger),r}return u(t,[{key:"to",value:function(e,t,r){return G(0,arguments,this),this}},{key:"from",value:function(e,t,r){return G(1,arguments,this),this}},{key:"fromTo",value:function(e,t,r,n){return G(2,arguments,this),this}},{key:"set",value:function(e,t,r){return t.duration=0,t.parent=this,O(t).repeatDelay||(t.repeat=0),t.immediateRender=!!t.immediateRender,new hr(e,t,V(this,r),1),this}},{key:"call",value:function(e,t,r){return I(this,hr.delayedCall(0,e,t),r)}},{key:"staggerTo",value:function(e,t,r,n,a,i,s){return r.duration=t,r.stagger=r.stagger||n,r.onComplete=i,r.onCompleteParams=s,r.parent=this,new hr(e,r,V(this,a)),this}},{key:"staggerFrom",value:function(e,t,r,n,a,i,s){return r.runBackwards=1,O(r).immediateRender=Ke(r.immediateRender),this.staggerTo(e,t,r,n,a,i,s)}},{key:"staggerFromTo",value:function(e,t,r,n,a,i,s,o){return n.startAt=r,O(n).immediateRender=Ke(n.immediateRender),this.staggerTo(e,t,n,a,i,s,o)}},{key:"render",value:function(e,t,r){var n,a,i,s,o,l,c,u,h,d,p=this._time,f=this._dirty?this.totalDuration():this._tDur,m=this._dur,g=e<=0?0:mt(e),v=this._zTime<0!=e<0&&(this._initted||!m);if((g=this!==le&&f<g&&0<=e?f:g)!==this._tTime||r||v){if(p!==this._time&&m&&(g+=this._time-p,e+=this._time-p),n=g,u=this._start,o=!(c=this._ts),v&&(m||(p=this._zTime),!e&&t||(this._zTime=e)),this._repeat){if(v=this._yoyo,s=m+this._rDelay,this._repeat<-1&&e<0)return this.totalTime(100*s+e,t,r);if(n=mt(g%s),g===f?(i=this._repeat,n=m):((i=~~(g/s))&&i===g/s&&(n=m,i--),m<n&&(n=m)),h=C(this._tTime,s),v&&1&i&&(n=m-n,d=1),i!==(h=!p&&this._tTime&&h!==i?i:h)&&!this._lock){var b=v&&1&h;if(v=b===(v&&1&i),p=(b=i<h?!b:b)?0:m,this._lock=1,this.render(p||(d?0:mt(i*s)),t,!m)._lock=0,this._tTime=g,!t&&this.parent&&J(this,"onRepeat"),this.vars.repeatRefresh&&!d&&(this.invalidate()._lock=1),p&&p!==this._time||o!=!this._ts||this.vars.onRepeat&&!this.parent&&!this._act)return this;if(m=this._dur,f=this._tDur,v&&(this._lock=2,this.render(p=b?m:-1e-4,!0),this.vars.repeatRefresh&&!d&&this.invalidate()),this._lock=0,!this._ts&&!o)return this;re(this,d)}}if(this._hasPause&&!this._forcing&&this._lock<2&&(l=function(e,t,r){var n;if(t<r)for(n=e._first;n&&n._start<=r;){if("isPause"===n.data&&n._start>t)return n;n=n._next}else for(n=e._last;n&&n._start>=r;){if("isPause"===n.data&&n._start<t)return n;n=n._prev}}(this,mt(p),mt(n)))&&(g-=n-(n=l._start)),this._tTime=g,this._time=n,this._act=!c,this._initted||(this._onUpdate=this.vars.onUpdate,this._initted=1,this._zTime=e,p=0),!p&&n&&!t&&(J(this,"onStart"),this._tTime!==g))return this;if(p<=n&&0<=e)for(y=this._first;y;){if(a=y._next,(y._act||n>=y._start)&&y._ts&&l!==y){if(y.parent!==this)return this.render(e,t,r);if(y.render(0<y._ts?(n-y._start)*y._ts:(y._dirty?y.totalDuration():y._tDur)+(n-y._start)*y._ts,t,r),n!==this._time||!this._ts&&!o){l=0,a&&(g+=this._zTime=-Ie);break}}y=a}else for(var y=this._last,x=e<0?e:n;y;){if(a=y._prev,(y._act||x<=y._end)&&y._ts&&l!==y){if(y.parent!==this)return this.render(e,t,r);if(y.render(0<y._ts?(x-y._start)*y._ts:(y._dirty?y.totalDuration():y._tDur)+(x-y._start)*y._ts,t,r),n!==this._time||!this._ts&&!o){l=0,a&&(g+=this._zTime=x?-Ie:Ie);break}}y=a}if(l&&!t&&(this.pause(),l.render(p<=n?0:-Ie)._zTime=p<=n?1:-1,this._ts))return this._start=u,St(this),this.render(e,t,r);this._onUpdate&&!t&&J(this,"onUpdate",!0),!(g===f&&f>=this.totalDuration()||!g&&p)||u!==this._start&&Math.abs(c)===Math.abs(this._ts)||this._lock||(!e&&m||!(g===f&&0<this._ts||!g&&this._ts<0)||xt(this,1),t||e<0&&!p||!g&&!p&&f||(J(this,g===f&&0<=e?"onComplete":"onReverseComplete",!0),!this._prom||g<f&&0<this.timeScale()||this._prom()))}return this}},{key:"add",value:function(e,t){var r=this;if(He(t)||(t=V(this,t,e)),!(e instanceof ar)){if(Ze(e))return e.forEach((function(e){return r.add(e,t)})),this;if(Ve(e))return this.addLabel(e,t);if(!Ge(e))return this;e=hr.delayedCall(0,e)}return this!==e?I(this,e,t):this}},{key:"getChildren",value:function(){for(var e=!(0<arguments.length&&void 0!==arguments[0])||arguments[0],t=!(1<arguments.length&&void 0!==arguments[1])||arguments[1],r=!(2<arguments.length&&void 0!==arguments[2])||arguments[2],n=3<arguments.length&&void 0!==arguments[3]?arguments[3]:-Le,a=[],i=this._first;i;)i._start>=n&&(i instanceof hr?t&&a.push(i):(r&&a.push(i),e&&a.push.apply(a,d(i.getChildren(!0,t,r))))),i=i._next;return a}},{key:"getById",value:function(e){for(var t=this.getChildren(1,1,1),r=t.length;r--;)if(t[r].vars.id===e)return t[r]}},{key:"remove",value:function(e){return Ve(e)?this.removeLabel(e):Ge(e)?this.killTweensOf(e):(yt(this,e),e===this._recent&&(this._recent=this._last),wt(this))}},{key:"totalTime",value:function(e,r){return arguments.length?(this._forcing=1,!this._dp&&this._ts&&(this._start=mt(Ut.time-(0<this._ts?e/this._ts:(this.totalDuration()-e)/-this._ts))),n(l(t.prototype),"totalTime",this).call(this,e,r),this._forcing=0,this):this._tTime}},{key:"addLabel",value:function(e,t){return this.labels[e]=V(this,t),this}},{key:"removeLabel",value:function(e){return delete this.labels[e],this}},{key:"addPause",value:function(e,t,r){return(t=hr.delayedCall(0,t||w,r)).data="isPause",this._hasPause=1,I(this,t,V(this,e))}},{key:"removePause",value:function(e){var t=this._first;for(e=V(this,e);t;)t._start===e&&"isPause"===t.data&&xt(t),t=t._next}},{key:"killTweensOf",value:function(e,t,r){for(var n=this.getTweensOf(e,r),a=n.length;a--;)rr!==n[a]&&n[a].kill(e,t);return this}},{key:"getTweensOf",value:function(e,t){for(var r,n=[],a=Ot(e),i=this._first,s=He(t);i;)i instanceof hr?function(e,t){for(var r=t.length,n=0;e.indexOf(t[n])<0&&++n<r;);return n<r}(i._targets,a)&&(s?(!rr||i._initted&&i._ts)&&i.globalTime(0)<=t&&i.globalTime(i.totalDuration())>t:!t||i.isActive())&&n.push(i):(r=i.getTweensOf(a,t)).length&&n.push.apply(n,d(r)),i=i._next;return n}},{key:"tweenTo",value:function(e,t){t=t||{};var r,n=this,a=V(n,e),i=(e=t).startAt,s=e.onStart,o=e.onStartParams,l=(e=e.immediateRender,hr.to(n,vt({ease:t.ease||"none",lazy:!1,immediateRender:!1,time:a,overwrite:"auto",duration:t.duration||Math.abs((a-(i&&"time"in i?i.time:n._time))/n.timeScale())||Ie,onStart:function(){var e;n.pause(),r||(e=t.duration||Math.abs((a-(i&&"time"in i?i.time:n._time))/n.timeScale()),l._dur!==e&&F(l,e,0,1).render(l._time,!0,!0),r=1),s&&s.apply(l,o||[])}},t)));return e?l.render(0):l}},{key:"tweenFromTo",value:function(e,t,r){return this.tweenTo(t,vt({startAt:{time:V(this,e)}},r))}},{key:"recent",value:function(){return this._recent}},{key:"nextLabel",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:this._time;return Y(this,V(this,e))}},{key:"previousLabel",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:this._time;return Y(this,V(this,e),1)}},{key:"currentLabel",value:function(e){return arguments.length?this.seek(e,!0):this.previousLabel(this._time+Ie)}},{key:"shiftChildren",value:function(e,t){for(var r,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0,a=this._first,i=this.labels;a;)a._start>=n&&(a._start+=e,a._end+=e),a=a._next;if(t)for(r in i)i[r]>=n&&(i[r]+=e);return wt(this)}},{key:"invalidate",value:function(){var e=this._first;for(this._lock=0;e;)e.invalidate(),e=e._next;return n(l(t.prototype),"invalidate",this).call(this)}},{key:"clear",value:function(){for(var e,t=!(0<arguments.length&&void 0!==arguments[0])||arguments[0],r=this._first;r;)e=r._next,this.remove(r),r=e;return this._dp&&(this._time=this._tTime=this._pTime=0),t&&(this.labels={}),wt(this)}},{key:"totalDuration",value:function(e){var t,r,n,a=0,i=this,s=i._last,o=Le;if(arguments.length)return i.timeScale((i._repeat<0?i.duration():i.totalDuration())/(i.reversed()?-e:e));if(i._dirty){for(n=i.parent;s;)t=s._prev,s._dirty&&s.totalDuration(),(r=s._start)>o&&i._sort&&s._ts&&!i._lock?(i._lock=1,I(i,s,r-s._delay,1)._lock=0):o=r,r<0&&s._ts&&(a-=r,(!n&&!i._dp||n&&n.smoothChildTiming)&&(i._start+=r/i._ts,i._time-=r,i._tTime-=r),i.shiftChildren(-r,!1,-1/0),o=0),s._end>a&&s._ts&&(a=s._end),s=t;F(i,i===le&&i._time>a?i._time:a,1,1),i._dirty=0}return i._tDur}}],[{key:"updateRoot",value:function(e){if(le._ts&&(T(le,R(e,le)),pe=Ut.frame),Ut.frame>=ut){ut+=Ce.autoSleep||120;var t=le._first;if((!t||!t._ts)&&Ce.autoSleep&&Ut._listeners.length<2){for(;t&&!t._ts;)t=t._next;t||Ut.sleep()}}}}]),t}()),sr=(vt(ir.prototype,{_lock:0,_hasPause:0,_forcing:0}),function(e,t,r,n,a,i,s){var o,l,c,u,h,d=new yr(this._pt,e,t,0,1,Qt,null,a),p=0,f=0;for(d.b=r,d.e=n,r+="",(a=~(n+="").indexOf("random("))&&(n=At(n)),i&&(i(i=[r,n],e,t),r=i[0],n=i[1]),o=r.match(Je)||[];u=Je.exec(n);)c=u[0],u=n.substring(p,u.index),l?l=(l+1)%5:"rgba("===u.substr(-5)&&(l=1),c!==o[f++]&&(h=parseFloat(o[f-1])||0,d._pt={_next:d._pt,p:u||1===f?u:",",s:h,c:"="===c.charAt(1)?parseFloat(c.substr(2))*("-"===c.charAt(0)?-1:1):parseFloat(c)-h,m:l&&l<4?Math.round:0},p=Je.lastIndex);return d.c=p<n.length?n.substring(p,n.length):"",d.fp=s,($e.test(n)||a)&&(d.e=0),this._pt=d}),or=function(e,t,r,n,a,i,s,o,l){var c;if(Ge(n)&&(n=n(a||0,e,i)),a=e[t],i="get"!==r?r:Ge(a)?l?e[t.indexOf("set")||!Ge(e["get"+t.substr(3)])?t:"get"+t.substr(3)](l):e[t]():a,r=Ge(a)?l?fr:pr:dr,Ve(n)&&"="===(n=~n.indexOf("random(")?At(n):n).charAt(1)&&(!(c=parseFloat(i)+parseFloat(n.substr(2))*("-"===n.charAt(0)?-1:1)+(Et(i)||0))&&0!==c||(n=c)),i!==n)return isNaN(i*n)||""===n?(a||t in e||at(t,n),sr.call(this,e,t,i,n,r,o||Ce.stringFilter,l)):(c=new yr(this._pt,e,t,+i||0,n-(i||0),"boolean"==typeof a?vr:gr,0,r),l&&(c.fp=l),s&&c.modifier(s,this,e),this._pt=c)},lr=function(e,t,r,n,a,i){var s,o,l,c;if(lt[e]&&!1!==(s=new lt[e]).init(a,s.rawVars?t[e]:function(e,t,r,n,a){if(Ge(e)&&(e=Zt(e,a,t,r,n)),!We(e)||e.style&&e.nodeType||Ze(e)||qe(e))return Ve(e)?Zt(e,a,t,r,n):e;var i,s={};for(i in e)s[i]=Zt(e[i],a,t,r,n);return s}(t[e],n,a,i,r),r,n,i)&&(r._pt=o=new yr(r._pt,a,e,0,1,s.render,s,0,s.priority),r!==fe))for(l=r._ptLookup[r._targets.indexOf(a)],c=s._props.length;c--;)l[s._props[c]]=o;return s},cr=dt+"repeat,repeatDelay,yoyo,repeatRefresh,yoyoEase",ur={},hr=(M(cr+",id,stagger,delay,duration,paused,scrollTrigger",(function(e){return ur[e]=1})),function(){a(t,ar);var e=s(t);function t(r,n,a,i){h(this,t),"number"==typeof n&&(a.duration=n,n=a,a=null);var s,l,c,u,d,p,f,m,g,b=(i=(s=e.call(this,i?n:O(n))).vars).duration,x=i.delay,w=i.immediateRender,S=i.stagger,M=i.overwrite,T=i.keyframes,_=i.defaults,E=i.scrollTrigger,D=i.yoyoEase,A=(i=n.parent||le,(Ze(r)||qe(r)?He(r[0]):"length"in n)?[r]:Ot(r));if(s._targets=A.length?pt(A):y("GSAP target "+r+" not found. https://greensock.com",!Ce.nullTargetWarn)||[],s._ptLookup=[],s._overwrite=M,T||S||v(b)||v(x)){if(n=s.vars,(l=s.timeline=new ir({data:"nested",defaults:_||{}})).kill(),l.parent=l._dp=o(s),l._start=0,S||v(b)||v(x)){if(d=A.length,m=S&&W(S),We(S))for(p in S)~cr.indexOf(p)&&((g=g||{})[p]=S[p]);for(c=0;c<d;c++)(u=bt(n,ur)).stagger=0,D&&(u.yoyoEase=D),g&&k(u,g),f=A[c],u.duration=+Zt(b,o(s),c,f,A),u.delay=(+Zt(x,o(s),c,f,A)||0)-s._delay,!S&&1===d&&u.delay&&(s._delay=x=u.delay,s._start+=x,u.delay=0),l.to(f,u,m?m(c,f,A):0),l._ease=Ft.none;l.duration()?b=x=0:s.timeline=0}else if(T){O(vt(l.vars.defaults,{ease:"none"})),l._ease=Ht(T.ease||n.ease||"none");var C,R,L,j=0;if(Ze(T))T.forEach((function(e){return l.to(A,e,">")}));else{for(p in u={},T)"ease"!==p&&"easeEach"!==p&&function(e,t,r,n){var a,i,s=t.ease||n||"power1.inOut";if(Ze(t))i=r[e]||(r[e]=[]),t.forEach((function(e,r){return i.push({t:r/(t.length-1)*100,v:e,e:s})}));else for(a in t)i=r[a]||(r[a]=[]),"ease"!==a&&i.push({t:parseFloat(e),v:t[a],e:s})}(p,T[p],u,T.easeEach);for(p in u)for(C=u[p].sort((function(e,t){return e.t-t.t})),c=j=0;c<C.length;c++)(L={ease:(R=C[c]).e,duration:(R.t-(c?C[c-1].t:0))/100*b})[p]=R.v,l.to(A,L,j),j+=L.duration;l.duration()<b&&l.to({},{duration:b-l.duration()})}}b||s.duration(b=l.duration())}else s.timeline=0;return!0!==M||oe||(rr=o(s),le.killTweensOf(A),rr=0),I(i,o(s),a),n.reversed&&s.reverse(),n.paused&&s.paused(!0),(w||!b&&!T&&s._start===mt(i._time)&&Ke(w)&&P(o(s))&&"nested"!==i.data)&&(s._tTime=-Ie,s.render(Math.max(0,-x))),E&&B(o(s),E),s}return u(t,[{key:"render",value:function(e,t,r){var n,a,i=this._time,s=this._tDur,o=this._dur,l=s-Ie<e&&0<=e?s:e<Ie?0:e;if(o){if(l!==this._tTime||!e||r||!this._initted&&this._tTime||this._startAt&&this._zTime<0!=e<0){if(m=l,f=this.timeline,this._repeat){if(h=o+this._rDelay,this._repeat<-1&&e<0)return this.totalTime(100*h+e,t,r);if(m=mt(l%h),l===s?(v=this._repeat,m=o):((v=~~(l/h))&&v===l/h&&(m=o,v--),o<m&&(m=o)),(p=this._yoyo&&1&v)&&(d=this._yEase,m=o-m),b=C(this._tTime,h),m===i&&!r&&this._initted)return this;v!==b&&(f&&this._yEase&&re(f,p),!this.vars.repeatRefresh||p||this._lock||(this._lock=r=1,this.render(mt(h*v),!0).invalidate()._lock=0))}if(!this._initted){if(j(this,e<0?e:m,r,t))return this._tTime=0,this;if(o!==this._dur)return this.render(e,t,r)}if(this._tTime=l,this._time=m,!this._act&&this._ts&&(this._act=1,this._lazy=0),this.ratio=a=(d||this._ease)(m/o),this._from&&(this.ratio=a=1-a),m&&!i&&!t&&(J(this,"onStart"),this._tTime!==l))return this;for(n=this._pt;n;)n.r(a,n.d),n=n._next;f&&f.render(e<0?e:!m&&p?-Ie:f._dur*f._ease(m/this._dur),t,r)||this._startAt&&(this._zTime=e),this._onUpdate&&!t&&(e<0&&this._startAt&&this._startAt.render(e,!0,r),J(this,"onUpdate")),this._repeat&&v!==b&&this.vars.onRepeat&&!t&&this.parent&&J(this,"onRepeat"),l!==this._tDur&&l||this._tTime!==l||(e<0&&this._startAt&&!this._onUpdate&&this._startAt.render(e,!0,!0),!e&&o||!(l===this._tDur&&0<this._ts||!l&&this._ts<0)||xt(this,1),t||e<0&&!i||!l&&!i||(J(this,l===s?"onComplete":"onReverseComplete",!0),!this._prom||l<s&&0<this.timeScale()||this._prom()))}}else{var c,u,h=this,d=e,p=t,f=r,m=h.ratio,g=d<0||!d&&(!h._start&&U(h)&&(h._initted||!N(h))||(h._ts<0||h._dp._ts<0)&&!N(h))?0:1,v=h._rDelay,b=0;if(v&&h._repeat&&(u=C(b=H(0,h._tDur,d),v),h._yoyo&&1&u&&(g=1-g),u!==C(h._tTime,v)&&(m=1-g,h.vars.repeatRefresh&&h._initted&&h.invalidate())),g!==m||f||h._zTime===Ie||!d&&h._zTime){if(h._initted||!j(h,d,f,p)){for(u=h._zTime,h._zTime=d||(p?Ie:0),p=p||d&&!u,h.ratio=g,h._from&&(g=1-g),h._time=0,h._tTime=b,c=h._pt;c;)c.r(g,c.d),c=c._next;h._startAt&&d<0&&h._startAt.render(d,!0,!0),h._onUpdate&&!p&&J(h,"onUpdate"),b&&h._repeat&&!p&&h.parent&&J(h,"onRepeat"),(d>=h._tDur||d<0)&&h.ratio===g&&(g&&xt(h,1),p||(J(h,g?"onComplete":"onReverseComplete",!0),h._prom&&h._prom()))}}else h._zTime||(h._zTime=d)}return this}},{key:"targets",value:function(){return this._targets}},{key:"invalidate",value:function(){return this._pt=this._op=this._startAt=this._onUpdate=this._lazy=this.ratio=0,this._ptLookup=[],this.timeline&&this.timeline.invalidate(),n(l(t.prototype),"invalidate",this).call(this)}},{key:"kill",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"all";if(!(e||t&&"all"!==t))return this._lazy=this._pt=0,this.parent?$(this):this;if(this.timeline)return d=this.timeline.totalDuration(),this.timeline.killTweensOf(e,t,rr&&!0!==rr.vars.overwrite)._first||$(this),this.parent&&d!==this.timeline.totalDuration()&&F(this,this._dur*this.timeline._tDur/d,0,1),this;var r,n,a,i,s,o,l,c=this._targets,u=e?Ot(e):c,h=this._ptLookup,d=this._pt;if((!t||"all"===t)&&function(e,t){for(var r=e.length,n=r===t.length;n&&r--&&e[r]===t[r];);return r<0}(c,u))return"all"===t&&(this._pt=0),$(this);for(r=this._op=this._op||[],"all"!==t&&(Ve(t)&&(s={},M(t,(function(e){return s[e]=1})),t=s),t=function(e,t){var r,n,a,i,s=(e=e[0]?ft(e[0]).harness:0)&&e.aliases;if(!s)return t;for(n in r=k({},t),s)if(n in r)for(a=(i=s[n].split(",")).length;a--;)r[i[a]]=r[n];return r}(c,t)),l=c.length;l--;)if(~u.indexOf(c[l]))for(s in n=h[l],"all"===t?(r[l]=t,i=n,a={}):(a=r[l]=r[l]||{},i=t),i)(o=n&&n[s])&&("kill"in o.d&&!0!==o.d.kill(s)||yt(this,o,"_pt"),delete n[s]),"all"!==a&&(a[s]=1);return this._initted&&!this._pt&&d&&$(this),this}}],[{key:"to",value:function(e,r){return new t(e,r,arguments[2])}},{key:"from",value:function(e,t){return G(1,arguments)}},{key:"delayedCall",value:function(e,r,n,a){return new t(r,0,{immediateRender:!1,lazy:!1,overwrite:!1,delay:e,onComplete:r,onReverseComplete:r,onCompleteParams:n,onReverseCompleteParams:n,callbackScope:a})}},{key:"fromTo",value:function(e,t,r){return G(2,arguments)}},{key:"set",value:function(e,r){return r.duration=0,r.repeatDelay||(r.repeat=0),new t(e,r)}},{key:"killTweensOf",value:function(e,t,r){return le.killTweensOf(e,t,r)}}]),t}()),dr=(vt(hr.prototype,{_targets:[],_lazy:0,_startAt:0,_op:0,_onInit:0}),M("staggerTo,staggerFrom,staggerFromTo",(function(e){hr[e]=function(){var t=new ir,r=kt.call(arguments,0);return r.splice("staggerFromTo"===e?5:4,0,0),t[e].apply(t,r)}})),function(e,t,r){return e[t]=r}),pr=function(e,t,r){return e[t](r)},fr=function(e,t,r,n){return e[t](n.fp,r)},mr=function(e,t){return Ge(e[t])?pr:m(e[t])&&e.setAttribute?Xt:dr},gr=function(e,t){return t.set(t.t,t.p,Math.round(1e6*(t.s+t.c*e))/1e6,t)},vr=function(e,t){return t.set(t.t,t.p,!!(t.s+t.c*e),t)},br=function(e){for(var t,r,n,a,i=e._pt;i;){for(t=i._next,r=n;r&&r.pr>i.pr;)r=r._next;(i._prev=r?r._prev:a)?i._prev._next=i:n=i,(i._next=r)?r._prev=i:a=i,i=t}e._pt=n},yr=function(){function e(t,r,n,a,i,s,o,l,c){h(this,e),this.t=r,this.s=a,this.c=i,this.p=n,this.r=s||gr,this.d=o||this,this.set=l||dr,this.pr=c||0,(this._next=t)&&(t._prev=this)}return u(e,[{key:"modifier",value:function(e,t,r){this.mSet=this.mSet||this.set,this.set=er,this.m=e,this.mt=r,this.tween=t}}]),e}(),xr=(M(dt+"parent,duration,ease,delay,overwrite,runBackwards,startAt,yoyo,immediateRender,repeat,repeatDelay,data,paused,reversed,lazy,callbackScope,stringFilter,id,yoyoEase,stagger,inherit,repeatRefresh,keyframes,autoRevert,scrollTrigger",(function(e){return it[e]=1})),rt.TweenMax=rt.TweenLite=hr,rt.TimelineLite=rt.TimelineMax=ir,le=new ir({sortChildren:!1,defaults:Re,autoRemoveChildren:!0,id:"root",smoothChildTiming:!0}),Ce.stringFilter=function(e){var t=e.join(" ");if(Bt.lastIndex=0,Bt.test(t))return t=jt.test(t),e[1]=te(e[1],t),e[0]=te(e[0],t,It(e[1])),!0},{registerPlugin:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];t.forEach((function(e){var t=(e=!e.name&&e.default||e).name,r=Ge(e),n=(r=t&&!r&&e.init?function(){this._props=[]}:e,{init:w,render:Yt,add:or,kill:$t,modifier:Jt,rawVars:0}),a={targetTest:0,get:0,getSetter:mr,aliases:{},register:0};if(Nt(),e!==r){if(lt[t])return;vt(r,vt(bt(e,n),a)),k(r.prototype,k(n,bt(e,a))),lt[r.prop=t]=r,e.targetTest&&(ht.push(r),it[t]=1),t=("css"===t?"CSS":t.charAt(0).toUpperCase()+t.substr(1))+"Plugin"}x(t,r),e.register&&e.register(Sr,r,yr)}))},timeline:function(e){return new ir(e)},getTweensOf:function(e,t){return le.getTweensOf(e,t)},getProperty:function(e,t,r,n){Ve(e)&&(e=Ot(e)[0]);var a=ft(e||{}).get,i=r?E:_;return"native"===r&&(r=""),e&&(t?i((lt[t]&<[t].get||a)(e,t,r,n)):function(t,r,n){return i((lt[t]&<[t].get||a)(e,t,r,n))})},quickSetter:function(e,t,r){var n,a;if(1<(e=Ot(e)).length)return n=e.map((function(e){return Sr.quickSetter(e,t,r)})),a=n.length,function(e){for(var t=a;t--;)n[t](e)};e=e[0]||{};var i=lt[t],s=ft(e),o=s.harness&&(s.harness.aliases||{})[t]||t,l=i?function(t){var n=new i;fe._pt=0,n.init(e,r?t+r:t,fe,0,[e]),n.render(1,n),fe._pt&&Yt(1,fe)}:s.set(e,o);return i?l:function(t){return l(e,o,r?t+r:t,s,1)}},isTweening:function(e){return 0<le.getTweensOf(e,!0).length},defaults:function(e){return e&&e.ease&&(e.ease=Ht(e.ease,Re.ease)),D(Re,e||{})},config:function(e){return D(Ce,e||{})},registerEffect:function(e){var t=e.name,r=e.effect,n=e.plugins,a=e.defaults;e=e.extendTimeline,(n||"").split(",").forEach((function(e){return e&&!lt[e]&&!rt[e]&&y(t+" effect requires "+e+" plugin.")})),ct[t]=function(e,t,n){return r(Ot(e),vt(t||{},a),n)},e&&(ir.prototype[t]=function(e,r,n){return this.add(ct[t](e,We(r)?r:(n=r)&&{},this),n)})},registerEase:function(e,t){Ft[e]=Ht(t)},parseEase:function(e,t){return arguments.length?Ht(e,t):Ft},getById:function(e){return le.getById(e)},exportRoot:function(){var e,t,r=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},n=1<arguments.length?arguments[1]:void 0,a=new ir(r);for(a.smoothChildTiming=Ke(r.smoothChildTiming),le.remove(a),a._dp=0,a._time=a._tTime=le._time,e=le._first;e;)t=e._next,!n&&!e._dur&&e instanceof hr&&e.vars.onComplete===e._targets[0]||I(a,e,e._start-e._delay),e=t;return I(le,a,0),a},utils:{wrap:function e(t,r,n){var a=r-t;return Ze(t)?X(t,e(0,t.length),r):_t(n,(function(e){return(a+(e-t)%a)%a+t}))},wrapYoyo:function e(t,r,n){var a=r-t,i=2*a;return Ze(t)?X(t,e(0,t.length-1),r):_t(n,(function(e){return t+(a<(e=(i+(e-t)%i)%i||0)?i-e:e)}))},distribute:W,random:Z,snap:q,normalize:function(e,t,r){return Q(e,t,0,1,r)},getUnit:Et,clamp:function(e,t,r){return _t(r,(function(r){return H(e,t,r)}))},splitColor:Lt,toArray:Ot,selector:function(e){return e=Ot(e)[0]||y("Invalid scope")||{},function(t){var r=e.current||e.nativeElement||e;return Ot(t,r.querySelectorAll?r:r===e?y("Invalid scope")||he.createElement("div"):e)}},mapRange:Q,pipe:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return function(e){return t.reduce((function(e,t){return t(e)}),e)}},unitize:function(e,t){return function(r){return e(parseFloat(r))+(t||Et(r))}},interpolate:function e(t,r,n,a){var i=isNaN(t+r)?0:function(e){return(1-e)*t+e*r};if(!i){var s,o,l,c,u,h=Ve(t),d={};if(!0===n&&(a=1)&&(n=null),h)t={p:t},r={p:r};else if(Ze(t)&&!Ze(r)){for(l=[],c=t.length,u=c-2,o=1;o<c;o++)l.push(e(t[o-1],t[o]));c--,i=function(e){e*=c;var t=Math.min(u,~~e);return l[t](e-t)},n=r}else a||(t=k(Ze(t)?[]:{},t));if(!l){for(s in r)or.call(d,t,s,"get",r[s]);i=function(e){return Yt(e,d),h?t.p:t}}}return _t(n,i)},shuffle:Pt},install:b,effects:ct,ticker:Ut,updateRoot:ir.updateRoot,plugins:lt,globalTimeline:le,core:{PropTween:yr,globals:x,Tween:hr,Timeline:ir,Animation:ar,getCache:ft,_removeLinkedListItem:yt,suppressOverwrites:function(e){return oe=e}}}),wr=(M("to,from,fromTo,delayedCall,set,killTweensOf",(function(e){return xr[e]=hr[e]})),Ut.add(ir.updateRoot),fe=xr.to({},{duration:0}),function(e,t){for(var r=e._pt;r&&r.p!==t&&r.op!==t&&r.fp!==t;)r=r._next;return r}),Sr=xr.registerPlugin({name:"attr",init:function(e,t,r,n,a){var i,s;for(i in t)(s=this.add(e,"setAttribute",(e.getAttribute(i)||0)+"",t[i],n,a,0,0,i))&&(s.op=i),this._props.push(i)}},{name:"endArray",init:function(e,t){for(var r=t.length;r--;)this.add(e,r,e[r]||0,t[r])}},tr("roundProps",K),tr("modifiers"),tr("snap",q))||xr;hr.version=ir.version=Sr.version="3.9.1",de=1,g()&&Nt(),Ft.Power0,Ft.Power1,Ft.Power2,Ft.Power3,Ft.Power4,Ft.Linear,Ft.Quad,Ft.Cubic,Ft.Quart,Ft.Quint,Ft.Strong,Ft.Elastic,Ft.Back,Ft.SteppedEase,Ft.Bounce,Ft.Sine,Ft.Expo,Ft.Circ},4230:(e,t,r)=>{r.d(t,{N:()=>o,Z:()=>s});var n=r(8881),a=r(1794),i=r(6272);class s{constructor(e){this.mode="PerspectiveCamera",this.oCam=this.createOrthographic(),this.pCam=this.create(),this.onInited=()=>{this.runScene.cb.events.model.addOptions.cb({name:"camera",map:{parse:e=>Promise.all(e.childs.map((e=>new Promise((t=>{this.setTemp(e,{time:.5,onComplete:()=>{t(0)}})})))))}})},this.clean=()=>{this.temp.clear()},this.backgroudDom=null,this.temp=new a.Z,this.pointerDown=()=>{this.closeAnima()},this.animaData={animaIns:null,onComplete:null},this.runScene=e,this.runScene.cb.resize.add("camera-background",(()=>{var e,t;this.backgroudDom&&(({width:e,height:t}=this.runScene.renderEx.getDomSize()),this.backgroudDom.style.width=e+"px",this.backgroudDom.style.height=t+"px")})),this.runScene.cb.events.pointer.down.add("camera",this.pointerDown),this.runScene.cb.clean.add("camera",this.clean),this.runScene.cb.inited.add("camera",this.onInited)}setBackground(e){const t=this.runScene.assetsEx.engineDom;var r,n;this.backgroudDom||(this.backgroudDom=document.createElement("div"),({width:r,height:n}=this.runScene.assetsEx.renderer.domElement.getBoundingClientRect()),this.backgroudDom.style.position="absolute",this.backgroudDom.style.left="50%",this.backgroudDom.style.top="50%",this.backgroudDom.style.transform="translate(-50%,-50%)",this.backgroudDom.style.width=r+"px",this.backgroudDom.style.height=n+"px",t.appendChild(this.backgroudDom)),e?(this.backgroudDom.style.display="block",this.backgroudDom.style.backgroundImage="url("+e+")",this.backgroudDom.style.backgroundRepeat="no-repeat",this.backgroudDom.style.backgroundSize="100% 100%"):this.backgroudDom.style.display="none"}create(){return new n.PerspectiveCamera}createOrthographic(){return new n.OrthographicCamera}setMode(e){if(e!==this.mode){this.runScene.helperEx.transContro.reset(),this.mode=e,this.runScene.assetsEx.reset(),this.reset(this.getCamera()),this.setSize();const t=this.runScene.assetsEx.get().controls;"OrthographicCamera"===e&&(t.enableRotate=!1,t.enablePan=!1)}}getCamera(){return"OrthographicCamera"===this.mode?this.oCam:this.pCam}reset(e){e.position.set(0,20,20),e.near=.1,e.far=1e3,e.fov=50,e.updateProjectionMatrix()}get(){return this.runScene.assetsEx.get().camera}setSize(){var{width:e,height:t}=this.runScene.renderEx.getDomSize();const r=this.getCamera();r.aspect=e/t,r.updateProjectionMatrix()}addTemp(e){var{name:e,data:t}=e;this.temp.set(e,{name:e,data:t})}delTemp(e){this.temp.delete(e)}getLocal(){var{camera:e,controls:t}=this.runScene.assetsEx,{x:e,y:r,z:n}=e.position,{x:t,y:a,z:i}=t.target;return{x:e,y:r,z:n,tx:t,ty:a,tz:i}}closeAnima(){var e,t;null!=(e=this.animaData.animaIns)&&e.kill(),(this.animaData.animaIns=null)!=(t=(e=this.animaData).onComplete)&&t.call(e),this.animaData.onComplete=null}setTemp(e,t){return(e=this.temp.get(e))?this.anima(e.data,t):Promise.resolve()}anima(e,t){return new Promise((r=>{const{time:n,onComplete:a,onUpdate:s}=t||{},{camera:o,controls:l}=this.runScene.assetsEx;this.closeAnima(),this.animaData.onComplete=a,this.animaData.animaIns=(0,i.gY)(this.getLocal(),e,n||.5,(e=>{var{x:t,y:r,z:n,tx:a,ty:i,tz:c}=e;o.position.set(t,r,n),l.target.set(a,i,c),l.update(),null!=s&&s(e)}),(()=>{null!=a&&a(),r(0)}))}))}static toJSON(e){const t=e.assetsEx.camera;return{temp:e.cameraEx.temp.toJSON(),camera:t.toJSON()}}}const o=e=>null==e?void 0:e.isCamera},4330:(e,t,r)=>{r.d(t,{sG:()=>n,zX:()=>a});const n=["map","normalMap","aoMap"],a=["map","metalnessMap","roughnessMap","normalMap","aoMap","emissiveMap","alphaMap","lightMap","envMap","displacementMap"]},3263:(e,t,r)=>{r.d(t,{F6:()=>n,YD:()=>c});var n={};r.r(n),r.d(n,{filter:()=>a,isDef:()=>l,isEmpty:()=>i,notEmpty:()=>s,random:()=>o});const a=e=>e.filter((e=>e)),i=e=>0===e.length,s=e=>0!==e.length,o=e=>{var t=Math.random()*e.length;return e[Math.floor(t)]},l=(e,t)=>{for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!0;return!1};r(1794),r(272);var c=r(7201)},1794:(e,t,r)=>{r.d(t,{Z:()=>a});var n=r(6001);class a extends Map{constructor(e){e?super((0,n.mapObj)(e,((e,t)=>[e,t]))):super()}toArray(e){let t=[];for(const r of this.entries())"key"==e?t.push(r[0]):t.push(r[1]);return t}map(e){return[...this.entries()].map((t=>{var[t,r]=t;return e(t,r)}))}toJSON(){const e={};return this.forEach(((t,r)=>{e[r]=t})),e}toString(){return JSON.stringify(this.map)}filter(e,t){let r=[];for(var[n,a]of this.entries())e(n,a)&&r.push("key"===t?n:a);return r}find(e){for(var[t,r]of this.entries())if(e(t,r))return r}static formJSON(e){return new a(e)}copy(e){e.map(((e,t)=>this.set(e,t)))}}},7201:(e,t,r)=>{r.r(t),r.d(t,{is:()=>i,isDef:()=>a,logObj:()=>u,objLength:()=>h,objToStr:()=>c,replaceKVForObj:()=>o,replaceKeyForObj:()=>l,replaceValForObj:()=>s});var n=r(6001);const a=(e,t)=>{if(!i(e))return!0;var r=Object.keys(e);for(let o=0;o<r.length;o++){var n=r[o],s=e[n];if(n=t[n],i(s))return!i(n)||a(s,n);if(s!==n)return!0}return!1},i=e=>(null==e?void 0:e.constructor)===Object,s=(e,t)=>{let r={};return Object.keys(e).map(((n,a)=>{var i=e[n];r[n]=t(n,i,a)})),r},o=(e,t)=>{let r={};return Object.keys(e).map(((n,a)=>{var i=e[n],{k:n,v:i}=t(n,i,a);r[n]=i})),r},l=(e,t)=>{let r={};return Object.keys(e).map(((n,a)=>{var i=e[n];r[t(n,i,a)]=i})),r},c=e=>{let t="";return(0,n.mapObj)(e,((e,r)=>{t=(t+=e+":")+(i(r)?c(r):r)})),t},u=e=>{console.log(c(e))},h=e=>Object.keys(e).length},272:(e,t,r)=>{r.d(t,{Z:()=>n});class n extends Set{constructor(e){super(),this.isSet=!0,null!=e&&e.map((e=>this.add(e)))}add(e){return Array.isArray(e)?e.map((e=>this.add(e))):super.add(e),this}remove(e){if(Array.isArray(e))e.map((e=>this.remove(e)));else{if(!super.has(e))return;super.delete(e)}return this}toArray(){return[...this]}map(e,t=!1){const r=[];return this.forEach((n=>{if(n=e(n),!t)return r.push(n);n&&r.push(n)})),r}find(e){for(const t of this)if(e(t))return t}filter(e){const t=[];for(const r of this)e(r)&&t.push(r);return t}toJSON(){return this.toArray()}}},5247:(e,t,r)=>{r.d(t,{Z:()=>n});const n=t=r(8881)},7625:(e,t,r)=>{r.d(t,{Z:()=>n});class n{constructor(e){this.snapshot={create:e=>({}),set(e){}},this.runScene=e}}},7585:(e,t,r)=>{r.d(t,{Z:()=>u});var n=r(8715),a=r(3736),i=r(1398),s=r(3729),o=r(4457);t=r(7625);const l={far:1e5,near:.5,mapSizeX:512,scaleX:1,targetPosition:{x:0,y:-10,z:0}},c={position:{type:"v3",val:{x:0,y:10,z:0},shortKey:"p"},intensity:{type:"number",val:1,shortKey:"i"},visible:{type:"other",val:!0,shortKey:"v"},color:{type:"color",val:{r:1,g:1,b:1},shortKey:"c"}};class u extends t.Z{constructor(){super(...arguments),this.type="DirectionalLight",this.parseNromalLight=e=>(e=this.parseJSON(e.normal),this.runScene.lightEx.update(e[0]),e),this.toNormalLight=e=>{var{type:e,model:t}=e;if(e===this.type){const e=(0,n.createDefModel)("Box");return e.userData.normal=Object.assign({type:this.type},u.toJSON(t)),e}}}static toJSON(e){const{intensity:t,name:r,type:n,position:a,visible:i,color:o,castShadow:l,shadow:c,rotation:u,target:h}=e;var{mapSize:d,camera:p}=c,{scale:p,near:f,far:m}=p;return{type:n,intensity:t,name:r,visible:i,color:o.getHexString(),castShadow:l,shadow:{mapSize:d.x,camera:{near:f,far:m,scale:p.x}},id:(0,s.Ki)(e),position:{x:a.x,y:a.y,z:a.z},rotation:{x:u.x,y:u.y,z:u.z},targetPosition:{x:h.position.x,y:h.position.y,z:h.position.z}}}parseJSON(e,t){t=this.runScene.lightEx.get("DirectionalLight",t);var[r]=t;return u.setConfig(r,e),(0,a.M)(r,"id",e.id),t}get(e){return this.runScene.lightEx.get("DirectionalLight",e)}static setConfig(e,t){var{intensity:t,position:r,rotation:n,targetPosition:a,name:i,visible:s,color:l,castShadow:c,shadow:u}=t,{mapSize:u,camera:h}=u,{scale:h,near:d,far:p}=h;e.intensity=t,e.name=i,e.visible=s,e.castShadow=c,e.color=(0,o.getColorByHexStr)(l),r&&e.position.set(r.x,r.y,r.z),n&&e.rotation.set(n.x,n.y,n.z),a&&e.target.position.set(a.x,a.y,a.z),e.add(e.target),e.shadow.mapSize.x=u,e.shadow.mapSize.y=u,e.shadow.camera.scale.x=h,e.shadow.camera.scale.y=h,e.shadow.camera.scale.z=h,e.shadow.camera.near=d,e.shadow.camera.far=p,e.shadow.camera.updateProjectionMatrix(),null!=(t=e.cameraHelper)&&t.update()}setConfig(e,t){return u.setConfig(e,t)}}u.snapshot={create:e=>{const t=i.LV.getDiff(c,e);var r=e.shadow,{mapSize:r,camera:n}=r,{scale:n,near:a,far:s}=n,{x:e,y:u,z:h}=e.target.position;return(0,o.isDef)(r.x,l.mapSizeX)&&(t.m=r.x),(0,o.isDef)({x:e,y:u,z:h},l.targetPosition)&&(t.tp={x:e,y:u,z:h}),(0,o.isDef)(n.x,l.scaleX)&&(t.s=n.x),(0,o.isDef)(a,l.near)&&(t.n=a),(0,o.isDef)(s,l.far)&&(t.f=s),t},set:e=>{const{map:t,light:r,runScene:n,data:a}=e,{m:s,tp:o,s:u,n:h,f:d}=(i.LV.set({def:c,data:a,runScene:n,map:t,target:r}),a);t.data.completedCbs.push((()=>{var{far:e,near:t,mapSizeX:n,scaleX:a,targetPosition:i}=l,{x:i,y:c,z:p}=o||i,i=(r.target.position.set(i,c,p),s||n),c=(r.shadow.mapSize.x=i,r.shadow.mapSize.y=i,u||a);r.shadow.camera.scale.x=c,r.shadow.camera.scale.y=c,r.shadow.camera.scale.z=c,r.shadow.camera.near=h||t,r.shadow.camera.far=d||e,r.shadow.camera.updateProjectionMatrix(),null!=(p=r.cameraHelper)&&p.update()}))}}},1269:(e,t,r)=>{r.d(t,{ZP:()=>D,RQ:()=>O});var n=r(6001),a=r(8881);function i(e){return(i="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})(e)}function s(e,t){return(s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function o(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=l(e);if(r=t?(r=l(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===i(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function l(e){return(l=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var c=function(e){var t=n;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&s(t,e);var r=o(n);function n(e,t){if(!(this instanceof n))throw new TypeError("Cannot call a class as a function");var i=new a.BufferGeometry,s=(i.setAttribute("position",new a.Float32BufferAttribute([1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],3)),i.computeBoundingSphere(),new a.LineBasicMaterial({fog:!1}));return((i=r.call(this,i,s)).light=e,i.color=t,i.type="RectAreaLightHelper",s=new a.BufferGeometry).setAttribute("position",new a.Float32BufferAttribute([1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],3)),s.computeBoundingSphere(),i.add(new a.Mesh(s,new a.MeshBasicMaterial({side:a.BackSide,fog:!1}))),i}return t=n,(e=[{key:"updateMatrixWorld",value:function(){var e,t;this.scale.set(.5*this.light.width,.5*this.light.height,1),void 0!==this.color?(this.material.color.set(this.color),this.children[0].material.color.set(this.color)):(this.material.color.copy(this.light.color).multiplyScalar(this.light.intensity),e=this.material.color,1<(t=Math.max(e.r,e.g,e.b))&&e.multiplyScalar(1/t),this.children[0].material.color.copy(this.material.color)),this.matrixWorld.extractRotation(this.light.matrixWorld).scale(this.scale).copyPosition(this.light.matrixWorld),this.children[0].matrixWorld.copy(this.matrixWorld)}},{key:"dispose",value:function(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),n}(a.Line),u=r(5247),h=r(3736),d=r(1398),p=r(3729),f=(t=r(7625),r(8715));const m={intensity:{type:"number",val:1,shortKey:"i"},visible:{type:"other",val:!0,shortKey:"v"},color:{type:"color",val:{r:1,g:1,b:1},shortKey:"c"}};class g extends t.Z{constructor(){super(...arguments),this.parseNromalLight=e=>(e=this.parseJSON(e.normal),this.runScene.lightEx.update(e[0]),e),this.toNormalLight=e=>{var{type:e,model:t}=e;if(e===this.type){const e=(0,f.createDefModel)("Box");return e.userData.normal=Object.assign({type:this.type},g.toJSON(t)),e}},this.type="AmbientLight"}get(){}static toJSON(e){const{type:t,intensity:r,name:n,visible:a,color:i}=e;return{type:t,intensity:r,name:n,visible:a,id:(0,p.Ki)(e),color:i.getHexString()}}setConfig(e,t){var{type:t,intensity:r,name:n,visible:a,color:i}=t;return e.intensity=r,e.type=t,e.name=n,e.visible=a,e.color=new u.Z.Color("#"+i),e}parseJSON(e){var t=this.runScene.lightEx.get("AmbientLight"),[r]=t,n=e.id;return this.setConfig(r,e),(0,h.M)(r,"id",n),t}}g.snapshot={create:e=>d.LV.getDiff(m,e),set:e=>{var{map:e,light:t,runScene:r,data:n}=e;d.LV.set({def:m,data:n,runScene:r,map:e,target:t})}};var v=r(7585);class b extends t.Z{constructor(){super(...arguments),this.parseNromalLight=e=>(e=this.parseJSON(e.normal),this.runScene.lightEx.update(e[0]),e),this.toNormalLight=e=>{var{type:e,model:t}=e;if(e===this.type){const e=(0,f.createDefModel)("Box");return e.userData.normal=Object.assign({type:this.type},b.toJSON(t)),e}},this.type="HemisphereLight"}get(){throw new Error("Method not implemented.")}static toJSON(e){const{type:t,intensity:r,name:n,visible:a,color:i,groundColor:s,position:o}=e;return{name:n,id:(0,p.Ki)(e),type:t,intensity:r,visible:a,position:{x:o.x,y:o.y,z:o.z},groundColor:s.getHexString(),color:i.getHexString()}}setConfig(e,t){var{type:t,intensity:r,name:n,visible:a,color:i,groundColor:s,position:o}=t;e.type=t,e.intensity=r,e.name=n,e.visible=a,e.color=new u.Z.Color("#"+i),e.groundColor=new u.Z.Color("#"+s),e.position.set(o.x,o.y,o.z)}parseJSON(e){var t=this.runScene.lightEx.get("HemisphereLight"),[r]=t,n=e.id;return this.setConfig(r,e),(0,h.M)(r,"id",n),t}}class y extends t.Z{constructor(){super(...arguments),this.parseNromalLight=e=>(e=this.parseJSON(e.normal),this.runScene.lightEx.update(e[0]),e),this.toNormalLight=e=>{var{type:e,model:t}=e;if(e===this.type){const e=(0,f.createDefModel)("Box");return e.userData.normal=Object.assign({type:this.type},y.toJSON(t)),e}},this.type="PointLight"}get(){throw new Error("Method not implemented.")}static toJSON(e){const{name:t,type:r,intensity:n,distance:a,decay:i,renderOrder:s,color:o,visible:l,castShadow:c,shadow:u,position:h}=e;var{mapSize:d,camera:f,bias:m,radius:g}=u,{scale:f,near:v,far:b}=f;return{name:t,type:r,intensity:n,visible:l,color:o.getHexString(),castShadow:c,id:(0,p.Ki)(e),distance:a,decay:i,renderOrder:s,shadow:{mapSize:d.x,camera:{near:v,far:b,scale:f.x},radius:g,bias:m},position:{x:h.x,y:h.y,z:h.z}}}setConfig(e,t){var{name:t,type:r,intensity:n,distance:a,decay:i,renderOrder:s,color:o,visible:l,castShadow:c,shadow:h,position:d}=t,{mapSize:h,camera:p,bias:f,radius:m}=h,{scale:p,near:g,far:v}=p;e.intensity=n,e.type=r,e.name=t,e.visible=l,e.castShadow=c,e.distance=a,e.renderOrder=s,e.color=new u.Z.Color("#"+o),e.position.set(d.x,d.y,d.z),e.shadow.mapSize.x=h,e.shadow.mapSize.y=h,e.shadow.bias=f,e.decay=i,e.shadow.radius=m,e.shadow.camera.scale.x=p,e.shadow.camera.scale.y=p,e.shadow.camera.scale.z=p,e.shadow.camera.near=g,e.shadow.camera.far=v,e.shadow.camera.updateProjectionMatrix()}parseJSON(e){var t=this.runScene.lightEx.get("PointLight"),[r]=t,n=e.id;return this.setConfig(r,e),(0,h.M)(r,"id",n),t}}class x extends t.Z{constructor(){super(...arguments),this.parseNromalLight=e=>(e=this.parseJSON(e.normal),this.runScene.lightEx.update(e[0]),e),this.toNormalLight=e=>{var{type:e,model:t}=e;if(e===this.type){const e=(0,f.createDefModel)("Box");return e.userData.normal=Object.assign({type:this.type},x.toJSON(t)),e}},this.type="RectAreaLight"}get(){throw new Error("Method not implemented.")}static toJSON(e){const{type:t,intensity:r,name:n,visible:a,color:i,position:s}=e;return{name:n,type:t,intensity:r,id:(0,p.Ki)(e),visible:a,position:{x:s.x,y:s.y,z:s.z},color:i.getHexString()}}setConfig(e,t){var{type:t,intensity:r,name:n,visible:a,color:i,position:s}=t;e.type=t,e.intensity=r,e.name=n,e.visible=a,e.color=new u.Z.Color("#"+i),e.position.set(s.x,s.y,s.z)}parseJSON(e){var t=this.runScene.lightEx.get("RectAreaLight"),[r]=t,n=e.id;return this.setConfig(r,e),(0,h.M)(r,"id",n),t}}class w extends t.Z{constructor(){super(...arguments),this.parseNromalLight=e=>(e=this.parseJSON(e.normal),this.runScene.lightEx.update(e[0]),e),this.toNormalLight=e=>{var{type:e,model:t}=e;if(e===this.type){const e=(0,f.createDefModel)("Box");return e.userData.normal=Object.assign({type:this.type},w.toJSON(t)),e}},this.type="SpotLight"}get(){throw new Error("Method not implemented.")}static toJSON(e){const{name:t,type:r,color:n,distance:a,decay:i,intensity:s,angle:o,penumbra:l,visible:c,castShadow:u,shadow:h,renderOrder:d,position:f,target:m}=e;var{bias:g,camera:v,normalBias:b,mapSize:y,radius:x}=h,v=v.near;return{type:r,intensity:s,name:t,visible:c,distance:a,angle:o,id:(0,p.Ki)(e),decay:i,penumbra:l,renderOrder:d,color:n.getHexString(),castShadow:u,shadow:{bias:g,normalBias:b,mapSize:y.x,camera:{near:v},radius:x},position:{x:f.x,y:f.y,z:f.z},targetPosition:{x:m.position.x,y:m.position.y,z:m.position.z}}}setConfig(e,t){var{name:t,type:r,color:n,distance:a,decay:i,intensity:s,angle:o,penumbra:l,visible:c,castShadow:h,shadow:d,renderOrder:p,position:f,targetPosition:m}=t,{bias:d,camera:g,normalBias:v,mapSize:b,radius:y}=d,g=g.near;return e.intensity=s,e.type=r,e.name=t,e.visible=c,e.distance=a,e.decay=i,e.angle=o,e.penumbra=l,e.renderOrder=p,e.castShadow=h,e.color=new u.Z.Color("#"+n),e.position.set(f.x,f.y,f.z),e.shadow.mapSize.x=b,e.shadow.mapSize.y=b,e.shadow.camera.near=g,e.target.position.set(m.x,m.y,m.z),e.shadow.bias=d,e.shadow.normalBias=v,e.shadow.radius=y,e.shadow.camera.updateProjectionMatrix(),e}parseJSON(e){var t=this.runScene.lightEx.get("SpotLight"),[r]=t,n=e.id;return this.setConfig(r,e),(0,h.M)(r,"id",n),t}}var S=r(3735),M=r(2510),T=r(7169),_=r(4457),E=r(7201);const k={DirectionalLight:v.Z,PointLight:y,SpotLight:w,RectAreaLight:x,HemisphereLight:b,AmbientLight:g};class D{constructor(e){this.inited=()=>{(0,n.mapObj)(this.lightExMap,((e,t)=>{this.runScene.modelEx.importAndExport.addParses(t.type,{parse:t.parseNromalLight,toNormal:t.toNormalLight})}))},this.shadowList=["DirectionalLight","PointLight","SpotLight"],this.helperList=["DirectionalLight","PointLight","SpotLight","RectAreaLight","HemisphereLight"],this.helperUpdateList=["DirectionalLight","PointLight","SpotLight","HemisphereLight"],this.snapshot={create:e=>{const t=this.runScene.assetsEx.scene.children.filter((e=>this.isLight(e)&&!(0,f.isHelper)(e))),r={};t.map((e=>{var t=e.type,n=(0,p.Ki)(e),a=null==(a=null==(t=this.lightExMap[t].snapshot)?void 0:t.create)?void 0:a.call(t,e);a&&n&&(r[n]=a)})),0!==(0,E.objLength)(r)&&e.data.set("light",r)},set:e=>{var t=e.snapshot.data.get("light");t&&(0,n.mapObj)(t,((t,r)=>{var n,a=((t=this.runScene.modelEx.getById(t))||{}).type;a&&null!=(n=null==(a=this.lightExMap[a].snapshot)?void 0:a.set)&&n.call(a,{data:r,runScene:this.runScene,light:t,map:e})}))}},this.runScene=e,this.lightExMap={DirectionalLight:new v.Z(e),PointLight:new y(e),SpotLight:new w(e),RectAreaLight:new x(e),HemisphereLight:new b(e),AmbientLight:new g(e)},e.cb.snapshot.create.add("light",this.snapshot.create),e.cb.snapshot.set.add("light",this.snapshot.set),e.cb.snapshot.getLength.add("light",(e=>{var t=e.data.data.get("light");t&&(e.inputData.light=Object.keys(t).length)})),e.cb.inited.add("light",this.inited)}getLightsByScene(e=this.runScene.sceneEx.get()){return e.children.filter((e=>e.isLight))}add(e,t){e=e.map((e=>this.runScene.modelEx.add(e,void 0,Object.assign(Object.assign({},t),{select:!!O(e)&&t.select,addUndo:!1})))),t.addUndo&&this.runScene.undoEx.addUndo(e)}get(e,t){t=(0,_.mergeObject)({id:(0,n.getId)()},t).id;let r=new u.Z[e],a=[r];return r.position.y=10,r.name=e,r.userData.id=t,this.shadowList.includes(e)&&(r.castShadow=!0),this.setLight(r),a.push(...this.setLightHelper(r)),null!=(t=null==r?void 0:r.lightHelper)&&t.update(),a}setNull(e){e.lightTarget&&this.setNull(e.lightTarget),this.isLight(e)&&("DirectionalLight"===e.type?e.cameraHelper&&(e.cameraHelper.visible=!1):"SpotLight"===e.type&&(e.cameraHelper&&(e.cameraHelper.visible=!1),e.helper&&(e.helper.visible=!0)))}setSelect(e){e.lightTarget&&this.setSelect(e.lightTarget),this.isLight(e)&&("DirectionalLight"===e.type?e.cameraHelper&&(e.cameraHelper.visible=!0):"SpotLight"===e.type&&(e.cameraHelper&&(e.cameraHelper.visible=!0),e.helper&&(e.helper.visible=!0)))}update(e){var t;e.userData.isLightTarget&&e.lightTarget&&(e=e.lightTarget),this.isLight(e)&&("DirectionalLight"===e.type||"SpotLight"===e.type?(null!=(t=e.helper)&&t.update(),null!=(t=e.cameraHelper)&&t.update()):null!=(e=null==(t=e.helper)?void 0:t.update)&&e.call(t))}remove(e,t=!0){let r;return this.runScene.helperEx.unfocus(),r="DirectionalLight"===e.type||"SpotLight"===e.type?[e,e.cameraHelper,e.helper].map((t=>{if(t)return new T.Z({addTree:t===e,runScene:this.runScene,model:t,parent:t.parent||this.runScene.sceneEx.get()}).execute()})).filter((e=>e)):[e,e.helper].map((t=>{if(t)return new T.Z({addTree:t===e,runScene:this.runScene,model:t,parent:t.parent||this.runScene.sceneEx.get()}).execute()})).filter((e=>e)),t&&r&&this.runScene.undoEx.addUndo(r),r}getLightHelper(e,t){this.runScene.uniqueEx.model.add(t);const r=(0,p.Ki)(t);let n,a=[];switch(e){case"RectAreaLight":n=new c(t,16773120);break;case"DirectionalLight":if(n=new u.Z.DirectionalLightHelper(t,1,16711680),t.children[0])t.target=t.children[0];else{let e=new u.Z.Object3D;(t.target=e).name="helperModel",e.position.y=-10,t.shadow.autoUpdate=!0,e.userData.isLightTarget=!0,(e.lightTarget=t).add(e)}t.shadow.camera.layers.set(1),t.shadow.camera.far=1e5,t.shadowCameraLeft=-5,t.shadowCameraRight=5,t.shadowCameraTop=5,t.shadowCameraBottom=-5,t.shadow.camera.updateProjectionMatrix();const e=new u.Z.CameraHelper(t.shadow.camera);t.shadow.camera.matrixWorldNeedsUpdate=!0,this.runScene.helperEx.setHelper(e,!0,(e=>{e.userData.id=r,e.userData.unClick=!0})),e.userData.id=r,e.userData.unClick=!0,e.visible=!1,t.cameraHelper=e,a.push(e);break;case"PointLight":n=new u.Z.PointLightHelper(t,1,16711935);break;case"SpotLight":n=new u.Z.SpotLightHelper(t);let i=new u.Z.Object3D;(t.target=i).name="helperModel",i.userData.isLightTarget=!0,i.lightTarget=t,i.position.y=-10,t.shadow.autoUpdate=!0,t.add(i);const s=new u.Z.CameraHelper(t.shadow.camera);t.shadow.camera.matrixWorldNeedsUpdate=!0,this.runScene.helperEx.setHelper(s,!0,(e=>{e.userData.id=r})),s.userData.id=r,s.visible=!1,t.cameraHelper=s,a.push(s);break;case"HemisphereLight":n=new u.Z.HemisphereLightHelper(t,1,16773135)}return n.name="helperModel",this.runScene.helperEx.setHelper(n,!0,(e=>{e.userData.id=r})),n.userData.id=r,(n.light=t).helper=n,this.update(t),a.push(n),a}setLightHelper(e){return"editor"===this.runScene.optionsEx.options.mode&&this.helperList.includes(e.type)?this.getLightHelper(e.type,e):[]}isUpdateHelper(e){return this.helperUpdateList.includes(e)}initLight(e){e.forEach((e=>this.setLightHelper(e)))}setNormal(e,t=0){var{model:e,info:r,val:n,cb:a}=e;return new M.Z({target:e,runScene:this.runScene,info:r,oldVal:e[r],newVal:n,cb:a}).execute()}setMultip(e,t,r=!0,n=!0){if(e instanceof Array)return a=e.map((e=>{var{model:e,typeList:n,newVal:a}=e;const i=new S.Z({target:e,typeList:n,newVal:a,cb:t});return r?i.execute():i})),n&&this.runScene.undoEx.addUndo(a),a;{var{model:a,typeList:e,newVal:i}=e;const s=new S.Z({target:a,typeList:e,newVal:i,cb:t});return n&&this.runScene.undoEx.addUndo(s),r?s.execute():s}}isLight(e){return null==(e=null==e?void 0:e.userData)?void 0:e.isLight}setLight(e){e.userData.isLight=!0}isHelperTarget(e){return e.userData.isLightTarget}clone(e){var t=k[e.type].toJSON(e),r=this.get(e.type),[n]=r;return this.lightExMap[e.type].setConfig(n,t),r}toJSON(e){return e.filter((e=>!(0,f.isHelper)(e))).map((e=>k[e.type].toJSON(e)))}}const O=e=>null==(e=null==e?void 0:e.userData)?void 0:e.isLight},2353:(e,t,r)=>{r.d(t,{B:()=>Le,Z:()=>Re});var n=r(8881),a=(t=r(3300),r.n(t));function i(e){return(i="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})(e)}r(6001);var s=function(){var e=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]),t=new Uint8Array([32,0,65,2,1,106,34,33,3,128,11,4,13,64,6,253,10,7,15,116,127,5,8,12,40,16,19,54,20,9,27,255,113,17,42,67,24,23,146,148,18,14,22,45,70,69,56,114,101,21,25,63,75,136,108,28,118,29,73,115]);if("object"!==("undefined"==typeof WebAssembly?"undefined":i(WebAssembly)))return{supported:!1};var r,n=WebAssembly.validate(e)?"b9H79TebbbeKl9Gbb9Gvuuuuueu9Giuuub9Geueuikqbbebeedddilve9Weeeviebeoweuec:q;Aekr;leDo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbdY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVblE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtboK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbrL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949Wbwl79IV9RbDq;t9tqlbzik9:evu8Jjjjjbcz9Rhbcbheincbhdcbhiinabcwfadfaicjuaead4ceGglE86bbaialfhiadcefgdcw9hmbkaec:q:yjjbfai86bbaecitc:q1jjbfab8Piw83ibaecefgecjd9hmbkk;h8JlHud97euo978Jjjjjbcj;kb9Rgv8Kjjjjbc9:hodnadcefal0mbcuhoaiRbbc:Ge9hmbavaialfgrad9Rad;8qbbcj;abad9UhoaicefhldnadTmbaoc;WFbGgocjdaocjd6EhwcbhDinaDae9pmeawaeaD9RaDawfae6Egqcsfgoc9WGgkci2hxakcethmaocl4cifcd4hPabaDad2fhscbhzdnincehHalhOcbhAdninaraO9RaP6miavcj;cbfaAak2fhCaOaPfhlcbhidnakc;ab6mbaral9Rc;Gb6mbcbhoinaCaofhidndndndndnaOaoco4fRbbgXciGPlbedibkaipxbbbbbbbbbbbbbbbbpklbxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklbalczfhlkdndndndndnaXcd4ciGPlbedibkaipxbbbbbbbbbbbbbbbbpklzxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklzalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklzalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklzalczfhlkdndndndndnaXcl4ciGPlbedibkaipxbbbbbbbbbbbbbbbbpklaxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklaalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklaalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklaalczfhlkdndndndndnaXco4Plbedibkaipxbbbbbbbbbbbbbbbbpkl8WxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibaXc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spkl8WalclfaYpQbfaXc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibaXc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spkl8WalcwfaYpQbfaXc:q:yjjbfRbbfhlxekaialpbbbpkl8Walczfhlkaoc;abfhiaocjefak0meaihoaral9Rc;Fb0mbkkdndnaiak9pmbaici4hoinaral9RcK6mdaCaifhXdndndndndnaOaico4fRbbaocoG4ciGPlbedibkaXpxbbbbbbbbbbbbbbbbpklbxikaXalpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaXalpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaXalpbbbpklbalczfhlkaocdfhoaiczfgiak6mbkkalTmbaAci6hHalhOaAcefgohAaoclSmdxekkcbhlaHceGmdkdnakTmbavcjdfazfhiavazfpbdbhYcbhXinaiavcj;cbfaXfgopblbgLcep9TaLpxeeeeeeeeeeeeeeeegQp9op9Hp9rgLaoakfpblbg8Acep9Ta8AaQp9op9Hp9rg8ApmbzeHdOiAlCvXoQrLgEaoamfpblbg3cep9Ta3aQp9op9Hp9rg3aoaxfpblbg5cep9Ta5aQp9op9Hp9rg5pmbzeHdOiAlCvXoQrLg8EpmbezHdiOAlvCXorQLgQaQpmbedibedibedibediaYp9UgYp9AdbbaiadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaEa8EpmwDKYqk8AExm35Ps8E8FgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaLa8ApmwKDYq8AkEx3m5P8Es8FgLa3a5pmwKDYq8AkEx3m5P8Es8Fg8ApmbezHdiOAlvCXorQLgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaLa8ApmwDKYqk8AExm35Ps8E8FgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfhiaXczfgXak6mbkkazclfgzad6mbkasavcjdfaqad2;8qbbavavcjdfaqcufad2fad;8qbbaqaDfhDc9:hoalmexikkc9:hoxekcbc99aral9Radcaadca0ESEhokavcj;kbf8Kjjjjbaokwbz:bjjjbk;uzeHu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnaeci9UgrcHfal0mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecje;8kbavcUf9cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhodnaeTmbcmcsaDceSEhkcbhxcbhmcbhDcbhicbhlindnaoaq9nmbc9:hoxikdndnawRbbgrc;Ve0mbavc;abfalarcl4cu7fcsGcitfgPydlhsaPydbhzdnarcsGgPak9pmbavaiarcu7fcsGcdtfydbaxaPEhraPThPdndnadcd9hmbabaDcetfgHaz87ebaHcdfas87ebaHclfar87ebxekabaDcdtfgHazBdbaHclfasBdbaHcwfarBdbkaxaPfhxavc;abfalcitfgHarBdbaHasBdlavaicdtfarBdbavc;abfalcefcsGglcitfgHazBdbaHarBdlaiaPfhialcefhlxdkdndnaPcsSmbamaPfaPc987fcefhmxekaocefhrao8SbbgPcFeGhHdndnaPcu9mmbarhoxekaocvfhoaHcFbGhHcrhPdninar8SbbgOcFbGaPtaHVhHaOcu9kmearcefhraPcrfgPc8J9hmbxdkkarcefhokaHce4cbaHceG9R7amfhmkdndnadcd9hmbabaDcetfgraz87ebarcdfas87ebarclfam87ebxekabaDcdtfgrazBdbarclfasBdbarcwfamBdbkavc;abfalcitfgramBdbarasBdlavaicdtfamBdbavc;abfalcefcsGglcitfgrazBdbaramBdlaicefhialcefhlxekdnarcpe0mbaxcefgOavaiaqarcsGfRbbgPcl49RcsGcdtfydbaPcz6gHEhravaiaP9RcsGcdtfydbaOaHfgsaPcsGgOEhPaOThOdndnadcd9hmbabaDcetfgzax87ebazcdfar87ebazclfaP87ebxekabaDcdtfgzaxBdbazclfarBdbazcwfaPBdbkavaicdtfaxBdbavc;abfalcitfgzarBdbazaxBdlavaicefgicsGcdtfarBdbavc;abfalcefcsGcitfgzaPBdbazarBdlavaiaHfcsGgicdtfaPBdbavc;abfalcdfcsGglcitfgraxBdbaraPBdlalcefhlaiaOfhiasaOfhxxekaxcbaoRbbgzEgAarc;:eSgrfhsazcsGhCazcl4hXdndnazcs0mbascefhOxekashOavaiaX9RcsGcdtfydbhskdndnaCmbaOcefhxxekaOhxavaiaz9RcsGcdtfydbhOkdndnarTmbaocefhrxekaocdfhrao8SbegHcFeGhPdnaHcu9kmbaocofhAaPcFbGhPcrhodninar8SbbgHcFbGaotaPVhPaHcu9kmearcefhraocrfgoc8J9hmbkaAhrxekarcefhrkaPce4cbaPceG9R7amfgmhAkdndnaXcsSmbarhPxekarcefhPar8SbbgocFeGhHdnaocu9kmbarcvfhsaHcFbGhHcrhodninaP8SbbgrcFbGaotaHVhHarcu9kmeaPcefhPaocrfgoc8J9hmbkashPxekaPcefhPkaHce4cbaHceG9R7amfgmhskdndnaCcsSmbaPhoxekaPcefhoaP8SbbgrcFeGhHdnarcu9kmbaPcvfhOaHcFbGhHcrhrdninao8SbbgPcFbGartaHVhHaPcu9kmeaocefhoarcrfgrc8J9hmbkaOhoxekaocefhokaHce4cbaHceG9R7amfgmhOkdndnadcd9hmbabaDcetfgraA87ebarcdfas87ebarclfaO87ebxekabaDcdtfgraABdbarclfasBdbarcwfaOBdbkavc;abfalcitfgrasBdbaraABdlavaicdtfaABdbavc;abfalcefcsGcitfgraOBdbarasBdlavaicefgicsGcdtfasBdbavc;abfalcdfcsGcitfgraABdbaraOBdlavaiazcz6aXcsSVfgicsGcdtfaOBdbaiaCTaCcsSVfhialcifhlkawcefhwalcsGhlaicsGhiaDcifgDae6mbkkcbc99aoaqSEhokavc;aef8Kjjjjbaok:llevu8Jjjjjbcz9Rhvc9:hodnaecvfal0mbcuhoaiRbbc;:eGc;qe9hmbav9cb83iwaicefhraialfc98fhwdnaeTmbdnadcdSmbcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcdtfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfglBdbaoalBdbaDcefgDae9hmbxdkkcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcetfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfgl87ebaoalBdbaDcefgDae9hmbkkcbc99arawSEhokaok:EPliuo97eue978Jjjjjbca9Rhidndnadcl9hmbdnaec98GglTmbcbhvabhdinadadpbbbgocKp:RecKp:Sep;6egraocwp:RecKp:Sep;6earp;Geaoczp:RecKp:Sep;6egwp;Gep;Kep;LegDpxbbbbbbbbbbbbbbbbp:2egqarpxbbbjbbbjbbbjbbbjgkp9op9rp;Kegrpxbb;:9cbb;:9cbb;:9cbb;:9cararp;MeaDaDp;Meawaqawakp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFbbbFbbbFbbbFbbbp9oaopxbbbFbbbFbbbFbbbFp9op9qarawp;Meaqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaDawp;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpkbbadczfhdavclfgval6mbkkalae9pmeaiaeciGgvcdtgdVcbczad9R;8kbaiabalcdtfglad;8qbbdnavTmbaiaipblbgocKp:RecKp:Sep;6egraocwp:RecKp:Sep;6earp;Geaoczp:RecKp:Sep;6egwp;Gep;Kep;LegDpxbbbbbbbbbbbbbbbbp:2egqarpxbbbjbbbjbbbjbbbjgkp9op9rp;Kegrpxbb;:9cbb;:9cbb;:9cbb;:9cararp;MeaDaDp;Meawaqawakp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFbbbFbbbFbbbFbbbp9oaopxbbbFbbbFbbbFbbbFp9op9qarawp;Meaqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaDawp;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpklbkalaiad;8qbbskdnaec98GgxTmbcbhvabhdinadczfglalpbbbgopxbbbbbbFFbbbbbbFFgkp9oadpbbbgDaopmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;6eaDaopmbediwDqkzHOAKY8AEgoczp:Sep;6egrp;Geaoczp:Reczp:Sep;6egwp;Gep;Kep;Legopxb;:FSb;:FSb;:FSb;:FSawaopxbbbbbbbbbbbbbbbbp:2egqawpxbbbjbbbjbbbjbbbjgmp9op9rp;Kegwawp;Meaoaop;Mearaqaramp9op9rp;Kegoaop;Mep;Kep;Kep;Jep;Negrp;Mepxbbn0bbn0bbn0bbn0gqp;Keczp:Reawarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9op9qgwaoarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9ogopmwDKYqk8AExm35Ps8E8Fp9qpkbbadaDakp9oawaopmbezHdiOAlvCXorQLp9qpkbbadcafhdavclfgvax6mbkkaxae9pmbaiaeciGgvcitgdfcbcaad9R;8kbaiabaxcitfglad;8qbbdnavTmbaiaipblzgopxbbbbbbFFbbbbbbFFgkp9oaipblbgDaopmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;6eaDaopmbediwDqkzHOAKY8AEgoczp:Sep;6egrp;Geaoczp:Reczp:Sep;6egwp;Gep;Kep;Legopxb;:FSb;:FSb;:FSb;:FSawaopxbbbbbbbbbbbbbbbbp:2egqawpxbbbjbbbjbbbjbbbjgmp9op9rp;Kegwawp;Meaoaop;Mearaqaramp9op9rp;Kegoaop;Mep;Kep;Kep;Jep;Negrp;Mepxbbn0bbn0bbn0bbn0gqp;Keczp:Reawarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9op9qgwaoarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9ogopmwDKYqk8AExm35Ps8E8Fp9qpklzaiaDakp9oawaopmbezHdiOAlvCXorQLp9qpklbkalaiad;8qbbkk;4wllue97euv978Jjjjjbc8W9Rhidnaec98GglTmbcbhvabhoinaiaopbbbgraoczfgwpbbbgDpmlvorxmPsCXQL358E8Fgqczp:Segkclp:RepklbaopxbbjZbbjZbbjZbbjZpx;Zl81Z;Zl81Z;Zl81Z;Zl81Zakpxibbbibbbibbbibbbp9qp;6ep;NegkaraDpmbediwDqkzHOAKY8AEgrczp:Reczp:Sep;6ep;MegDaDp;Meakarczp:Sep;6ep;Megxaxp;Meakaqczp:Reczp:Sep;6ep;Megqaqp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jepxb;:FSb;:FSb;:FSb;:FSgkp;Mepxbbn0bbn0bbn0bbn0grp;KepxFFbbFFbbFFbbFFbbgmp9oaxakp;Mearp;Keczp:Rep9qgxaqakp;Mearp;Keczp:ReaDakp;Mearp;Keamp9op9qgkpmbezHdiOAlvCXorQLgrp5baipblbpEb:T:j83ibaocwfarp5eaipblbpEe:T:j83ibawaxakpmwDKYqk8AExm35Ps8E8Fgkp5baipblbpEd:T:j83ibaocKfakp5eaipblbpEi:T:j83ibaocafhoavclfgval6mbkkdnalae9pmbaiaeciGgvcitgofcbcaao9R;8kbaiabalcitfgwao;8qbbdnavTmbaiaipblbgraipblzgDpmlvorxmPsCXQL358E8Fgqczp:Segkclp:RepklaaipxbbjZbbjZbbjZbbjZpx;Zl81Z;Zl81Z;Zl81Z;Zl81Zakpxibbbibbbibbbibbbp9qp;6ep;NegkaraDpmbediwDqkzHOAKY8AEgrczp:Reczp:Sep;6ep;MegDaDp;Meakarczp:Sep;6ep;Megxaxp;Meakaqczp:Reczp:Sep;6ep;Megqaqp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jepxb;:FSb;:FSb;:FSb;:FSgkp;Mepxbbn0bbn0bbn0bbn0grp;KepxFFbbFFbbFFbbFFbbgmp9oaxakp;Mearp;Keczp:Rep9qgxaqakp;Mearp;Keczp:ReaDakp;Mearp;Keamp9op9qgkpmbezHdiOAlvCXorQLgrp5baipblapEb:T:j83ibaiarp5eaipblapEe:T:j83iwaiaxakpmwDKYqk8AExm35Ps8E8Fgkp5baipblapEd:T:j83izaiakp5eaipblapEi:T:j83iKkawaiao;8qbbkk:Pddiue978Jjjjjbc;ab9Rhidnadcd4ae2glc98GgvTmbcbhdabheinaeaepbbbgocwp:Recwp:Sep;6eaocep:SepxbbjZbbjZbbjZbbjZp:UepxbbjFbbjFbbjFbbjFp9op;Mepkbbaeczfheadclfgdav6mbkkdnaval9pmbaialciGgdcdtgeVcbc;abae9R;8kbaiabavcdtfgvae;8qbbdnadTmbaiaipblbgocwp:Recwp:Sep;6eaocep:SepxbbjZbbjZbbjZbbjZp:UepxbbjFbbjFbbjFbbjFp9op;Mepklbkavaiae;8qbbkk9teiucbcbydj1jjbgeabcifc98GfgbBdj1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaikkkebcjwklz9Tbb":"b9H79Tebbbe8Fv9Gbb9Gvuuuuueu9Giuuub9Geueu9Giuuueuikqbeeedddillviebeoweuec:q;iekr;leDo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbeY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVbdE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbiL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtblK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949Wbol79IV9Rbrq:P8Yqdbk;3sezu8Jjjjjbcj;eb9Rgv8Kjjjjbc9:hodnadcefal0mbcuhoaiRbbc:Ge9hmbavaialfgrad9Radz1jjjbhwcj;abad9UhoaicefhldnadTmbaoc;WFbGgocjdaocjd6EhDcbhqinaqae9pmeaDaeaq9RaqaDfae6Egkcsfgocl4cifcd4hxdndndndnaoc9WGgmTmbcbhPcehsawcjdfhzalhHinaraH9Rax6midnaraHaxfgl9RcK6mbczhoinawcj;cbfaogifgoc9WfhOdndndndndnaHaic9WfgAco4fRbbaAci4coG4ciGPlbedibkaO9cb83ibaOcwf9cb83ibxikaOalRblalRbbgAco4gCaCciSgCE86bbaocGfalclfaCfgORbbaAcl4ciGgCaCciSgCE86bbaocVfaOaCfgORbbaAcd4ciGgCaCciSgCE86bbaoc7faOaCfgORbbaAciGgAaAciSgAE86bbaoctfaOaAfgARbbalRbegOco4gCaCciSgCE86bbaoc91faAaCfgARbbaOcl4ciGgCaCciSgCE86bbaoc4faAaCfgARbbaOcd4ciGgCaCciSgCE86bbaoc93faAaCfgARbbaOciGgOaOciSgOE86bbaoc94faAaOfgARbbalRbdgOco4gCaCciSgCE86bbaoc95faAaCfgARbbaOcl4ciGgCaCciSgCE86bbaoc96faAaCfgARbbaOcd4ciGgCaCciSgCE86bbaoc97faAaCfgARbbaOciGgOaOciSgOE86bbaoc98faAaOfgORbbalRbiglco4gAaAciSgAE86bbaoc99faOaAfgORbbalcl4ciGgAaAciSgAE86bbaoc9:faOaAfgORbbalcd4ciGgAaAciSgAE86bbaocufaOaAfgoRbbalciGglalciSglE86bbaoalfhlxdkaOalRbwalRbbgAcl4gCaCcsSgCE86bbaocGfalcwfaCfgORbbaAcsGgAaAcsSgAE86bbaocVfaOaAfgORbbalRbegAcl4gCaCcsSgCE86bbaoc7faOaCfgORbbaAcsGgAaAcsSgAE86bbaoctfaOaAfgORbbalRbdgAcl4gCaCcsSgCE86bbaoc91faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc4faOaAfgORbbalRbigAcl4gCaCcsSgCE86bbaoc93faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc94faOaAfgORbbalRblgAcl4gCaCcsSgCE86bbaoc95faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc96faOaAfgORbbalRbvgAcl4gCaCcsSgCE86bbaoc97faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc98faOaAfgORbbalRbogAcl4gCaCcsSgCE86bbaoc99faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc9:faOaAfgORbbalRbrglcl4gAaAcsSgAE86bbaocufaOaAfgoRbbalcsGglalcsSglE86bbaoalfhlxekaOal8Pbb83bbaOcwfalcwf8Pbb83bbalczfhlkdnaiam9pmbaiczfhoaral9RcL0mekkaiam6mialTmidnakTmbawaPfRbbhOcbhoazhiinaiawcj;cbfaofRbbgAce4cbaAceG9R7aOfgO86bbaiadfhiaocefgoak9hmbkkazcefhzaPcefgPad6hsalhHaPad9hmexvkkcbhlasceGmdxikalaxad2fhCdnakTmbcbhHcehsawcjdfhminaral9Rax6mialTmdalaxfhlawaHfRbbhOcbhoamhiinaiawcj;cbfaofRbbgAce4cbaAceG9R7aOfgO86bbaiadfhiaocefgoak9hmbkamcefhmaHcefgHad6hsaHad9hmbkaChlxikcbhocehsinaral9Rax6mdalTmealaxfhlaocefgoad6hsadao9hmbkaChlxdkcbhlasceGTmekc9:hoxikabaqad2fawcjdfakad2z1jjjb8Aawawcjdfakcufad2fadz1jjjb8Aakaqfhqalmbkc9:hoxekcbc99aral9Radcaadca0ESEhokavcj;ebf8Kjjjjbaok;yzeHu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnaeci9UgrcHfal0mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecjez:jjjjb8AavcUf9cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhodnaeTmbcmcsaDceSEhkcbhxcbhmcbhDcbhicbhlindnaoaq9nmbc9:hoxikdndnawRbbgrc;Ve0mbavc;abfalarcl4cu7fcsGcitfgPydlhsaPydbhzdnarcsGgPak9pmbavaiarcu7fcsGcdtfydbaxaPEhraPThPdndnadcd9hmbabaDcetfgHaz87ebaHcdfas87ebaHclfar87ebxekabaDcdtfgHazBdbaHclfasBdbaHcwfarBdbkaxaPfhxavc;abfalcitfgHarBdbaHasBdlavaicdtfarBdbavc;abfalcefcsGglcitfgHazBdbaHarBdlaiaPfhialcefhlxdkdndnaPcsSmbamaPfaPc987fcefhmxekaocefhrao8SbbgPcFeGhHdndnaPcu9mmbarhoxekaocvfhoaHcFbGhHcrhPdninar8SbbgOcFbGaPtaHVhHaOcu9kmearcefhraPcrfgPc8J9hmbxdkkarcefhokaHce4cbaHceG9R7amfhmkdndnadcd9hmbabaDcetfgraz87ebarcdfas87ebarclfam87ebxekabaDcdtfgrazBdbarclfasBdbarcwfamBdbkavc;abfalcitfgramBdbarasBdlavaicdtfamBdbavc;abfalcefcsGglcitfgrazBdbaramBdlaicefhialcefhlxekdnarcpe0mbaxcefgOavaiaqarcsGfRbbgPcl49RcsGcdtfydbaPcz6gHEhravaiaP9RcsGcdtfydbaOaHfgsaPcsGgOEhPaOThOdndnadcd9hmbabaDcetfgzax87ebazcdfar87ebazclfaP87ebxekabaDcdtfgzaxBdbazclfarBdbazcwfaPBdbkavaicdtfaxBdbavc;abfalcitfgzarBdbazaxBdlavaicefgicsGcdtfarBdbavc;abfalcefcsGcitfgzaPBdbazarBdlavaiaHfcsGgicdtfaPBdbavc;abfalcdfcsGglcitfgraxBdbaraPBdlalcefhlaiaOfhiasaOfhxxekaxcbaoRbbgzEgAarc;:eSgrfhsazcsGhCazcl4hXdndnazcs0mbascefhOxekashOavaiaX9RcsGcdtfydbhskdndnaCmbaOcefhxxekaOhxavaiaz9RcsGcdtfydbhOkdndnarTmbaocefhrxekaocdfhrao8SbegHcFeGhPdnaHcu9kmbaocofhAaPcFbGhPcrhodninar8SbbgHcFbGaotaPVhPaHcu9kmearcefhraocrfgoc8J9hmbkaAhrxekarcefhrkaPce4cbaPceG9R7amfgmhAkdndnaXcsSmbarhPxekarcefhPar8SbbgocFeGhHdnaocu9kmbarcvfhsaHcFbGhHcrhodninaP8SbbgrcFbGaotaHVhHarcu9kmeaPcefhPaocrfgoc8J9hmbkashPxekaPcefhPkaHce4cbaHceG9R7amfgmhskdndnaCcsSmbaPhoxekaPcefhoaP8SbbgrcFeGhHdnarcu9kmbaPcvfhOaHcFbGhHcrhrdninao8SbbgPcFbGartaHVhHaPcu9kmeaocefhoarcrfgrc8J9hmbkaOhoxekaocefhokaHce4cbaHceG9R7amfgmhOkdndnadcd9hmbabaDcetfgraA87ebarcdfas87ebarclfaO87ebxekabaDcdtfgraABdbarclfasBdbarcwfaOBdbkavc;abfalcitfgrasBdbaraABdlavaicdtfaABdbavc;abfalcefcsGcitfgraOBdbarasBdlavaicefgicsGcdtfasBdbavc;abfalcdfcsGcitfgraABdbaraOBdlavaiazcz6aXcsSVfgicsGcdtfaOBdbaiaCTaCcsSVfhialcifhlkawcefhwalcsGhlaicsGhiaDcifgDae6mbkkcbc99aoaqSEhokavc;aef8Kjjjjbaok:llevu8Jjjjjbcz9Rhvc9:hodnaecvfal0mbcuhoaiRbbc;:eGc;qe9hmbav9cb83iwaicefhraialfc98fhwdnaeTmbdnadcdSmbcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcdtfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfglBdbaoalBdbaDcefgDae9hmbxdkkcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcetfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfgl87ebaoalBdbaDcefgDae9hmbkkcbc99arawSEhokaok:Lvoeue99dud99eud99dndnadcl9hmbaeTmeindndnabcdfgd8Sbb:Yab8Sbbgi:Ygl:l:tabcefgv8Sbbgo:Ygr:l:tgwJbb;:9cawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai86bbdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad86bbdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad86bbabclfhbaecufgembxdkkaeTmbindndnabclfgd8Ueb:Yab8Uebgi:Ygl:l:tabcdfgv8Uebgo:Ygr:l:tgwJb;:FSawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai87ebdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad87ebdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad87ebabcwfhbaecufgembkkk;siliui99iue99dnaeTmbcbhiabhlindndnJ;Zl81Zalcof8UebgvciV:Y:vgoal8Ueb:YNgrJb;:FSNJbbbZJbbb:;arJbbbb9GEMgw:lJbbb9p9DTmbaw:OhDxekcjjjj94hDkalclf8Uebhqalcdf8UebhkabavcefciGaiVcetfaD87ebdndnaoak:YNgwJb;:FSNJbbbZJbbb:;awJbbbb9GEMgx:lJbbb9p9DTmbax:Ohkxekcjjjj94hkkabavcdfciGaiVcetfak87ebdndnaoaq:YNgoJb;:FSNJbbbZJbbb:;aoJbbbb9GEMgx:lJbbb9p9DTmbax:Ohqxekcjjjj94hqkabavcufciGaiVcetfaq87ebdndnJbbjZararN:tawawN:taoaoN:tgrJbbbbarJbbbb9GE:rJb;:FSNJbbbZMgr:lJbbb9p9DTmbar:Ohqxekcjjjj94hqkabavciGaiVcetfaq87ebalcwfhlaiclfhiaecufgembkkk9mbdnadcd4ae2geTmbinababydbgdcwtcw91:Yadce91cjjj;8ifcjjj98G::NUdbabclfhbaecufgembkkk9teiucbcbydj1jjbgeabcifc98GfgbBdj1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaik;LeeeudndnaeabVciGTmbabhixekdndnadcz9pmbabhixekabhiinaiaeydbBdbaiclfaeclfydbBdbaicwfaecwfydbBdbaicxfaecxfydbBdbaiczfhiaeczfheadc9Wfgdcs0mbkkadcl6mbinaiaeydbBdbaeclfheaiclfhiadc98fgdci0mbkkdnadTmbinaiaeRbb86bbaicefhiaecefheadcufgdmbkkabk;aeedudndnabciGTmbabhixekaecFeGc:b:c:ew2hldndnadcz9pmbabhixekabhiinaialBdbaicxfalBdbaicwfalBdbaiclfalBdbaiczfhiadc9Wfgdcs0mbkkadcl6mbinaialBdbaiclfhiadc98fgdci0mbkkdnadTmbinaiae86bbaicefhiadcufgdmbkkabkkkebcjwklz9Kbb",a=WebAssembly.instantiate(s(n),{}).then((function(e){(r=e.instance).exports.__wasm_call_ctors()}));function s(e){for(var r=new Uint8Array(e.length),n=0;n<e.length;++n){var a=e.charCodeAt(n);r[n]=96<a?a-97:64<a?a-39:a+4}var i=0;for(n=0;n<e.length;++n)r[i++]=r[n]<60?t[r[n]]:64*(r[n]-60)+r[++n];return r.buffer.slice(0,i)}function o(e,t,n,a,i,s){var o=r.exports.sbrk,l=n+3&-4,c=o(l*a),u=o(i.length),h=new Uint8Array(r.exports.memory.buffer);if(0==(h.set(i,u),e=e(c,n,a,u,i.length))&&s&&s(c,l,a),t.set(h.subarray(c,c+n*a)),o(c-o(0)),0!=e)throw new Error("Malformed buffer data: "+e)}var l={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},c={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"},u=[],h=0;return{ready:a,supported:!0,useWorkers:function(e){!function(e){for(var t="var instance; var ready = WebAssembly.instantiate(new Uint8Array(["+new Uint8Array(s(n))+"]), {}).then(function(result) { instance = result.instance; instance.exports.__wasm_call_ctors(); });self.onmessage = workerProcess;"+o.toString()+function(e){a.then((function(){var t=e.data;try{var n=new Uint8Array(t.count*t.size);o(r.exports[t.mode],n,t.count,t.size,t.source,r.exports[t.filter]),self.postMessage({id:t.id,count:t.count,action:"resolve",value:n},[n.buffer])}catch(n){self.postMessage({id:t.id,count:t.count,action:"reject",value:n})}}))}.toString(),i=(t=new Blob([t],{type:"text/javascript"}),URL.createObjectURL(t)),l=0;l<e;++l)u[l]=function(e){var t={object:new Worker(e),pending:0,requests:{}};return t.object.onmessage=function(e){e=e.data,t.pending-=e.count,t.requests[e.id][e.action](e.value),delete t.requests[e.id]},t}(i);URL.revokeObjectURL(i)}(e)},decodeVertexBuffer:function(e,t,n,a,i){o(r.exports.meshopt_decodeVertexBuffer,e,t,n,a,r.exports[l[i]])},decodeIndexBuffer:function(e,t,n,a){o(r.exports.meshopt_decodeIndexBuffer,e,t,n,a)},decodeIndexSequence:function(e,t,n,a){o(r.exports.meshopt_decodeIndexSequence,e,t,n,a)},decodeGltfBuffer:function(e,t,n,a,i,s){o(r.exports[c[i]],e,t,n,a,r.exports[l[s]])},decodeGltfBufferAsync:function(e,t,n,i,s){if(0<u.length){for(var d=e,p=t,f=n,m=c[i],g=l[s],v=u[0],b=1;b<u.length;++b)u[b].pending<v.pending&&(v=u[b]);return new Promise((function(e,t){var r=new Uint8Array(f),n=h++;v.pending+=d,v.requests[n]={resolve:e,reject:t},v.object.postMessage({id:n,count:d,size:p,source:r,mode:m,filter:g},[r.buffer])}))}return a.then((function(){var a=new Uint8Array(e*t);return o(r.exports[c[i]],a,e,t,n,r.exports[l[s]]),a}))}}}();function o(e){return(o="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})(e)}function l(e,t){return(l=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function c(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=u(e);if(r=t?(r=u(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===o(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function u(e){return(u=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var h=new WeakMap,d=function(e){var t=a;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&l(t,e);var r=c(a);function a(e){if(this instanceof a)return(e=r.call(this,e)).decoderPath="",e.decoderConfig={},e.decoderBinary=null,e.decoderPending=null,e.workerLimit=4,e.workerPool=[],e.workerNextTaskID=1,e.workerSourceURL="",e.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},e.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"},e;throw new TypeError("Cannot call a class as a function")}return t=a,(e=[{key:"setDecoderPath",value:function(e){return this.decoderPath=e,this}},{key:"setDecoderConfig",value:function(e){return this.decoderConfig=e,this}},{key:"setWorkerLimit",value:function(e){return this.workerLimit=e,this}},{key:"load",value:function(e,t,r,a){var i=this,s=new n.FileLoader(this.manager);s.setPath(this.path),s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(e,(function(e){i.decodeDracoFile(e,t).catch(a)}),r,a)}},{key:"decodeDracoFile",value:function(e,t,r,n){return n={attributeIDs:r||this.defaultAttributeIDs,attributeTypes:n||this.defaultAttributeTypes,useUniqueIDs:!!r},this.decodeGeometry(e,n).then(t)}},{key:"decodeGeometry",value:function(e,t){var r,n=this,a=JSON.stringify(t);if(h.has(e)){if((s=h.get(e)).key===a)return s.promise;if(0===e.byteLength)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}var i=this.workerNextTaskID++,s=e.byteLength;return s=this._getWorker(i,s).then((function(n){return r=n,new Promise((function(n,a){r._callbacks[i]={resolve:n,reject:a},r.postMessage({type:"decode",id:i,taskConfig:t,buffer:e},[e])}))})).then((function(e){return n._createGeometry(e.geometry)})),s.catch((function(){return!0})).then((function(){r&&i&&n._releaseTask(r,i)})),h.set(e,{key:a,promise:s}),s}},{key:"_createGeometry",value:function(e){var t=new n.BufferGeometry;e.index&&t.setIndex(new n.BufferAttribute(e.index.array,1));for(var r=0;r<e.attributes.length;r++){var a=(s=e.attributes[r]).name,i=s.array,s=s.itemSize;t.setAttribute(a,new n.BufferAttribute(i,s))}return t}},{key:"_loadLibrary",value:function(e,t){var r=new n.FileLoader(this.manager);return r.setPath(this.decoderPath),r.setResponseType(t),r.setWithCredentials(this.withCredentials),new Promise((function(t,n){r.load(e,t,void 0,n)}))}},{key:"preload",value:function(){return this._initDecoder(),this}},{key:"_initDecoder",value:function(){var e=this;if(this.decoderPending)return this.decoderPending;var t="object"!==("undefined"==typeof WebAssembly?"undefined":o(WebAssembly))||"js"===this.decoderConfig.type,r=[];return t?r.push(this._loadLibrary("draco_decoder.js","text")):(r.push(this._loadLibrary("draco_wasm_wrapper.js","text")),r.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(r).then((function(r){var n=r[0];t||(e.decoderConfig.wasmBinary=r[1]),r=function(){var e,t;onmessage=function(r){var n=r.data;switch(n.type){case"init":e=n.decoderConfig,t=new Promise((function(t){e.onModuleLoaded=function(e){t({draco:e})},DracoDecoderModule(e)}));break;case"decode":var a=n.buffer,i=n.taskConfig;t.then((function(e){var t=new(e=e.draco).Decoder,r=new e.DecoderBuffer;r.Init(new Int8Array(a),a.byteLength);try{var s=function(e,t,r,n){var a,i=n.attributeIDs,s=n.attributeTypes,o=t.GetEncodedGeometryType(r);if(o===e.TRIANGULAR_MESH)a=new e.Mesh,v=t.DecodeBufferToMesh(r,a);else{if(o!==e.POINT_CLOUD)throw new Error("THREE.DRACOLoader: Unexpected geometry type.");a=new e.PointCloud,v=t.DecodeBufferToPointCloud(r,a)}if(!v.ok()||0===a.ptr)throw new Error("THREE.DRACOLoader: Decoding failed: "+v.error_msg());var l,c,u,h,d,p,f,m,g,v,b,y,x,w={index:null,attributes:[]};for(l in i){var S=self[s[l]],M=void 0,T=void 0;if(n.useUniqueIDs)T=i[l],M=t.GetAttributeByUniqueId(a,T);else{if(-1===(T=t.GetAttributeId(a,e[i[l]])))continue;M=t.GetAttribute(a,T)}w.attributes.push((T=e,c=t,u=a,h=l,d=M.num_components(),f=(p=u.num_points()*d)*S.BYTES_PER_ELEMENT,m=function(e,t){switch(t){case Float32Array:return e.DT_FLOAT32;case Int8Array:return e.DT_INT8;case Int16Array:return e.DT_INT16;case Int32Array:return e.DT_INT32;case Uint8Array:return e.DT_UINT8;case Uint16Array:return e.DT_UINT16;case Uint32Array:return e.DT_UINT32}}(T,S),g=T._malloc(f),c.GetAttributeDataArrayForAllPoints(u,M,m,f,g),c=new S(T.HEAPF32.buffer,g,p).slice(),T._free(g),{name:h,array:c,itemSize:d}))}return o===e.TRIANGULAR_MESH&&(w.index=(r=e,v=t,y=4*(b=3*(o=a).num_faces()),x=r._malloc(y),v.GetTrianglesUInt32Array(o,y,x),v=new Uint32Array(r.HEAPF32.buffer,x,b).slice(),r._free(x),{array:v,itemSize:1})),e.destroy(a),w}(e,t,r,i),o=s.attributes.map((function(e){return e.array.buffer}));s.index&&o.push(s.index.array.buffer),self.postMessage({type:"decode",id:n.id,geometry:s},o)}catch(e){console.error(e),self.postMessage({type:"error",id:n.id,error:e.message})}finally{e.destroy(r),e.destroy(t)}}))}}}.toString(),n=["/* draco decoder */",n,"","/* worker */",r.substring(r.indexOf("{")+1,r.lastIndexOf("}"))].join("\n"),e.workerSourceURL=URL.createObjectURL(new Blob([n]))})),this.decoderPending}},{key:"_getWorker",value:function(e,t){var r=this;return this._initDecoder().then((function(){r.workerPool.length<r.workerLimit?((n=new Worker(r.workerSourceURL))._callbacks={},n._taskCosts={},n._taskLoad=0,n.postMessage({type:"init",decoderConfig:r.decoderConfig}),n.onmessage=function(e){var t=e.data;switch(t.type){case"decode":n._callbacks[t.id].resolve(t);break;case"error":n._callbacks[t.id].reject(t);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+t.type+'"')}},r.workerPool.push(n)):r.workerPool.sort((function(e,t){return e._taskLoad>t._taskLoad?-1:1}));var n,a=r.workerPool[r.workerPool.length-1];return a._taskCosts[e]=t,a._taskLoad+=t,a}))}},{key:"_releaseTask",value:function(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}},{key:"debug",value:function(){console.log("Task load: ",this.workerPool.map((function(e){return e._taskLoad})))}},{key:"dispose",value:function(){for(var e=0;e<this.workerPool.length;++e)this.workerPool[e].terminate();return this.workerPool.length=0,""!==this.workerSourceURL&&URL.revokeObjectURL(this.workerSourceURL),this}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),a}(n.Loader),p=r(4091),f={enabled:!1,files:{},add:function(e,t){!1!==this.enabled&&(this.files[e]=t)},get:function(e){if(!1!==this.enabled)return this.files[e]},remove:function(e){delete this.files[e]},clear:function(){this.files={}}};var m=new(function(e,t,r){return Object.defineProperty(e,"prototype",{writable:!1}),e}((function e(t,r,n){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");var a=this,i=!1,s=0,o=0,l=void 0,c=[];this.onStart=void 0,this.onLoad=t,this.onProgress=r,this.onError=n,this.itemStart=function(e){o++,!1===i&&void 0!==a.onStart&&a.onStart(e,s,o),i=!0},this.itemEnd=function(e){s++,void 0!==a.onProgress&&a.onProgress(e,s,o),s===o&&(i=!1,void 0!==a.onLoad&&a.onLoad())},this.itemError=function(e){void 0!==a.onError&&a.onError(e)},this.resolveURL=function(e){return l?l(e):e},this.setURLModifier=function(e){return l=e,this},this.addHandler=function(e,t){return c.push(e,t),this},this.removeHandler=function(e){return-1!==(e=c.indexOf(e))&&c.splice(e,2),this},this.getHandler=function(e){for(var t=0,r=c.length;t<r;t+=2){var n=c[t],a=c[t+1];if(n.global&&(n.lastIndex=0),n.test(e))return a}return null}})));var g=function(){function e(t){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");this.manager=void 0!==t?t:m,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}var t,r;return t=e,(r=[{key:"load",value:function(){}},{key:"loadAsync",value:function(e,t){var r=this;return new Promise((function(n,a){r.load(e,n,t,a)}))}},{key:"parse",value:function(){}},{key:"setCrossOrigin",value:function(e){return this.crossOrigin=e,this}},{key:"setWithCredentials",value:function(e){return this.withCredentials=e,this}},{key:"setPath",value:function(e){return this.path=e,this}},{key:"setResourcePath",value:function(e){return this.resourcePath=e,this}},{key:"setRequestHeader",value:function(e){return this.requestHeader=e,this}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,r),Object.defineProperty(t,"prototype",{writable:!1}),e}();function v(e){return(v="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})(e)}function b(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function y(e,t){return(y=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function x(e){return(x=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var w=function(){var e=n,t=g;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&&y(e,t);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=x(e);if(r=t?(r=x(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===v(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(e){if(this instanceof n)return(e=r.call(this,e)).isImageBitmapLoader=!0,"undefined"==typeof createImageBitmap&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),"undefined"==typeof fetch&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),e.options={premultiplyAlpha:"none"},e;throw new TypeError("Cannot call a class as a function")}return e=n,(t=[{key:"setOptions",value:function(e){return this.options=e,this}},{key:"load",value:function(e,t,r,n,a){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);var i=this,s=f.get(e);if(void 0!==s)return i.manager.itemStart(e),setTimeout((function(){t&&t(s),i.manager.itemEnd(e)}),0),s;var o={};o.credentials="anonymous"===this.crossOrigin?"same-origin":"include",o.headers=this.requestHeader,fetch(e,o).then((function(e){return e.blob()})).then((function(e){return Promise.all([new Promise((function(t){var r=(n=i.options).textureQuality,n=n.reverseTexture,s=a.notCompress,o=a.size,l=0===e.size?new ImageData(1,1):e;t(o&&1!==r?(o=(t=a.size).w,t=t.h,s=s?1:r,createImageBitmap(l,Object.assign(i.options,{imageOrientation:n?"none":"flipY",resizeHeight:t*s,resizeWidth:o*s}))):createImageBitmap(l,Object.assign(i.options,{imageOrientation:n?"none":"flipY"})))})),Promise.resolve(e)])})).then((function(r){r=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,a,i=[],s=!0,o=!1;try{for(r=r.call(e);!(s=(n=r.next()).done)&&(i.push(n.value),2!==i.length);s=!0);}catch(e){o=!0,a=e}finally{try{s||null==r.return||r.return()}finally{if(o)throw a}}return i}}(e)||function(e,t){if(e){if("string"==typeof e)return b(e,2);var r=Object.prototype.toString.call(e).slice(8,-1);return"Map"===(r="Object"===r&&e.constructor?e.constructor.name:r)||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?b(e,2):void 0}}(e)||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.")}()}(r);var n=r[0];r=r[1],f.add(e,n),t&&t(n,r),i.manager.itemEnd(e)})).catch((function(t){console.log(t,"e"),n&&n(t),i.manager.itemError(e),i.manager.itemEnd(e)})),i.manager.itemStart(e)}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),n}(),S=r(4457),M=r(6422);function T(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,a,i=[],s=!0,o=!1;try{for(r=r.call(e);!(s=(n=r.next()).done)&&(i.push(n.value),!t||i.length!==t);s=!0);}catch(e){o=!0,a=e}finally{try{s||null==r.return||r.return()}finally{if(o)throw a}}return i}}(e,t)||D(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 _(e){return(_="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})(e)}function E(){return(E="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=B(e)););return e}(e,t);if(n)return(n=Object.getOwnPropertyDescriptor(n,t)).get?n.get.call(arguments.length<3?e:r):n.value}).apply(this,arguments)}function k(e,t){var r,n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=D(e))||t&&e&&"number"==typeof e.length)return n&&(e=n),r=0,{s:t=function(){},n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:t};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,i=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return i=e.done,e},e:function(e){s=!0,a=e},f:function(){try{i||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 r=Object.prototype.toString.call(e).slice(8,-1);return"Map"===(r="Object"===r&&e.constructor?e.constructor.name:r)||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?O(e,t):void 0}}function O(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function P(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function A(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function C(e,t,r){return t&&A(e.prototype,t),r&&A(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function R(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&&L(e,t)}function L(e,t){return(L=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function I(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=B(e);if(r=t?(r=B(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===_(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function B(e){return(B=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var j=function(){R(t,n.Loader);var e=I(t);function t(r){return P(this,t),(r=e.call(this,r)).dracoLoader=null,r.ktx2Loader=null,r.meshoptDecoder=null,r.pluginCallbacks=[],r.register((function(e){return new G(e)})),r.register((function(e){return new Q(e)})),r.register((function(e){return new Y(e)})),r.register((function(e){return new W(e)})),r.register((function(e){return new K(e)})),r.register((function(e){return new q(e)})),r.register((function(e){return new Z(e)})),r.register((function(e){return new V(e)})),r.register((function(e){return new X(e)})),r.register((function(e){return new H(e)})),r.register((function(e){return new F(e)})),r.register((function(e){return new J(e)})),r.register((function(e){return new $(e)})),r}return C(t,[{key:"load",value:function(e,t,r,a){function i(t){a?a(t):console.error(t),s.manager.itemError(e),s.manager.itemEnd(e)}var s=this,o=""!==this.resourcePath?this.resourcePath:""!==this.path?this.path:n.LoaderUtils.extractUrlBase(e),l=(this.manager.itemStart(e),new n.FileLoader(this.manager));l.setPath(this.path),l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),l.setWithCredentials(this.withCredentials),l.load(e,(function(r){try{s.parse(r,o,(function(r){t(r),s.manager.itemEnd(e)}),i)}catch(r){i(r)}}),r,i)}},{key:"setDRACOLoader",value:function(e){return this.dracoLoader=e,this}},{key:"setDDSLoader",value:function(){throw new Error('THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".')}},{key:"setKTX2Loader",value:function(e){return this.ktx2Loader=e,this}},{key:"setMeshoptDecoder",value:function(e){return this.meshoptDecoder=e,this}},{key:"register",value:function(e){return-1===this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.push(e),this}},{key:"unregister",value:function(e){return-1!==this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}},{key:"parse",value:function(e,t,r,n,a){var i,s={},o={},l=new TextDecoder;if("string"==typeof e)i=JSON.parse(e);else if(e instanceof ArrayBuffer)if(l.decode(new Uint8Array(e,0,4))===ee){try{s[N.KHR_BINARY_GLTF]=new te(e)}catch(e){return void(n&&n(e))}i=JSON.parse(s[N.KHR_BINARY_GLTF].content)}else i=JSON.parse(l.decode(e));else i=e;if(void 0===i.asset||i.asset.version[0]<2)n&&n(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));else if(a.valid(i)){var c=new we(i,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder,ex:a});c.fileLoader.setRequestHeader(this.requestHeader);for(var u=0;u<this.pluginCallbacks.length;u++){var h=this.pluginCallbacks[u](c);s[(o[h.name]=h).name]=!0}if(i.extensionsUsed)for(var d=0;d<i.extensionsUsed.length;++d){var p=i.extensionsUsed[d],f=i.extensionsRequired||[];switch(p){case N.KHR_MATERIALS_UNLIT:s[p]=new z;break;case N.KHR_DRACO_MESH_COMPRESSION:s[p]=new re(i,this.dracoLoader);break;case N.KHR_TEXTURE_TRANSFORM:s[p]=new ne;break;case N.KHR_MESH_QUANTIZATION:s[p]=new ae;break;default:0<=f.indexOf(p)&&void 0===o[p]&&console.warn('THREE.GLTFLoader: Unknown extension "'+p+'".')}}c.setExtensions(s),c.setPlugins(o),c.parse(r,n)}}},{key:"parseAsync",value:function(e,t){var r=this;return new Promise((function(n,a){r.parse(e,t,n,a)}))}}]),t}();function U(){var e={};return{get:function(t){return e[t]},add:function(t,r){e[t]=r},remove:function(t){delete e[t]},removeAll:function(){e={}}}}var N={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",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_TEXTURE_WEBP:"EXT_texture_webp",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"},F=function(){function e(t){P(this,e),this.parser=t,this.name=N.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}return C(e,[{key:"_markDefs",value:function(){for(var e=this.parser,t=this.parser.json.nodes||[],r=0,n=t.length;r<n;r++){var a=t[r];a.extensions&&a.extensions[this.name]&&void 0!==a.extensions[this.name].light&&e._addNodeRef(this.cache,a.extensions[this.name].light)}}},{key:"_loadLight",value:function(e){var t=this.parser,r="light:"+e,a=t.cache.get(r);if(a)return a;var i,s=t.json,o=((s.extensions&&s.extensions[this.name]||{}).lights||[])[e],l=new n.Color(16777215),c=(void 0!==o.color&&l.fromArray(o.color),void 0!==o.range?o.range:0);switch(o.type){case"directional":(i=new n.DirectionalLight(l)).target.position.set(0,0,-1),i.add(i.target);break;case"point":(i=new n.PointLight(l)).distance=c;break;case"spot":(i=new n.SpotLight(l)).distance=c,o.spot=o.spot||{},o.spot.innerConeAngle=void 0!==o.spot.innerConeAngle?o.spot.innerConeAngle:0,o.spot.outerConeAngle=void 0!==o.spot.outerConeAngle?o.spot.outerConeAngle:Math.PI/4,i.angle=o.spot.outerConeAngle,i.penumbra=1-o.spot.innerConeAngle/o.spot.outerConeAngle,i.target.position.set(0,0,-1),i.add(i.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+o.type)}return i.position.set(0,0,0),i.decay=2,ve(i,o),void 0!==o.intensity&&(i.intensity=o.intensity),i.name=t.createUniqueName(o.name||"light_"+e),a=Promise.resolve(i),t.cache.add(r,a),a}},{key:"getDependency",value:function(e,t){if("light"===e)return this._loadLight(t)}},{key:"createNodeAttachment",value:function(e){var t=this,r=this.parser,n=((e=r.json.nodes[e]).extensions&&e.extensions[this.name]||{}).light;return void 0===n?null:this._loadLight(n).then((function(e){return r._getNodeRef(t.cache,n,e)}))}}]),e}(),z=function(){function e(){P(this,e),this.name=N.KHR_MATERIALS_UNLIT}return C(e,[{key:"getMaterialType",value:function(){return n.MeshBasicMaterial}},{key:"extendParams",value:function(e,t,r){var a,i=[];return e.color=new n.Color(1,1,1),e.opacity=1,(t=t.pbrMetallicRoughness)&&(Array.isArray(t.baseColorFactor)&&(a=t.baseColorFactor,e.color.fromArray(a),e.opacity=a[3]),void 0!==t.baseColorTexture&&i.push(r.assignTexture(e,"map",t.baseColorTexture,n.sRGBEncoding))),Promise.all(i)}}]),e}(),V=function(){function e(t){P(this,e),this.parser=t,this.name=N.KHR_MATERIALS_EMISSIVE_STRENGTH}return C(e,[{key:"extendMaterialParams",value:function(e,t){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?(void 0!==(e=e.extensions[this.name].emissiveStrength)&&(t.emissiveIntensity=e),Promise.resolve()):Promise.resolve()}}]),e}(),G=function(){function e(t){P(this,e),this.parser=t,this.name=N.KHR_MATERIALS_CLEARCOAT}return C(e,[{key:"getMaterialType",value:function(e){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?n.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(e,t){var r=this.parser;if(!(e=r.json.materials[e]).extensions||!e.extensions[this.name])return Promise.resolve();var a=[];return void 0!==(e=e.extensions[this.name]).clearcoatFactor&&(t.clearcoat=e.clearcoatFactor),void 0!==e.clearcoatTexture&&a.push(r.assignTexture(t,"clearcoatMap",e.clearcoatTexture)),void 0!==e.clearcoatRoughnessFactor&&(t.clearcoatRoughness=e.clearcoatRoughnessFactor),void 0!==e.clearcoatRoughnessTexture&&a.push(r.assignTexture(t,"clearcoatRoughnessMap",e.clearcoatRoughnessTexture)),void 0!==e.clearcoatNormalTexture&&(a.push(r.assignTexture(t,"clearcoatNormalMap",e.clearcoatNormalTexture)),void 0!==e.clearcoatNormalTexture.scale&&(r=e.clearcoatNormalTexture.scale,t.clearcoatNormalScale=new n.Vector2(r,r))),Promise.all(a)}}]),e}(),H=function(){function e(t){P(this,e),this.parser=t,this.name=N.KHR_MATERIALS_IRIDESCENCE}return C(e,[{key:"getMaterialType",value:function(e){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?n.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(e,t){var r=this.parser;if(!(e=r.json.materials[e]).extensions||!e.extensions[this.name])return Promise.resolve();var n=[];return void 0!==(e=e.extensions[this.name]).iridescenceFactor&&(t.iridescence=e.iridescenceFactor),void 0!==e.iridescenceTexture&&n.push(r.assignTexture(t,"iridescenceMap",e.iridescenceTexture)),void 0!==e.iridescenceIor&&(t.iridescenceIOR=e.iridescenceIor),void 0===t.iridescenceThicknessRange&&(t.iridescenceThicknessRange=[100,400]),void 0!==e.iridescenceThicknessMinimum&&(t.iridescenceThicknessRange[0]=e.iridescenceThicknessMinimum),void 0!==e.iridescenceThicknessMaximum&&(t.iridescenceThicknessRange[1]=e.iridescenceThicknessMaximum),void 0!==e.iridescenceThicknessTexture&&n.push(r.assignTexture(t,"iridescenceThicknessMap",e.iridescenceThicknessTexture)),Promise.all(n)}}]),e}(),W=function(){function e(t){P(this,e),this.parser=t,this.name=N.KHR_MATERIALS_SHEEN}return C(e,[{key:"getMaterialType",value:function(e){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?n.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(e,t){var r=this.parser;if(!(e=r.json.materials[e]).extensions||!e.extensions[this.name])return Promise.resolve();var a=[];return void 0!==(t.sheenColor=new n.Color(0,0,0),t.sheenRoughness=0,t.sheen=1,e=e.extensions[this.name]).sheenColorFactor&&t.sheenColor.fromArray(e.sheenColorFactor),void 0!==e.sheenRoughnessFactor&&(t.sheenRoughness=e.sheenRoughnessFactor),void 0!==e.sheenColorTexture&&a.push(r.assignTexture(t,"sheenColorMap",e.sheenColorTexture,n.sRGBEncoding)),void 0!==e.sheenRoughnessTexture&&a.push(r.assignTexture(t,"sheenRoughnessMap",e.sheenRoughnessTexture)),Promise.all(a)}}]),e}(),K=function(){function e(t){P(this,e),this.parser=t,this.name=N.KHR_MATERIALS_TRANSMISSION}return C(e,[{key:"getMaterialType",value:function(e){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?n.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(e,t){var r=this.parser;if(!(e=r.json.materials[e]).extensions||!e.extensions[this.name])return Promise.resolve();var n=[];return void 0!==(e=e.extensions[this.name]).transmissionFactor&&(t.transmission=e.transmissionFactor),void 0!==e.transmissionTexture&&n.push(r.assignTexture(t,"transmissionMap",e.transmissionTexture)),Promise.all(n)}}]),e}(),q=function(){function e(t){P(this,e),this.parser=t,this.name=N.KHR_MATERIALS_VOLUME}return C(e,[{key:"getMaterialType",value:function(e){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?n.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(e,t){if(!(e=(a=this.parser).json.materials[e]).extensions||!e.extensions[this.name])return Promise.resolve();var r=[],a=(e=e.extensions[this.name],t.thickness=void 0!==e.thicknessFactor?e.thicknessFactor:0,void 0!==e.thicknessTexture&&r.push(a.assignTexture(t,"thicknessMap",e.thicknessTexture)),t.attenuationDistance=e.attenuationDistance||1/0,e.attenuationColor||[1,1,1]);return t.attenuationColor=new n.Color(a[0],a[1],a[2]),Promise.all(r)}}]),e}(),Z=function(){function e(t){P(this,e),this.parser=t,this.name=N.KHR_MATERIALS_IOR}return C(e,[{key:"getMaterialType",value:function(e){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?n.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(e,t){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?(e=e.extensions[this.name],t.ior=void 0!==e.ior?e.ior:1.5,Promise.resolve()):Promise.resolve()}}]),e}(),X=function(){function e(t){P(this,e),this.parser=t,this.name=N.KHR_MATERIALS_SPECULAR}return C(e,[{key:"getMaterialType",value:function(e){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?n.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(e,t){var r=this.parser;if(!(e=r.json.materials[e]).extensions||!e.extensions[this.name])return Promise.resolve();var a=[],i=(e=e.extensions[this.name],t.specularIntensity=void 0!==e.specularFactor?e.specularFactor:1,void 0!==e.specularTexture&&a.push(r.assignTexture(t,"specularIntensityMap",e.specularTexture)),e.specularColorFactor||[1,1,1]);return t.specularColor=new n.Color(i[0],i[1],i[2]),void 0!==e.specularColorTexture&&a.push(r.assignTexture(t,"specularColorMap",e.specularColorTexture,n.sRGBEncoding)),Promise.all(a)}}]),e}(),Q=function(){function e(t){P(this,e),this.parser=t,this.name=N.KHR_TEXTURE_BASISU}return C(e,[{key:"loadTexture",value:function(e){var t=this.parser,r=t.json;if(!(n=r.textures[e]).extensions||!n.extensions[this.name])return null;var n=n.extensions[this.name],a=t.options.ktx2Loader;if(a)return t.loadTextureImage(e,n.source,a);if(r.extensionsRequired&&0<=r.extensionsRequired.indexOf(this.name))throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}}]),e}(),Y=function(){function e(t){P(this,e),this.parser=t,this.name=N.EXT_TEXTURE_WEBP,this.isSupported=null}return C(e,[{key:"loadTexture",value:function(e){var t=this.name,r=this.parser,n=r.json;if(!(i=n.textures[e]).extensions||!i.extensions[t])return null;var a=i.extensions[t],i=n.images[a.source],s=r.textureLoader;return i.uri&&null!==(i=r.options.manager.getHandler(i.uri))&&(s=i),this.detectSupport().then((function(i){if(i)return r.loadTextureImage(e,a.source,s);if(n.extensionsRequired&&0<=n.extensionsRequired.indexOf(t))throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return r.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}}]),e}(),J=function(){function e(t){P(this,e),this.name=N.EXT_MESHOPT_COMPRESSION,this.parser=t}return C(e,[{key:"loadBufferView",value:function(e){var t=this.parser.json;if((e=t.bufferViews[e]).extensions&&e.extensions[this.name]){var r=e.extensions[this.name],n=(e=this.parser.getDependency("buffer",r.buffer),this.parser.options.meshoptDecoder);if(n&&n.supported)return e.then((function(e){var t=r.byteOffset||0,a=r.byteLength||0,i=r.count,s=r.byteStride,o=new Uint8Array(e,t,a);return n.decodeGltfBufferAsync?n.decodeGltfBufferAsync(i,s,o,r.mode,r.filter).then((function(e){return e.buffer})):n.ready.then((function(){var e=new ArrayBuffer(i*s);return n.decodeGltfBuffer(new Uint8Array(e),i,s,o,r.mode,r.filter),e}))}));if(t.extensionsRequired&&0<=t.extensionsRequired.indexOf(this.name))throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return null}}]),e}(),$=function(){function e(t){P(this,e),this.name=N.EXT_MESH_GPU_INSTANCING,this.parser=t}return C(e,[{key:"createNodeMesh",value:function(e){var t=this,r=this.parser.json,a=r.nodes[e];if(!a.extensions||!a.extensions[this.name]||void 0===a.mesh)return null;var i,s=k(r.meshes[a.mesh].primitives);try{for(s.s();!(i=s.n()).done;){var o=i.value;if(o.mode!==le.TRIANGLES&&o.mode!==le.TRIANGLE_STRIP&&o.mode!==le.TRIANGLE_FAN&&void 0!==o.mode)return null}}catch(e){s.e(e)}finally{s.f()}var l,c=a.extensions[this.name].attributes,u=[],h={};for(l in c)!function(e){u.push(t.parser.getDependency("accessor",c[e]).then((function(t){return h[e]=t,h[e]})))}(l);return u.length<1?null:(u.push(this.parser.createNodeMesh(e)),Promise.all(u).then((function(e){var r,a=e.pop(),i=a.isGroup?a.children:[a],s=e[0].count,o=[],l=k(i);try{for(l.s();!(r=l.n()).done;){for(var c,u=r.value,d=new n.Matrix4,p=new n.Vector3,f=new n.Quaternion,m=new n.Vector3(1,1,1),g=new n.InstancedMesh(u.geometry,u.material,s),v=0;v<s;v++)h.TRANSLATION&&p.fromBufferAttribute(h.TRANSLATION,v),h.ROTATION&&f.fromBufferAttribute(h.ROTATION,v),h.SCALE&&m.fromBufferAttribute(h.SCALE,v),g.setMatrixAt(v,d.compose(p,f,m));for(c in h)"TRANSLATION"!==c&&"ROTATION"!==c&&"SCALE"!==c&&u.geometry.setAttribute(c,h[c]);n.Object3D.prototype.copy.call(g,u),g.frustumCulled=!1,t.parser.assignFinalMaterial(g),o.push(g)}}catch(e){l.e(e)}finally{l.f()}return a.isGroup?(a.clear(),a.add.apply(a,o),a):o[0]})))}}]),e}(),ee="glTF",te=C((function e(t){P(this,e),this.name=N.KHR_BINARY_GLTF,this.content=null,this.body=null;var r=new DataView(t,0,12),n=new TextDecoder;if(this.header={magic:n.decode(new Uint8Array(t.slice(0,4))),version:r.getUint32(4,!0),length:r.getUint32(8,!0)},this.header.magic!==ee)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");for(var a=this.header.length-12,i=new DataView(t,12),s=0;s<a;){var o,l=i.getUint32(s,!0),c=(s+=4,i.getUint32(s,!0));s+=4,1313821514===c?(o=new Uint8Array(t,12+s,l),this.content=n.decode(o)):5130562===c&&(this.body=t.slice(o=12+s,o+l)),s+=l}if(null===this.content)throw new Error("THREE.GLTFLoader: JSON content not found.")})),re=function(){function e(t,r){if(P(this,e),!r)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=N.KHR_DRACO_MESH_COMPRESSION,this.json=t,this.dracoLoader=r,this.dracoLoader.preload()}return C(e,[{key:"decodePrimitive",value:function(e,t){var r,n,a=this.json,i=this.dracoLoader,s=e.extensions[this.name].bufferView,o=e.extensions[this.name].attributes,l={},c={},u={};for(r in o){var h=pe[r]||r.toLowerCase();l[h]=o[r]}for(n in e.attributes){var d,p,f=pe[n]||n.toLowerCase();void 0!==o[n]&&(d=a.accessors[e.attributes[n]],p=ce[d.componentType],u[f]=p.name,c[f]=!0===d.normalized)}return t.getDependency("bufferView",s).then((function(e){return new Promise((function(t){i.decodeDracoFile(e,(function(e){for(var r in e.attributes){var n=e.attributes[r];void 0!==(r=c[r])&&(n.normalized=r)}t(e)}),l,u)}))}))}}]),e}(),ne=function(){function e(){P(this,e),this.name=N.KHR_TEXTURE_TRANSFORM}return C(e,[{key:"extendTexture",value:function(e,t){return void 0!==t.texCoord&&console.warn('THREE.GLTFLoader: Custom UV sets in "'+this.name+'" extension not yet supported.'),void 0===t.offset&&void 0===t.rotation&&void 0===t.scale||(e=e.clone(),void 0!==t.offset&&e.offset.fromArray(t.offset),void 0!==t.rotation&&(e.rotation=t.rotation),void 0!==t.scale&&e.repeat.fromArray(t.scale),e.needsUpdate=!0),e}}]),e}(),ae=C((function e(){P(this,e),this.name=N.KHR_MESH_QUANTIZATION})),ie=function(){R(t,n.Interpolant);var e=I(t);function t(r,n,a,i){return P(this,t),e.call(this,r,n,a,i)}return C(t,[{key:"copySampleValue_",value:function(e){for(var t=this.resultBuffer,r=this.sampleValues,n=this.valueSize,a=e*n*3+n,i=0;i!==n;i++)t[i]=r[a+i];return t}},{key:"interpolate_",value:function(e,t,r,n){for(var a=this.resultBuffer,i=this.sampleValues,s=this.valueSize,o=2*s,l=3*s,c=n-t,u=e*l,h=u-l,d=-2*(t=(r=(n=(r-t)/c)*n)*n)+3*r,p=t-r,f=1-d,m=p-r+n,g=0;g!==s;g++){var v=i[h+g+s],b=i[h+g+o]*c,y=i[u+g+s],x=i[u+g]*c;a[g]=f*v+m*b+d*y+p*x}return a}}]),t}(),se=new n.Quaternion,oe=function(){R(t,ie);var e=I(t);function t(){return P(this,t),e.apply(this,arguments)}return C(t,[{key:"interpolate_",value:function(e,r,n,a){return e=E(B(t.prototype),"interpolate_",this).call(this,e,r,n,a),se.fromArray(e).normalize().toArray(e),e}}]),t}(),le={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},ce={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},ue={9728:n.NearestFilter,9729:n.LinearFilter,9984:n.NearestMipmapNearestFilter,9985:n.LinearMipmapNearestFilter,9986:n.NearestMipmapLinearFilter,9987:n.LinearMipmapLinearFilter},he={33071:n.ClampToEdgeWrapping,33648:n.MirroredRepeatWrapping,10497:n.RepeatWrapping},de={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},pe={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv2",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},fe={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},me={CUBICSPLINE:void 0,LINEAR:n.InterpolateLinear,STEP:n.InterpolateDiscrete};function ge(e,t,r){for(var n in r.extensions)void 0===e[n]&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[n]=r.extensions[n])}function ve(e,t){void 0!==t.extras&&("object"===_(t.extras)?Object.assign(e.userData,t.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras))}function be(e){for(var t="",r=Object.keys(e).sort(),n=0,a=r.length;n<a;n++)t+=r[n]+":"+e[r[n]]+";";return t}function ye(e){switch(e){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}var xe=new n.Matrix4,we=function(){function e(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},a=(P(this,e),this.json=t,this.extensions={},this.plugins={},this.options=r,this.cache=new U,this.associations=new Map,this.primitiveCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},t=!(this.nodeNamesUsed={}),r=!1,-1);"undefined"!=typeof navigator&&(t=!0===/^((?!chrome|android).)*safari/i.test(navigator.userAgent),a=(r=-1<navigator.userAgent.indexOf("Firefox"))?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),"undefined"==typeof createImageBitmap||t||r&&a<98?this.textureLoader=new n.TextureLoader(this.options.manager):this.textureLoader=new w(this.options.manager),this.options.ex.setTextureLoader(this.textureLoader),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new n.FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.rgbeLoader=new M.x(this.options.manager),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}return C(e,[{key:"setExtensions",value:function(e){this.extensions=e}},{key:"setPlugins",value:function(e){this.plugins=e}},{key:"parse",value:function(e,t){var r=this,n=this.json,a=this.extensions;this.cache.removeAll(),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([r.getDependencies("scene"),r.getDependencies("animation"),r.getDependencies("camera")])})).then((function(t){var i={scene:t[0][n.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:n.asset,parser:r,userData:{}};ge(a,i,n),ve(i,n),Promise.all(r._invokeAll((function(e){return e.afterRoot&&e.afterRoot(i)}))).then((function(){e(i)}))})).catch(t)}},{key:"_markDefs",value:function(){for(var e=this.json.nodes||[],t=this.json.skins||[],r=this.json.meshes||[],n=0,a=t.length;n<a;n++)for(var i=t[n].joints,s=0,o=i.length;s<o;s++)e[i[s]].isBone=!0;for(var l=0,c=e.length;l<c;l++){var u=e[l];void 0!==u.mesh&&(this._addNodeRef(this.meshCache,u.mesh),void 0!==u.skin&&(r[u.mesh].isSkinnedMesh=!0)),void 0!==u.camera&&this._addNodeRef(this.cameraCache,u.camera)}}},{key:"_addNodeRef",value:function(e,t){void 0!==t&&(void 0===e.refs[t]&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}},{key:"_getNodeRef",value:function(e,t,r){var n=this;if(e.refs[t]<=1)return r;var a=r.clone();return function e(t,r){var a,i=n.associations.get(t),s=(null!=i&&n.associations.set(r,i),k(t.children.entries()));try{for(s.s();!(a=s.n()).done;){var o=T(a.value,2),l=o[0];e(o[1],r.children[l])}}catch(e){s.e(e)}finally{s.f()}}(r,a),a.name+="_instance_"+e.uses[t]++,a}},{key:"_invokeOne",value:function(e){var t=Object.values(this.plugins);t.push(this);for(var r=0;r<t.length;r++){var n=e(t[r]);if(n)return n}return null}},{key:"_invokeAll",value:function(e){for(var t=Object.values(this.plugins),r=(t.unshift(this),[]),n=0;n<t.length;n++){var a=e(t[n]);a&&r.push(a)}return r}},{key:"getDependency",value:function(e,t){var r=e+":"+t,n=this.cache.get(r);if(!n){switch(e){case"scene":try{n=this.loadScene(t)}catch(r){console.log(r,"e")}break;case"node":try{n=this._invokeOne((function(e){return e.loadNode&&e.loadNode(t)}))}catch(r){console.log(r,"e")}break;case"mesh":try{n=this._invokeOne((function(e){return e.loadMesh&&e.loadMesh(t)}))}catch(r){console.log(r,"e")}break;case"accessor":try{n=this.loadAccessor(t);break}catch(r){console.log(r,"e")}case"bufferView":try{n=this._invokeOne((function(e){return e.loadBufferView&&e.loadBufferView(t)}))}catch(r){console.log(r,"e")}break;case"buffer":try{n=this.loadBuffer(t)}catch(r){console.log(r,"e")}break;case"material":try{n=this._invokeOne((function(e){return e.loadMaterial&&e.loadMaterial(t)}))}catch(r){console.log(r,"e")}break;case"texture":try{n=this._invokeOne((function(e){return e.loadTexture&&e.loadTexture(t)}))}catch(r){console.log(r,"e")}break;case"skin":try{n=this.loadSkin(t)}catch(r){console.log(r,"e")}break;case"animation":try{n=this._invokeOne((function(e){return e.loadAnimation&&e.loadAnimation(t)}))}catch(r){console.log(r,"e")}break;case"camera":try{n=this.loadCamera(t)}catch(r){console.log(r,"e")}break;default:try{n=this._invokeOne((function(r){return r!=this&&r.getDependency&&r.getDependency(e,t)}))}catch(r){console.log(r,"e")}if(n)break;throw new Error("Unknown type: "+e)}this.cache.add(r,n)}return n}},{key:"getDependencies",value:function(e){var t,r,n=this.cache.get(e);return n||(r=(t=this).json[e+("mesh"===e?"es":"s")]||[],n=Promise.all(r.map((function(r,n){return t.getDependency(e,n)}))),this.cache.add(e,n)),n}},{key:"loadBuffer",value:function(e){var t=this.json.buffers[e],r=this.fileLoader;if(t.type&&"arraybuffer"!==t.type)throw new Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(void 0===t.uri&&0===e)return Promise.resolve(this.extensions[N.KHR_BINARY_GLTF].body);var a=this.options;return new Promise((function(e,i){r.load(n.LoaderUtils.resolveURL(t.uri,a.path),e,void 0,(function(){i(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))}))}))}},{key:"loadBufferView",value:function(e){var t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then((function(e){var r=t.byteLength||0,n=t.byteOffset||0;return e.slice(n,n+r)}))}},{key:"loadAccessor",value:function(e){var t,r=this,a=this.json,i=this.json.accessors[e];if(void 0===i.bufferView&&void 0===i.sparse)return e=de[i.type],s=ce[i.componentType],t=!0===i.normalized,s=new s(i.count*e),Promise.resolve(new n.BufferAttribute(s,e,t));var s=[];return void 0!==i.bufferView?s.push(this.getDependency("bufferView",i.bufferView)):s.push(null),void 0!==i.sparse&&(s.push(this.getDependency("bufferView",i.sparse.indices.bufferView)),s.push(this.getDependency("bufferView",i.sparse.values.bufferView))),Promise.all(s).then((function(e){var t,s=e[0],o=de[i.type],l=ce[i.componentType],c=l.BYTES_PER_ELEMENT,u=i.byteOffset||0,h=void 0!==i.bufferView?a.bufferViews[i.bufferView].byteStride:void 0,d=!0===i.normalized,p=h&&h!==c*o?(f=Math.floor(u/h),m="InterleavedBuffer:"+i.bufferView+":"+i.componentType+":"+f+":"+i.count,(g=r.cache.get(m))||(t=new l(s,f*h,i.count*h/c),g=new n.InterleavedBuffer(t,h/c),r.cache.add(m,g)),new n.InterleavedBufferAttribute(g,o,u%h/c,d)):(t=null===s?new l(i.count*o):new l(s,u,i.count*o),new n.BufferAttribute(t,o,d));if(void 0!==i.sparse){var f=ce[i.sparse.indices.componentType],m=i.sparse.indices.byteOffset||0,g=i.sparse.values.byteOffset||0,v=new f(e[1],m,i.sparse.count*de.SCALAR),b=new l(e[2],g,i.sparse.count*o);null!==s&&(p=new n.BufferAttribute(p.array.slice(),p.itemSize,p.normalized));for(var y=0,x=v.length;y<x;y++){var w=v[y];if(p.setX(w,b[y*o]),2<=o&&p.setY(w,b[y*o+1]),3<=o&&p.setZ(w,b[y*o+2]),4<=o&&p.setW(w,b[y*o+3]),5<=o)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return p}))}},{key:"loadTexture",value:function(e){var t=this.json,r=this.options,n=t.textures[e].source,a=(t=t.images[n],this.textureLoader);return t.uri&&null!==(r=r.manager.getHandler(t.uri))&&(a=r),this.loadTextureImage(e,n,a)}},{key:"loadTextureImage",value:function(e,t,r){var a=this,i=this.json,s=i.textures[e],o=i.images[t],l=(o.uri||o.bufferView)+":"+s.sampler;return this.textureCache[l]?this.textureCache[l]:(t=this.loadImageSource(t,r,e).then((function(t){t.flipY=!1,t.name=s.name||o.name||"";var r=(i.samplers||{})[s.sampler]||{};return t.magFilter=ue[r.magFilter]||n.LinearFilter,t.minFilter=ue[r.minFilter]||n.LinearMipmapLinearFilter,t.wrapS=he[r.wrapS]||n.RepeatWrapping,t.wrapT=he[r.wrapT]||n.RepeatWrapping,a.associations.set(t,{textures:e}),a.options.ex.loadTexture({texture:t,textureDef:s}),t})).catch((function(){return null})),this.textureCache[l]=t)}},{key:"loadImageSource",value:function(e,t,r){var a=this,i=this.json,s=this.options,o=i.textures[r];if(void 0!==this.sourceCache[e])return this.sourceCache[e].then((function(e){return e.clone()}));var l=i.images[e],c=self.URL||self.webkitURL,u=l.uri||"",h=!1;if(void 0!==l.bufferView)u=a.getDependency("bufferView",l.bufferView).then((function(e){h=!0;var t=new Blob([e],{type:l.mimeType});return{sourceURI:u=c.createObjectURL(t),blob:t,bufferView:e}}));else if(void 0===l.uri)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");return r=Promise.resolve(u).then((function(e){var r=e.sourceURI,i=e.blob;return new Promise((function(e,l){if(0===i.size)return c=new n.Texture,e({texture:c,blob:i});var c;o.isHdr?((c=new FileReader).readAsDataURL(i),c.addEventListener("load",(function(t){t=t.target.result,a.rgbeLoader.loadAsync(t).then((function(t){e({texture:t,blob:i})}))}))):!0===t.isImageBitmapLoader?(c=function(t,r){(t=new n.Texture(t)).needsUpdate=!0,e({texture:t,blob:r})},t.load(n.LoaderUtils.resolveURL(r,s.path),c,void 0,l,o)):(s.ex.options.loadConfig.reverseTexture,t.load(n.LoaderUtils.resolveURL(r,s.path),(function(t){e({texture:t,blob:i})}),void 0,l))}))})).then((function(e){var t=e.texture;return e=e.blob,"editor"===s.ex.options.mode?(t.userData.url=u,t.userData.blob=e):!0===h&&c.revokeObjectURL(u),t.userData.mimeType=l.mimeType||(0<(e=l.uri||"").search(/\.jpe?g($|\?)/i)||0===e.search(/^data\:image\/jpeg/)?"image/jpeg":0<e.search(/\.webp($|\?)/i)||0===e.search(/^data\:image\/webp/)?"image/webp":"image/png"),t})).catch((function(e){throw console.log(e,"error"),console.error("THREE.GLTFLoader: Couldn't loadImageSource texture",u),e})),this.sourceCache[e]=r}},{key:"assignTexture",value:function(e,t,r,n){var a=this;return this.getDependency("texture",r.index).then((function(i){return i?(void 0===r.texCoord||0==r.texCoord||"aoMap"===t&&1==r.texCoord||console.warn("THREE.GLTFLoader: Custom UV set "+r.texCoord+" for texture "+t+" not yet supported."),a.extensions[N.KHR_TEXTURE_TRANSFORM]&&(s=void 0!==r.extensions?r.extensions[N.KHR_TEXTURE_TRANSFORM]:void 0)&&(o=a.associations.get(i),i=a.extensions[N.KHR_TEXTURE_TRANSFORM].extendTexture(i,s),a.associations.set(i,o)),void 0!==n&&(i.encoding=n),e[t]=i):null;var s,o}))}},{key:"assignFinalMaterial",value:function(e){var t,r,a=e.geometry,i=e.material,s=void 0===a.attributes.tangent,o=void 0!==a.attributes.color,l=void 0===a.attributes.normal;e.isPoints?(t="PointsMaterial:"+i.uuid,(r=this.cache.get(t))||(r=new n.PointsMaterial,n.Material.prototype.copy.call(r,i),r.color.copy(i.color),r.map=i.map,r.sizeAttenuation=!1,this.cache.add(t,r)),i=r):e.isLine&&(t="LineBasicMaterial:"+i.uuid,(r=this.cache.get(t))||(r=new n.LineBasicMaterial,n.Material.prototype.copy.call(r,i),r.color.copy(i.color),this.cache.add(t,r)),i=r),(s||o||l)&&(t="ClonedMaterial:"+i.uuid+":",s&&(t+="derivative-tangents:"),o&&(t+="vertex-colors:"),l&&(t+="flat-shading:"),(r=this.cache.get(t))||(r=i.clone(),o&&(r.vertexColors=!0),l&&(r.flatShading=!0),s&&(r.normalScale&&(r.normalScale.y*=-1),r.clearcoatNormalScale&&(r.clearcoatNormalScale.y*=-1)),this.cache.add(t,r),this.associations.set(r,this.associations.get(i)))),i.aoMap&&void 0===a.attributes.uv2&&void 0!==a.attributes.uv&&a.setAttribute("uv2",a.attributes.uv),this.options.ex.loadMaterial({material:i,materialDef:i.userData,model:e}),e.material=i}},{key:"getMaterialType",value:function(){return n.MeshStandardMaterial}},{key:"loadMaterial",value:function(e){var t,r,a=this,i=this.json,s=this.extensions,o=i.materials[e],l={},c=(i=[],(o.extensions||{})[N.KHR_MATERIALS_UNLIT]?(r=s[N.KHR_MATERIALS_UNLIT],t=r.getMaterialType(),i.push(r.extendParams(l,o,a))):(r=o.pbrMetallicRoughness||{},l.color=new n.Color(1,1,1),l.opacity=1,Array.isArray(r.baseColorFactor)&&(c=r.baseColorFactor,l.color.fromArray(c),l.opacity=c[3]),void 0!==r.baseColorTexture&&i.push(a.assignTexture(l,"map",r.baseColorTexture,n.sRGBEncoding)),l.metalness=void 0!==r.metallicFactor?r.metallicFactor:1,l.roughness=void 0!==r.roughnessFactor?r.roughnessFactor:1,void 0!==r.metallicRoughnessTexture&&(i.push(a.assignTexture(l,"metalnessMap",r.metallicRoughnessTexture)),i.push(a.assignTexture(l,"roughnessMap",r.metallicRoughnessTexture))),t=this._invokeOne((function(t){return t.getMaterialType&&t.getMaterialType(e)})),i.push(Promise.all(this._invokeAll((function(t){return t.extendMaterialParams&&t.extendMaterialParams(e,l)}))))),!0===o.doubleSided&&(l.side=n.DoubleSide),o.alphaMode||"OPAQUE");return"BLEND"===c?(l.transparent=!0,l.depthWrite=!1):(l.transparent=!1,"MASK"===c&&(l.alphaTest=void 0!==o.alphaCutoff?o.alphaCutoff:.5)),void 0!==o.normalTexture&&t!==n.MeshBasicMaterial&&(i.push(a.assignTexture(l,"normalMap",o.normalTexture)),l.normalScale=new n.Vector2(1,1),void 0!==o.normalTexture.scale&&(r=o.normalTexture.scale,l.normalScale.set(r,r))),void 0!==o.occlusionTexture&&t!==n.MeshBasicMaterial&&(i.push(a.assignTexture(l,"aoMap",o.occlusionTexture)),void 0!==o.occlusionTexture.strength&&(l.aoMapIntensity=o.occlusionTexture.strength)),void 0!==o.emissiveFactor&&t!==n.MeshBasicMaterial&&(l.emissive=(new n.Color).fromArray(o.emissiveFactor)),void 0!==o.emissiveTexture&&t!==n.MeshBasicMaterial&&i.push(a.assignTexture(l,"emissiveMap",o.emissiveTexture,n.sRGBEncoding)),Promise.all(i).then((function(){var r=new t(l);return o.name&&(r.name=o.name),ve(r,o),a.associations.set(r,{materials:e}),o.extensions&&ge(s,r,o),r}))}},{key:"createUniqueName",value:function(e){for(var t=n.PropertyBinding.sanitizeNodeName(e||""),r=t,a=1;this.nodeNamesUsed[r];++a)r=t+"_"+a;return this.nodeNamesUsed[r]=!0,r}},{key:"loadGeometries",value:function(e){for(var t=this,r=this.extensions,a=this.primitiveCache,i=[],s=0,o=e.length;s<o;s++){var l=e[s],c=(u=void 0,u=(u=(c=l).extensions&&c.extensions[N.KHR_DRACO_MESH_COMPRESSION])?"draco:"+u.bufferView+":"+u.indices+":"+be(u.attributes):c.indices+":"+be(c.attributes)+":"+c.mode),u=a[c];u?i.push(u.promise):(u=void 0,u=l.extensions&&l.extensions[N.KHR_DRACO_MESH_COMPRESSION]?function(e){return r[N.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,t).then((function(r){return Se(r,e,t)}))}(l):Se(new n.BufferGeometry,l,t),a[c]={primitive:l,promise:u},i.push(u))}return Promise.all(i)}},{key:"loadMesh",value:function(e){for(var t=this,r=this.json,a=this.extensions,i=r.meshes[e],s=i.primitives,o=[],l=0,c=s.length;l<c;l++){var u=void 0===s[l].material?(void 0===(u=this.cache).DefaultMaterial&&(u.DefaultMaterial=new n.MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:n.FrontSide})),u.DefaultMaterial):this.getDependency("material",s[l].material);o.push(u)}return o.push(t.loadGeometries(s)),Promise.all(o).then((function(r){for(var o=r.slice(0,r.length-1),l=r[r.length-1],c=[],u=0,h=l.length;u<h;u++){var d=l[u],f=s[u],m=void 0,g=o[u];if(f.mode===le.TRIANGLES||f.mode===le.TRIANGLE_STRIP||f.mode===le.TRIANGLE_FAN||void 0===f.mode)!0!==(m=new(!0===i.isSkinnedMesh?n.SkinnedMesh:n.Mesh)(d,g)).isSkinnedMesh||m.geometry.attributes.skinWeight.normalized||m.normalizeSkinWeights(),f.mode===le.TRIANGLE_STRIP?m.geometry=(0,p.Vs)(m.geometry,n.TriangleStripDrawMode):f.mode===le.TRIANGLE_FAN&&(m.geometry=(0,p.Vs)(m.geometry,n.TriangleFanDrawMode));else if(f.mode===le.LINES)m=new n.LineSegments(d,g);else if(f.mode===le.LINE_STRIP)m=new n.Line(d,g);else if(f.mode===le.LINE_LOOP)m=new n.LineLoop(d,g);else{if(f.mode!==le.POINTS)throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+f.mode);m=new n.Points(d,g)}if(0<Object.keys(m.geometry.morphAttributes).length){M=S=w=x=y=v=void 0;var v=m,b=i;if(v.updateMorphTargets(),void 0!==b.weights)for(var y=0,x=b.weights.length;y<x;y++)v.morphTargetInfluences[y]=b.weights[y];if(b.extras&&Array.isArray(b.extras.targetNames)){var w=b.extras.targetNames;if(v.morphTargetInfluences.length===w.length){v.morphTargetDictionary={};for(var S=0,M=w.length;S<M;S++)v.morphTargetDictionary[w[S]]=S}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}m.name=t.createUniqueName(i.name||"mesh_"+e),ve(m,i),f.extensions&&ge(a,m,f),t.assignFinalMaterial(m),c.push(m)}for(var T=0,_=c.length;T<_;T++)t.associations.set(c[T],{meshes:e,primitives:T});if(1===c.length)return c[0];var E=new n.Group;t.associations.set(E,{meshes:e});for(var k=0,D=c.length;k<D;k++)E.add(c[k]);return E}))}},{key:"loadCamera",value:function(e){var t,r=(e=this.json.cameras[e])[e.type];if(r)return"perspective"===e.type?t=new n.PerspectiveCamera(n.MathUtils.radToDeg(r.yfov),r.aspectRatio||1,r.znear||1,r.zfar||2e6):"orthographic"===e.type&&(t=new n.OrthographicCamera(-r.xmag,r.xmag,r.ymag,-r.ymag,r.znear,r.zfar)),e.name&&(t.name=this.createUniqueName(e.name)),ve(t,e),Promise.resolve(t);console.warn("THREE.GLTFLoader: Missing camera parameters.")}},{key:"loadSkin",value:function(e){for(var t=this.json.skins[e],r=[],a=0,i=t.joints.length;a<i;a++)r.push(this.getDependency("node",t.joints[a]));return void 0!==t.inverseBindMatrices?r.push(this.getDependency("accessor",t.inverseBindMatrices)):r.push(null),Promise.all(r).then((function(e){for(var r=e.pop(),a=e,i=[],s=[],o=0,l=a.length;o<l;o++){var c=a[o];c?(i.push(c),c=new n.Matrix4,null!==r&&c.fromArray(r.array,16*o),s.push(c)):console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[o])}return new n.Skeleton(i,s)}))}},{key:"loadAnimation",value:function(e){for(var t=this.json.animations[e],r=[],a=[],i=[],s=[],o=[],l=0,c=t.channels.length;l<c;l++){var u=t.channels[l],h=t.samplers[u.sampler],d=(u=u.target).node,p=void 0!==t.parameters?t.parameters[h.input]:h.input,f=void 0!==t.parameters?t.parameters[h.output]:h.output;r.push(this.getDependency("node",d)),a.push(this.getDependency("accessor",p)),i.push(this.getDependency("accessor",f)),s.push(h),o.push(u)}return Promise.all([Promise.all(r),Promise.all(a),Promise.all(i),Promise.all(s),Promise.all(o)]).then((function(r){for(var a=r[0],i=r[1],s=r[2],o=r[3],l=r[4],c=[],u=0,h=a.length;u<h;u++)!function(e){var t=a[e],r=i[e],u=s[e],h=o[e],d=l[e];if(void 0!==t){t.updateMatrix();var p=void 0;switch(fe[d.path]){case fe.weights:p=n.NumberKeyframeTrack;break;case fe.rotation:p=n.QuaternionKeyframeTrack;break;default:p=n.VectorKeyframeTrack}e=t.name||t.uuid;var f=void 0!==h.interpolation?me[h.interpolation]:n.InterpolateLinear,m=[],g=(fe[d.path]===fe.weights?t.traverse((function(e){e.morphTargetInfluences&&m.push(e.name||e.uuid)})):m.push(e),u.array);if(u.normalized){for(var v=ye(g.constructor),b=new Float32Array(g.length),y=0,x=g.length;y<x;y++)b[y]=g[y]*v;g=b}for(var w=0,S=m.length;w<S;w++){var M=new p(m[w]+"."+fe[d.path],r.array,g,f);"CUBICSPLINE"===h.interpolation&&(M.createInterpolant=function(e){return new(this instanceof n.QuaternionKeyframeTrack?oe:ie)(this.times,this.values,this.getValueSize()/3,e)},M.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0),c.push(M)}}}(u);return r=t.name||"animation_"+e,new n.AnimationClip(r,void 0,c)}))}},{key:"createNodeMesh",value:function(e){var t=this.json,r=this,n=t.nodes[e];return void 0===n.mesh?null:r.getDependency("mesh",n.mesh).then((function(e){return e=r._getNodeRef(r.meshCache,n.mesh,e),void 0!==n.weights&&e.traverse((function(e){if(e.isMesh)for(var t=0,r=n.weights.length;t<r;t++)e.morphTargetInfluences[t]=n.weights[t]})),e}))}},{key:"loadNode",value:function(e){var t=this.json,r=this.extensions,a=this,i=t.nodes[e],s=i.name?a.createUniqueName(i.name):"";return function(){for(var t=[],r=a._invokeOne((function(t){return t.createNodeMesh&&t.createNodeMesh(e)})),n=(r&&t.push(r),void 0!==i.camera&&t.push(a.getDependency("camera",i.camera).then((function(e){return a._getNodeRef(a.cameraCache,i.camera,e)}))),a._invokeAll((function(t){return t.createNodeAttachment&&t.createNodeAttachment(e)})).forEach((function(e){t.push(e)})),[]),s=i.children||[],o=0,l=s.length;o<l;o++)n.push(a.getDependency("node",s[o]));return r=void 0===i.skin?Promise.resolve(null):a.getDependency("skin",i.skin),Promise.all([Promise.all(t),Promise.all(n),r])}().then((function(t){var o=t[0],l=t[1],c=t[2],u=!0===i.isBone?new n.Bone:1<o.length?new n.Group:1===o.length?o[0]:new n.Object3D;if(u!==o[0])for(var h=0,d=o.length;h<d;h++)u.add(o[h]);i.name&&(u.userData.name=i.name,u.name=s),ve(u,i),i.extensions&&ge(r,u,i),void 0!==i.matrix?((t=new n.Matrix4).fromArray(i.matrix),u.applyMatrix4(t)):(void 0!==i.translation&&u.position.fromArray(i.translation),void 0!==i.rotation&&u.quaternion.fromArray(i.rotation),void 0!==i.scale&&u.scale.fromArray(i.scale)),a.associations.has(u)||a.associations.set(u,{}),a.associations.get(u).nodes=e,null!==c&&u.traverse((function(e){e.isSkinnedMesh&&e.bind(c,xe)}));for(var p=0,f=l.length;p<f;p++)u.add(l[p]);return a.options.ex.loadNode({node:u,nodeDef:i})||u}))}},{key:"loadScene",value:function(e){for(var t=this.extensions,r=(e=this.json.scenes[e],this),a=new n.Group,i=(e.name&&(a.name=r.createUniqueName(e.name)),ve(a,e),e.extensions&&ge(t,a,e),e.nodes||[]),s=[],o=0,l=i.length;o<l;o++)s.push(r.getDependency("node",i[o]));return Promise.all(s).then((function(e){for(var t=0,i=e.length;t<i;t++)a.add(e[t]);return r.options.ex.loadScene(a),r.associations=function(e){var t,a=new Map,i=k(r.associations);try{for(i.s();!(t=i.n()).done;){var s=T(t.value,2),o=s[0],l=s[1];(o instanceof n.Material||o instanceof n.Texture)&&a.set(o,l)}}catch(e){i.e(e)}finally{i.f()}return e.traverse((function(e){var t=r.associations.get(e);null!=t&&a.set(e,t)})),a}(a),a}))}}]),e}();function Se(e,t,r){var a,i=t.attributes,s=[];for(a in i){var o=pe[a]||a.toLowerCase();o in e.attributes||s.push(function(t,n){return r.getDependency("accessor",t).then((function(t){e.setAttribute(n,t)}))}(i[a],o))}void 0===t.indices||e.index||(l=r.getDependency("accessor",t.indices).then((function(t){e.setIndex(t)})),s.push(l)),ve(e,t);var l=e,c=t,u=r,h=c.attributes,d=new n.Box3;if(void 0!==h.POSITION){var p=(h=u.json.accessors[h.POSITION]).min,f=h.max;if(void 0===p||void 0===f)console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");else{d.set(new n.Vector3(p[0],p[1],p[2]),new n.Vector3(f[0],f[1],f[2])),h.normalized&&(p=ye(ce[h.componentType]),d.min.multiplyScalar(p),d.max.multiplyScalar(p));var m=c.targets;if(void 0!==m){for(var g=new n.Vector3,v=new n.Vector3,b=0,y=m.length;b<y;b++){var x,w,S=m[b];void 0!==S.POSITION&&(w=(S=u.json.accessors[S.POSITION]).min,x=S.max,void 0!==w&&void 0!==x?(v.setX(Math.max(Math.abs(w[0]),Math.abs(x[0]))),v.setY(Math.max(Math.abs(w[1]),Math.abs(x[1]))),v.setZ(Math.max(Math.abs(w[2]),Math.abs(x[2]))),S.normalized&&(w=ye(ce[S.componentType]),v.multiplyScalar(w)),g.max(v)):console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION."))}d.expandByVector(g)}l.boundingBox=d,f=new n.Sphere,d.getCenter(f.center),f.radius=d.min.distanceTo(d.max)/2,l.boundingSphere=f}}return Promise.all(s).then((function(){if(void 0===t.targets)return e;for(var n=e,a=t.targets,i=r,s=!1,o=!1,l=!1,c=0,u=a.length;c<u;c++){var h=a[c];if(void 0!==h.POSITION&&(s=!0),void 0!==h.NORMAL&&(o=!0),void 0!==h.COLOR_0&&(l=!0),s&&o&&l)break}if(!s&&!o&&!l)return Promise.resolve(n);for(var d=[],p=[],f=[],m=0,g=a.length;m<g;m++){var v,b=a[m];s&&(v=void 0!==b.POSITION?i.getDependency("accessor",b.POSITION):n.attributes.position,d.push(v)),o&&(v=void 0!==b.NORMAL?i.getDependency("accessor",b.NORMAL):n.attributes.normal,p.push(v)),l&&(b=void 0!==b.COLOR_0?i.getDependency("accessor",b.COLOR_0):n.attributes.color,f.push(b))}return Promise.all([Promise.all(d),Promise.all(p),Promise.all(f)]).then((function(e){var t=e[0],r=e[1];return e=e[2],s&&(n.morphAttributes.position=t),o&&(n.morphAttributes.normal=r),l&&(n.morphAttributes.color=e),n.morphTargetsRelative=!0,n}))}))}var Me=r(1794),Te=r(6272);class _e{constructor(e,t){this.runScene=e,this.helper=t}setTextureLoader(e){this.textureLoader=e,this.initTextureLoader(e)}initTextureLoader(e){e instanceof w?(this.helper.isImageBitmapLoader=!0,e.setOptions({reverseTexture:this.helper.loadConfig.reverseTexture,textureQuality:this.runScene.optionsEx.options.texture.quality})):this.helper.isImageBitmapLoader=!1}}class Ee{constructor(e,t){this.pending=[],this.models=[],this.module=new Me.Z,this.isImageBitmapLoader=!0,this.runScene=e,this.loadConfig=t,this.options=new _e(e,this),this.callback("mountModule",null)}beforeLoader(e){this.callback("getJSON",e),this.json=e;var t=this.processBase64(e);return"editor"===this.runScene.optionsEx.options.mode?(this.callback("beforeParse",e),!0):(t&&this.callback("beforeParse",e),t)}loadTexture(e){this.callback("loadTexture",e)}processBase64(e){if(null==(t=e.asset)||!t.ex)return!0;var t=e.asset.ex.base64;return!t||!!(e=(0,Te.Ne)(t))&&(t=Number(e),!isNaN(t)&&(new Date).getTime()<t)}callback(e,t){var r,n;return this.loadConfig.triggerCb&&null!=(r=null==(n=this.runScene.cb.loaderer.gltf[e])?void 0:n.cb)&&r.call(n,t),null!=(n=null==(r=this.loadConfig.callBack)?void 0:r[e])&&n.call(r,t),this.runScene.exporter.gltf.module.loadCallback({type:e,json:this.json,data:t,config:this.loadConfig,core:this})}loadMaterial(e){this.callback("loadMaterial",e)}loadNode(e){if(1===(e=this.callback("loadNode",e)).length)return e[0]}}class ke{constructor(e,t){this.options=e,this.runScene=t}static getGltfLoader(e){let t=this._gltf;if(!t){t=this._gltf=new j;const r=new d;r.setDecoderPath(e),this._gltf.setMeshoptDecoder(s),this._gltf.setDRACOLoader(r)}return t}parse(e){const{arrayBuffer:t,onDone:r,onError:n}=e;ke.getGltfLoader(this.runScene.optionsEx.options.decodePath).parse(t,"",r,(e=>{console.log(e,"e"),n(e)}),this)}valid(e){return this.options.core.beforeLoader(e)}loadTexture(e){return this.options.core.loadTexture(e)}loadMaterial(e){return this.options.core.loadMaterial(e)}loadNode(e){return this.options.core.loadNode(e)}setTextureLoader(e){this.options.core.options.setTextureLoader(e)}loadScene(e){this.scene=e,this.options.models.push(e)}onBuildNodeHierarchy(e){const{nodeId:t,parentObject:r,node:n,idMap:a,children:i}=e;a&&a.set(t,n);try{if(void 0!==i&&(null==i?void 0:i.length)===r.children.length){let e=!0;i.forEach((t=>{a.get(t)||(e=!1)})),e&&(r.children=[...a.entries()].sort(((e,t)=>e[0]-t[0])).map((e=>{var[,e]=e;return e})),a.clear())}}catch(e){console.log(e,"e")}}}class De{constructor(e){this.dracoPath="./draco/",this._gltf=new j,this.runScene=e}init(){const e=new d;e.setDecoderPath(this.runScene.optionsEx.options.decodePath),this._gltf.setMeshoptDecoder(s),this._gltf.setDRACOLoader(e)}load(e,t){return function(e,t,r,n){return new(r=r||Promise)((function(t,a){function i(e){try{o(n.next(e))}catch(e){a(e)}}function s(e){try{o(n.throw(e))}catch(e){a(e)}}function o(e){var n;e.done?t(e.value):((n=e.value)instanceof r?n:new r((function(e){e(n)}))).then(i,s)}o((n=n.apply(e,[])).next())}))}(this,0,void 0,(function*(){var r=yield a().get(e,{responseType:"arraybuffer",onDownloadProgress:e=>{var r,{total:e,loaded:n}=e;let a=n/e;1<(a=a<0?0:a)&&(a=1);var n=Number(a.toFixed(2));e=Math.floor(100*n),null!=(r=null==(n=null==t?void 0:t.callBack)?void 0:n.progress)&&r.call(n,e),this.runScene.optionsEx.log("下载场景进度:"+e,"detail"),null!=t&&t.triggerCb&&this.runScene.cb.loaderer.gltf.progress.cb(e)}}).then((e=>e.data)).catch((e=>{this.runScene.optionsEx.log("下载场景失败:",e)}));return r?this.parse(r,t):Promise.resolve()}))}parse(e,t){const r=(0,S.deepMergeObject)({cleanJSON:!0,triggerCb:!1,reverseTexture:!1,callBack:{mountModule:void 0,getJSON:void 0,beforeParse:void 0,afterParse:void 0,lazyLoadedTexture:void 0,loaded:void 0,loadMaterial:void 0,loadNode:void 0,modelLoaded:void 0,progress:void 0,getArrayBuffer:void 0,complete:void 0,loadedGltf:void 0,loadTexture:void 0},module:{light:!0,model:!0,camera:!0,controls:!0,tags:!0,objects:!0,timeline:!0,sceneConfig:!0}},t||{}),n=new Ee(this.runScene,r);return n.callback("getArrayBuffer",e),new Promise((t=>{new ke({rootModel:this.runScene.assetsEx.get().scene,models:[],core:n,runScene:this.runScene,loadConfig:r,mode:this.runScene.optionsEx.options.mode},this.runScene).parse({arrayBuffer:e,onDone:e=>{n.callback("loadedGltf",e);try{this.afterParse(e.parser.options.ex.options,e,r)}catch(e){this.runScene.cb.error.cb({tip:"加载glb出错",msg:e}),console.log(e,"e")}t(n.models)},onError:e=>{console.log(e,"_a")}})}))}afterParse(e,t,r){var n;const a=e.core;a.callback("afterParse",{options:e,json:t,loadConfig:r});var{cleanJSON:r,callBack:i}=r;if(!t.asset.ex){const{models:r,core:n}=e,a=this.runScene.sceneEx.cleanUnlessLevel(r[0]);n.models.push(a),0<t.animations.length&&(a.animations=[...t.animations])}this.runScene.optionsEx.log(t,"detail"),Promise.all(a.pending).then((()=>{a.callback("complete",{models:e.models,json:t})})),null!=(n=null==i?void 0:i.getJSON)&&n.call(i,t),r&&this.disposeJSON(t)}disposeJSON(e){}}var Oe=r(3736),Pe=r(110);class Ae{constructor(e){this._objectLoader=new n.ObjectLoader,this.runScene=e,this._parser=new Ce(e)}parse(e){return function(e,t,r,n){return new(r=r||Promise)((function(t,a){function i(e){try{o(n.next(e))}catch(e){a(e)}}function s(e){try{o(n.throw(e))}catch(e){a(e)}}function o(e){var n;e.done?t(e.value):((n=e.value)instanceof r?n:new r((function(e){e(n)}))).then(i,s)}o((n=n.apply(e,[])).next())}))}(this,0,void 0,(function*(){var t=yield this._objectLoader.parseAsync(JSON.parse(e));return this._parser.afterParse(this.runScene.sceneEx.cleanUnlessLevel(t))}))}}class Ce{constructor(e){this.runScene=e}parseModel(e){e.material&&this.parseMaterial(e)}parseMaterial(e){var t=e.material;"SpriteMaterial"===t.type&&(0,Oe.M)(t,"type",Pe.Z.tools.type),this.runScene.uniqueEx.material.add(e.material)}afterParse(e){return e instanceof Array?e.map((e=>{e.traverse((e=>{this.parseModel(e)}))})):e.traverse((e=>{this.parseModel(e)})),e}}class Re{constructor(e){this.imgBitMap=new n.ImageBitmapLoader,this.object=new n.ObjectLoader,this.runScene=e,this.gltf=new De(e),this.json=new Ae(e)}init(){this.gltf.init()}}const Le=new class{constructor(){this.load=new n.AnimationLoader}parse(e){return this.load.parse(e)}}},7880:(e,t,r)=>{r.d(t,{Ws:()=>Q,ZP:()=>Y,ee:()=>J}),t=r(1863);var n,a,i=r(932),s=r(4707),o=r(8881),l=r(6651),c=r(3735),u=r(3736);class h{constructor(e){this.runScene=e}undo(e){var{material:e,list:t,val:r}=e;this.runScene.undoEx.addUndo(new c.Z({target:e,typeList:["uniforms",...t],newVal:r}).execute())}}(n=h).IgnoredAttributes=["_listeners","version","userData","uuid","name","type","defines"],h.TextureNames=["sideWallTex","backWallTex","floorTex","ceilingTex"],h.tools={type:"FakeInterior",getTextures:e=>{const t=[];return e.uniforms.ceilingTex.value&&t.push({type:"ceilingTex",texture:e.uniforms.ceilingTex.value}),e.uniforms.floorTex.value&&t.push({type:"floorTex",texture:e.uniforms.floorTex.value}),e.uniforms.sideWallTex.value&&t.push({type:"sideWallTex",texture:e.uniforms.sideWallTex.value}),e.uniforms.backWallTex.value&&t.push({type:"backWallTex",texture:e.uniforms.backWallTex.value}),t},create:(e,t)=>{var r=new o.ShaderMaterial({uniforms:(0,l.d9)(d.uniforms),vertexShader:d.vertexShader,fragmentShader:d.fragmentShader});return n.tools.bind(r),r},parseData:e=>{const{texture:t,normal:r,material:a}=e,{data:i,load:s}=t,c=new o.ShaderMaterial({uniforms:(0,l.d9)(d.uniforms),vertexShader:d.vertexShader,fragmentShader:d.fragmentShader}),u=[];return s&&u.push(...i.map((e=>()=>{"ceilingTex"===e.type?c.uniforms.ceilingTex.value=e.texture||null:"floorTex"===e.type?c.uniforms.floorTex.value=e.texture||null:"sideWallTex"===e.type?c.uniforms.sideWallTex.value=e.texture||null:"backWallTex"===e.type&&(c.uniforms.backWallTex.value=e.texture||null)}))),Object.keys(r.uniforms).filter((e=>!h.TextureNames.includes(e))).map((e=>{var t=r.uniforms[e];c.uniforms[e].value="roomsXYZPropsW"===e||"positionOffsetRoomsXYZPropsW"===e||"roomColorTint"===e?new o.Vector4(t.x,t.y,t.z,t.w):t})),c.name=r.name,c.userData.id=a.userData.id,n.tools.bind(c),{material:c,setTextureFns:u}},toNormal:e=>{const t=(0,i.createDefMaterial)(),r=(t.userData=Object.assign({},t.userData),{}),a=e.uniforms,s=d.uniforms;return Object.keys(a).filter((e=>!h.TextureNames.includes(e))).map((e=>{var t,n,i,l,c,u,h=a[e].value,d=s[e].value;h instanceof o.Vector4?(({x:t,y:n,z:i}=h),({x:l,y:c,z:u}=d),t===l&&n===c&&i===u||(r[e]=h)):h!==d&&(r[e]=h)})),{material:t,normal:{type:n.tools.type,uniforms:r,name:e.name},textures:n.tools.getTextures(e)}},clone:(e,t)=>e,copy:(e,t)=>{const r=n.tools.create(t);return Object.keys(r).filter((e=>!h.IgnoredAttributes.includes(e))).map((t=>{r[t]=e[t]})),r},bind:e=>{(0,u.M)(e,"type",n.tools.type)},validType:e=>"FakeInterior"===e.userData.type};const d={uniforms:{roomIntensity:{value:1},roomColorTint:{value:new o.Vector4(1,1,1,1)},sideWallTex:{value:null},backWallTex:{value:null},floorTex:{value:null},ceilingTex:{value:null},sideWallTexTiling:{value:.097},backWallTexTiling:{value:.097},floorTexTiling:{value:.15},ceilingTexTiling:{value:.15},roomTile:{value:.3},roomsXYZPropsW:{value:new o.Vector4(.35,.65,.1,1)},positionOffsetRoomsXYZPropsW:{value:new o.Vector4(4.7,2,-11,-3)},depthTest:{value:!0},depthWrite:{value:!0}},vertexShader:"\n varying vec2 vUv;\n varying vec3 vPos;\n varying mat4 vModelMatrix;\n \n void main() {\n vUv = uv;\n vPos = position;\n vModelMatrix = modelMatrix;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n }\n ",fragmentShader:"\n uniform float roomIntensity;\n uniform vec4 roomColorTint;\n \n uniform sampler2D sideWallTex;\n uniform sampler2D backWallTex;\n uniform sampler2D floorTex;\n uniform sampler2D ceilingTex;\n \n uniform float sideWallTexTiling;\n uniform float backWallTexTiling;\n uniform float floorTexTiling;\n uniform float ceilingTexTiling;\n \n uniform float roomTile;\n uniform vec4 roomsXYZPropsW;\n uniform vec4 positionOffsetRoomsXYZPropsW;\n \n varying vec2 vUv;\n varying vec3 vPos;\n varying mat4 vModelMatrix;\n \n void main() {\n vec4 interpVertexPos = vec4(vPos.xyz, vPos.z);\n // 将相机世界空间坐标转换为对象空间坐标\n vec4 cameraObjectPos = inverse(vModelMatrix) * vec4(cameraPosition, 1.0);\n vec4 transCameraPos = vec4(cameraObjectPos.xyz, cameraObjectPos.z);\n \n vec4 temp1 = (interpVertexPos - positionOffsetRoomsXYZPropsW);\n vec4 temp2 = ((roomsXYZPropsW + vec4(-1E-05, -1E-05, -1E-05, -1E-05)) * roomTile);\n vec4 V2 = transCameraPos - positionOffsetRoomsXYZPropsW;\n vec4 V1 = temp1 - V2;\n vec4 middleman = ((floor(temp2 * temp1) + step(vec4(0, 0, 0, 0), V1)) / temp2 - V2) / V1;\n \n // Side Walls\n vec2 sideWallUv = (middleman.x * V1 + V2).zy * sideWallTexTiling;\n vec4 sideWallColor = texture2D(sideWallTex, sideWallUv);\n \n // Back Wall\n vec2 backWallUv = (middleman.z * V1 + V2).xy * backWallTexTiling;\n vec4 backWallColor = texture2D(backWallTex, backWallUv);\n \n // Floor Ceiling\n vec2 floorUv = ((middleman.y * V1) + V2).xz * floorTexTiling;\n vec2 ceilingUv = ((middleman.y * V1) + V2).xz * ceilingTexTiling;\n vec4 floorColor = texture2D(floorTex, floorUv);\n vec4 ceilingColor = texture2D(ceilingTex, ceilingUv);\n vec4 cfColor = mix(floorColor, ceilingColor, step(0.0, V1.y));\n \n // Mix\n float compareXZ = 0.0;\n float stepXZ = step(middleman.z, middleman.x);\n if(stepXZ <= 0.0)\n compareXZ = middleman.x;\n else\n compareXZ = middleman.z;\n \n vec4 wallColor = vec4(0);\n if(stepXZ <= 0.0)\n wallColor = sideWallColor;\n else\n wallColor = backWallColor;\n \n vec4 finalColor = vec4(0);\n if(middleman.y <= compareXZ)\n finalColor = cfColor;\n else\n finalColor = wallColor;\n \n // Tint Room\n vec4 tintColor = roomColorTint * finalColor * roomIntensity;\n \n gl_FragColor = tintColor;\n }\n "};class p{constructor(e){this.runScene=e}undo(e){var{material:e,list:t,val:r}=e;this.runScene.undoEx.addUndo(new c.Z({target:e,typeList:[...t],newVal:r}).execute())}}(a=p).IgnoredAttributes=["_listeners","version","userData","uuid","name","type","defines"],p.TextureNames=["envMap","displacementMap"],p.tools={type:"Fresnel",getTextures:e=>{const t=[];return e.envMap&&t.push({type:"envMap",texture:e.envMap}),e.displacementMap&&t.push({type:"displacementMap",texture:e.displacementMap}),t},create:(e,t)=>{const r=new f(void 0,void 0,e);return r.insertFresnelShader(),a.tools.bind(r),(t=t||e.modelEx.select)&&(r.name=t.name),r},parseData:(e,t)=>{const{texture:r,normal:n,material:s}=e,{data:o,load:l}=r,c=(0,i.mergeMaterial)(s,new f(void 0,void 0,t)),u=[];return l&&u.push(...o.map((e=>()=>{c[e.type]=e.texture}))),Object.keys(n.uniforms).filter((e=>!p.TextureNames.includes(e))).map((e=>{c[e]=n.uniforms[e]})),c.insertFresnelShader(),c.name=n.name,c.userData.id=s.userData.id,a.tools.bind(c),{material:c,setTextureFns:u}},toNormal:e=>{const t=(0,i.mergeMaterial)(e,(0,i.createDefMaterial)()),r=(t.userData=Object.assign({},t.userData),t.name=e.name,{}),n=m.uniforms;return Object.keys(n).filter((e=>!p.TextureNames.includes(e))).map((t=>{var a=e[t],i=n[t].value;"fresnelBias"===t||"fresnelScale"===t||"fresnelPower"===t||"isSurge"===t?a.value!==i&&(r[t]=a):a!==i&&(r[t]=a)})),{material:t,normal:{type:a.tools.type,uniforms:r,name:e.name},textures:a.tools.getTextures(e)}},clone:(e,t)=>e,copy:(e,t)=>{const r=a.tools.create(t);return Object.keys(r).filter((e=>!p.IgnoredAttributes.includes(e))).map((t=>{r[t]=e[t]})),r},bind:e=>{(0,u.M)(e,"type",a.tools.type)},validType:e=>"Fresnel"===e.userData.type};class f extends o.MeshPhysicalMaterial{constructor(e,t,r){if(e?super(e):(super(),this.emissive=new o.Color(65535),this.envMap=null,this.displacementMap=null,this.metalness=0,this.roughness=0,this.ior=1.5,this.transmission=1,this.opacity=1,this.transparent=!0,this.thickness=0),this.runScene=r,this.isSpecialMaterial=!0,t?(this.fresnelBias=new o.Uniform(t.fresnelBias),this.fresnelScale=new o.Uniform(t.fresnelScale),this.fresnelPower=new o.Uniform(t.fresnelPower)):(this.fresnelBias=new o.Uniform(m.uniforms.fresnelBias.value),this.fresnelScale=new o.Uniform(m.uniforms.fresnelScale.value),this.fresnelPower=new o.Uniform(m.uniforms.fresnelPower.value)),this.clock=new o.Clock,this.isSurge=new o.Uniform(!1),this.deltaTime=new o.Uniform(0),!this.cubeCamera){const e=new o.WebGLCubeRenderTarget(2048);e.texture.mapping=o.CubeRefractionMapping,this.cubeCamera=new o.CubeCamera(.1,1e5,e),this.runScene.assetsEx.scene.add(this.cubeCamera),this.runScene.cb.render.add("Fresnel",(()=>{this.update()}))}}insertFresnelShader(){this.onBeforeCompile=e=>{e.uniforms.isSurge=this.isSurge,e.uniforms.deltaTime=this.deltaTime,e.uniforms.fresnelBias=this.fresnelBias,e.uniforms.fresnelScale=this.fresnelScale,e.uniforms.fresnelPower=this.fresnelPower,e.vertexShader=e.vertexShader.replace(/varying vec3 vWorldPosition;/g,m.vertexParas),e.vertexShader=e.vertexShader.replace(/#include <begin_vertex>/g,m.vertexShader1),e.vertexShader=e.vertexShader.replace(/vWorldPosition = worldPosition.xyz;/g,m.vertexShader2),e.fragmentShader=e.fragmentShader.replace(/#include <transmission_pars_fragment>/g,m.fragmentParas),e.fragmentShader=e.fragmentShader.replace(/vec3 totalEmissiveRadiance = emissive;/g,m.fragmentShaderEmissive)}}update(){this.clock&&(this.deltaTime.value+=3*this.clock.getDelta()),this.cubeCamera&&(this.cubeCamera.position.copy(this.runScene.assetsEx.camera.position),this.cubeCamera.update(this.runScene.assetsEx.renderer,this.runScene.assetsEx.scene))}}const m={uniforms:{depthTest:new o.Uniform(!0),depthWrite:new o.Uniform(!0),isSurge:new o.Uniform(!1),deltaTime:new o.Uniform(0),fresnelBias:new o.Uniform(0),fresnelScale:new o.Uniform(1),fresnelPower:new o.Uniform(3)},vertexParas:"\n uniform bool isSurge;\n uniform float deltaTime;\n varying vec3 vWorldPosition;\n varying vec3 vWorldNormal;\n ",vertexShader1:"\n vec3 transformed = vec3(position);\n if(isSurge) {\n // 0.15作为系数控制气泡表面波纹的稀疏程度,数值越大越密\n float wobbleValue = 0.15 * transformed.y + deltaTime;\n // 三角函数的系数控制气泡表面波纹的波动幅度,数值越大波幅越大\n vec3 wobblePos = vec3(0.75 * cos(wobbleValue) + 0.25 * sin(wobbleValue));\n transformed += wobblePos;\n }\n ",vertexShader2:"\n vWorldPosition = worldPosition.xyz;\n vWorldNormal = normalize(vec3(modelMatrix * vec4(normal, 0.0)));\n ",fragmentParas:"\n #include <transmission_pars_fragment>\n varying vec3 vWorldNormal;\n uniform float fresnelBias;\n uniform float fresnelScale;\n uniform float fresnelPower;\n ",fragmentShaderEmissive:"\n vec3 viewDir = normalize(cameraPosition - vWorldPosition);\n float fresnelNdot = dot(viewDir, vWorldNormal);\n float fresnelValue = fresnelBias + fresnelScale * pow(1.0 - fresnelNdot, fresnelPower);\n // fresnelValue = [0, 1], 0=center,1=edge\n \n vec3 totalEmissiveRadiance = emissive * fresnelValue;\n "};var g,v,b=r(3263),y=r(1398);const x={color:s.Gf.color,opacity:s.Gf.opacity};class w{constructor(e){this.runScene=e}}(g=w).tools={type:"LineBasicMaterial",bind(e){(0,u.M)(e,"type","LineBasicMaterial")},create:()=>{var e=new o.LineBasicMaterial;return g.tools.bind(e),e},parseData:e=>{const{texture:t,normal:r,core:n,material:a}=e,{data:i,load:s}=t,o=[];return s&&o.push(...b.F6.filter(i.map((e=>{const{type:t,texture:r}=e;if(r)return()=>{n.runScene.uniqueEx.texture.addMaterial(r,{material:a,type:t})}})))),n.runScene.materialEx.parseNromals(r,a),g.tools.bind(a),{material:a,setTextureFns:o}},toNormal:e=>({material:e.clone(),normal:{type:g.tools.type},textures:[]}),clone:(e,t)=>e,copy:e=>e.clone(),getTextures:()=>[],snapshot:{getDiff:e=>y.LV.getDiff(x,e),set:e=>{const{map:t,material:r,runScene:n,data:a}=e;y.LV.set({def:x,data:a,runScene:n,map:t,target:r}),t.data.completedCbs.push((()=>{(0,i.updateMaterial)(r)}))}},validType:e=>e.type===g.tools.type};class S{constructor(e){this.runScene=e}undo(e){const{material:t,list:r,val:n}=e;this.runScene.undoEx.addUndo(new c.Z({target:t,typeList:[...r],newVal:n,cb:()=>{t.needsUpdate=!0}}).execute())}}(v=S).IgnoredAttributes=["_listeners","version","userData","uuid","name","type","defines"],S.TextureNames=["alphaMap","bumpMap","displacementMap","map","normalMap","matcap"],S.tools={type:"Matcap",getTextures:e=>{const t=[];return S.TextureNames.forEach((r=>{e[r]&&t.push({type:r,texture:e[r]})})),t},create:(e,t)=>{const r=new o.MeshMatcapMaterial;return v.tools.bind(r),(t=t||e.modelEx.select)&&(r.name="Matcap-"+t.name),r},parseData:e=>{const{normal:t,texture:r,material:n}=e,{data:a,load:s}=r,l=(0,i.mergeMaterial)(n,new o.MeshMatcapMaterial),c=(delete l.emissive,[]);return s&&c.push(...a.map((e=>()=>{l[e.type]=e.texture}))),Object.keys(t.uniforms).filter((e=>!S.IgnoredAttributes.includes(e))).map((e=>{l[e]="normalScale"===e?new o.Vector2(t.uniforms[e].x,t.uniforms[e].y):t.uniforms[e]})),l.name=t.name,l.userData.id=n.userData.id,v.tools.bind(l),{material:l,setTextureFns:c}},toNormal:e=>{var t=v.tools.getTextures(e);const r=(0,i.mergeMaterial)(e,(0,i.createDefMaterial)()),n=(r.userData=Object.assign({},r.userData),r.name=e.name,{}),a=new o.MeshMatcapMaterial;return Object.keys(e).filter((e=>!S.TextureNames.includes(e))).filter((e=>!S.IgnoredAttributes.includes(e))).map((t=>{var r=e[t],i=a[t];"bumpScale"===t||"displacementScale"===t||"displacementBias"===t||"depthTest"===t||"depthWrite"===t||"transparent"===t||"opacity"===t?r!==i&&(n[t]=r):"normalScale"!==t||r.x===i.x&&r.y===i.y||(n[t]=r)})),{material:r,normal:{type:v.tools.type,uniforms:n,name:e.name},textures:t}},clone:(e,t)=>e,copy:(e,t)=>{const r=v.tools.create(t);return Object.keys(r).filter((e=>!S.IgnoredAttributes.includes(e))).map((t=>{r[t]=e[t]})),r},bind:e=>{(0,u.M)(e,"type",v.tools.type)},validType:e=>"Matcap"===e.userData.type};const M="\nvec3 mod289(vec3 x) {\n return x - floor(x * (1.0 / 289.0)) * 289.0;\n}\n\nvec2 mod289(vec2 x) {\n return x - floor(x * (1.0 / 289.0)) * 289.0;\n}\n\nvec3 permute(vec3 x) {\n return mod289(((x*34.0)+1.0)*x);\n}\n\nfloat noise2D(vec2 v) {\n const vec4 C = vec4(0.211324865405187, // (3.0-sqrt(3.0))/6.0\n 0.366025403784439, // 0.5*(sqrt(3.0)-1.0)\n -0.577350269189626, // -1.0 + 2.0 * C.x\n 0.024390243902439); // 1.0 / 41.0\n// First corner\nvec2 i = floor(v + dot(v, C.yy) );\nvec2 x0 = v - i + dot(i, C.xx);\n\n// Other corners\nvec2 i1;\n//i1.x = step( x0.y, x0.x ); // x0.x > x0.y ? 1.0 : 0.0\n//i1.y = 1.0 - i1.x;\ni1 = (x0.x > x0.y) ? vec2(1.0, 0.0) : vec2(0.0, 1.0);\n// x0 = x0 - 0.0 + 0.0 * C.xx ;\n// x1 = x0 - i1 + 1.0 * C.xx ;\n// x2 = x0 - 1.0 + 2.0 * C.xx ;\nvec4 x12 = x0.xyxy + C.xxzz;\nx12.xy -= i1;\n\n// Permutations\ni = mod289(i); // Avoid truncation effects in permutation\nvec3 p = permute( permute( i.y + vec3(0.0, i1.y, 1.0 )) + i.x + vec3(0.0, i1.x, 1.0 ));\n\nvec3 m = max(0.5 - vec3(dot(x0,x0), dot(x12.xy,x12.xy), dot(x12.zw,x12.zw)), 0.0);\nm = m*m ;\nm = m*m ;\n\n// Gradients: 41 points uniformly over a line, mapped onto a diamond.\n// The ring size 17*17 = 289 is close to a multiple of 41 (41*7 = 287)\n\nvec3 x = 2.0 * fract(p * C.www) - 1.0;\nvec3 h = abs(x) - 0.5;\nvec3 ox = floor(x + 0.5);\nvec3 a0 = x - ox;\n\n// Normalise gradients implicitly by scaling m\n// Approximation of: m *= inversesqrt( a0*a0 + h*h );\nm *= 1.79284291400159 - 0.85373472095314 * ( a0*a0 + h*h );\n\n// Compute final noise value at P\nvec3 g;\ng.x = a0.x * x0.x + h.x * x0.y;\ng.yz = a0.yz * x12.xz + h.yz * x12.yw;\nreturn 130.0 * dot(m, g);\n}\n ",T="\n vec3 mod289(vec3 x) {\n return x - floor(x * (1.0 / 289.0)) * 289.0;\n }\n \n vec4 mod289(vec4 x) {\n return x - floor(x * (1.0 / 289.0)) * 289.0;\n }\n \n vec4 permute(vec4 x) {\n return mod289(((x*34.0)+1.0)*x);\n }\n \n vec4 taylorInvSqrt(vec4 r) {\n return 1.79284291400159 - 0.85373472095314 * r;\n }\n \n float noise3D(vec3 v) {\n const vec2 C = vec2(1.0/6.0, 1.0/3.0);\n const vec4 D = vec4(0.0, 0.5, 1.0, 2.0);\n \n // First corner\n vec3 i = floor(v + dot(v, C.yyy));\n vec3 x0 = v - i + dot(i, C.xxx);\n \n // Other corners\n vec3 g = step(x0.yzx, x0.xyz);\n vec3 l = 1.0 - g;\n vec3 i1 = min(g.xyz, l.zxy);\n vec3 i2 = max(g.xyz, l.zxy);\n \n // x0 = x0 - 0.0 + 0.0 * C.xxx;\n // x1 = x0 - i1 + 1.0 * C.xxx;\n // x2 = x0 - i2 + 2.0 * C.xxx;\n // x3 = x0 - 1.0 + 3.0 * C.xxx;\n vec3 x1 = x0 - i1 + C.xxx;\n vec3 x2 = x0 - i2 + C.yyy;\n // 2.0*C.x = 1/3 = C.y\n vec3 x3 = x0 - D.yyy;\n // -1.0+3.0*C.x = -0.5 = -D.y\n \n // Permutations\n i = mod289(i);\n vec4 p = permute(permute(permute(i.z + vec4(0.0, i1.z, i2.z, 1.0 )) + i.y + vec4(0.0, i1.y, i2.y, 1.0 )) + i.x + vec4(0.0, i1.x, i2.x, 1.0 ));\n \n // Gradients: 7x7 points over a square, mapped onto an octahedron.\n // The ring size 17*17 = 289 is close to a multiple of 49 (49*6 = 294)\n float n_ = 0.142857142857; // 1.0/7.0\n vec3 ns = n_ * D.wyz - D.xzx;\n \n vec4 j = p - 49.0 * floor(p * ns.z * ns.z); // mod(p,7*7)\n \n vec4 x_ = floor(j * ns.z);\n vec4 y_ = floor(j - 7.0 * x_ ); // mod(j,N)\n \n vec4 x = x_ *ns.x + ns.yyyy;\n vec4 y = y_ *ns.x + ns.yyyy;\n vec4 h = 1.0 - abs(x) - abs(y);\n \n vec4 b0 = vec4( x.xy, y.xy );\n vec4 b1 = vec4( x.zw, y.zw );\n \n //vec4 s0 = vec4(lessThan(b0,0.0))*2.0 - 1.0;\n //vec4 s1 = vec4(lessThan(b1,0.0))*2.0 - 1.0;\n vec4 s0 = floor(b0)*2.0 + 1.0;\n vec4 s1 = floor(b1)*2.0 + 1.0;\n vec4 sh = -step(h, vec4(0.0));\n \n vec4 a0 = b0.xzyw + s0.xzyw*sh.xxyy;\n vec4 a1 = b1.xzyw + s1.xzyw*sh.zzww;\n \n vec3 p0 = vec3(a0.xy,h.x);\n vec3 p1 = vec3(a0.zw,h.y);\n vec3 p2 = vec3(a1.xy,h.z);\n vec3 p3 = vec3(a1.zw,h.w);\n \n //Normalise gradients\n vec4 norm = taylorInvSqrt(vec4(dot(p0,p0), dot(p1,p1), dot(p2, p2), dot(p3,p3)));\n p0 *= norm.x;\n p1 *= norm.y;\n p2 *= norm.z;\n p3 *= norm.w;\n \n // Mix final noise value\n vec4 m = max(0.6 - vec4(dot(x0,x0), dot(x1,x1), dot(x2,x2), dot(x3,x3)), 0.0);\n m = m * m;\n return 42.0 * dot( m*m, vec4( dot(p0,x0), dot(p1,x1), dot(p2,x2), dot(p3,x3) ) );\n }\n ",_={defines:{USE_UV:!0,USE_MAP:!0},uniforms:{mapArray:{value:[null,null,null,null,null,null]},maskArray:{value:[null,null,null,null,null]},mapUvTransArray:{value:[new o.Matrix3,new o.Matrix3,new o.Matrix3,new o.Matrix3,new o.Matrix3,new o.Matrix3]},maskUvTransArray:{value:[new o.Matrix3,new o.Matrix3,new o.Matrix3,new o.Matrix3,new o.Matrix3]},diffuse:{value:new o.Color(16777215)},uvTransform:{value:new o.Matrix3},shadowShade:{value:.6}},vertex:"\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n\nvoid main() {\n #include <uv_vertex>\n #include <uv2_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <worldpos_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n // vUv = (uvTransform * vec3(uv, 1.0)).xy;\n}\n ",fragment:"\nuniform vec3 diffuse;\nuniform float opacity;\n\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\n\n#define MAX_TEX 6\nuniform mat3 mapUvTransArray[MAX_TEX];\nuniform mat3 maskUvTransArray[MAX_TEX - 1];\nuniform sampler2D mapArray[MAX_TEX];\nuniform sampler2D maskArray[MAX_TEX - 1];\nuniform float shadowShade;\n\n// Insert Noise2D\nfloat sum(vec3 v) {return v.x + v.y + v.z;}\nvec3 textureNoTile(sampler2D tex, vec2 tUv, float offsetScale) {\n // cheap (cache friendly) lookup\n float k = noise2D(0.25 * tUv);\n\n float l = k * 8.0;\n float f = fract(l);\n float ia = floor(l);\n float ib = ia + 1.0;\n\n // can replace with any other hash\n vec2 offa = sin(vec2(3.0, 7.0) * ia);\n vec2 offb = sin(vec2(3.0, 7.0) * ib);\n\n vec2 duvdx = dFdx(tUv);\n vec2 duvdy = dFdy(tUv);\n vec3 cola = textureGrad(tex, tUv + offsetScale * offa, duvdx, duvdy).xyz;\n vec3 colb = textureGrad(tex, tUv + offsetScale * offb, duvdx, duvdy).xyz;\n\n return mix(cola, colb, smoothstep(0.2, 0.8, f - 0.1 * sum(cola-colb)));\n}\nvec4 texSampler(sampler2D tex, vec2 tUv, float offsetScale) {\n return vec4(textureNoTile(tex, tUv, offsetScale), 1.0);\n}\n\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4(diffuse, opacity);\n #include <logdepthbuf_fragment>\n \n // Custom UV Start\n #if MAX_TEX > 0\n vec2 vCustomMapUv[MAX_TEX];\n for (int i = 0; i < MAX_TEX; i++) {\n vCustomMapUv[i] = (mapUvTransArray[i] * vec3(vUv, 1.0)).xy;\n }\n #endif\n #if MAX_TEX > 1\n vec2 vCustomMaskUv[MAX_TEX - 1];\n for (int i = 0; i < MAX_TEX - 1; i++) {\n vCustomMaskUv[i] = (maskUvTransArray[i] * vec3(vUv, 1.0)).xy;\n }\n #endif\n // Custom UV End\n \n // Custom Texture Start\n float offsetScale = 1.2;\n vec4 maskColor = vec4(1.0);\n vec4 textureColor = vec4(1.0);\n #if MAX_TEX > 0\n textureColor = texSampler(mapArray[0], vCustomMapUv[0], offsetScale);\n #endif\n #if MAX_TEX > 1\n maskColor = texture2D(maskArray[0], vCustomMaskUv[0]);\n textureColor = mix(textureColor, texSampler(mapArray[1], vCustomMapUv[1], offsetScale), maskColor.r);\n #endif\n #if MAX_TEX > 2\n maskColor = texture2D(maskArray[1], vCustomMaskUv[1]);\n textureColor = mix(textureColor, texSampler(mapArray[2], vCustomMapUv[2], offsetScale), maskColor.r);\n #endif\n #if MAX_TEX > 3\n maskColor = texture2D(maskArray[2], vCustomMaskUv[2]);\n textureColor = mix(textureColor, texSampler(mapArray[3], vCustomMapUv[3], offsetScale), maskColor.r);\n #endif\n #if MAX_TEX > 4\n maskColor = texture2D(maskArray[3], vCustomMaskUv[3]);\n textureColor = mix(textureColor, texSampler(mapArray[4], vCustomMapUv[4], offsetScale), maskColor.r);\n #endif\n #if MAX_TEX > 5\n maskColor = texture2D(maskArray[4], vCustomMaskUv[4]);\n textureColor = mix(textureColor, texSampler(mapArray[5], vCustomMapUv[5], offsetScale), maskColor.r);\n #endif\n diffuseColor *= textureColor;\n // Custom Texture End\n \n // ReflectedLight reflectedLight = ReflectedLight(vec3(0.0), vec3(0.0), vec3(0.0), vec3(0.0));\n // reflectedLight.indirectDiffuse *= diffuseColor.rgb;\n // vec3 outgoingLight = reflectedLight.indirectDiffuse;\n vec3 outgoingLight = diffuseColor.rgb;\n #include <output_fragment>\n \n // gl_FragColor = vec4(diffuse, opacity * (1.0 - getShadowMask()));\n gl_FragColor.rgb *= vec3(getShadowMask() * (1.0 - shadowShade) + shadowShade);\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n}\n "};var E,k,D=r(3729);const O={diffuse:{type:"color",label:["uniforms","diffuse","value"],val:{r:1,g:1,b:1},shortKey:"df"},shadowShade:{type:"number",label:["uniforms","shadowShade","value"],val:.6,shortKey:"ss"},terrainMap0:{type:"texture",val:null,get:e=>(e=e.uniforms.mapArray.value[0])?(0,D.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.mapArray.value[0]=r},shortKey:"p0"},terrainMap1:{type:"texture",val:null,get:e=>(e=e.uniforms.mapArray.value[1])?(0,D.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.mapArray.value[1]=r},shortKey:"p1"},terrainMap2:{type:"texture",val:null,get:e=>(e=e.uniforms.mapArray.value[2])?(0,D.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.mapArray.value[2]=r},shortKey:"p2"},terrainMap3:{type:"texture",val:null,get:e=>(e=e.uniforms.mapArray.value[3])?(0,D.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.mapArray.value[3]=r},shortKey:"p3"},terrainMap4:{type:"texture",val:null,get:e=>(e=e.uniforms.mapArray.value[4])?(0,D.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.mapArray.value[4]=r},shortKey:"p4"},terrainMap5:{type:"texture",val:null,get:e=>(e=e.uniforms.mapArray.value[5])?(0,D.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.mapArray.value[5]=r},shortKey:"p5"},terrainMap6:{type:"texture",val:null,get:e=>(e=e.uniforms.mapArray.value[6])?(0,D.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.mapArray.value[6]=r},shortKey:"p6"},terrainMap7:{type:"texture",val:null,get:e=>(e=e.uniforms.mapArray.value[7])?(0,D.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.mapArray.value[7]=r},shortKey:"p7"},terrainMask0:{type:"texture",val:null,get:e=>(e=e.uniforms.maskArray.value[0])?(0,D.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.maskArray.value[0]=r},shortKey:"k0"},terrainMask1:{type:"texture",val:null,get:e=>(e=e.uniforms.maskArray.value[1])?(0,D.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.maskArray.value[1]=r},shortKey:"k1"},terrainMask2:{type:"texture",val:null,get:e=>(e=e.uniforms.maskArray.value[2])?(0,D.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.maskArray.value[2]=r},shortKey:"k2"},terrainMask3:{type:"texture",val:null,get:e=>(e=e.uniforms.maskArray.value[3])?(0,D.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.maskArray.value[3]=r},shortKey:"k3"},terrainMask4:{type:"texture",val:null,get:e=>(e=e.uniforms.maskArray.value[4])?(0,D.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.maskArray.value[4]=r},shortKey:"k4"},terrainMask5:{type:"texture",val:null,get:e=>(e=e.uniforms.maskArray.value[5])?(0,D.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.maskArray.value[5]=r},shortKey:"k5"},terrainMask6:{type:"texture",val:null,get:e=>(e=e.uniforms.maskArray.value[6])?(0,D.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.maskArray.value[6]=r},shortKey:"k6"}};class P{constructor(e){this.runScene=e}undo(e){var{material:e,list:t,val:r}=e;this.runScene.undoEx.addUndo(new c.Z({target:e,typeList:["uniforms",...t],newVal:r}).execute())}insertShader(e){e&&(e.onBeforeCompile=t=>{t.defines=_.defines,this.mergeUniforms(e.uniforms,t.uniforms),t.vertexShader=_.vertex,t.fragmentShader=_.fragment,t.fragmentShader=t.fragmentShader.replace(/\/\/ Insert Noise2D/g,M)})}mergeUniforms(e,t){if(e&&t)for(const r in e)t[r]=e[r]}onTexRepeatChange(e,t,r){e&&0<=t&&(r?(r=e.uniforms.mapArray.value[t],e.uniforms.mapUvTransArray.value[t].identity(),e.uniforms.mapUvTransArray.value[t].scale(r.repeat.x,r.repeat.y)):(r=e.uniforms.maskArray.value[t],e.uniforms.maskUvTransArray.value[t].identity(),e.uniforms.maskUvTransArray.value[t].scale(r.repeat.x,r.repeat.y)))}}(E=P).IgnoredAttributes=["_listeners","version","userData","uuid","name","type","defines"],P.TextureNames=["terrainMap0","terrainMap1","terrainMap2","terrainMap3","terrainMap4","terrainMap5","terrainMap6","terrainMap7","terrainMask0","terrainMask1","terrainMask2","terrainMask3","terrainMask4","terrainMask5","terrainMask6"],P.tools={type:"MixTexture",getTextures:e=>{const t=[];return P.TextureNames.forEach((r=>{var n=parseInt(r.slice(-1));r.startsWith("terrainMap")?e.uniforms.mapArray.value[n]&&t.push({type:r,texture:e.uniforms.mapArray.value[n]}):r.startsWith("terrainMask")&&e.uniforms.maskArray.value[n]&&t.push({type:r,texture:e.uniforms.maskArray.value[n]})})),t},create:(e,t)=>{const r=new o.ShadowMaterial({color:0,opacity:1});return r.uniforms=o.UniformsUtils.clone(_.uniforms),e.materialEx.def.map.MixTexture.insertShader(r),E.tools.bind(r),r},parseData:(e,t)=>{const{texture:r,normal:n,material:a}=e,{data:i,load:s}=r,l=new o.ShadowMaterial({color:0,opacity:1}),c=(l.uniforms=o.UniformsUtils.clone(_.uniforms),t.materialEx.def.map.MixTexture.insertShader(l),[]);return s&&c.push(...i.map((e=>()=>{var r=parseInt(e.type.slice(-1));e.type.startsWith("terrainMap")?(l.uniforms.mapArray.value[r]=e.texture,t.materialEx.def.map.MixTexture.onTexRepeatChange(l,r,!0)):e.type.startsWith("terrainMask")&&(l.uniforms.maskArray.value[r]=e.texture,t.materialEx.def.map.MixTexture.onTexRepeatChange(l,r,!1))}))),Object.keys(n.uniforms).filter((e=>!P.TextureNames.includes(e))).map((e=>{var t=n.uniforms[e];"diffuse"===e?l.uniforms[e].value=new o.Color(parseInt(t,16)):"uvTransform"!==e&&(l.uniforms[e].value=t)})),l.name=n.name,l.userData.id=a.userData.id,E.tools.bind(l),{material:l,setTextureFns:c}},toNormal:e=>{const t=(0,i.createDefMaterial)(),r=(t.userData=Object.assign(Object.assign({},t.userData),{normal:{type:E.tools.type,uniforms:{},name:e.name},textures:E.tools.getTextures(e)}),{}),n=e.uniforms,a=_.uniforms;return Object.keys(n).filter((e=>"mapArray"!==e&&"maskArray"!==e&&"mapUvTransArray"!==e&&"maskUvTransArray"!==e)).map((e=>{const t=n[e].value,i=a[e].value;"diffuse"===e?t.getHexString()!==i.getHexString()&&(r[e]=t.getHexString()):"uvTransform"!==e&&t!==i&&(r[e]=t)})),{material:t,normal:{type:E.tools.type,uniforms:r,name:e.name},textures:E.tools.getTextures(e)}},clone:(e,t)=>e,copy:(e,t)=>{const r=E.tools.create(t);return Object.keys(r).filter((e=>!P.IgnoredAttributes.includes(e))).map((t=>{r[t]=e[t]})),r},bind:e=>{(0,u.M)(e,"type",E.tools.type)},validType:e=>"MixTexture"===e.userData.type,snapshot:{getDiff:e=>y.LV.getDiff(O,e),set:e=>{const{map:t,material:r,runScene:n,data:a}=e;y.LV.set({def:O,data:a,runScene:n,map:t,target:r}),t.data.completedCbs.push((()=>{(0,i.updateMaterial)(r)}))}}};class A{constructor(e){this.runScene=e}}(k=A).tools={type:"MyPointsMaterial",bind(e){(0,u.M)(e,"type","MyPointsMaterial")},getTextures:e=>["map","alphaMap"].map((t=>{var r=e[t];if(r)return{type:t,texture:r}})).filter((e=>e)),create:(e,t)=>(t=t.modelEx.def.vertices.rain.createMaterial(e),k.tools.bind(t),t),parseData:(e,t)=>{var{texture:e,material:r,normal:n}=e;const{data:a,load:s}=e,o=[];var{name:e,size:n}=n;const l=A.tools.create({size:n},t);return(0,D.x)(l,(0,D.Ki)(r)),e&&(l.name=e),s&&o.push(...a.map((e=>{const{type:t,texture:r}=e;return()=>{l[t]=r,(0,i.updateMaterial)(l)}}))),{material:l,setTextureFns:o}},toNormal:e=>{const t=(0,i.createDefMaterial)();var r={type:A.tools.type,name:e.name,size:e.size};return t.map=e.map,t.userData=Object.assign({},t.userData),{normal:r,textures:A.tools.getTextures(e),material:t}},clone:e=>e,copy:e=>{const t=e.clone();return t.userData.type=A.tools.type,t}};var C,R=r(110);class L{constructor(e){this.runScene=e}undo(e){var{material:e,list:t,val:r}=e;this.runScene.undoEx.addUndo(new c.Z({target:e,typeList:[...t],newVal:r}).execute())}}(C=L).IgnoredAttributes=["_listeners","version","userData","uuid","name","type","defines"],L.TextureNames=["alphaMap","aoMap","bumpMap","displacementMap","emissiveMap","envMap","lightMap","map","metalnessMap","normalMap","roughnessMap","clearcoatMap","clearcoatNormalMap","clearcoatRoughnessMap","sheenRoughnessMap","sheenColorMap","specularIntensityMap","specularColorMap","thicknessMap","transmissionMap"],L.tools={type:"Physical",getTextures:e=>{const t=[];return L.TextureNames.forEach((r=>{e[r]&&t.push({type:r,texture:e[r]})})),t},create:(e,t)=>{const r=new o.MeshPhysicalMaterial;return C.tools.bind(r),(t=t||e.modelEx.select)&&(r.name="MeshPhysicalMaterial-"+t.name),r},parseData:e=>{const{normal:t,texture:r,material:n}=e,{data:a,load:s}=r,l=(0,i.mergeMaterial)(n,new o.MeshPhysicalMaterial),c=[];return s&&c.push(...a.map((e=>()=>{l[e.type]=e.texture}))),Object.keys(t.uniforms).filter((e=>!L.IgnoredAttributes.includes(e))).map((e=>{var r=t.uniforms[e];l[e]="attenuationColor"===e||"sheenColor"===e||"specularColor"===e?new o.Color(r):"clearcoatNormalScale"===e?new o.Vector2(r.x,r.y):r})),l.name=t.name,l.userData.id=n.userData.id,C.tools.bind(l),{material:l,setTextureFns:c}},toNormal:e=>{const t=(0,i.mergeMaterial)(e,(0,i.createDefMaterial)()),r=(t.userData=Object.assign({},t.userData),t.name=e.name,{}),n=new o.MeshPhysicalMaterial;return Object.keys(e).filter((e=>!L.TextureNames.includes(e))).filter((e=>!L.IgnoredAttributes.includes(e))).filter((e=>void 0===t[e])).map((t=>{const a=e[t],i=n[t];"attenuationColor"===t||"sheenColor"===t||"specularColor"===t?a.getHexString()!==i.getHexString()&&(r[t]=a.getHexString()):"clearcoatNormalScale"===t?a.x===i.x&&a.y===i.y||(r[t]=a):a!==i&&(r[t]=a)})),{material:t,normal:{type:C.tools.type,uniforms:r,name:e.name},textures:C.tools.getTextures(e)}},clone:(e,t)=>e,copy:(e,t)=>{const r=C.tools.create(t);return Object.keys(r).filter((e=>!L.IgnoredAttributes.includes(e))).map((t=>{r[t]=e[t]})),r},bind:e=>{(0,u.M)(e,"type",C.tools.type)},validType:e=>"MeshPhysicalMaterial"===e.type};var I=r(6001),B=r(5180);const j={uniforms:{tDiffuse:new o.Uniform(null),h:new o.Uniform(1/512)},vertexShader:"\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t}",fragmentShader:"\n\t\tuniform sampler2D tDiffuse;\n\t\tuniform float h;\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\t\t\tvec4 sum = vec4( 0.0 );\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 4.0 * h, vUv.y ) ) * 0.051;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 3.0 * h, vUv.y ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 2.0 * h, vUv.y ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 1.0 * h, vUv.y ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 1.0 * h, vUv.y ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 2.0 * h, vUv.y ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 3.0 * h, vUv.y ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 4.0 * h, vUv.y ) ) * 0.051;\n\t\t\t\n\t\t\tgl_FragColor = sum;\n\t\t}"},U={uniforms:{tDiffuse:new o.Uniform(null),v:new o.Uniform(1/512)},vertexShader:"\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t}",fragmentShader:"\n\t\tuniform sampler2D tDiffuse;\n\t\tuniform float v;\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\t\t\tvec4 sum = vec4( 0.0 );\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 4.0 * v ) ) * 0.051;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 3.0 * v ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 2.0 * v ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 1.0 * v ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 1.0 * v ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 2.0 * v ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 3.0 * v ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 4.0 * v ) ) * 0.051;\n\t\t\t\n\t\t\tgl_FragColor = sum;\n\t\t}"};var N,F;new o.Uniform(null),new o.Uniform(null),new o.Uniform(0),new o.Uniform(0),new o.Uniform(0),new o.Uniform(new o.Vector2),new o.Uniform(.1),new o.Uniform(1e3);class z{constructor(e){this.materials={},this.render=()=>{(0,I.mapObj)(this.materials,((e,t)=>{const{model:r,material:n}=t;n.update(r)}))},this.runScene=e,this.init(),this.runScene.cb.material.dispose.add("Reflector",this.dispose.bind(this))}init(){this.runScene.cb.render.add("Reflector-render",this.render),this.runScene.cb.model.add.add("",(({model:e})=>{var t;e.material&&"Reflector"===(null==(t=null==(t=e.material.userData)?void 0:t.tools)?void 0:t.type)&&(t=e.material,this.materials[t.userData.id]||(this.materials[t.userData.id]={model:e,material:t}))})),this.runScene.cb.model.remove.add("",(({model:e})=>{var t;e.material&&"Reflector"===(null==(t=null==(t=e.material.userData)?void 0:t.tools)?void 0:t.type)&&(t=e.material,delete this.materials[t.userData.id])}))}bindData(e){const t=e.material;var r=(0,I.getId)();t.userData.id=r,this.materials[r]=e}undo(e){var{material:e,list:t,val:r}=e;this.runScene.undoEx.addUndo(new c.Z({target:e,typeList:[...t],newVal:r}).execute())}dispose(){this.materials={}}}(N=z).IgnoredAttributes=["_listeners","version","userData","uuid","name","type","defines"],z.TextureNames=["map","normalMap","roughnessMap","metalnessMap","tDiffuse","tDiffuseBlur"],z.tools={type:"Reflector",getTextures:e=>(0,i.getTexturesByMaterial)(e),create:(e,t)=>{const r=new V(void 0,void 0,e);return r.insertReflectorShader(),N.tools.bind(r),(t=t||e.modelEx.select)&&(r.name=t.name),e.materialEx.def.map.Reflector.bindData({model:t,material:r}),r},parseData:(e,t)=>{const{texture:r,normal:n,models:a,material:s}=e,{data:l,load:c}=r,u=(0,i.mergeMaterial)(s,new V(void 0,void 0,t)),h=[];return c&&h.push(...l.map((e=>()=>{u[e.type]=e.texture}))),Object.keys(n.uniforms).filter((e=>!z.TextureNames.includes(e))).map((e=>{u[e]="normalScale"===e?new o.Vector2(n.uniforms[e].x,n.uniforms[e].y):n.uniforms[e]})),u.setRTSize(u.resolution),u.setBlurPass(u.blurSize),u.insertReflectorShader(),t.materialEx.def.map.Reflector.bindData({model:a[0],material:u}),u.name=n.name,u.userData.id=s.userData.id,N.tools.bind(u),{material:u,setTextureFns:h}},toNormal:e=>{const t=(0,i.mergeMaterial)(e,(0,i.createDefMaterial)()),r=(t.userData=Object.assign({},t.userData),t.name=e.name,{}),n=G.uniforms;return Object.keys(n).filter((e=>!z.TextureNames.includes(e))).map((t=>{var a=e[t],i=n[t].value;"mirror"===t||"mixBlur"===t||"mixStrength"===t||"mixContrast"===t?a.value!==i&&(r[t]=a):a!==i&&(r[t]=a)})),t.normalScale&&(r.normalScale=t.normalScale),{material:t,normal:{type:N.tools.type,uniforms:r,name:e.name},textures:N.tools.getTextures(e)}},clone:(e,t)=>e,copy:(e,t)=>{const r=N.tools.create(t);return Object.keys(r).filter((e=>!z.IgnoredAttributes.includes(e))).map((t=>{r[t]=e[t]})),r},bind:e=>{(0,u.M)(e,"type",N.tools.type)},validType:e=>"Reflector"===e.userData.type};class V extends o.MeshStandardMaterial{constructor(e,t,r){e?super(e):(super(),this.opacity=G.uniforms.opacity.value,this.transparent=G.uniforms.transparent.value,this.roughness=G.uniforms.roughness.value,this.metalness=G.uniforms.metalness.value),this.runScene=r,this.isSpecialMaterial=!0,t?(this.resolution=t.resolution,this.blurSize=t.blurSize,this.mirror=new o.Uniform(t.mirror),this.mixBlur=new o.Uniform(t.mixBlur),this.mixStrength=new o.Uniform(t.mixStrength),this.mixContrast=new o.Uniform(t.mixContrast)):(this.resolution=G.uniforms.resolution.value,this.blurSize=G.uniforms.blurSize.value,this.mirror=new o.Uniform(G.uniforms.mirror.value),this.mixBlur=new o.Uniform(G.uniforms.mixBlur.value),this.mixStrength=new o.Uniform(G.uniforms.mixStrength.value),this.mixContrast=new o.Uniform(G.uniforms.mixContrast.value)),this.textureMatrix=new o.Uniform(new o.Matrix4),this.reflectorWorldPosition=new o.Vector3,this.cameraWorldPosition=new o.Vector3,this.rotationMatrix=new o.Matrix4,this.normal=new o.Vector3,this.view=new o.Vector3,this.lookAtPosition=new o.Vector3,this.target=new o.Vector3,this.tempQuaternion=new o.Vector4,this.virtualCamera=new o.PerspectiveCamera,this.reflectorPlane=new o.Plane,this.clipPlane=new o.Vector4,e={minFilter:o.LinearFilter,magFilter:o.LinearFilter,type:o.HalfFloatType,encoding:this.runScene.assetsEx.get().renderer.outputEncoding},this.glRT1=new o.WebGLRenderTarget(this.resolution,this.resolution,e),this.glRT2=new o.WebGLRenderTarget(this.resolution,this.resolution,e),this.tDiffuse=new o.Uniform(this.glRT1.texture),this.tDiffuseBlur=new o.Uniform(this.glRT2.texture),this.hBlurPass=new B.T(j),this.hBlurPass.uniforms.h.value=1/this.blurSize,this.hBlurPass.clear=!1,this.hBlurPass.renderToScreen=!1,this.hBlurPass.enabled=0<this.blurSize,this.hBlurPass.material.depthWrite=!1,this.vBlurPass=new B.T(U),this.vBlurPass.uniforms.v.value=1/this.blurSize,this.vBlurPass.clear=!1,this.vBlurPass.renderToScreen=!1,this.vBlurPass.enabled=0<this.blurSize,this.vBlurPass.material.depthWrite=!1}insertReflectorShader(){this.onBeforeCompile=e=>{var t;null!=(t=e.defines)&&t.USE_UV||(e.defines.USE_UV=""),null!=(t=e.defines)&&t.USE_BLUR||(e.defines.USE_BLUR=""),e.uniforms.tDiffuse=this.tDiffuse,e.uniforms.tDiffuseBlur=this.tDiffuseBlur,e.uniforms.textureMatrix=this.textureMatrix,e.uniforms.mirror=this.mirror,e.uniforms.mixBlur=this.mixBlur,e.uniforms.mixStrength=this.mixStrength,e.uniforms.mixContrast=this.mixContrast,e.vertexShader=G.vertexParas+""+e.vertexShader,e.vertexShader=e.vertexShader.replace("#include <project_vertex>",G.vertexShader),e.fragmentShader=G.fragmentParas+""+e.fragmentShader,e.fragmentShader=e.fragmentShader.replace("#include <emissivemap_fragment>",G.fragmentShader)}}setRTSize(e){this.glRT1.setSize(e,e),this.glRT2.setSize(e,e),this.hBlurPass.setSize(e,e),this.vBlurPass.setSize(e,e)}setBlurPass(e){this.hBlurPass.enabled=0<e,this.hBlurPass.enabled&&(this.hBlurPass.uniforms.h.value=1/e),this.vBlurPass.enabled=0<e,this.vBlurPass.enabled&&(this.vBlurPass.uniforms.v.value=1/e)}copy(e){return super.copy(e),this.resolution=e.resolution,this.blurSize=e.blurSize,this.mirror.value=e.mirror.value,this.mixBlur.value=e.mixBlur.value,this.mixStrength.value=e.mixStrength.value,this.mixContrast.value=e.mixContrast.value,this}swapBuffers(){var e=this.glRT1;this.glRT1=this.glRT2,this.glRT2=e}beforeRender(e){if(this.reflectorWorldPosition.setFromMatrixPosition(e.matrixWorld),this.cameraWorldPosition.setFromMatrixPosition(this.runScene.assetsEx.get().camera.matrixWorld),this.rotationMatrix.extractRotation(e.matrixWorld),this.normal.set(0,0,1),this.normal.applyMatrix4(this.rotationMatrix),this.reflectorWorldPosition.addScaledVector(this.normal,0),this.view.subVectors(this.reflectorWorldPosition,this.cameraWorldPosition),!(0<this.view.dot(this.normal))){this.view.reflect(this.normal).negate(),this.view.add(this.reflectorWorldPosition),this.rotationMatrix.extractRotation(this.runScene.assetsEx.get().camera.matrixWorld),this.lookAtPosition.set(0,0,-1),this.lookAtPosition.applyMatrix4(this.rotationMatrix),this.lookAtPosition.add(this.cameraWorldPosition),this.target.subVectors(this.reflectorWorldPosition,this.lookAtPosition),this.target.reflect(this.normal).negate(),this.target.add(this.reflectorWorldPosition),this.virtualCamera.position.copy(this.view),this.virtualCamera.up.set(0,1,0),this.virtualCamera.up.applyMatrix4(this.rotationMatrix),this.virtualCamera.up.reflect(this.normal),this.virtualCamera.lookAt(this.target),this.virtualCamera.far=this.runScene.assetsEx.get().camera.far,this.virtualCamera.updateMatrixWorld(),this.virtualCamera.projectionMatrix.copy(this.runScene.assetsEx.get().camera.projectionMatrix),this.textureMatrix.value.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),this.textureMatrix.value.multiply(this.virtualCamera.projectionMatrix),this.textureMatrix.value.multiply(this.virtualCamera.matrixWorldInverse),this.textureMatrix.value.multiply(e.matrixWorld),this.reflectorPlane.setFromNormalAndCoplanarPoint(this.normal,this.reflectorWorldPosition),this.reflectorPlane.applyMatrix4(this.virtualCamera.matrixWorldInverse),this.clipPlane.set(this.reflectorPlane.normal.x,this.reflectorPlane.normal.y,this.reflectorPlane.normal.z,this.reflectorPlane.constant);const t=this.virtualCamera.projectionMatrix;this.tempQuaternion.x=(Math.sign(this.clipPlane.x)+t.elements[8])/t.elements[0],this.tempQuaternion.y=(Math.sign(this.clipPlane.y)+t.elements[9])/t.elements[5],this.tempQuaternion.z=-1,this.tempQuaternion.w=(1+t.elements[10])/t.elements[14],this.clipPlane.multiplyScalar(2/this.clipPlane.dot(this.tempQuaternion)),t.elements[2]=this.clipPlane.x,t.elements[6]=this.clipPlane.y,t.elements[10]=this.clipPlane.z+1,t.elements[14]=this.clipPlane.w}}update(e){e&&e.visible&&(this.beforeRender(e),e.visible=!1,this.runScene.assetsEx.get().renderer.setRenderTarget(this.glRT1),this.runScene.assetsEx.get().renderer.clear(),this.runScene.assetsEx.get().renderer.render(this.runScene.assetsEx.get().scene,this.virtualCamera),this.hBlurPass&&this.hBlurPass.enabled&&(this.hBlurPass.render(this.runScene.assetsEx.get().renderer,this.glRT2,this.glRT1,0,!1),this.swapBuffers()),this.vBlurPass&&this.vBlurPass.enabled&&(this.vBlurPass.render(this.runScene.assetsEx.get().renderer,this.glRT2,this.glRT1,0,!1),this.swapBuffers()),e.visible=!0,this.runScene.assetsEx.get().renderer.setRenderTarget(null))}}const G={uniforms:{opacity:new o.Uniform(1),transparent:new o.Uniform(!1),roughness:new o.Uniform(1),metalness:new o.Uniform(.6),resolution:new o.Uniform(1024),blurSize:new o.Uniform(1024),mirror:new o.Uniform(0),mixBlur:new o.Uniform(10),mixStrength:new o.Uniform(2),mixContrast:new o.Uniform(1),depthTest:new o.Uniform(!0),depthWrite:new o.Uniform(!0)},vertexParas:"\n uniform mat4 textureMatrix;\n varying vec4 my_vUv;\n ",vertexShader:"\n #include <project_vertex>\n my_vUv = textureMatrix * vec4(position, 1.0);\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n ",fragmentParas:"\n uniform sampler2D tDiffuse;\n uniform sampler2D tDiffuseBlur;\n uniform sampler2D tDepth;\n uniform sampler2D distortionMap;\n uniform float distortion;\n uniform float mirror;\n uniform float mixBlur;\n uniform float mixStrength;\n uniform float mixContrast;\n uniform float minDepthThreshold;\n uniform float maxDepthThreshold;\n uniform float depthScale;\n uniform float depthToBlurRatioBias;\n varying vec4 my_vUv;\n ",fragmentShader:"\n #include <emissivemap_fragment>\n float distortionFactor = 0.0;\n #ifdef USE_DISTORTION\n distortionFactor = texture2D(distortionMap, vUv).r * distortion;\n #endif\n \n vec4 new_vUv = my_vUv;\n new_vUv.x += distortionFactor;\n new_vUv.y += distortionFactor;\n \n vec4 base = texture2DProj(tDiffuse, new_vUv);\n vec4 blur = texture2DProj(tDiffuseBlur, new_vUv);\n \n vec4 merge = base;\n \n #ifdef USE_NORMALMAP\n vec2 normal_uv = vec2(0.0);\n vec4 normalColor = texture2D(normalMap, vUv * normalScale);\n vec3 my_normal = normalize( vec3( normalColor.r * 2.0 - 1.0, normalColor.b, normalColor.g * 2.0 - 1.0 ) );\n vec3 coord = new_vUv.xyz / new_vUv.w;\n normal_uv = coord.xy + coord.z * my_normal.xz * 0.05;\n vec4 base_normal = texture2D(tDiffuse, normal_uv);\n vec4 blur_normal = texture2D(tDiffuseBlur, normal_uv);\n merge = base_normal;\n blur = blur_normal;\n #endif\n \n float blurFactor = 0.0;\n float depthFactor = 0.0001;\n \n #ifdef USE_DEPTH\n vec4 depth = texture2DProj(tDepth, new_vUv);\n depthFactor = smoothstep(minDepthThreshold, maxDepthThreshold, 1.0-(depth.r * depth.a));\n depthFactor *= depthScale;\n depthFactor = max(0.0001, min(1.0, depthFactor));\n #ifdef USE_BLUR\n blur = blur * min(1.0, depthFactor + depthToBlurRatioBias);\n merge = merge * min(1.0, depthFactor + 0.5);\n #else\n merge = merge * depthFactor;\n #endif\n #endif\n \n float reflectorRoughnessFactor = roughness;\n #ifdef USE_ROUGHNESSMAP\n vec4 reflectorTexelRoughness = texture2D( roughnessMap, vUv );\n reflectorRoughnessFactor *= reflectorTexelRoughness.g;\n #endif\n \n #ifdef USE_BLUR\n blurFactor = min(1.0, mixBlur * reflectorRoughnessFactor);\n merge = mix(merge, blur, blurFactor);\n #endif\n \n vec4 newMerge = vec4(0.0, 0.0, 0.0, 1.0);\n newMerge.r = (merge.r - 0.5) * mixContrast + 0.5;\n newMerge.g = (merge.g - 0.5) * mixContrast + 0.5;\n newMerge.b = (merge.b - 0.5) * mixContrast + 0.5;\n \n diffuseColor.rgb = diffuseColor.rgb * ((1.0 - min(1.0, mirror)) + newMerge.rgb * mixStrength);\n "},H="\n#define STANDARD\n\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n varying vec3 vWorldPosition;\n#endif\n\n// Insert Noise3D\n\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n\nuniform float uTime;\nuniform float uWindForce;\nuniform float uWindSpeed;\nuniform float uWindWaveScale;\nvarying vec3 vWorldPos;\nvarying vec3 vWorldNor;\n\nvoid main() {\n #include <uv_vertex>\n #include <uv2_vertex>\n #include <color_vertex>\n #include <morphcolor_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n\n vec4 mvPosition = vec4(transformed, 1.0);\n #ifdef USE_INSTANCING\n mvPosition = instanceMatrix * mvPosition;\n #endif\n mvPosition = modelViewMatrix * mvPosition;\n\n // Wind Vertex Start\n vWorldNor = normalize((modelMatrix * vec4(transformedNormal, 1.0)).xyz);\n vWorldPos = (modelMatrix * vec4(transformed, 1.0)).xyz;\n float tSpeed = uTime * uWindSpeed * 5.0;\n float wNoise = noise3D((vWorldPos + vec3(tSpeed)) * uWindWaveScale);\n float pOffset = wNoise * uWindForce * 30.0;\n transformed.xyz += vec3(pOffset);\n gl_Position = projectionMatrix * modelViewMatrix * vec4(transformed, 1.0);\n // Wind Vertex End\n\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vViewPosition = - mvPosition.xyz;\n #include <worldpos_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n #ifdef USE_TRANSMISSION\n vWorldPosition = worldPosition.xyz;\n #endif\n}\n ",W="\n#define STANDARD\n#ifdef PHYSICAL\n#define IOR\n#define SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n uniform float ior;\n#endif\n#ifdef SPECULAR\n uniform float specularIntensity;\n uniform vec3 specularColor;\n#ifdef USE_SPECULARINTENSITYMAP\n uniform sampler2D specularIntensityMap;\n#endif\n#ifdef USE_SPECULARCOLORMAP\n uniform sampler2D specularColorMap;\n#endif\n#endif\n#ifdef USE_CLEARCOAT\n uniform float clearcoat;\n uniform float clearcoatRoughness;\n#endif\n#ifdef USE_IRIDESCENCE\n uniform float iridescence;\n uniform float iridescenceIOR;\n uniform float iridescenceThicknessMinimum;\n uniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n uniform vec3 sheenColor;\n uniform float sheenRoughness;\n#ifdef USE_SHEENCOLORMAP\n uniform sampler2D sheenColorMap;\n#endif\n#ifdef USE_SHEENROUGHNESSMAP\n uniform sampler2D sheenRoughnessMap;\n#endif\n#endif\n\nuniform vec3 uColorGradient;\nuniform float uColorLevel;\nuniform float uColorFade;\nuniform float uLeavesCore;\nuniform vec3 uLeavesSize;\nuniform vec3 uLeavesPos;\n//uniform float uDirectLightOffset;\n//uniform float uDirectLightInt;\n//uniform float uIndirectLightInt;\nvarying vec3 vViewPosition;\nvarying vec3 vWorldPos;\nvarying vec3 vWorldNor;\n\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <bsdfs>\n//#include <iridescence_fragment>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_physical_pars_fragment>\n#include <transmission_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n//#include <iridescence_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\n\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4(diffuse, opacity);\n ReflectedLight reflectedLight = ReflectedLight(vec3(0.0), vec3(0.0), vec3(0.0), vec3(0.0));\n vec3 totalEmissiveRadiance = emissive;\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <roughnessmap_fragment>\n #include <metalnessmap_fragment>\n\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n #include <clearcoat_normal_fragment_begin>\n #include <clearcoat_normal_fragment_maps>\n #include <emissivemap_fragment>\n\n #ifdef USE_MAP\n // Gradient Colors Start\n float normalizeY = vWorldPos.y / uLeavesSize.y;\n float secColorMask = saturate((normalizeY + uColorLevel) * uColorFade * 30.0);\n vec3 diffuseColor2 = uColorGradient * texture2D(map, vUv).rgb;\n vec3 mixColor = mix(diffuseColor.rgb, diffuseColor2, secColorMask);\n diffuseColor.rgb = mixColor;\n // Gradient Colors End\n #endif\n\n // Custom Normal Start\n vec3 leafCore = vec3(uLeavesPos.x, uLeavesPos.y + uLeavesCore * uLeavesSize.y, uLeavesPos.z);\n normal = normalize(vWorldPos - leafCore);\n // Custom Normal End\n\n #include <lights_physical_fragment>\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n #include <aomap_fragment>\n\n // 直射光:DirectLight = IncidentLight\n // float dotNL = saturate(dot(geometry.normal, directLight.direction));\n // vec3 irradiance = dotNL * directLight.color;\n // reflectedLight.directDiffuse += irradiance * BRDF_Lambert(material.diffuseColor);\n // 间接光:IndirectLight = ReflectedLight\n // vec3 irradiance = getAmbientLightIrradiance(ambientLightColor);\n // irradiance += getLightProbeIrradiance(lightProbe, geometry.normal);\n // irradiance += getHemisphereLightIrradiance(hemisphereLights[i], geometry.normal);\n // reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert(material.diffuseColor);\n\n // Custom Lighting Start\n // float dotNL = dot(geometry.normal, directLight.direction);\n // vec3 customIrradiance = clamp((dotNL + uDirectLightOffset), 0.01, 1.0) * vec3(1.0, 0.87, 0.67);\n // vec3 customDirectLight = customIrradiance * diffuseColor.rgb * uDirectLightInt;\n // vec3 customIndirectLight = (irradiance + vWorldNor * 0.001) * diffuseColor.rgb * uIndirectLightInt;\n // vec3 totalDiffuse = customDirectLight + customIndirectLight;\n // Custom Lighting End\n\n vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n #include <transmission_fragment>\n vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n #ifdef USE_SHEEN\n float sheenEnergyComp = 1.0 - 0.157 * max3(material.sheenColor);\n outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecular;\n #endif\n #ifdef USE_CLEARCOAT\n float dotNVcc = saturate(dot(geometry.clearcoatNormal, geometry.viewDir));\n vec3 Fcc = F_Schlick(material.clearcoatF0, material.clearcoatF90, dotNVcc);\n outgoingLight = outgoingLight * (1.0 - material.clearcoat * Fcc) + clearcoatSpecular * material.clearcoat;\n #endif\n #include <output_fragment>\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}\n ",K={emissive:s.Gf.emissive,alphaTest:{type:"number",val:0,shortKey:"at"},colorGradient:{type:"color",label:["uniforms","colorGradient","value"],val:{r:0,g:1,b:0},shortKey:"cg"}};class q{constructor(e){this.runScene=e}undo(e){const{material:t,list:r,val:n}=e;this.runScene.undoEx.addUndo(new c.Z({target:t,typeList:[...r],newVal:n,cb:()=>{t.needsUpdate=!0}}).execute())}}(F=q).IgnoredAttributes=["_listeners","version","userData","uuid","name","type","defines","onBeforeCompile"],q.TextureNames=["alphaMap","aoMap","displacementMap","emissiveMap","envMap","lightMap","map","metalnessMap","normalMap","roughnessMap"],q.tools={type:"TreeLeaf",getTextures:e=>{const t=[];return q.TextureNames.forEach((r=>{e[r]&&t.push({type:r,texture:e[r]})})),t},create:(e,t)=>{const r=new X(e);return F.tools.bind(r),(t=t||e.modelEx.select)&&(r.name=t.name,r.setSize(t),r.setWorldPos(t)),r},parseData:(e,t)=>{const{normal:r,texture:n,material:a,models:s}=e,{data:l,load:c}=n,u=(0,i.mergeMaterial)(a,new X(t)),h=(u.setSize(s[0]),u.setWorldPos(s[0]),[]);return c&&h.push(...l.map((e=>()=>{u[e.type]=e.texture}))),Object.keys(r.uniforms).filter((e=>!q.IgnoredAttributes.includes(e))).map((e=>{var t=r.uniforms[e];"color"!==e&&"emissive"!==e&&("normalScale"===e?u[e]=new o.Vector2(t.x,t.y):"windForce"===e||"windSpeed"===e||"windWaveScale"===e||"colorLevel"===e||"colorFade"===e||"leavesCore"===e?u.uniforms[e]=new o.Uniform(t):"colorGradient"===e?u.uniforms[e]=new o.Uniform(new o.Color(parseInt(t,16))):u[e]=r.uniforms[e])})),u.name=r.name,u.userData.id=a.userData.id,F.tools.bind(u),{material:u,setTextureFns:h}},toNormal:(e,t)=>{var r=F.tools.getTextures(e);const n=(0,i.mergeMaterial)(e,(0,i.createDefMaterial)()),a=(n.name=e.name,{}),s=new X(t);return Object.keys(e).filter((e=>!q.TextureNames.includes(e))).filter((e=>!q.IgnoredAttributes.includes(e))).map((t=>{var r=e[t],n=s[t];"color"!==t&&"emissive"!==t&&("normalScale"===t?r.x===n.x&&r.y===n.y||(a[t]=r):"uniforms"===t?Object.keys(r).map((t=>{const r=e.uniforms[t].value,n=s.uniforms[t].value;"windForce"===t||"windSpeed"===t||"windWaveScale"===t||"colorLevel"===t||"colorFade"===t||"leavesCore"===t?r!==n&&(a[t]=r):"colorGradient"===t&&r.getHexString()!==n.getHexString()&&(a[t]=r.getHexString())})):r!==n&&(a[t]=r))})),{material:n,normal:{type:F.tools.type,uniforms:a,name:e.name},textures:r}},clone:(e,t)=>e,copy:(e,t)=>{const r=F.tools.create(t);return Object.keys(r).filter((e=>!q.IgnoredAttributes.includes(e))).map((t=>{r[t]=e[t]})),r},bind:e=>{(0,u.M)(e,"type",F.tools.type)},validType:e=>"TreeLeaf"===e.userData.type,snapshot:{getDiff:e=>y.LV.getDiff(K,e),set:e=>{const{map:t,material:r,runScene:n,data:a}=e;y.LV.set({def:K,data:a,runScene:n,map:t,target:r}),t.data.completedCbs.push((()=>{(0,i.updateMaterial)(r)}))}}};const Z=new o.Clock;class X extends o.MeshStandardMaterial{constructor(e){super(),this.isSpecialMaterial=!0,this.uniforms={time:new o.Uniform(0),windForce:new o.Uniform(.3),windSpeed:new o.Uniform(.5),windWaveScale:new o.Uniform(.25),colorGradient:new o.Uniform(new o.Color(65280)),colorLevel:new o.Uniform(-.5),colorFade:new o.Uniform(-.25),leavesCore:new o.Uniform(.3),leavesSize:new o.Uniform(new o.Vector3),leavesPos:new o.Uniform(new o.Vector3)},this.insertShader(),e&&e.cb.render.add("TreeLeaf",(()=>{this.update()}))}insertShader(){this.onBeforeCompile=e=>{e.uniforms.uTime=this.uniforms.time,e.uniforms.uWindForce=this.uniforms.windForce,e.uniforms.uWindSpeed=this.uniforms.windSpeed,e.uniforms.uWindWaveScale=this.uniforms.windWaveScale,e.uniforms.uColorGradient=this.uniforms.colorGradient,e.uniforms.uColorLevel=this.uniforms.colorLevel,e.uniforms.uColorFade=this.uniforms.colorFade,e.uniforms.uLeavesCore=this.uniforms.leavesCore,e.uniforms.uLeavesSize=this.uniforms.leavesSize,e.uniforms.uLeavesPos=this.uniforms.leavesPos,e.vertexShader=H,e.fragmentShader=W,e.vertexShader=e.vertexShader.replace(/\/\/ Insert Noise3D/g,T)}}update(){this.uniforms.time.value=Z.getElapsedTime()}setSize(e){var t=new o.Vector3;e.getWorldScale(t),t=new o.Vector3,(new o.Box3).setFromObject(e).getSize(t),this.uniforms.leavesSize.value=t}setWorldPos(e){var t=new o.Vector3;e.getWorldPosition(t),this.uniforms.leavesPos.value=t}}const Q={SpriteMaterial:R.Z,FakeInterior:h,Fresnel:p,Matcap:S,MixTexture:P,Physical:L,Reflector:z,TreeLeaf:q,BasicMaterial:s.ZP,LineBasicMaterial:w,MyPointsMaterial:A,Water:t.Z};class Y{constructor(e){this.runScene=e,this.map={SpriteMaterial:new R.Z(e),FakeInterior:new h(e),Fresnel:new p(e),Matcap:new S(e),MixTexture:new P(e),Physical:new L(e),Reflector:new z(e),TreeLeaf:new q(e),BasicMaterial:new s.ZP(e)}}static create(e,t){return Q[e].tools.create(t)}static copy(e,t,r){return Q[e].tools.copy(t,r)}static clone(e,t){return Q[e].tools.clone(t)}static toNromal(e,t,r){return Q[e].tools.toNormal(t,r)}static parseData(e,t,r){var n=t.material;let a=e;return Q.LineBasicMaterial.tools.validType(n)&&(a=Q.LineBasicMaterial.tools.type),(null==(e=Q[a])?void 0:e.tools.parseData(t,r))||{material:(0,i.createDefMaterial)(),setTextureFns:[]}}static bind(e){e.material&&("MeshStandardMaterial"===e.material.type?s.ZP.tools.bind(e):"SpriteMaterial"===e.material.type&&R.Z.tools.bind(e))}static getTextures(e){var t=J(e);if(t)return Q[t].tools.getTextures(e);throw TypeError("该材质没有类型")}static parseNode(e){e.material&&(e=e.material,(0,i.isBaseMaterial)(e)&&s.ZP.tools.bind(e),e.isSpriteMaterial&&R.Z.tools.bind(e))}static validType(e,t){return!Q[e].tools.validType||Q[e].tools.validType(t)}}Y.snapshot={getDiff:e=>{var t=J(e);if(Q[t])return Q[t].tools.snapshot.getDiff(e);throw TypeError("该材质没有类型")},set:e=>{var t=e.material;if(t=J(t),Q[t])return Q[t].tools.snapshot.set(e);throw TypeError("该材质没有类型")}};const J=e=>{var t=e.userData.type;if(t)return Y.validType(t,e)?t:void 0}},932:(e,t,r)=>{r.r(t),r.d(t,{SpecialMaterial:()=>I,createDefMaterial:()=>S,defAllMaterialMap:()=>x,defBaseMaterialMap:()=>y,default:()=>w,disposeMaterial:()=>T,getBaseTextures:()=>k,getMaterialType:()=>B,getTextures:()=>E,getTexturesByMaterial:()=>_,initMaterial:()=>O,isBaseMaterial:()=>L,isColor:()=>P,isMaterial:()=>C,materialIgnore:()=>j,mergeMaterial:()=>M,setDefMaterialForSameGeo:()=>R,setMaterialTexture:()=>D,updateMaterial:()=>A});var n=r(6001),a=r(8881),i=r(4330),s=r(1794),o=r(3736),l=r(3625),c=r(8024),u=r(2510),h=r(3729),d=r(6272),p=r(4707);class f{constructor(e){this.data=this.getData(),this.pending=[],this.clonedTextures=[],this.mount=e=>{e.core.module.set("material",this)},this.complete=()=>{this.reset()},this.load=e=>{e=e.data;var{materialDef:e,material:t,model:r}=e;O(t),this.data.materialIns[e.id]||(this.data.materialIns[e.id]={material:t,models:[]}),this.data.materialIns[e.id].models.push(r)},this.done=e=>{const{json:t,core:r}=e;var{materialMap:e,textureMap:n}=(null==(e=t.asset)?void 0:e.ex)||{};this.processTextureMap(n||{}),this.processMaterialMap(e||{},t),this.processClonedTextures(),this.pending.push(this.loadTextures(r)),r.pending.push(Promise.all(this.pending))},this.parser=null,this.loadTexture=e=>{var t=e.data;const{textureDef:r,texture:n}=t;var{md5:t,format:a,size:i,uvScript:s,unDelAble:c,unDelAbleRef:u,id:h,cloneSourceId:d,minFilter:p,isHdr:f}=r;n.userData.md5=t,n.userData.isHdr=f,a&&(n.format=a,n.userData.format=a),s&&(n.userData.uvScript=s),d&&((0,l.setTextureCloneId)(n,d),this.clonedTextures.push(n)),"nearest"===p&&((0,l.setTextureMinFilter)(n,"nearest"),(0,o.M)(n,"minFilter",p)),c&&l.unDelAbleTexture.set(n,c,u),e.core.isImageBitmapLoader||(n.userData.flipY=!0),n.userData.id=h,n.userData.size=i,this.data.textureIns[r.id]=this.runScene.textureEx.getSameTexture(t,n)||n},this.processTextureMap=(()=>{const e=e=>{const{target:t,data:r}=e;var n;r&&(({x:e,y:n}="object"==typeof r?r:{x:r,y:r}),t.x=e,t.y=n)};return t=>{(0,n.mapObj)(t,((t,r)=>{var{format:r,center:n,rotation:a,offset:i,repeat:s}=r;const o=this.data.textureIns[t];o&&(o.format=r,e({target:o.repeat,data:s}),e({target:o.center,data:n}),e({target:o.offset,data:i}),a&&(o.rotation=a),this.runScene.textureEx.initTextureAndAddtoAll(o))}))}})(),this.processMaterialMap=(()=>{const e=e=>{const{textures:t,normal:r,models:a,material:i}=e;e=(0,n.mapObj)(t,((e,t)=>({type:e,texture:this.data.textureIns[t]})));const{material:s,setTextureFns:o}=this.runScene.materialEx.parseData(r.type,{normal:r,texture:{data:e,load:this.runScene.optionsEx.options.texture.load},core:this,models:a,material:i});s&&(0<o.length&&this.lazyLoadFns.push(...o),a.map((e=>e.material=s)))};return(t,r)=>{(0,n.mapObj)(t,((t,a)=>{if(t=this.data.materialIns[t]){const{material:i,models:s}=t;if(i){const{normal:o,textures:l}=a;o.type||(o.type=p.ZP.tools.type),"scene"===(null==(a=null==(t=r.asset)?void 0:t.ex)?void 0:a.type)&&r.asset.ex.sceneEx.materialId===i.userData.id&&(0,n.mapObj)(l,((e,t)=>{t=this.data.textureIns[t],D({material:i,type:e,texture:t})})),e({textures:l,models:s,material:i,normal:o}),i.needsUpdate=!0}}}))}})(),this.lazyLoadFns=[],this.loadTextures=(()=>{const e=e=>{e.callback("lazyLoadedTexture",""),this.runScene.optionsEx.log("贴图懒加载完毕","base","success")},t=(r,n,a)=>{const i=this.lazyLoadFns[r];if(!i)return n(0),e(a);i(),setTimeout((()=>t(++r,n,a)),this.runScene.optionsEx.options.texture.lazyLoad.intervalTime)};return e=>new Promise((r=>{this.runScene.optionsEx.options.texture.lazyLoad.open?t(0,r,e):(this.lazyLoadFns.map((e=>e())),r(0))}))})(),this.afterParse=e=>{const{data:t,core:r,json:n}=e;if("material"===(null==(e=null==(e=n.asset)?void 0:e.ex)?void 0:e.type)){e=t.options.models;const[n]=e,a=[];n.material?(this.runScene.materialEx.add(n.material),a.push(n.material)):n.children.map((e=>{e.material&&(a.push(e.material),this.runScene.materialEx.add(e.material))})),r.models.push(...a)}},this.runScene=e}getData(){return{materialMap:{},textureMap:{},materialIns:{},textureIns:{}}}getMap(){return new s.Z({loadedGltf:this.done,loadMaterial:this.load,loadTexture:this.loadTexture,afterParse:this.afterParse,complete:this.complete,mountModule:this.mount})}processInput(e,t){return function(e,t,r,n){return new(r=r||Promise)((function(t,a){function i(e){try{o(n.next(e))}catch(e){a(e)}}function s(e){try{o(n.throw(e))}catch(e){a(e)}}function o(e){var n;e.done?t(e.value):((n=e.value)instanceof r?n:new r((function(e){e(n)}))).then(i,s)}o((n=n.apply(e,[])).next())}))}(this,0,void 0,(function*(){this.parser=t}))}processClonedTextures(){this.clonedTextures.map((e=>{var t=(0,l.getCloneIdFromTexture)(e);(t=this.data.textureIns[t])?(e.image=t.image,e.needsUpdate=!0,"editor"===this.runScene.optionsEx.options.mode&&(e.userData.blob=t.userData.blob,e.userData.md5=t.userData.md5,e.userData.url=t.userData.url,(0,l.bindTextureBaseData)(e,this.runScene))):(this.runScene.textureEx.delete(e),(0,o.bv)(e,"cloneSourceId"),(0,l.disposeTexture)(e))}))}reset(){this.clonedTextures=[],this.data=this.getData(),this.pending=[],this.lazyLoadFns=[]}}var m=r(7880),g=(t=r(110),r(7201));class v{constructor(e){this.resetItem=e=>{"material"===e.type&&e.datas.map((t=>{const r=t.data;let n=r.get("material");n||(n={},r.set("material",n)),e.targets.map((e=>{var t=(0,m.ee)(e);t&&m.Ws[t].tools.snapshot&&(t=(0,h.Ki)(e))&&(n[t]=this.getItem(e))}))}))},this.getDiff=()=>{let e={};return this.runScene.uniqueEx.material.getAll("values").map((t=>{t=t.material;var r=(0,m.ee)(t);r&&m.Ws[r].tools.snapshot&&(r=(0,h.Ki)(t))&&(e[r]=this.getItem(t))})),e},this.create=e=>{var t=this.getDiff();0!==(0,g.objLength)(t)&&e.data.set("material",t)},this.set=e=>{var t=e.snapshot.data.get("material");t&&(0,n.mapObj)(t,((t,r)=>{(t=this.runScene.uniqueEx.material.get(t))&&m.ZP.snapshot.set({material:t,data:r,runScene:this.runScene,map:e})}))},this.runScene=e,this.runScene.cb.snapshot.create.add("material",this.create),this.runScene.cb.snapshot.set.add("material",this.set),this.runScene.cb.snapshot.getLength.add("material",(e=>{var t=e.data.data.get("material");t&&(e.inputData.material=Object.keys(t).length)})),this.runScene.cb.snapshot.resetItem.add("material",this.resetItem)}getItem(e){return m.ZP.snapshot.getDiff(e)}}var b=function(e,t,r,n){return new(r=r||Promise)((function(a,i){function s(e){try{l(n.next(e))}catch(e){i(e)}}function o(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?a(e.value):((t=e.value)instanceof r?t:new r((function(e){e(t)}))).then(s,o)}l((n=n.apply(e,t||[])).next())}))};const y={depthTest:!0,depthWrite:!0,alphaTest:0,side:0,displacementScale:1,visible:!0,normalScale:{x:1,y:1},aoMapIntensity:1,lightMapIntensity:1,envMapIntensity:1,fog:!0},x=["color","emissive","roughness","metalness","normalScale","aoMapIntensity","displacementScale","transparent","lightMapIntensity","envMapIntensity","opacity","alphaTest","fog"];class w{constructor(e){this.materialX={},this.clean=()=>{this.dispose()},this.defMaterial=S(),this.addCb=e=>{this.runScene.cb.material.add.cb(e)},this.runScene=e,this.def=new m.ZP(e),this.snaphot=new v(e),this.runScene.cb.unique.material.add.add("engine-material-add",(e=>{this.addCb(e)})),this.runScene.cb.clean.add("EngineMaterial",this.clean),this.import=new f(e)}init(){var e={name:"material",loadCallBacks:this.import.getMap(),exportCallBacks:new s.Z};this.runScene.exporter.gltf.module.bind(e)}parse(e){m.Ws.LineBasicMaterial.tools.validType(e)&&m.Ws.LineBasicMaterial.tools.bind(e),this.setEnvStrength(e,this.runScene.sceneEx.envStrength)}add(e,t,r){j.is(e)||this.runScene.uniqueEx.material.add(e,t,r)}setEnvStrength(e,t,r=!1){void 0===e.envMapIntensity||e.envMapIntensity===t||!r&&e.envMapIntensity!==this.runScene.sceneEx.envStrength||(e.envMapIntensity=t,A(e))}create(e="BasicMaterial"){return e=m.ZP.create(e,this.runScene),this.add(e),e}toArray(){return(0,n.mapObj)(this.runScene.uniqueEx.material.map,((e,t)=>t.material))}copy(e){var t=B(e);if(t){const r=m.ZP.copy(t,e,this.runScene);return r.userData.id=(0,n.getId)(),r}}clone(e){var t=B(e);if(t){const r=m.ZP.clone(t,e);return r.userData.id=(0,n.getId)(),r}}setNormals(e,t=!0){const{info:r,newVal:n,materials:a,oldval:i,cb:s}=e;let o=n;return o.isVector2&&(o=o.clone()),e=a.map((e=>new c.Z({info:r,target:e,newVal:o,oldVal:i||e[r],runScene:this.runScene,cb:s}).execute())),t&&this.runScene.undoEx.addUndo(e),e}setNormal(e,t=!0){return e=new c.Z(Object.assign(Object.assign({},e),{runScene:this.runScene})).execute(),t&&this.runScene.undoEx.addUndo(e),e}setTextures(e,t=!0){return b(this,void 0,void 0,(function*(){const{info:r,newVal:n,materials:a,oldVal:i}=e;n instanceof File&&(e.newVal=yield this.runScene.textureEx.parse(n)),"envMap"===r&&(0,l.setTextureMapping)(e.newVal);var s=a.map((t=>new c.Z({info:r,target:t,newVal:e.newVal,oldVal:i||t[r],runScene:this.runScene}).execute()));return t&&this.runScene.undoEx.addUndo(s),a[0][r]}))}setTexture(e,t=!0){return b(this,void 0,void 0,(function*(){var{info:r,newVal:n,target:a}=e,n=(n instanceof File&&(e.newVal=yield this.runScene.textureEx.parse(n)),"envMap"===r&&(0,l.setTextureMapping)(e.newVal),new c.Z(Object.assign(Object.assign({},e),{oldVal:a[r],runScene:this.runScene})).execute());return t&&this.runScene.undoEx.addUndo(n),e.newVal}))}resetMaterial(e,t,r){const{addUndo:n,includeChild:a}=r=(0,d.Gm)({addUndo:!0,includeChild:!1},r);if(e&&t){const r=new Set;((0,d.lG)(e,"array")?e:[e]).map((e=>{a?e.traverse((e=>{L(e.material)&&r.add(e)})):e.material&&r.add(e)}));const i=[];r.forEach((e=>{i.push(new u.Z({target:e,runScene:this.runScene,info:"material",newVal:t,oldVal:e.material}).execute())})),this.runScene.modelEx.select===e&&this.runScene.cb.setSelectMaterial.cb(t),n&&this.runScene.undoEx.addUndo(i)}}toNromal(e){var t=B(e);if(t){const r=m.ZP.toNromal(t,e,this.runScene);return r.material.userData=Object.assign(Object.assign({},r.material.userData),e.userData),r}}setSelect(e){this.select=e,this.runScene.cb.setSelectMaterial.cb(e)}parseData(e,t){return m.ZP.parseData(e,t,this.runScene)}dispose(){this.runScene.cb.material.dispose.cb("")}remove(e){const t=this.runScene.uniqueEx.material.getModels((0,h.Ki)(e));t&&(this.resetMaterial(t.toArray(),S()),this.runScene.cb.material.remove.cb(e))}getDefNromals(e){var t;return"BasicMaterial"!==(null==(t=e.userData)?void 0:t.type)?{}:(0,d.ad)(y,e)}parseNromals(e,t){(0,n.mapObj)(e,((e,r)=>{var n,a,i,s,o;void 0!==y[e]&&("object"==typeof r?(({x:i,y:s,z:o}=r),null!=(a=null==(n=t[e])?void 0:n.set)&&a.call(n,i,s,o)):t[e]=r)}))}isBaseMaterial(e){return"MeshStandardMaterial"===e.type&&"BasicMaterial"===e.userData.type&&!e.userData.isTimeLineUsed&&p.ZP.isDefVal(e)}setByType(e,t){"SpriteMaterial"===e&&!t.isSprite||(e=this.create(e))&&(this.add(e),this.runScene.modelEx.setMaterial(t,e))}}const S=e=>{const t=new a.MeshStandardMaterial(e);return t.userData.id=(0,n.getId)(),p.ZP.tools.bind(t),t},M=(e,t)=>(x.map((r=>{const n=e[r];"object"==typeof n&&(t[r]=n.clone()),t[r]=n})),t),T=e=>{e.dispose();const t=_(e);0!==t.length&&t.map((e=>{e=e.texture,(0,l.disposeTexture)(e)}))},_=e=>k(e),E=e=>m.ZP.getTextures(e)||k(e),k=e=>i.zX.map((t=>({type:t,texture:e[t]}))).filter((e=>e.texture)),D=e=>{const{material:t,type:r,texture:n}=e;"envMap"===r&&(0,l.setTextureMapping)(n),t[r]=n,t.needsUpdate=!0},O=e=>{e.vertexColors=!1,e.depthWrite=!0,e.needsUpdate=!1},P=e=>null==e?void 0:e.isColor,A=e=>{e.needsUpdate=!0},C=e=>null==e?void 0:e.isMaterial,R=e=>{},L=e=>(null==e?void 0:e.isMeshStandardMaterial)&&!e.isSpecialMaterial,I={Sprite:t.Z},B=e=>{var t;return(null==(t=null==e?void 0:e.userData)?void 0:t.type)||(null==e?void 0:e.type)},j={set(e,t){t?(0,o.M)(e,"ignore",!0):delete e.userData.ignore},is:e=>!0===(0,o.is)(e,"ignore")}},4707:(e,t,r)=>{r.d(t,{ZP:()=>v,Gf:()=>g});var n=r(8881),a=r(4330),i=r(3263),s=r(3736);const o="\n#define STANDARD\nuniform int uvCount;\n ",l="\nattribute vec2 uv2;\nvarying vec2 vUv2;\nuniform mat3 uv2Transform;\n ",c="\nvUv2 = (uv2Transform * vec3(uv2, 1)).xy;\n ",u="\nvarying vec2 vUv2;\n ",h="\n#ifdef USE_MAP\n vec4 sampledDiffuseColor = vec4(0.0);\n if(uvCount > 1) sampledDiffuseColor = texture2D(map, vUv2);\n else sampledDiffuseColor = texture2D(map, vUv);\n \n #ifdef DECODE_VIDEO_TEXTURE\n sampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w );\n #endif\n diffuseColor *= sampledDiffuseColor;\n#endif\n ",d="\n#ifdef USE_EMISSIVEMAP\n vec4 emissiveColor = vec4(0.0);\n if(uvCount > 1) emissiveColor = texture2D(emissiveMap, vUv2);\n else emissiveColor = texture2D(emissiveMap, vUv);\n totalEmissiveRadiance *= emissiveColor.rgb;\n#endif\n ";var p,f=r(1398),m=r(932);const g={color:{type:"color",val:{r:1,g:1,b:1},shortKey:"clr"},map:{type:"texture",val:null,shortKey:"map"},emissiveMap:{type:"texture",val:null,shortKey:"em"},roughnessMap:{type:"texture",val:null,shortKey:"rm"},emissive:{type:"color",val:{r:0,g:0,b:0},shortKey:"emi"},roughness:{type:"number",val:1,shortKey:"rgh"},metalness:{type:"number",val:0,shortKey:"meta"},metalnessMap:{type:"texture",val:null,shortKey:"mm"},lightMap:{type:"texture",val:null,shortKey:"lm"},lightMapIntensity:{type:"number",val:1,shortKey:"lmi"},envMap:{type:"texture",val:null,shortKey:"envm"},envMapIntensity:{type:"number",val:1,shortKey:"envI"},transparent:{type:"other",val:!1,shortKey:"trans"},opacity:{type:"number",val:1,shortKey:"opc",before:({target:e,end:t})=>{t<1&&!e.transparent&&(e.transparent=!0,(0,m.updateMaterial)(e))}},depthTest:{type:"other",val:!0,shortKey:"dt"},depthWrite:{type:"other",val:!0,shortKey:"dw"},fog:{type:"other",val:!0,shortKey:"fo"},wireframe:{type:"other",val:!1,shortKey:"wf"},alphaMap:{type:"texture",val:null,shortKey:"alpm"}};class v{constructor(e){this.init(e)}init(e){e.cb.material.add.add("base-material",(e=>{(0,m.isBaseMaterial)(e)&&"MeshPhysicalMaterial"!==e.type&&(v.tools.bind(e),e.userData.uvCount||(e.userData.uvCount=new n.Uniform(1)),e.onBeforeCompile=t=>{t.uniforms.uvCount=e.userData.uvCount,t.vertexShader=t.vertexShader.replace(/#include <uv2_pars_vertex>/g,l),t.vertexShader=t.vertexShader.replace(/#include <uv2_vertex>/g,c),t.fragmentShader=t.fragmentShader.replace(/#define STANDARD/g,o),t.fragmentShader=t.fragmentShader.replace(/#include <uv2_pars_fragment>/g,u),t.fragmentShader=t.fragmentShader.replace(/#include <map_fragment>/g,h),t.fragmentShader=t.fragmentShader.replace(/#include <emissivemap_fragment>/g,d)})}))}static isDefVal(e){for(const t in this.defVal){const r=this.defVal[t],a=e[t];if(r instanceof n.Color){if(r.getHexString()!==a.getHexString())return!1}else if("object"==typeof r){if(a.x!==r.x)return!1}else if(a!==r)return!1}for(const t of a.zX)if(e[t])return!1;return!0}create(){return(0,m.createDefMaterial)()}}(p=v).tools={type:"BasicMaterial",bind(e){(0,s.M)(e,"type","BasicMaterial")},create:()=>{var e=new n.MeshStandardMaterial;return p.tools.bind(e),e},parseData:e=>{const{texture:t,normal:r,core:n,material:a}=e,{data:s,load:o}=t,l=[];return o&&l.push(...i.F6.filter(s.map((e=>{const{type:t,texture:r}=e;if(r)return()=>{n.runScene.uniqueEx.texture.addMaterial(r,{material:a,type:t}),(0,m.setMaterialTexture)({material:a,type:t,texture:r})}})))),n.runScene.materialEx.parseNromals(r,a),{material:a,setTextureFns:l}},toNormal:e=>({material:e.clone(),normal:{type:v.tools.type},textures:(0,m.getBaseTextures)(e)}),clone:(e,t)=>e,copy:e=>e.clone(),getTextures:e=>(0,m.getBaseTextures)(e),snapshot:{getDiff:e=>f.LV.getDiff(g,e),set:e=>{const{map:t,material:r,runScene:n,data:a}=e;f.LV.set({def:g,data:a,runScene:n,map:t,target:r}),t.data.completedCbs.push((()=>{(0,m.updateMaterial)(r)}))}},validType:e=>"MeshStandardMaterial"===e.type},v.defVal={color:new n.Color(16777215),emissive:new n.Color(0),roughness:1,metalness:0,lightMapIntensity:1,aoMapIntensity:1,emissiveIntensity:1,bumpScale:1,normalScale:new n.Vector2(1,1),displacementScale:1,envMapIntensity:1,wireframe:!1,transparent:!1,depthTest:!0,depthWrite:!0,opacity:1,fog:!0}},110:(e,t,r)=>{r.d(t,{Z:()=>h});var n,a=r(8881),i=r(8715),s=r(3736),o=r(1398),l=r(3729),c=r(932);const u={color:(t=r(4707)).Gf.color,map:t.Gf.map,opacity:t.Gf.opacity};class h{constructor(e){this.modelParse={toNormal:e=>{e=e.model;const t=(0,i.createDefModel)("Box");return t.userData.normal=Object.assign({type:"MySpriteMaterial"},e.userData),t.material=e.material,this.merge(e,t),t},parse:e=>{var{model:e,normal:t}=e;const r=(0,i.createDefModel)("Sprite");var n=e.userData.layers;return(0,i.setLayers)(r,n),r.userData=Object.assign(Object.assign({},t),r.userData),this.merge(e,r),r.material=e.material,r}},this.merge=(e,t)=>{t.position.copy(e.position),t.rotation.copy(e.rotation),t.scale.copy(e.scale),t.renderOrder=e.renderOrder,t.castShadow=e.castShadow,t.receiveShadow=e.receiveShadow,t.name=e.name,t.name=e.name,(0,s.M)(e,"name",e.name),(0,i.setLayers)(t,1===e.layers.mask?0:1)},this.type="Sprite",this.runScene=e;const{parse:t,toNormal:r}=this.modelParse;e.cb.inited.add("MySpriteMaterial",(()=>{e.modelEx.importAndExport.addParses(this.type,{parse:t,toNormal:r}),e.modelEx.importAndExport.addParses("MySpriteMaterial",{parse:t,toNormal:r})}))}}(n=h).tools={type:"SpriteMaterial",bind(e){(0,s.M)(e,"type","SpriteMaterial")},getTextures:e=>["map","alphaMap"].map((t=>{var r=e[t];if(r)return{type:t,texture:r}})).filter((e=>e)),create:()=>{var e=new a.SpriteMaterial;return n.tools.bind(e),e},parseData:(e,t)=>{var{texture:e,material:r,normal:n}=e;const{data:a,load:i}=e,s=[],o=(0,c.mergeMaterial)(r,h.tools.create(t));(0,l.x)(o,(0,l.Ki)(r));var{depthWrite:e,depthTest:t,name:r,fog:n}=n;return!1===n&&(o.fog=!1),void 0!==e&&(o.depthWrite=e),void 0!==t&&(o.depthTest=t),r&&(o.name=r),i&&s.push(...a.map((e=>{const{type:t,texture:r}=e;return()=>{o[t]=r}}))),{material:o,setTextureFns:s}},toNormal:e=>{const t=(0,c.mergeMaterial)(e,(0,c.createDefMaterial)());var r=Object.assign({},t.userData);const n={type:h.tools.type,name:e.name};return e.fog||(n.fog=!1),e.depthWrite!==c.defBaseMaterialMap.depthWrite&&(n.depthWrite=e.depthWrite),e.depthTest!==c.defBaseMaterialMap.depthTest&&(n.depthTest=e.depthTest),t.userData=r,{normal:n,textures:h.tools.getTextures(e),material:t}},clone:e=>e,copy:e=>{const t=e.clone();return t.userData.type=h.tools.type,t},snapshot:{getDiff:e=>o.LV.getDiff(u,e),set:e=>{const{map:t,material:r,runScene:n,data:a}=e;o.LV.set({def:u,data:a,runScene:n,map:t,target:r}),t.data.completedCbs.push((()=>{(0,c.updateMaterial)(r)}))}}}},3801:(e,t,r)=>{r.d(t,{Ju:()=>i,t9:()=>a,zf:()=>s});var n=r(3736);const a={isDynamic:()=>{}},i={isDeleted(e,t=!1){var r;return!!e&&(!(null==(r=null==e?void 0:e.userData)||!r.isDeleted)||!!t&&i.isDeleted(e.parent,t))},setDeleted(e,t){e.userData&&(t?(0,n.M)(e,"isDeleted",!0):null!=(t=null==e?void 0:e.userData)&&delete t.isDeleted)}},s={setLock(e){(0,n.M)(e,"lock",!0)},reLock(e){delete e.userData.lock},isLock(e,t=!1){if(!e||"Scene"===e.type)return!1;var r=e.userData.lock;return t?!!r||s.isLock(e.parent,t):void 0!==r&&r}}},8715:(e,t,r)=>{r.r(t),r.d(t,{closeModelEvent:()=>pe,createDefModel:()=>V,createSpecialModel:()=>z,default:()=>F,delClonedModel:()=>re,deletedModel:()=>N.Ju,disposeModel:()=>G,dynamicModel:()=>N.t9,getClonedIdModel:()=>ee,getDeepModels:()=>Q,getIdMapByModel:()=>he,getModelSize:()=>se,hasSkeleton:()=>Y,helperModel:()=>ce,instanceModel:()=>H,isDynamicModel:()=>$,isGLowModel:()=>ne,isGroup:()=>ie,isHelper:()=>Z,isSprite:()=>ae,lockModel:()=>N.zf,mergeModel:()=>W,normalModel:()=>le,selectableModel:()=>oe,setClonedModel:()=>te,setDynamicModel:()=>J,setHelper:()=>q,setLayers:()=>X,tempModel:()=>de,uselessGroup:()=>ue,withAnima:()=>K});var n=r(6001),a=r(8881),i=r(4091),s=r(4230);const o=["Group","Box","Circle","Cylinder","Dodecahedron","Icosahedron","Lathe","Octahedron","Plane","Ring","Sphere","Sprite","Tetrahedron","Torus","TorusKnot","Tube","Reflector","VerticesRain","Water"];var l=r(1794),c=r(272),u=r(5247),h=r(1269),d=r(7880),p=r(932),f=r(3736);class m extends r(4773).Z{constructor(e){super(e),this.type="添加模型",this.isUndoAdd=!0}_execute(e){return Promise.reject()}undo(){this.remove({model:this.model,parent:this.parent,addTree:this.addTree,isClone:this.isClone,runScene:this.runScene})}redo(){this.add({model:this.model,parent:this.parent,addTree:this.addTree,isClone:this.isClone,runScene:this.runScene})}execute(){return this.redo(),this}}var g=r(3735),v=r(2510);class b extends r(4616).Z{constructor(e){super(),this.type="修改父元素",this.isUndoParent=!0,this.runScene=e.runScene,this.oldParent=e.oldParent,this.newParent=e.newParent,this.target=e.target}execute(){return this.redo(),this}_execute(e,t){e.attach(this.target),this.runScene.cb.model.setParent.cb({model:this.target,parent:e}),(null==(e=this.runScene.modelEx.select)?void 0:e.userData.id)===t.userData.id&&this.runScene.modelEx.selectNull()}undo(){this._execute(this.oldParent,this.newParent)}redo(){this._execute(this.newParent,this.oldParent)}}const y=b;var x=r(7169),w=r(4380),S=r(3729),M=r(8089),T=r(4670);class _{constructor(e){this.definfo={speed:1,size:10,length:2e3},this.map=new l.Z,this.modelParse={toNormal:e=>{const{model:t,runScene:r}=e,n=V("Box");e=(0,S.Ki)(t);var a=r.modelEx.def.vertices.rain.map.get(e);if(n.material=t.material,!e||!a)throw TypeError("缺少属性");var{length:e,size:a,speed:i}=a;return n.userData.normal={type:_.modelTools.type,length:e,size:a,speed:i,materialId:(0,S.Ki)(t.material)},n},parse:e=>{const{runScene:t,normal:r,model:n}=e,a=t.modelEx.def.create(_.modelTools.type,r);return a.material=n.material,a.material.userData.id=r.materialId,a}},this.update=()=>{const e=this.runScene.assetsEx.get().camera;this.map.map(((t,r)=>{const{model:n,length:a,speed:i,del:s}=r;if(!s){n.position.set(e.position.x,e.position.y,e.position.z);for(let e=0;e<a;e++)n.geometry.attributes.position.setY(e,n.geometry.attributes.position.getY(e)-i),0<=i?n.geometry.attributes.position.getY(e)<=-1e3&&n.geometry.attributes.position.setY(e,1e3):1e3<=n.geometry.attributes.position.getY(e)&&n.geometry.attributes.position.setY(e,-1e3),n.geometry.attributes.position.needsUpdate=!0}}))},this.tools={type:"VerticesRain",merge:function(e,t){},toNormal:function(e){const t=V("Box");var r=(0,S.Ki)(e),n=this.map.get(r);if(t.material.map=e.material.map,r&&n)return t.userData.normal=Object.assign({type:this.tools.type},n),t;throw TypeError("缺少属性")},parseData:function(e,t){}},(this.runScene=e).cb.render.add("verticesRain",this.update),e.cb.model.add.add("verticesRain",(({model:e})=>{var t;if((null==(t=e.userData.normal)?void 0:t.type)===this.tools.type){const t=this.map.get((0,S.Ki)(e));t&&(t.del=!1)}})),e.cb.model.remove.add("verticesRain",(({model:e})=>{var t;if((null==(t=e.userData.normal)?void 0:t.type)===this.tools.type){const t=this.map.get((0,S.Ki)(e));t&&(t.del=!0)}})),e.cb.clean.add("verticesRain",(()=>{this.map.clear()}));const{toNormal:t,parse:r}=this.modelParse;e.cb.inited.add("VerticesRain",(()=>{e.modelEx.importAndExport.addParses(_.modelTools.type,{toNormal:t,parse:r})}))}bindMaterial(e,t){(0,f.M)(e,"id",t||(0,n.getId)()),(0,f.M)(e,"type","MyPointsMaterial")}create(e){var t=(e=e||this.definfo).length;const r=new T.Sf.Points(this.createGeo(t),this.createMaterial(e));return r.name="雨雪",r.renderOrder=1,t=(0,n.getId)(),(0,f.M)(r,"id",t),this.bindMaterial(r.material),(0,f.M)(r,"type",this.tools.type),(0,f.M)(r,"normal",{type:this.tools.type}),this.map.set(t,{model:r,length:e.length,size:e.size,speed:e.speed,del:!1}),r}createGeo(e){let t=[];const r=new a.BufferGeometry;for(let r=0;r<e;r++){var n=2e3*Math.random()-1e3,i=2e3*Math.random()-1e3,s=2e3*Math.random()-1e3;t.push(n,i,s)}return r.setAttribute("position",new a.Float32BufferAttribute(t,3)),r}createMaterial(e){var{size:e,map:t}=e;return new T.Sf.PointsMaterial({blending:T.Sf.AdditiveBlending,depthTest:!1,transparent:!0,size:e,map:t})}setForModel(e){var{model:e,type:t,data:r}=e;(e=(0,S.Ki)(e))&&this.set(e,t,r)}set(e,t,r){const n=this.map.get(e);if(n){const{model:e,size:i}=n;switch(t){case"show":e.visible=r;break;case"length":e.geometry=this.createGeo(r),n[t]=r;break;case"size":var a=e.material;e.material=this.createMaterial({map:e.material.map,size:r}),this.bindMaterial(e.material,(0,S.Ki)(a)),n[t]=r;break;case"speed":n[t]=r;break;case"texture":a=e.material,e.material=this.createMaterial({map:r,size:i}),this.bindMaterial(e.material,(0,S.Ki)(a))}}}}_.modelTools={type:"VerticesRain",parseData:function(e,t,r){const n=r.modelEx.def.create(_.modelTools.type,t);return n.material=e.material,n.material.userData.id=t.materialId,n},toNormal:(e,t,r)=>{const n=V("Box");var a=(0,S.Ki)(e);if(t=t.modelEx.def.vertices.rain.map.get(a),n.material=e.material,!a||!t)throw TypeError("缺少属性");var{length:a,size:t,speed:i}=t;return n.userData.normal={type:_.modelTools.type,length:a,size:t,speed:i,materialId:(0,S.Ki)(e.material)},n}};class E{constructor(e){this.runScene=e,this.rain=new _(e)}}var k=r(1863);class D{constructor(e){this.runScene=e,this.vertices=new E(e),this.water=new k.Z(e)}create(e,t){let r;return"VerticesRain"===e?r=this.vertices.rain.create(t):"Water"===e?r=this.water.create():o.includes(e)&&(r=(0,M.Py)(e,t)),d.ZP.parseNode(r),r}}var O=r(4457);class P{constructor(e){this.runScene=e}init(){this.bindEvent()}bindEvent(){}}var A=r(2353),C=r(110);class R{constructor(e){this.data=this.getData(),this.parses=new l.Z,this.nodeType={MySpriteMaterial:C.Z,VerticesRain:_},this.mount=e=>{e.core.module.set("model",this)},this.complete=()=>{this.data=this.getData()},this.loadNodeDef=e=>{let{node:t,nodeDef:r}=e;(0,n.mapObj)(this.runScene.modelEx.defNodeMap,((e,n)=>{var a=r[e];null!=a&&(t[e]=a)})),r.wireframe&&(t.material.wireframe=!0)},this.load=e=>{var{data:e,core:t}=e;return this.loadNodeDef(e),this.loadExtras(e,t),e.node},this.done=()=>{this.removeHelperModel()},this.afterParse=e=>{const{config:t,data:r,json:n,core:a}=e;if("model"===(null==(e=null==(e=n.asset)?void 0:e.ex)?void 0:e.type)){if(null==(e=t.module)||!e.model)return[];let n=["glb_model"===(e=(e=r.options).models[0]).name&&(null==e?void 0:e.children[0])||e];var[e]=n;ue.is(e)&&(n=[...e.children]),a.models.push(...n),this.mergeClone()}},this.toNromal=e=>{var t=e.type;const r=this.parses.get(t);return r?r.toNormal(e):e.model},this.parse=e=>{var t=e.type;const r=this.parses.get(t);if(r)return r.parse(e)},this.runScene=e}getData(){return{map:new l.Z,clonedMap:{},instancedMap:{},helperModels:[]}}getMap(){return new l.Z({loadNode:this.load,loadedGltf:this.done,afterParse:this.afterParse,complete:this.complete,mountModule:this.mount})}addParses(e,t){this.parses.set(e,t)}loadExtras(e,t){let{node:r,nodeDef:n}=e;if(n.extras){const{layers:o,normal:l,local:c,cloneId:u,id:h,animations:d,isDynamic:p}=n.extras;var a,i=$(r,!0),s=("running"!==this.runScene.optionsEx.options.mode||i||null!=(s=this.runScene.optionsEx.options.renderConfig)&&s.matrixAutoUpdate||(r.matrixAutoUpdate=!1),d&&(r.animations=A.B.parse(d)),p&&(r.userData.isDynamic=!0),!u||i||(this.data.instancedMap[u]||(this.data.instancedMap[u]=new Set),this.data.instancedMap[u].add(r)),c&&([s,i,a]=c.split(","),r.position.set(s,i,a)),o&&(r.layers.enable(1),this.runScene.cb.model.setLayers.cb({model:r,val:1})),n.extras.isHelper&&this.data.helperModels.push(r),l&&([i,...a]=(s=this.parse({type:l.type,model:e.node,normal:l,runScene:this.runScene}))instanceof Array?s:[s],e.node=i,t.models.push(...a)),h&&this.data.map.set(h,e.node),null==(a=null==(i=null==(s=e.node)?void 0:s.material)?void 0:i.userData)?void 0:a.id);if(s){const r=t.module.get("material").data.materialIns[s];r&&r.models.push(e.node)}}}removeHelperModel(){this.data.helperModels.map((e=>{var t;return null==(t=e.parent)?void 0:t.remove(e)}))}mergeClone(){var e;this.runScene.optionsEx.options.instanceClone&&"running"===this.runScene.optionsEx.options.mode&&(this.runScene.assetsEx.scene.updateMatrixWorld(),e=this.data.instancedMap,(0,n.mapObj)(e,((e,t)=>{var r,n=this.runScene.uniqueEx.model.map[e];t.size<2||!n||!n.geometry||$(n,!0)||(r=H(n,[...t]),this.runScene.modelEx.add(r,void 0,{isClone:!1,select:!1,addUndo:!1}),ne(n)&&this.runScene.modelEx.setGlow(r,!0),this.runScene.modelEx.remove(n,!1),t.forEach((e=>this.runScene.modelEx.remove(e,!1))),t.clear(),delete this.data.instancedMap[e])}))),this.data.instancedMap={}}mergeGeometry(){}}var L=r(7201),I=r(228),B=r(1398);const j={position:{type:"v3",val:{x:0,y:0,z:0},shortKey:"po"},rotation:{type:"v3",val:{x:0,y:0,z:0},shortKey:"ro"},scale:{type:"v3",val:{x:1,y:1,z:1},shortKey:"scl"},visible:{type:"other",val:!0,shortKey:"vi"},castShadow:{type:"other",val:!1,shortKey:"ca"},receiveShadow:{type:"other",val:!1,shortKey:"rec"},renderOrder:{type:"other",val:0,shortKey:"ren"}};class U{constructor(e){this.resetItem=e=>{"model"===e.type&&e.datas.map((t=>{const r=t.data;let n=r.get("model");n||(n={},r.set("model",n));const a=new c.Z;if(e.targets.map((e=>{e.traverse((e=>{var t=(0,S.Ki)(e);t&&(e.material&&a.add(e.material),n[t]=this.getItem(e))}))})),0!==a.size){const t=new c.Z;a.map((e=>{const r=d.ZP.getTextures(e);0!==r.length&&t.add(r.map((e=>e.texture)))})),this.runScene.cb.snapshot.resetItem.cb({type:"texture",datas:e.datas,targets:t.toArray()}),this.runScene.cb.snapshot.resetItem.cb({type:"material",datas:e.datas,targets:a.toArray()})}}))},this.create=e=>{var t=this.getDiff(this.runScene.sceneEx.getClearModels());0!==(0,L.objLength)(t)&&e.data.set("model",t)},this.set=e=>{var t=e.snapshot.data.get("model");if(t){const r=e.data.completedCbs;this.runScene.pp.clearAllOutlineObj(),(0,n.mapObj)(t,((t,n)=>{const a=this.runScene.uniqueEx.model.get(t);a&&(B.LV.set({def:j,runScene:this.runScene,data:n,target:a,map:e}),t=n[j.visible.shortKey],a.visible=void 0===t,r.push((()=>{var e;this.runScene.modelEx.setGlow(a,!!n.isGLow),n.isOutline?this.runScene.modelEx.setOutline(a,!0):a.userData.outline&&(a.userData.outline=!1),this.runScene.cb.model.change.cb({model:a,type:"visible",val:a.visible}),n.materialId&&n.materialId!==(0,S.Ki)(a.material)&&(e=this.runScene.uniqueEx.material.get(n.materialId))&&this.runScene.materialEx.resetMaterial(a,e,{addUndo:!1,includeChild:!1})})))}))}},this.runScene=e,this.runScene.cb.snapshot.create.add("model",this.create),this.runScene.cb.snapshot.set.add("model",this.set),this.runScene.cb.snapshot.getLength.add("model",(e=>{var t=e.data.data.get("model");t&&(e.inputData.model=Object.keys(t).length)})),this.runScene.cb.snapshot.resetItem.add("model",this.resetItem),this.runScene.cb.snapshot.getByType.add("model",(({targets:e,type:t,data:r})=>{"model"===t&&this.resetItem({type:t,datas:[r],targets:e})}))}getItem(e){const t=B.LV.getDiff(j,e);return ne(e)&&(t.isGLow=!0),(0,I.S)(e)&&(t.isOutline=!0),e.material&&(t.materialId=(0,S.Ki)(e.material)),t}getDiff(e){const t={};return e.map((e=>{e.traverse((e=>{var r=(0,S.Ki)(e);r&&(t[r]=this.getItem(e))}))})),t}getData(){}}var N=r(3801);class F{constructor(e){this._selectModel=void 0,this.geometryMap=new l.Z,this.clonedMap=new l.Z,this.defNodeMap={castShadow:!1,receiveShadow:!1,renderOrder:0,visible:!0},this.clean=()=>{this.reset()},this.add=(()=>{const e=(e,t)=>{t?(this.runScene.uniqueEx.model.add(e,{hasReset:!0}),this.runScene.cb.model.clone.cb(e)):this.runScene.uniqueEx.model.add(e)};return(t,r,n)=>{var{addUndo:a,isClone:i,select:s,addToTree:o}=(0,O.mergeObject)({addUndo:!0,isClone:!1,select:!1,addToTree:!0},n);return t instanceof Array?t.map((e=>this.add(e,r,n))):(e(t,i),this.setGeometryMap(t),this.setCloneMap(t),o=new m({model:t,parent:r||this.runScene.sceneEx.get(),isClone:i,addTree:o,runScene:this.runScene}).execute(),!0===a&&this.runScene.undoEx.addUndo(o),s&&this.setSelectByModel(t,{isDomTreeActive:!1,isClone:i}),o)}})(),this.deepIsVisible=e=>"Scene"===e.type||!!e.visible&&!!e.parent&&this.deepIsVisible(e.parent),this.runScene=e,this.clone=(e=>(t,r=!0)=>{if(e.lightEx.isLight(t))return e.lightEx.clone(t);var a,i,s=Y(t),o=(e=>{const t={};return(0,O.getModelMap)(e,"id",(e=>{0<e.animations.length&&(t[(0,S.Ki)(e)]=e.animations)})),t})(t),l=(s=s?function(e){var t=new Map,r=new Map,n=e.clone();return function e(t,r,n){n(t,r);for(var a=0;a<t.children.length;a++)e(t.children[a],r.children[a],n)}(e,n,(function(e,n){t.set(n,e),r.set(e,n)})),n.traverse((function(e){var n,a;e.isSkinnedMesh&&(a=(n=t.get(e)).skeleton.bones,e.skeleton=n.skeleton.clone(),e.bindMatrix.copy(n.bindMatrix),e.skeleton.bones=a.map((function(e){return r.get(e)})),e.bind(e.skeleton,e.bindMatrix))})),n}(t):t.clone(),l=t,(0,f.M)(s,"cloneId",ee(l)||l.userData.id),(0,f.is)(t,"isDynamic")&&J(s,!0),(0,O.getModelMap)(s,"id"));c=s,(i=null==t?void 0:t.material)&&(a=d.ZP.clone((0,d.ee)(i),i))&&a.uuid!==i.uuid&&(e.materialEx.resetMaterial(c,a,{addUndo:!0}),e.materialEx.add(a,t,i));{var c={newModel:s,newModelMap:l,animaMap:o};const{animaMap:t,newModelMap:r}=c;(0,n.mapObj)(t,((t,a)=>{const i=r[t],s={};i&&(i.animations=[...a.map((e=>{const t=e.clone();return t.tracks.map((e=>{var[t]=e.name.split(".");s[t]||(s[t]=[]),s[t].push(e)})),t}))],(0,n.mapObj)(s,((t,r)=>{var a=i.getObjectByName(t);if(a){(0,f.M)(a,"id",(0,n.getId)());const i=e.uniqueEx.model.parseName(a);r.map((e=>{e.name=i+e.name.slice(t.length)}))}})))}))}return r&&e.uniqueEx.model.add(s,{hasReset:!0}),s})(e),this.runScene.cb.clean.add("EngineModel",this.clean),this.export=new P(e),this.importAndExport=new R(e),this.snapsot=new U(e),this.def=new D(e),this.runScene.cb.loaderer.gltf.getArrayBuffer.add("EngineModel",(()=>{this.selectNull()}))}get select(){return this._selectModel}set select(e){this.setSelectByModel(e)}init(){var e={name:"node",loadCallBacks:this.importAndExport.getMap(),exportCallBacks:new l.Z};this.runScene.exporter.gltf.module.bind(e),this.runScene.cb.unique.model.add.add("model",(({model:e})=>{(0,I.S)(e)&&this.setOutline(e,!0)}))}getSelectedModels(){return[this.select,...this.runScene.multipSelector.getSelectedList("value")].filter((e=>e))}setGeometryMap(e){if((0,O.validType)(e,"array"))return e.map((e=>this.setGeometryMap(e)));var t;e.geometry&&(t=e.geometry.uuid,this.geometryMap.get(t)||this.geometryMap.set(t,new Set),this.geometryMap.get(t).add((0,S.Ki)(e))),this.setGeometryMap(e.children)}isSameGeo(e,t){var{normal:e,position:r,uv:n}=e.attributes,{normal:t,position:a,uv:i}=t.attributes;return e.array.length===t.array.length&&r.array.length===a.array.length&&n.array.length===i.array.length&&(e=(0,O.sameArr)([...e.array],[...t.array],20),t=(0,O.sameArr)([...r.array],[...a.array],20),r=(0,O.sameArr)([...n.array],[...i.array],20),e&&t&&r)}getClonedIdFromModel(e){if(e.geometry){for(const e of this.clonedMap){const[r,n]=e;if(0!==n.size){var t=n.values()[0];if(!t)return;const e=this.runScene.uniqueEx.model.get(t);if(!e||!e.geometry)return;if(this.isSameGeo(e.geometry,e.geometry))return r}}this.clonedMap.map(((e,t)=>{t.size}))}}setCloneMap(e){if((0,O.validType)(e,"array"))return e.map((e=>this.setGeometryMap(e)));var t=ee(e);(t||this.getClonedIdFromModel(e))&&(this.clonedMap.get(t)||this.clonedMap.set(t,new c.Z),this.clonedMap.get(t).add((0,S.Ki)(e)),this.setCloneMap(e.children))}removeCloneMap(e){this.clonedMap.get((0,S.Ki)(e))}replaceClonedGroup(e,t){t=ee(t)||(0,S.Ki)(t);const r=this.clonedMap.get(t);r&&0!==r.size&&(e.userData.id=t,r.map((t=>{if(t=this.runScene.modelEx.getById(t)){var{position:r,rotation:n,scale:a,name:i,parent:s}=t;this.remove(t,!1);const o=this.runScene.modelEx.clone(e);o.userData.id=(0,S.Ki)(t),o.position.copy(r),o.rotation.copy(n),o.scale.copy(a),o.name=i,this.add(o,s,{addUndo:!1,isClone:!0,select:!1})}})))}replaceGeometry(e,t){t=t.uuid;const r=this.geometryMap.get(t);r&&0!==r.size&&(r.forEach((t=>{const r=this.runScene.uniqueEx.model.get(t);r&&(r.geometry=e,r.updateMatrix())})),this.geometryMap.delete(t),this.geometryMap.set(e.uuid,r))}setSelectByModel(e,t){this.runScene.optionsEx.log([e,"选中的模型",(0,S.Ki)(e)],"detail");var{isDomTreeActive:t,isClone:r}=t||{};if(this.runScene.events.key.ctrl&&!r)this.runScene.multipSelector.add(e);else{if(this.runScene.multipSelector.isEmpty()||this.runScene.multipSelector.setEmpty(),this._selectModel){if(this._selectModel===e)return void(this.runScene.helperEx.focusModelId||this.runScene.helperEx.focus(e));this.runScene.lightEx.setNull(this._selectModel),this.runScene.cb.model.unFocus.cb(this._selectModel)}e&&(this.runScene.cb.model.focus.cb({model:e,status:!0,domActive:!t}),this.runScene.materialEx.setSelect(e.material),this.runScene.cb.model.setSelect.cb(e),(this._selectModel=e).isCamera||(this.runScene.helperEx.focus(e),this.runScene.lightEx.setSelect(e)))}}setSelectById(e){(e=this.runScene.uniqueEx.model.get(e))&&this.setSelectByModel(e)}remove(e,t=!0){let r=[];Array.isArray(e)?r.push(...e):r.push(e),e=r.map((e=>new x.Z({runScene:this.runScene,model:e,parent:e.parent||this.runScene.sceneEx.get()}).execute())),t&&this.runScene.undoEx.addUndo(e)}isNavieV3(e,t){var{x:e,y:r,z:n}=e;return e===(t=t?1:0)&&r===t&&n===t}isNavieV2(e,t=0){var{x:e,y:r}=e;return e===t&&r===t}isUnless(e){return!e.material&&this.isNavieV3(e.position,!1)&&this.isNavieV3(e.rotation,!1)&&this.isNavieV3(e.scale,!0)&&0===e.children.length&&!K(e)}isUnlessLevel(e){return this.isNavieV3(e.position,!1)&&this.isNavieV3(e.rotation,!1)&&this.isNavieV3(e.scale,!0)&&1===e.children.length&&!K(e)}create(e="Box"){return e=(0,O.getModelByType)(e),d.ZP.parseNode(e),e}getById(e){return Array.isArray(e)?e.map((e=>this.runScene.uniqueEx.model.get(e))).filter((e=>e)):this.runScene.uniqueEx.model.get(e)}getLevel(e,t=0){return e.parent&&"Scene"!==e.parent.type?this.getLevel(e.parent,++t):t}selectNull(){var e=this._selectModel;e&&(this.runScene.cb.model.unFocus.cb(e),this.runScene.materialEx.setSelect(null),this.runScene.lightEx.setNull(e)),this._selectModel=void 0,this.runScene.cb.model.setSelect.cb(null),this.runScene.helperEx.unfocus()}cloneV3(e){return e.clone()}setParent(e,t,r=!0){if(t=new y({oldParent:e.parent,newParent:t,target:e,runScene:this.runScene}).execute(),!r)return t;this.runScene.undoEx.addUndo(t)}_setV3(e){const{model:t,info:r,newV3:n}=e;if(Array.isArray(t))return t.map((e=>{e[r].set(n.x,n.y,n.z),e.updateMatrix()}));t[r].set(n.x,n.y,n.z),t.updateMatrix()}update(e){if(Array.isArray(e))return e.map((e=>e.updateMatrix()));e.updateMatrix()}setV3(e,t=!0,r=!0){let{model:n,info:i,newV3:s,oldV3:o}=e;var l,c;if(s.isVector3||s.isEuler||(({x:u,y:l,z:c}=s),s=new a.Vector3(u,l,c)),(0,O.isRunning)(this.runScene))return this._setV3(e);var u=n instanceof Array?n.map((e=>new w.Z({target:e,info:i,runScene:this.runScene,oldV3:o||e[i].clone(),newV3:s}).execute(r))):new w.Z({target:n,info:i,oldV3:o||n[i].clone(),newV3:s,runScene:this.runScene}).execute(r);t&&this.runScene.undoEx.addUndo(u)}setNormal(e,t=!0){const{model:r,oldVal:n,info:a,val:i,executeCb:s}=e;return e=r instanceof Array?r.map((e=>new v.Z({target:e,info:a,runScene:this.runScene,oldVal:n||r[a],newVal:i,executeCb:s}).execute())):new v.Z({target:r,info:a,runScene:this.runScene,oldVal:n||r[a],newVal:i,executeCb:s}).execute(),t&&this.runScene.undoEx.addUndo(e),e}setMaterial(e,t,r=!0){var n=new v.Z({target:e,info:"material",runScene:this.runScene,oldVal:e.material,newVal:t}).execute();this.select===e&&this.runScene.cb.setSelectMaterial.cb(t),e.material.needsUpdate=!0,r&&this.runScene.undoEx.addUndo(n)}addDef(e){this.add(this.def.create(e),void 0,{select:!0})}isModel(e){return!((0,h.RQ)(e)||(0,s.N)(s.N))}getSphere(){var e=new a.MeshBasicMaterial,t=new a.SphereGeometry(.7,150,150);return new a.Mesh(t,e)}getIndexByModel(e){var t;return e.parent?null==(t=e.parent)?void 0:t.children.findIndex((t=>t===e)):-1}getBeTweenChildByTwoModel(e,t){if(e.parent.uuid===t.parent.uuid){var r=this.getIndexByModel(e);if(t=this.getIndexByModel(t),-1!==r&&-1!==t){const n=Math.max(r,t),a=r===n?t:r;return e.parent.children.map(((e,t)=>t>a&&t<n&&e)).filter((e=>e))}}}setMultip(e){var{model:e,typeList:t,newVal:r}=e;this.runScene.undoEx.addUndo(new g.Z({target:e,typeList:t,newVal:r}).execute())}createGroup(e,t,r){const n=t||new a.Group,i=[];i.push(new m({model:n,runScene:this.runScene,parent:r||this.runScene.assetsEx.get().scene}).execute()),e instanceof Array?i.push(...e.map((e=>new y({target:e,oldParent:e.parent,newParent:n,runScene:this.runScene}).execute()))):i.push(new y({target:e,oldParent:e.parent,newParent:n,runScene:this.runScene}).execute()),r&&this.runScene.cb.model.setOpen.cb({isOpen:!0,model:r}),this.runScene.cb.model.setOpen.cb({isOpen:!0,model:n}),this.runScene.cb.model.setMainStatue.cb({status:!0,model:n}),this.runScene.undoEx.addUndo(i),this.setSelectByModel(n)}cleanGroup(e,t=!0){if(e instanceof Array){const t=(0,n.multiArrToArr)(e.map((e=>(this.runScene.cb.model.unFocus.cb(e),this.cleanGroup(e,!1)))).filter((e=>e)));return this.runScene.undoEx.addUndo(t),t}if(this.runScene.cb.model.unFocus.cb(e),0!==e.children.length){const r=[],n=e.children.map((e=>{if(e.parent.parent)return new y({target:e,oldParent:e.parent,newParent:e.parent.parent,runScene:this.runScene})})).filter((e=>e));return r.push(...n.map((e=>e.execute()))),r.push(new x.Z({runScene:this.runScene,model:e,parent:e.parent}).execute()),t&&this.runScene.undoEx.addUndo(r),r}}hideOther(e){const t=e.uuid,r=0<e.children.length,n=this.runScene.sceneEx.getClearModels(),a=[];n.map((n=>{n.traverse((n=>{r?!1===(0,O.deepFindParentByUuid)(n,t)&&n.uuid!==e.uuid&&a.push(n):n.uuid!==e.uuid&&a.push(n)}))}));var i=a.map((e=>new v.Z({target:e,info:"visible",newVal:!1,runScene:this.runScene,oldVal:e.visible}).execute()));this.runScene.undoEx.addUndo(i),(0,O.setParentVisible)(e,!0)}showAll(){const e=this.runScene.sceneEx.getClearModels(),t=[];e.map((e=>{e.traverse((e=>{"materialHelper"!==e.name&&!1===e.visible&&t.push(e)}))}));var r=t.map((e=>new v.Z({target:e,info:"visible",runScene:this.runScene,newVal:!0,oldVal:e.visible}).execute()));this.runScene.undoEx.addUndo(r)}removeHide(){const e=this.runScene.sceneEx.getClearModels(),t=new Set,r=[];e.map((e=>{e.traverse((e=>{e.visible||t.add(e)}))})),t.forEach((e=>{r.push(new x.Z({runScene:this.runScene,model:e,parent:e.parent}).execute())})),this.runScene.undoEx.addUndo(r)}_getModel(e){var t=this.runScene.uniqueEx.model.nameMap[e];if(t)return this.runScene.uniqueEx.model.get(t)||this.runScene.assetsEx.scene.getObjectByName(e)}getModel(e,t="array"){if(!(e instanceof Array))return this._getModel(e);if("array"===t)return e.map((e=>this._getModel(e)));if("map"===t){const t={};return e.map((e=>{t[e]=this.getModel(e)})),t}}getWorldLocal(e){this.runScene.assetsEx.scene.updateMatrixWorld(!0);var t=new a.Vector3;return e.getWorldPosition(t),t}getClickObj(e,t,r=!1){let n=new a.Raycaster,i=new a.Vector2,s=(i.x=e.offsetX/this.runScene.assetsEx.engineDom.clientWidth*2-1,i.y=-e.offsetY/this.runScene.assetsEx.engineDom.clientHeight*2+1,n.setFromCamera(i,this.runScene.assetsEx.camera),n.intersectObjects(t,!0)),o={intersects:null,obj:null};if(0===s.length)return o;if(r){if(0===(e=s.filter((e=>(0,O.isVisible)(e.object)))).length)return o;o={intersects:e,obj:e[0].object}}else o={intersects:s,obj:s[0].object};return o}getCamLocal(){var{x:e,y:t,z:r}=this.runScene.assetsEx.camera.position,{x:n,y:a,z:i}=this.runScene.assetsEx.controls.target;return{cx:e,cy:t,cz:r,tx:n,ty:a,tz:i}}camAnima(e,t,r=1,n,a){return(0,O.anima)(e,t,r,(e=>{a&&a(e),this.runScene.assetsEx.camera.position.set(e.cx,e.cy,e.cz),this.runScene.assetsEx.controls.target.set(e.tx,e.ty,e.tz),this.runScene.assetsEx.camera.lookAt(this.runScene.assetsEx.controls.target)}),(e=>{n&&n()}))}setGlow(e,t=!0){t=t?1:0,0==(e.userData.layers=t)?e.layers.set(0):e.layers.enable(1),this.runScene.cb.model.setLayers.cb({model:e,val:t})}setOutline(e,t=!0){e.userData.outline=t,this.runScene.pp.addOutlineObj(e,t),this.runScene.cb.model.setOutline.cb({model:e,val:t})}focus(e){const{scene:t,camera:r,renderer:n,controls:i}=this.runScene.assetsEx.get(),s=new a.Vector3,o=new a.Vector3;if("Mesh"===e.type||"Group"===e.type||"Object3D"===e.type){const e=this.runScene.helperEx.boxHelper;if(e.update(),!e||!e.object)return;var l=n.domElement.getBoundingClientRect();let t=l.width/l.height;const i=new a.Vector3;l=e.geometry.attributes.position.array,i.set(Math.abs(l[0]-l[3]),Math.abs(l[1]-l[7]),Math.abs(l[2]-l[14])),o.x=.5*(l[0]+l[3]),o.y=.5*(l[1]+l[7]),o.z=.5*(l[2]+l[14]);let c=new a.Vector3;c.subVectors(r.position,o),c.projectOnPlane(new a.Vector3(0,1,0)),c.normalize(),1<t&&(t=1/t),l=2*Math.tan(.5*r.fov*Math.PI/180),l=i.length()/t/l,s.addVectors(o,c.multiplyScalar(l))}else{t.updateMatrixWorld(!0),l=new a.Vector3,e.getWorldPosition(l),o.set(l.x,l.y,l.z);let n=new a.Vector3;n.subVectors(r.position,o),n.projectOnPlane(new a.Vector3(0,1,0)),n.normalize(),s.addVectors(o,n.multiplyScalar(3))}(0,O.anima)({positionX:r.position.x,positionY:r.position.y,positionZ:r.position.z,targetX:i.target.x,targetY:i.target.y,targetZ:i.target.z},{positionX:s.x,positionY:s.y,positionZ:s.z,targetX:o.x,targetY:o.y,targetZ:o.z},.5,(e=>{r.position.set(e.positionX,e.positionY,e.positionZ),r.lookAt(e.targetX,e.targetY,e.targetZ),i.target.set(e.targetX,e.targetY,e.targetZ),i.update()}))}instance(e){this.runScene.assetsEx.scene.updateMatrixWorld();const t={},r=Array.isArray(e)?e:[e],a=[];r.map((e=>{e.traverse((e=>{var r;e.geometry&&!$(e)&&(r=ee(e))&&(a.push(e),t[r]||(t[r]=new Set),t[r].add(e))}))})),(0,n.mapObj)(t,((e,t)=>{e=this.runScene.uniqueEx.model.get(e),t.size<2||!e||(t=H(e,[...t]),this.runScene.modelEx.add(t,void 0,{isClone:!1,select:!1,addUndo:!1}),ne(e)&&this.setGlow(t,!0),this.runScene.modelEx.remove(e,!1))})),a.map((e=>{this.runScene.modelEx.remove(e,!1)}))}reset(){const e=this.runScene.sceneEx.getClearModels();let t=[];e.map((e=>e.traverse((e=>t.push(e))))),t.map((e=>{G(e,{remove:!1}),this.runScene.cb.model.dispose.cb(e)})),this.runScene.modelEx.selectNull(),this.geometryMap.clear()}getHoverFromModels(e,t,r){const{getOriginData:n,ignoreMove:i}=(0,O.mergeObject)({ignoreMove:!1,getOriginData:!1},r);this.runScene.cb.events.pointer.move.add("get-hover-from-models",(r=>{if(i||!this.runScene.events.mouse.isMove){const i=new a.Raycaster,u=new a.Vector2,{engineDom:h,camera:d}=this.runScene.assetsEx.get();var{top:s,left:o,width:l,height:c}=h.getBoundingClientRect(),o=r.pageX-o;r=r.pageY-s,u.x=o/l*2-1,u.y=-r/c*2+1,i.setFromCamera(u,d);const p=i.intersectObjects(e||[],!0);null!=t&&t(0===p.length?null:n?p:p.map((e=>e.object)))}}))}}const z=e=>{},V=e=>{if(o.includes(e))return e=(0,O.getModelByType)(e),d.ZP.parseNode(e),e;throw TypeError("")},G=(e,t)=>{t=(t||{}).remove;const{geometry:r,material:n}=e;r&&(null!=r&&r.dispose(),delete e.geometry),n&&((0,p.disposeMaterial)(e.material),e.material.dispose(),delete e.material),!1!==t&&e.parent&&e.parent.remove(e)},H=(e,t)=>{var{material:r,geometry:n}=e;const a=new u.Z.InstancedMesh(n,r,t.length+1);return[e,...t].map(((e,t)=>{e.updateMatrix(),a.setMatrixAt(t,e.matrixWorld)})),a.name=e.name,a},W=(e,t)=>{const r=[];if(t.map((e=>{e=e.geometry,r.push(e)})),t=i.qf(r))return new u.Z.Mesh(t,e)},K=e=>0!==e.animations.length,q=e=>{e&&e.userData&&(e.userData.isHelper=!0)},Z=e=>null==(e=null==e?void 0:e.userData)?void 0:e.isHelper,X=(e,t)=>{null!=t&&(0===t?e.layers.set(0):e.layers.enable(1),(0,f.M)(e,"layers",t))},Q=e=>{const t=[];e.traverse((e=>{t.push(e)}))},Y=e=>{let t=!1;if(e)return e.traverse((e=>{e.isSkinnedMesh&&(t=!0)})),t},J=(e,t)=>{t?(0,f.M)(e,"isDynamic",!0):delete e.userData.isDynamic},$=(e,t)=>e&&t?!!e.userData.isDynamic||!!e.parent&&$(e.parent,t):null==(t=null==e?void 0:e.userData)?void 0:t.isDynamic,ee=e=>e.userData.cloneId,te=(e,t)=>{(0,f.M)(e,"cloneId",t)},re=e=>{delete e.userData.cloneId},ne=e=>1===e.userData.layers,ae=e=>e.isSprite,ie=e=>{},se=e=>{var t=new a.Vector3;return(new a.Box3).setFromObject(e).getSize(t),t},oe={open(e){delete e.userData.unSelectable},close(e){e.userData.unSelectable=!0},is:e=>void 0===e.userData.unSelectable},le={set(e,t){t?delete e.userData.unNormal:e.userData.unNormal=!0},is:e=>!(0,s.N)(e)&&void 0===e.userData.unNormal,hasUnNormal:e=>void 0!==(null==(e=null==e?void 0:e.userData)?void 0:e.unNormal)},ce={is:e=>null==(e=null==e?void 0:e.userData)?void 0:e.isHelper,set(e,t=!0){t?e.userData.isHelper=!0:delete e.userData.isHelper}},ue={is:e=>null==(e=null==e?void 0:e.userData)?void 0:e.uselessGroup,set(e,t){t?e.userData.uselessGroup=!0:delete e.userData.uselessGroup}},he=(e,t)=>{let r=[];Array.isArray(e)?r.push(...e):r.push(e);const n={};return r.map((e=>e.traverse((e=>{null!=t&&t(e),n[(0,S.Ki)(e)]=e})))),n},de={is:e=>!(null==(e=null==e?void 0:e.userData)||!e.isTemp),set(e,t){t?e.userData.isTemp=t:delete e.userData.isTemp}},pe={is:e=>!(null==(e=null==e?void 0:e.userData)||!e.closeEvent),set(e,t){t?e.userData.closeEvent=t:delete e.userData.closeEvent}}},1863:(e,t,r)=>{r.d(t,{Z:()=>b});var n=r(6001),a=r(8881);function i(e){return(i="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})(e)}function s(e,t){return(s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function o(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function l(e){return(l=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var c,u=function(e){var t=n;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&s(t,e);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=l(e);if(r=t?(r=l(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===i(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return o(n)}}(n);function n(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},i=this;if(!(i instanceof(l=n)))throw new TypeError("Cannot call a class as a function");(i=r.call(this,e)).isWater=!0;var s=o(i),l=void 0!==t.textureWidth?t.textureWidth:512,c=(e=void 0!==t.textureHeight?t.textureHeight:512,void 0!==t.clipBias?t.clipBias:0),u=void 0!==t.alpha?t.alpha:1,h=void 0!==t.time?t.time:0,d=void 0!==t.waterNormals?t.waterNormals:null,p=void 0!==t.sunDirection?t.sunDirection:new a.Vector3(.70707,.70707,0),f=new a.Color(void 0!==t.sunColor?t.sunColor:16777215),m=new a.Color(void 0!==t.waterColor?t.waterColor:8355711),g=void 0!==t.eye?t.eye:new a.Vector3(0,0,0),v=void 0!==t.distortionScale?t.distortionScale:20,b=void 0!==t.side?t.side:a.FrontSide,y=(t=void 0!==t.fog&&t.fog,new a.Plane),x=new a.Vector3,w=new a.Vector3,S=new a.Vector3,M=new a.Matrix4,T=new a.Vector3(0,0,-1),_=new a.Vector4,E=new a.Vector3,k=new a.Vector3,D=new a.Vector4,O=new a.Matrix4,P=new a.PerspectiveCamera,A=new a.WebGLRenderTarget(l,e);return l={uniforms:a.UniformsUtils.merge([a.UniformsLib.fog,a.UniformsLib.lights,{normalSampler:{value:null},mirrorSampler:{value:null},alpha:{value:1},time:{value:0},size:{value:1},distortionScale:{value:20},textureMatrix:{value:new a.Matrix4},sunColor:{value:new a.Color(8355711)},sunDirection:{value:new a.Vector3(.70707,.70707,0)},eye:{value:new a.Vector3},waterColor:{value:new a.Color(5592405)}}]),vertexShader:"\n\t\t\t\tuniform mat4 textureMatrix;\n\t\t\t\tuniform float time;\n\n\t\t\t\tvarying vec4 mirrorCoord;\n\t\t\t\tvarying vec4 worldPosition;\n\n\t\t\t\t#include <common>\n\t\t\t\t#include <fog_pars_vertex>\n\t\t\t\t#include <shadowmap_pars_vertex>\n\t\t\t\t#include <logdepthbuf_pars_vertex>\n\n\t\t\t\tvoid main() {\n\t\t\t\t\tmirrorCoord = modelMatrix * vec4( position, 1.0 );\n\t\t\t\t\tworldPosition = mirrorCoord.xyzw;\n\t\t\t\t\tmirrorCoord = textureMatrix * mirrorCoord;\n\t\t\t\t\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t\tgl_Position = projectionMatrix * mvPosition;\n\n\t\t\t\t#include <beginnormal_vertex>\n\t\t\t\t#include <defaultnormal_vertex>\n\t\t\t\t#include <logdepthbuf_vertex>\n\t\t\t\t#include <fog_vertex>\n\t\t\t\t#include <shadowmap_vertex>\n\t\t\t}",fragmentShader:"\n\t\t\t\tuniform sampler2D mirrorSampler;\n\t\t\t\tuniform float alpha;\n\t\t\t\tuniform float time;\n\t\t\t\tuniform float size;\n\t\t\t\tuniform float distortionScale;\n\t\t\t\tuniform sampler2D normalSampler;\n\t\t\t\tuniform vec3 sunColor;\n\t\t\t\tuniform vec3 sunDirection;\n\t\t\t\tuniform vec3 eye;\n\t\t\t\tuniform vec3 waterColor;\n\n\t\t\t\tvarying vec4 mirrorCoord;\n\t\t\t\tvarying vec4 worldPosition;\n\n\t\t\t\tvec4 getNoise( vec2 uv ) {\n\t\t\t\t\tvec2 uv0 = ( uv / 103.0 ) + vec2(time / 17.0, time / 29.0);\n\t\t\t\t\tvec2 uv1 = uv / 107.0-vec2( time / -19.0, time / 31.0 );\n\t\t\t\t\tvec2 uv2 = uv / vec2( 8907.0, 9803.0 ) + vec2( time / 101.0, time / 97.0 );\n\t\t\t\t\tvec2 uv3 = uv / vec2( 1091.0, 1027.0 ) - vec2( time / 109.0, time / -113.0 );\n\t\t\t\t\tvec4 noise = texture2D( normalSampler, uv0 ) +\n\t\t\t\t\t\ttexture2D( normalSampler, uv1 ) +\n\t\t\t\t\t\ttexture2D( normalSampler, uv2 ) +\n\t\t\t\t\t\ttexture2D( normalSampler, uv3 );\n\t\t\t\t\treturn noise * 0.5 - 1.0;\n\t\t\t\t}\n\n\t\t\t\tvoid sunLight( const vec3 surfaceNormal, const vec3 eyeDirection, float shiny, float spec, float diffuse, inout vec3 diffuseColor, inout vec3 specularColor ) {\n\t\t\t\t\tvec3 reflection = normalize( reflect( -sunDirection, surfaceNormal ) );\n\t\t\t\t\tfloat direction = max( 0.0, dot( eyeDirection, reflection ) );\n\t\t\t\t\tspecularColor += pow( direction, shiny ) * sunColor * spec;\n\t\t\t\t\tdiffuseColor += max( dot( sunDirection, surfaceNormal ), 0.0 ) * sunColor * diffuse;\n\t\t\t\t}\n\n\t\t\t\t#include <common>\n\t\t\t\t#include <packing>\n\t\t\t\t#include <bsdfs>\n\t\t\t\t#include <fog_pars_fragment>\n\t\t\t\t#include <logdepthbuf_pars_fragment>\n\t\t\t\t#include <lights_pars_begin>\n\t\t\t\t#include <shadowmap_pars_fragment>\n\t\t\t\t#include <shadowmask_pars_fragment>\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\t#include <logdepthbuf_fragment>\n\t\t\t\t\tvec4 noise = getNoise( worldPosition.xz * size );\n\t\t\t\t\tvec3 surfaceNormal = normalize( noise.xzy * vec3( 1.5, 1.0, 1.5 ) );\n\n\t\t\t\t\tvec3 diffuseLight = vec3(0.0);\n\t\t\t\t\tvec3 specularLight = vec3(0.0);\n\n\t\t\t\t\tvec3 worldToEye = eye-worldPosition.xyz;\n\t\t\t\t\tvec3 eyeDirection = normalize( worldToEye );\n\t\t\t\t\tsunLight( surfaceNormal, eyeDirection, 100.0, 2.0, 0.5, diffuseLight, specularLight );\n\n\t\t\t\t\tfloat distance = length(worldToEye);\n\n\t\t\t\t\tvec2 distortion = surfaceNormal.xz * ( 0.001 + 1.0 / distance ) * distortionScale;\n\t\t\t\t\tvec3 reflectionSample = vec3( texture2D( mirrorSampler, mirrorCoord.xy / mirrorCoord.w + distortion ) );\n\n\t\t\t\t\tfloat theta = max( dot( eyeDirection, surfaceNormal ), 0.0 );\n\t\t\t\t\tfloat rf0 = 0.3;\n\t\t\t\t\tfloat reflectance = rf0 + ( 1.0 - rf0 ) * pow( ( 1.0 - theta ), 5.0 );\n\t\t\t\t\tvec3 scatter = max( 0.0, dot( surfaceNormal, eyeDirection ) ) * waterColor;\n\t\t\t\t\tvec3 albedo = mix( ( sunColor * diffuseLight * 0.3 + scatter ) * getShadowMask(), ( vec3( 0.1 ) + reflectionSample * 0.9 + reflectionSample * specularLight ), reflectance);\n\t\t\t\t\tvec3 outgoingLight = albedo;\n\t\t\t\t\tgl_FragColor = vec4( outgoingLight, alpha );\n\n\t\t\t\t\t#include <tonemapping_fragment>\n\t\t\t\t\t#include <fog_fragment>\n\t\t\t\t}"},(e=new a.ShaderMaterial({fragmentShader:l.fragmentShader,vertexShader:l.vertexShader,uniforms:a.UniformsUtils.clone(l.uniforms),lights:!0,side:b,fog:t})).uniforms.mirrorSampler.value=A.texture,e.uniforms.textureMatrix.value=O,e.uniforms.alpha.value=u,e.uniforms.time.value=h,e.uniforms.normalSampler.value=d,e.uniforms.sunColor.value=f,e.uniforms.waterColor.value=m,e.uniforms.sunDirection.value=p,e.uniforms.distortionScale.value=v,e.uniforms.eye.value=g,s.material=e,s.onBeforeRender=function(e,t,r){var n,a,i;w.setFromMatrixPosition(s.matrixWorld),S.setFromMatrixPosition(r.matrixWorld),M.extractRotation(s.matrixWorld),x.set(0,0,1),x.applyMatrix4(M),E.subVectors(w,S),0<E.dot(x)||(E.reflect(x).negate(),E.add(w),M.extractRotation(r.matrixWorld),T.set(0,0,-1),T.applyMatrix4(M),T.add(S),k.subVectors(w,T),k.reflect(x).negate(),k.add(w),P.position.copy(E),P.up.set(0,1,0),P.up.applyMatrix4(M),P.up.reflect(x),P.lookAt(k),P.far=r.far,P.updateMatrixWorld(),P.projectionMatrix.copy(r.projectionMatrix),O.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),O.multiply(P.projectionMatrix),O.multiply(P.matrixWorldInverse),y.setFromNormalAndCoplanarPoint(x,w),y.applyMatrix4(P.matrixWorldInverse),_.set(y.normal.x,y.normal.y,y.normal.z,y.constant),n=P.projectionMatrix,D.x=(Math.sign(_.x)+n.elements[8])/n.elements[0],D.y=(Math.sign(_.y)+n.elements[9])/n.elements[5],D.z=-1,D.w=(1+n.elements[10])/n.elements[14],_.multiplyScalar(2/_.dot(D)),n.elements[2]=_.x,n.elements[6]=_.y,n.elements[10]=_.z+1-c,n.elements[14]=_.w,g.setFromMatrixPosition(r.matrixWorld),n=e.getRenderTarget(),a=e.xr.enabled,i=e.shadowMap.autoUpdate,s.visible=!1,e.xr.enabled=!1,e.shadowMap.autoUpdate=!1,e.setRenderTarget(A),e.state.buffers.depth.setMask(!0),!1===e.autoClear&&e.clear(),e.render(t,P),s.visible=!0,e.xr.enabled=a,e.shadowMap.autoUpdate=i,e.setRenderTarget(n),void 0!==(t=r.viewport)&&e.state.viewport(t))},i}return t=n,Object.defineProperty(t,"prototype",{writable:!1}),t}(a.Mesh),h=r(1794),d=r(932),p=(t=r(4707),r(4670)),f=r(3736),m=r(3729),g=r(8089),v=r(8715);t.Gf.fog;class b{constructor(e){this.catchModel=new h.Z,this.map=new h.Z,this.inited=()=>{this.runScene.cb.render.add(b.type,this.render),this.runScene.cb.model.add.add(b.type,this.onModelAdd),this.runScene.cb.model.remove.add(b.type,this.onModelDel),this.runScene.modelEx.importAndExport.addParses("Water",{toNormal:e=>this.process(e),parse:e=>{const t=this.create();return e=e.model,t.name=e.name,t.visible=e.visible,t.position.copy(e.position),t.rotation.copy(e.rotation),t.scale.copy(e.scale),this.catchModel.set(e.userData.normal.id,{model:t,material:t.material}),t.material=e.material,t.userData=Object.assign({},e.userData),t}}),this.runScene.cb.loaderer.gltf.complete.add("water-model",this.complete),this.runScene.cb.load.complete.add("water-model",this.complete)},this.complete=()=>{this.catchModel.map(((e,t)=>{const{model:r,material:n}=t;t=r.material,r.material=n,b.mergeMaterial(t,n),this.bindMaterialData(n)})),this.catchModel.clear()},this.process=e=>{if(e=e.model,!this.is(e))return e;const t=(0,v.createDefModel)("Box");return t.userData.normal=Object.assign({type:"Water"},e.userData),t.name=e.name,t.visible=e.visible,t.position.copy(e.position),t.rotation.copy(e.rotation),t.scale.copy(e.scale),t.material=e.material,t},this.onModelAdd=e=>{var t;this.is(e.model)&&(e=e.model,(t=(0,m.Ki)(e))&&this.map.set(t,e))},this.onModelDel=e=>{this.is(e.model)&&(e=e.model,(e=(0,m.Ki)(e))&&this.map.delete(e))},this.render=()=>{0!==this.map.size&&this.map.map(((e,t)=>{t.material.uniforms.time.value+=1/60}))},this.runScene=e,this.runScene.cb.inited.add(b.type,this.inited)}create(){const e=new u(new a.PlaneGeometry(1e3,1e3),{textureWidth:512,textureHeight:512,sunDirection:new p.Sf.Vector3,sunColor:16711680,waterColor:16777215,distortionScale:3.7});return this.bindData(e),e.rotation.x=-Math.PI/2,e}static create(){const e=new u(new a.PlaneGeometry(1e3,1e3),{textureWidth:512,textureHeight:512,sunDirection:new p.Sf.Vector3,sunColor:16711680,waterColor:16777215,distortionScale:3.7});return e.rotation.x=-Math.PI/2,e}is(e){return"Water"===(null==(e=e.userData.normal)?void 0:e.type)}bindData(e){e.userData.normal={type:"Water"},e.name="water",this.bindMaterialData(e.material)}bindMaterialData(e){e.userData.type="Water",e.userData.id=e.userData.id||(0,n.getId)(),e.userData.tools=b.tools}set(e,t,r){e.material[t]=r}static mergeMaterial(e,t){var{fog:r,side:n}=e,{waterColor:a,distortionScale:i,normalSampler:s}=e.uniforms;t.fog=r,t.side=n,t.uniforms.normalSampler.value=s.value,t.uniforms.waterColor.value.copy(a.value),t.uniforms.distortionScale.value=i.value,t.userData=Object.assign({},e.userData)}}(c=b).type="water-model",b.tools={type:"Water",bind(e){(0,f.M)(e,"type","Water")},getTextures:e=>["normalSampler"].map((t=>{var r=e.uniforms[t].value;if(r)return{type:t,texture:r}})).filter((e=>e)),create:()=>{const e=c.create();return e.material.type=c.tools.type,e.material.userData.tools=c.tools,e.material},parseData:(e,t)=>{var{texture:e,material:r,normal:n}=e;const{data:a,load:i}=e,s=[],o=c.tools.create(t);var{side:e,fog:t,waterColor:n,distortionScale:l}=n;return!1===t&&(o.fog=!1),e&&(o.side=e),n&&(o.uniforms.waterColor.value=(0,g.ZD)(n)),void 0!==l&&(o.uniforms.distortionScale.value=l),i&&s.push(...a.map((e=>{const{type:t,texture:r}=e;return()=>{o.uniforms[t].value=r}}))),o.userData=Object.assign({},r.userData),{material:o,setTextureFns:s}},toNormal:e=>{const t=(0,d.createDefMaterial)();var r={type:"Water",id:(0,m.Ki)(t)};const n={type:"Water"};return e.fog||(n.fog=!1),0!==e.side&&(n.side=e.side),n.waterColor=e.uniforms.waterColor.value.getHexString(),n.distortionScale=e.uniforms.distortionScale.value,t.userData=r,{normal:n,textures:b.tools.getTextures(e),material:t}},clone:e=>e,copy:e=>{const t=e.clone();return t.userData.type=b.tools.type,t}}},228:(e,t,r)=>{r.d(t,{Q:()=>d,S:()=>p});var n=r(4670),a=r(8881),i=r(4819),s=r(6608);function o(e){return(o="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})(e)}function l(e,t){return(l=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function c(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=u(e);if(r=t?(r=u(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===o(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function u(e){return(u=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var h=function(e){var t=n;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&l(t,e);var r=c(n);function n(e,t,o,l){var c;if(!(this instanceof n))throw new TypeError("Cannot call a class as a function");return(c=r.call(this)).renderScene=t,c.renderCamera=o,c.selectedObjects=void 0!==l?l:[],c.visibleEdgeColor=new a.Color(1,1,1),c.hiddenEdgeColor=new a.Color(.1,.04,.02),c.edgeGlow=0,c.usePatternTexture=!1,c.edgeThickness=1,c.edgeStrength=3,c.downSampleRatio=2,c.pulsePeriod=0,c._visibilityCache=new Map,c.resolution=void 0!==e?new a.Vector2(e.x,e.y):new a.Vector2(256,256),t=Math.round(c.resolution.x/c.downSampleRatio),o=Math.round(c.resolution.y/c.downSampleRatio),c.renderTargetMaskBuffer=new a.WebGLRenderTarget(c.resolution.x,c.resolution.y),c.renderTargetMaskBuffer.texture.name="OutlinePass.mask",c.renderTargetMaskBuffer.texture.generateMipmaps=!1,c.depthMaterial=new a.MeshDepthMaterial,c.depthMaterial.side=a.DoubleSide,c.depthMaterial.depthPacking=a.RGBADepthPacking,c.depthMaterial.blending=a.NoBlending,c.prepareMaskMaterial=c.getPrepareMaskMaterial(),c.prepareMaskMaterial.side=a.DoubleSide,c.prepareMaskMaterial.fragmentShader=function(e,t){return t=t.isPerspectiveCamera?"perspective":"orthographic",e.replace(/DEPTH_TO_VIEW_Z/g,t+"DepthToViewZ")}(c.prepareMaskMaterial.fragmentShader,c.renderCamera),c.renderTargetDepthBuffer=new a.WebGLRenderTarget(c.resolution.x,c.resolution.y),c.renderTargetDepthBuffer.texture.name="OutlinePass.depth",c.renderTargetDepthBuffer.texture.generateMipmaps=!1,c.renderTargetMaskDownSampleBuffer=new a.WebGLRenderTarget(t,o),c.renderTargetMaskDownSampleBuffer.texture.name="OutlinePass.depthDownSample",c.renderTargetMaskDownSampleBuffer.texture.generateMipmaps=!1,c.renderTargetBlurBuffer1=new a.WebGLRenderTarget(t,o),c.renderTargetBlurBuffer1.texture.name="OutlinePass.blur1",c.renderTargetBlurBuffer1.texture.generateMipmaps=!1,c.renderTargetBlurBuffer2=new a.WebGLRenderTarget(Math.round(t/2),Math.round(o/2)),c.renderTargetBlurBuffer2.texture.name="OutlinePass.blur2",c.renderTargetBlurBuffer2.texture.generateMipmaps=!1,c.edgeDetectionMaterial=c.getEdgeDetectionMaterial(),c.renderTargetEdgeBuffer1=new a.WebGLRenderTarget(t,o),c.renderTargetEdgeBuffer1.texture.name="OutlinePass.edge1",c.renderTargetEdgeBuffer1.texture.generateMipmaps=!1,c.renderTargetEdgeBuffer2=new a.WebGLRenderTarget(Math.round(t/2),Math.round(o/2)),c.renderTargetEdgeBuffer2.texture.name="OutlinePass.edge2",c.renderTargetEdgeBuffer2.texture.generateMipmaps=!1,c.separableBlurMaterial1=c.getSeperableBlurMaterial(4),c.separableBlurMaterial1.uniforms.texSize.value.set(t,o),c.separableBlurMaterial1.uniforms.kernelRadius.value=1,c.separableBlurMaterial2=c.getSeperableBlurMaterial(4),c.separableBlurMaterial2.uniforms.texSize.value.set(Math.round(t/2),Math.round(o/2)),c.separableBlurMaterial2.uniforms.kernelRadius.value=4,c.overlayMaterial=c.getOverlayMaterial(),l=s.C,c.copyUniforms=a.UniformsUtils.clone(l.uniforms),c.copyUniforms.opacity.value=1,c.materialCopy=new a.ShaderMaterial({uniforms:c.copyUniforms,vertexShader:l.vertexShader,fragmentShader:l.fragmentShader,blending:a.NoBlending,depthTest:!1,depthWrite:!1,transparent:!0}),c.enabled=!0,c.needsSwap=!1,c._oldClearColor=new a.Color,c.oldClearAlpha=1,c.fsQuad=new i.T(null),c.tempPulseColor1=new a.Color,c.tempPulseColor2=new a.Color,c.textureMatrix=new a.Matrix4,c}return t=n,(e=[{key:"dispose",value:function(){this.renderTargetMaskBuffer.dispose(),this.renderTargetDepthBuffer.dispose(),this.renderTargetMaskDownSampleBuffer.dispose(),this.renderTargetBlurBuffer1.dispose(),this.renderTargetBlurBuffer2.dispose(),this.renderTargetEdgeBuffer1.dispose(),this.renderTargetEdgeBuffer2.dispose(),this.depthMaterial.dispose(),this.prepareMaskMaterial.dispose(),this.edgeDetectionMaterial.dispose(),this.separableBlurMaterial1.dispose(),this.separableBlurMaterial2.dispose(),this.overlayMaterial.dispose(),this.materialCopy.dispose(),this.fsQuad.dispose()}},{key:"setSize",value:function(e,t){this.renderTargetMaskBuffer.setSize(e,t),this.renderTargetDepthBuffer.setSize(e,t),e=Math.round(e/this.downSampleRatio),t=Math.round(t/this.downSampleRatio),this.renderTargetMaskDownSampleBuffer.setSize(e,t),this.renderTargetBlurBuffer1.setSize(e,t),this.renderTargetEdgeBuffer1.setSize(e,t),this.separableBlurMaterial1.uniforms.texSize.value.set(e,t),e=Math.round(e/2),t=Math.round(t/2),this.renderTargetBlurBuffer2.setSize(e,t),this.renderTargetEdgeBuffer2.setSize(e,t),this.separableBlurMaterial2.uniforms.texSize.value.set(e,t)}},{key:"changeVisibilityOfSelectedObjects",value:function(e){var t=this._visibilityCache;function r(r){r.isMesh&&(!0===e?r.visible=t.get(r):(t.set(r,r.visible),r.visible=e))}for(var n=0;n<this.selectedObjects.length;n++)this.selectedObjects[n].traverse(r)}},{key:"changeVisibilityOfNonSelectedObjects",value:function(e){var t=this._visibilityCache,r=[];function n(e){e.isMesh&&r.push(e)}for(var a=0;a<this.selectedObjects.length;a++)this.selectedObjects[a].traverse(n);this.renderScene.traverse((function(n){if(n.isMesh||n.isSprite){for(var a,i=!1,s=0;s<r.length;s++)if(r[s].id===n.id){i=!0;break}!1===i&&(a=n.visible,!1!==e&&!0!==t.get(n)||(n.visible=e),t.set(n,a))}else(n.isPoints||n.isLine)&&(!0===e?n.visible=t.get(n):(t.set(n,n.visible),n.visible=e))}))}},{key:"updateTextureMatrix",value:function(){this.textureMatrix.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),this.textureMatrix.multiply(this.renderCamera.projectionMatrix),this.textureMatrix.multiply(this.renderCamera.matrixWorldInverse)}},{key:"render",value:function(e,t,r,a,i){var s,o;0<this.selectedObjects.length&&(e.getClearColor(this._oldClearColor),this.oldClearAlpha=e.getClearAlpha(),s=e.autoClear,e.autoClear=!1,i&&e.state.buffers.stencil.setTest(!1),e.setClearColor(16777215,1),this.changeVisibilityOfSelectedObjects(!1),o=this.renderScene.background,this.renderScene.background=null,this.renderScene.overrideMaterial=this.depthMaterial,e.setRenderTarget(this.renderTargetDepthBuffer),e.clear(),e.render(this.renderScene,this.renderCamera),this.changeVisibilityOfSelectedObjects(!0),this._visibilityCache.clear(),this.updateTextureMatrix(),this.changeVisibilityOfNonSelectedObjects(!1),this.renderScene.overrideMaterial=this.prepareMaskMaterial,this.prepareMaskMaterial.uniforms.cameraNearFar.value.set(this.renderCamera.near,this.renderCamera.far),this.prepareMaskMaterial.uniforms.depthTexture.value=this.renderTargetDepthBuffer.texture,this.prepareMaskMaterial.uniforms.textureMatrix.value=this.textureMatrix,e.setRenderTarget(this.renderTargetMaskBuffer),e.clear(),e.render(this.renderScene,this.renderCamera),this.renderScene.overrideMaterial=null,this.changeVisibilityOfNonSelectedObjects(!0),this._visibilityCache.clear(),this.renderScene.background=o,this.fsQuad.material=this.materialCopy,this.copyUniforms.tDiffuse.value=this.renderTargetMaskBuffer.texture,e.setRenderTarget(this.renderTargetMaskDownSampleBuffer),e.clear(),this.fsQuad.render(e),this.tempPulseColor1.copy(this.visibleEdgeColor),this.tempPulseColor2.copy(this.hiddenEdgeColor),0<this.pulsePeriod&&(o=.625+.75*Math.cos(.01*performance.now()/this.pulsePeriod)/2,this.tempPulseColor1.multiplyScalar(o),this.tempPulseColor2.multiplyScalar(o)),this.fsQuad.material=this.edgeDetectionMaterial,this.edgeDetectionMaterial.uniforms.maskTexture.value=this.renderTargetMaskDownSampleBuffer.texture,this.edgeDetectionMaterial.uniforms.texSize.value.set(this.renderTargetMaskDownSampleBuffer.width,this.renderTargetMaskDownSampleBuffer.height),this.edgeDetectionMaterial.uniforms.visibleEdgeColor.value=this.tempPulseColor1,this.edgeDetectionMaterial.uniforms.hiddenEdgeColor.value=this.tempPulseColor2,e.setRenderTarget(this.renderTargetEdgeBuffer1),e.clear(),this.fsQuad.render(e),this.fsQuad.material=this.separableBlurMaterial1,this.separableBlurMaterial1.uniforms.colorTexture.value=this.renderTargetEdgeBuffer1.texture,this.separableBlurMaterial1.uniforms.direction.value=n.BlurDirectionX,this.separableBlurMaterial1.uniforms.kernelRadius.value=this.edgeThickness,e.setRenderTarget(this.renderTargetBlurBuffer1),e.clear(),this.fsQuad.render(e),this.separableBlurMaterial1.uniforms.colorTexture.value=this.renderTargetBlurBuffer1.texture,this.separableBlurMaterial1.uniforms.direction.value=n.BlurDirectionY,e.setRenderTarget(this.renderTargetEdgeBuffer1),e.clear(),this.fsQuad.render(e),this.fsQuad.material=this.separableBlurMaterial2,this.separableBlurMaterial2.uniforms.colorTexture.value=this.renderTargetEdgeBuffer1.texture,this.separableBlurMaterial2.uniforms.direction.value=n.BlurDirectionX,e.setRenderTarget(this.renderTargetBlurBuffer2),e.clear(),this.fsQuad.render(e),this.separableBlurMaterial2.uniforms.colorTexture.value=this.renderTargetBlurBuffer2.texture,this.separableBlurMaterial2.uniforms.direction.value=n.BlurDirectionY,e.setRenderTarget(this.renderTargetEdgeBuffer2),e.clear(),this.fsQuad.render(e),this.fsQuad.material=this.overlayMaterial,this.overlayMaterial.uniforms.maskTexture.value=this.renderTargetMaskBuffer.texture,this.overlayMaterial.uniforms.edgeTexture1.value=this.renderTargetEdgeBuffer1.texture,this.overlayMaterial.uniforms.edgeTexture2.value=this.renderTargetEdgeBuffer2.texture,this.overlayMaterial.uniforms.patternTexture.value=this.patternTexture,this.overlayMaterial.uniforms.edgeStrength.value=this.edgeStrength,this.overlayMaterial.uniforms.edgeGlow.value=this.edgeGlow,this.overlayMaterial.uniforms.usePatternTexture.value=this.usePatternTexture,i&&e.state.buffers.stencil.setTest(!0),e.setRenderTarget(r),this.fsQuad.render(e),e.setClearColor(this._oldClearColor,this.oldClearAlpha),e.autoClear=s),this.renderToScreen&&(this.fsQuad.material=this.materialCopy,this.copyUniforms.tDiffuse.value=r.texture,e.setRenderTarget(null),this.fsQuad.render(e))}},{key:"getPrepareMaskMaterial",value:function(){return new a.ShaderMaterial({uniforms:{depthTexture:{value:null},cameraNearFar:{value:new a.Vector2(.5,.5)},textureMatrix:{value:null}},vertexShader:"#include <morphtarget_pars_vertex>\n\t\t\t\t#include <skinning_pars_vertex>\n\n\t\t\t\tvarying vec4 projTexCoord;\n\t\t\t\tvarying vec4 vPosition;\n\t\t\t\tuniform mat4 textureMatrix;\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\t#include <skinbase_vertex>\n\t\t\t\t\t#include <begin_vertex>\n\t\t\t\t\t#include <morphtarget_vertex>\n\t\t\t\t\t#include <skinning_vertex>\n\t\t\t\t\t#include <project_vertex>\n\n\t\t\t\t\tvPosition = mvPosition;\n\n\t\t\t\t\tvec4 worldPosition = vec4( transformed, 1.0 );\n\n\t\t\t\t\t#ifdef USE_INSTANCING\n\n\t\t\t\t\t\tworldPosition = instanceMatrix * worldPosition;\n\n\t\t\t\t\t#endif\n\t\t\t\t\t\n\t\t\t\t\tworldPosition = modelMatrix * worldPosition;\n\n\t\t\t\t\tprojTexCoord = textureMatrix * worldPosition;\n\n\t\t\t\t}",fragmentShader:"#include <packing>\n\t\t\t\tvarying vec4 vPosition;\n\t\t\t\tvarying vec4 projTexCoord;\n\t\t\t\tuniform sampler2D depthTexture;\n\t\t\t\tuniform vec2 cameraNearFar;\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tfloat depth = unpackRGBAToDepth(texture2DProj( depthTexture, projTexCoord ));\n\t\t\t\t\tfloat viewZ = - DEPTH_TO_VIEW_Z( depth, cameraNearFar.x, cameraNearFar.y );\n\t\t\t\t\tfloat depthTest = (-vPosition.z > viewZ) ? 1.0 : 0.0;\n\t\t\t\t\tgl_FragColor = vec4(0.0, depthTest, 1.0, 1.0);\n\n\t\t\t\t}"})}},{key:"getEdgeDetectionMaterial",value:function(){return new a.ShaderMaterial({uniforms:{maskTexture:{value:null},texSize:{value:new a.Vector2(.5,.5)},visibleEdgeColor:{value:new a.Vector3(1,1,1)},hiddenEdgeColor:{value:new a.Vector3(1,1,1)}},vertexShader:"varying vec2 vUv;\n\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}",fragmentShader:"varying vec2 vUv;\n\n\t\t\t\tuniform sampler2D maskTexture;\n\t\t\t\tuniform vec2 texSize;\n\t\t\t\tuniform vec3 visibleEdgeColor;\n\t\t\t\tuniform vec3 hiddenEdgeColor;\n\n\t\t\t\tvoid main() {\n\t\t\t\t\tvec2 invSize = 1.0 / texSize;\n\t\t\t\t\tvec4 uvOffset = vec4(1.0, 0.0, 0.0, 1.0) * vec4(invSize, invSize);\n\t\t\t\t\tvec4 c1 = texture2D( maskTexture, vUv + uvOffset.xy);\n\t\t\t\t\tvec4 c2 = texture2D( maskTexture, vUv - uvOffset.xy);\n\t\t\t\t\tvec4 c3 = texture2D( maskTexture, vUv + uvOffset.yw);\n\t\t\t\t\tvec4 c4 = texture2D( maskTexture, vUv - uvOffset.yw);\n\t\t\t\t\tfloat diff1 = (c1.r - c2.r)*0.5;\n\t\t\t\t\tfloat diff2 = (c3.r - c4.r)*0.5;\n\t\t\t\t\tfloat d = length( vec2(diff1, diff2) );\n\t\t\t\t\tfloat a1 = min(c1.g, c2.g);\n\t\t\t\t\tfloat a2 = min(c3.g, c4.g);\n\t\t\t\t\tfloat visibilityFactor = min(a1, a2);\n\t\t\t\t\tvec3 edgeColor = 1.0 - visibilityFactor > 0.001 ? visibleEdgeColor : hiddenEdgeColor;\n\t\t\t\t\tgl_FragColor = vec4(edgeColor, 1.0) * vec4(d);\n\t\t\t\t}"})}},{key:"getSeperableBlurMaterial",value:function(e){return new a.ShaderMaterial({defines:{MAX_RADIUS:e},uniforms:{colorTexture:{value:null},texSize:{value:new a.Vector2(.5,.5)},direction:{value:new a.Vector2(.5,.5)},kernelRadius:{value:1}},vertexShader:"varying vec2 vUv;\n\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}",fragmentShader:"#include <common>\n\t\t\t\tvarying vec2 vUv;\n\t\t\t\tuniform sampler2D colorTexture;\n\t\t\t\tuniform vec2 texSize;\n\t\t\t\tuniform vec2 direction;\n\t\t\t\tuniform float kernelRadius;\n\n\t\t\t\tfloat gaussianPdf(in float x, in float sigma) {\n\t\t\t\t\treturn 0.39894 * exp( -0.5 * x * x/( sigma * sigma))/sigma;\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\t\t\t\t\tvec2 invSize = 1.0 / texSize;\n\t\t\t\t\tfloat sigma = kernelRadius/2.0;\n\t\t\t\t\tfloat weightSum = gaussianPdf(0.0, sigma);\n\t\t\t\t\tvec4 diffuseSum = texture2D( colorTexture, vUv) * weightSum;\n\t\t\t\t\tvec2 delta = direction * invSize * kernelRadius/float(MAX_RADIUS);\n\t\t\t\t\tvec2 uvOffset = delta;\n\t\t\t\t\tfor( int i = 1; i <= MAX_RADIUS; i ++ ) {\n\t\t\t\t\t\tfloat x = kernelRadius * float(i) / float(MAX_RADIUS);\n\t\t\t\t\t\tfloat w = gaussianPdf(x, sigma);\n\t\t\t\t\t\tvec4 sample1 = texture2D( colorTexture, vUv + uvOffset);\n\t\t\t\t\t\tvec4 sample2 = texture2D( colorTexture, vUv - uvOffset);\n\t\t\t\t\t\tdiffuseSum += ((sample1 + sample2) * w);\n\t\t\t\t\t\tweightSum += (2.0 * w);\n\t\t\t\t\t\tuvOffset += delta;\n\t\t\t\t\t}\n\t\t\t\t\tgl_FragColor = diffuseSum/weightSum;\n\t\t\t\t}"})}},{key:"getOverlayMaterial",value:function(){return new a.ShaderMaterial({uniforms:{maskTexture:{value:null},edgeTexture1:{value:null},edgeTexture2:{value:null},patternTexture:{value:null},edgeStrength:{value:1},edgeGlow:{value:1},usePatternTexture:{value:0}},vertexShader:"varying vec2 vUv;\n\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}",fragmentShader:"varying vec2 vUv;\n\n\t\t\t\tuniform sampler2D maskTexture;\n\t\t\t\tuniform sampler2D edgeTexture1;\n\t\t\t\tuniform sampler2D edgeTexture2;\n\t\t\t\tuniform sampler2D patternTexture;\n\t\t\t\tuniform float edgeStrength;\n\t\t\t\tuniform float edgeGlow;\n\t\t\t\tuniform bool usePatternTexture;\n\n\t\t\t\tvoid main() {\n\t\t\t\t\tvec4 edgeValue1 = texture2D(edgeTexture1, vUv);\n\t\t\t\t\tvec4 edgeValue2 = texture2D(edgeTexture2, vUv);\n\t\t\t\t\tvec4 maskColor = texture2D(maskTexture, vUv);\n\t\t\t\t\tvec4 patternColor = texture2D(patternTexture, 6.0 * vUv);\n\t\t\t\t\tfloat visibilityFactor = 1.0 - maskColor.g > 0.0 ? 1.0 : 0.5;\n\t\t\t\t\tvec4 edgeValue = edgeValue1 + edgeValue2 * edgeGlow;\n\t\t\t\t\tvec4 finalColor = edgeStrength * maskColor.r * edgeValue;\n\t\t\t\t\tif(usePatternTexture)\n\t\t\t\t\t\tfinalColor += + visibilityFactor * (1.0 - maskColor.r) * (1.0 - patternColor.r);\n\t\t\t\t\tgl_FragColor = finalColor;\n\t\t\t\t}",blending:a.AdditiveBlending,depthTest:!1,depthWrite:!1,transparent:!0})}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),n}(i.w);h.BlurDirectionX=new a.Vector2(1,0),h.BlurDirectionY=new a.Vector2(0,1);class d{constructor(e){this.mtuPP=e,this.mtuPP.renderer&&this.postProcessing()}postProcessing(){this.outlinePass||(this.outlinePass=new h(this.mtuPP.rtSize,this.mtuPP.mainScene,this.mtuPP.mainCamera)),this.mtuPP.effectComposer.addPass(this.outlinePass)}setOutlineData(e,t){this.outlinePass[e]="visibleEdgeColor"===e||"hiddenEdgeColor"===e?new n.Sf.Color(t):t}dispose(){this.outlinePass&&(this.outlinePass.dispose(),this.outlinePass=null)}addSelectedObject(e,t=!0){this.outlinePass&&e&&(this.outlinePass.selectedObjects||(this.outlinePass.selectedObjects=[]),t?this.isObjExist(e)||(e.userData.outline=!0,this.outlinePass.selectedObjects.push(e)):this.outlinePass.selectedObjects.map(((t,r)=>{t.uuid===e.uuid&&(e.userData.outline=!1,this.outlinePass.selectedObjects.splice(r,1))})))}clearAllOutlineObj(){this.outlinePass&&(this.outlinePass.selectedObjects=[])}isObjExist(e){if(!e||!this.outlinePass||!this.outlinePass.selectedObjects)return!1;let t=!1;return this.outlinePass.selectedObjects.forEach((r=>{e.uuid===r.uuid&&(t=!0)})),t}enablePass(e){this.outlinePass&&this.outlinePass.enabled!==e&&(this.outlinePass.enabled=e)}}const p=e=>e.userData.outline},7738:(e,t,r)=>{r.d(t,{Z:()=>a,s:()=>i});var n=r(8881);class a{constructor(e){this.setSize=(e,t)=>{var{width:r,height:n}=this.getDomSize();this.runScene.setSize(e||r,t||n),this.runScene.cb.renderEx.setSize.cb({width:r,height:n})},this.runScene=e,this.runScene.cb.resize.add("render-ex-resize",(()=>{this.setSize()}))}setBackground(e){this.runScene.assetsEx.engineDom.style.background=e}create(e){let t=new n.WebGLRenderer({antialias:!0,alpha:!0,powerPreference:"high-performance"});return t.domElement.style.position="absolute",t.setPixelRatio(window.devicePixelRatio),t.shadowMap.enabled=!0,t.shadowMap.type=n.PCFSoftShadowMap,t.physicallyCorrectLights=!0,t.localClippingEnabled=!0,e.appendChild(t.domElement),t}getDomSize(){var{width:e,height:t}=this.runScene.assetsEx.get().engineDom.getBoundingClientRect();return{width:e,height:t}}}const i=(e,t)=>{t=(t||{}).removeDom,!(e.render=()=>{})!==t&&e.domElement.remove(),e.setAnimationLoop(null),e.dispose(),e.renderLists&&e.renderLists.dispose()}},4670:(e,t,r)=>{r.d(t,{Gc:()=>ma,al:()=>ot,ch:()=>h,Az:()=>it,Sf:()=>ga,cQ:()=>u,ZP:()=>va}),t={};var n=(r.r(t),r.d(t,{FBXLoader:()=>tr}),r(3300)),a=r.n(n),i=r(6001),s=r(8881);class o{constructor(e){this.runScene=e}}var l=r(2353),c=r(5247),u=r(4457),h=r(8715);class d extends o{constructor(e){super(e),this.map={},this.clock=new s.Clock,this.tickIndex=void 0,this.playings=new Set,this.updates={},this.clean=()=>{this.reset()},e.cb.model.add.add("anima-parse",(({model:e})=>{this.parses(e)})),e.cb.model.remove.add("anima-parse",(({model:e})=>{this.onModelDelete(e)})),this.runScene.cb.clean.add("EngineHelper",this.clean)}onModelDelete(e){e.traverse((e=>{(0,h.withAnima)(e)&&e.animations.map((t=>{t.id&&(this.close(e,t.name),delete this.map[t.id])}))}))}parses(e){e.traverse((e=>this.parse(e)))}findId(e,t){for(const r of e.animations)if(r.name===t)return r.id}parse(e,t){if(0!==e.animations.length||t){const a=e.animations.length?e.animations:l.B.parse(t),o=new s.AnimationMixer(e);for(const t of a){var r=(0,i.getId)(),n=(t.id=r,o.clipAction(t));const a={finished:()=>{},loop:()=>{}};o.addEventListener("finished",(()=>a.finished())),o.addEventListener("loop",(()=>a.loop())),this.map[r]={mixer:o,action:n,model:e,time:0,runState:"close",clip:t,eventMap:a}}a.map((t=>{e.animations.find((e=>e.uuid===t.uuid))||e.animations.push(t)}))}}play(e,t,r){e=this.findId(e,t);const n=this.map[e];if(n&&!this.playings.has(n)){t=(0,u.mergeObject)({onLoop:()=>{},onProgress:()=>{},onFinished:()=>{},onClose:()=>{},onPause:()=>{},onResume:()=>{},onBeforeEnd:()=>{},loop:!1,lastFrame:!0,reset:!0},r);const{onProgress:a,onBeforeEnd:i,onLoop:s,onFinished:o,lastFrame:l,loop:h,reset:d}=t,{action:p,clip:f,eventMap:m}=(this.map[e].options=t,n);p.stop(),r=d?0:n.time,p.time=r,this.setPlayState(n,!0),d&&p.reset(),p.play();let g=!(n.runState="play");this.setUpdates(e,(()=>{var e=(0,u.getProgress)(p.time,f.duration,!0);99<=e&&!g&&(i(),g=!0),a(e)})),h?(p.loop=c.Z.LoopRepeat,m.loop=s):(l&&(p.clampWhenFinished=!0),p.loop=c.Z.LoopOnce,m.finished=()=>{this.setPlayState(n,!1),a(100),o()})}}pause(e,t){e=this.findId(e,t);const r=this.map[e];r&&this.playings.has(r)&&(this.updateTime(r),this.setPlayState(r,!1),r.options.onPause(),r.runState="pause")}resume(e,t){var r=this.findId(e,t);const n=this.map[r];n&&this.playings.has(n)&&(n.options.onResume(),this.play(e,t,null==(r=this.map[t])?void 0:r.options))}playAll(){this.pauseAll(),this.playings.clear(),Object.values(this.map).map((e=>{this.playings.add(e);const t=e.action;t.time=0,t.play()})),this.anima()}setValue(e){let t=this.clock.getDelta();Object.keys(this.map).map((r=>{const{mixer:n,action:a}=this.map[r];a.play(),a.time=e,n.update(t)}))}getDetal(){return this.clock.getDelta()}update(e){const t=e||this.getDetal();(0,i.mapObj)(this.updates,((e,r)=>r(t)))}anima(){let e=this.clock.getDelta();this.update(e),this.playings.forEach((t=>{t.mixer.update(e)})),this.tickIndex=window.requestAnimationFrame(this.anima.bind(this))}closeAnima(){window.cancelAnimationFrame(this.tickIndex)}resetItem(e){const{mixer:t,action:r}=e;r.reset(),r.stop(),t.time=0}pauseAll(){this.closeAnima(),this.playings.forEach((e=>this.resetItem(e))),this.playings.clear()}reset(){this.pauseAll(),this.map={},this.playings.clear(),this.closeAnima()}updateTime(e,t){e.time=t||e.action.time}setPlayState(e,t){t?(this.playings.add(e),1===this.playings.size&&this.anima()):(this.playings.delete(e),delete this.updates[e.clip.id],0===this.playings.size&&this.closeAnima())}getItem(e,t){return e=this.findId(e,t),this.map[e]}close(e,t,r){e=this.findId(e,t);const n=this.map[e];n&&this.playings.has(n)&&n.options&&((t=(0,u.mergeObject)({resetAction:!0},r).resetAction)&&n.action.reset(),this.setPlayState(n,!1),this.updateTime(n,0),n.options.onClose(),n.options=null,n.runState="pause")}setUpdates(e,t){this.updates[e]=t}fadeTo(e){var{lastModel:e,lastName:t,nextModel:r,nextName:n,duration:a}=e;e=this.findId(e,t);const i=this.map[e];i&&(t=this.findId(r,n),(e=this.map[t])&&i.action.crossFadeTo(e.action,a,!0))}resetTime(e,t){const r=this.getItem(e,t);r&&(r.action.time=0)}}var p=r(3693),f=r(699);class m{constructor(e){this.scene=null,this.camera=null,this.controls=null,this.renderer=null,this.engineDom=null,this.clean=()=>{var e=this.get().camera;this.runScene.controlsEx.reset(),this.runScene.cameraEx.reset(e)},this.disposeRender=e=>{e&&(e.render=()=>{},e.domElement.remove())},this.runScene=e,this.runScene.cb.clean.add("assets",this.clean)}initRender3(){const e=new p.lX;return e.setSize(this.engineDom.clientWidth,this.engineDom.clientHeight),e.domElement.style.position="absolute",e.domElement.style.top=String(0),e.domElement.className="css3dRenderer",this.engineDom.appendChild(e.domElement),this.runScene.cb.resize.add("render-3",(({width:t,height:r})=>{e.setSize(t,r)})),e}initRender2(){const e=new f.M;return e.setSize(this.engineDom.clientWidth,this.engineDom.clientHeight),e.domElement.style.position="absolute",e.domElement.classList.add("css2dRenderer"),e.domElement.style.top="0px",e.domElement.style.left="0px",this.engineDom.insertBefore(e.domElement,this.engineDom.childNodes[0]),this.runScene.cb.resize.add("render-2",(({width:t,height:r})=>{e.setSize(t,r)})),e}reset(){var e=this.get().camera;this.runScene.renderEx.setSize(),this.runScene.cameraEx.reset(e),this.runScene.controlsEx.reset()}dispose(){this.disposeRender(this.render2),this.disposeRender(this.render3)}setRender2(e){e?this.render2=this.initRender2():this.render2&&(this.disposeRender(this.render2),this.render2=null)}setRender3(e){e?this.render3=this.initRender3():this.render3&&(this.disposeRender(this.render3),this.render3=null)}init(e){var t=this.runScene.sceneEx.create(),r=this.runScene.cameraEx.pCam,n=this.runScene.renderEx.create(e),a=this.runScene.controlsEx.create(r,e),{render2:i,render3:s}=this.runScene.optionsEx.options;return this.camera=r,this.scene=t,this.renderer=n,this.controls=a,this.engineDom=e,this.runScene.renderEx.setSize(),this.setRender2(i),this.setRender3(s),{scene:t,camera:r,render:n,controls:a,engineDom:e}}get(){var{scene:e,renderer:t,controls:r,engineDom:n}=this;return{scene:e,camera:this.runScene.cameraEx.getCamera(),renderer:t,controls:r,engineDom:n}}}class g{constructor(){this.cbs=[],this.cb=e=>this.cbs.map((t=>{var r;return null==(r=t.fn)?void 0:r.call(t,e)})).filter((e=>e)),this.emit=this.cb}add(e,t){return this.cbs.push({fn:t,name:e})}on(e,t){return this.add(t||"custom_"+(0,i.getId)(),e)}get(e){var t=this.cbs.findIndex((t=>t.name===e));if(-1!==t)return{data:this.cbs[t],index:t}}reset(e,t){return!!(e=this.get(e))&&(e.data.fn=t,!0)}remove(e){this.reset(e,null)}delete(e){e=(this.get(e)||{}).index,this.cbs.splice(e,1)}}class v{constructor(){this.resize=new g,this.renderEx={setSize:new g},this.setSelectMaterial=new g,this.setScene=new g,this.reset=new g,this.render=new g,this.tick=new g,this.baseLog=new g,this.inited=new g,this.texture={add:new g,remove:new g,set:new g,setAnima:new g},this.model={multiSelect:{setEmpty:new g},change:new g,setSelect:new g,click:new g,add:new g,remove:new g,multipDrop:new g,focus:new g,unFocus:new g,changeName:new g,setOpen:new g,setMainStatue:new g,setVisible:new g,setParent:new g,setLayers:new g,setOutline:new g,clone:new g,dispose:new g},this.material={add:new g,remove:new g,dispose:new g,setName:new g},this.unique={model:{add:new g},material:{add:new g}},this.tranControls={changing:new g},this.undo={addUndos:new g,addRedus:new g,removeUndos:new g,undoByIndex:new g,reset:new g},this.scene={save:new g,saveNet:new g,setEnvStrength:new g},this.timeLine={setProgress:new g,playGroup:new g,setGroupMap:new g,reset:new g,closeGroup:new g},this.events={key:{down:new g,up:new g},mouse:{move:new g,down:new g,up:new g},pointer:{rightTrigger:new g,down:new g,up:new g,move:new g,trigger:new g},model:{addOptions:new g}},this.pp={glow:{setData:new g,setStatus:new g},outline:{setData:new g,setStatus:new g},ao:{setData:new g,setStatus:new g},vignette:{setData:new g,setStatus:new g}},this.load={getJSON:new g,progress:new g,complete:new g},this.exporter={gltf:{before:new g,complete:new g}},this.loaderer={gltf:{loadNode:new g,lazyLoadedTexture:new g,loaded:new g,modelLoaded:new g,progress:new g,getJSON:new g,getArrayBuffer:new g,complete:new g}},this.custom=new Proxy({},{get:(e,t)=>(e[t]||(e[t]=new g),e[t])}),this.tags={parseJSON:new g,clear:new g},this.snapshot={create:new g,set:new g,resetItem:new g,delete:new g,getLength:new g,getByType:new g},this.clean=new g,this.objects={sky:{setState:new g}},this.error=new g}}var b=r(4230);function y(e){return(y="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})(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&&w(e,t)}function w(e,t){return(w=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function S(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function M(e){return(M=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var T={type:"change"},_={type:"start"},E={type:"end"},k=function(){x(t,s.EventDispatcher);var e=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=M(e);if(r=t?(r=M(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===y(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return S(n)}}(t);function t(r,n){(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")})(this,t),(a=e.call(this)).object=r,a.domElement=n,a.domElement.style.touchAction="none",a.enabled=!0,a.target=new s.Vector3,a.minDistance=0,a.maxDistance=1/0,a.minZoom=0,a.maxZoom=1/0,a.minPolarAngle=0,a.maxPolarAngle=Math.PI,a.minAzimuthAngle=-1/0,a.maxAzimuthAngle=1/0,a.enableDamping=!1,a.dampingFactor=.05,a.enableZoom=!0,a.zoomSpeed=1,a.enableRotate=!0,a.rotateSpeed=1,a.enablePan=!0,a.panSpeed=1,a.screenSpacePanning=!0,a.keyPanSpeed=7,a.autoRotate=!1,a.autoRotateSpeed=2,a.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},a.mouseButtons={LEFT:s.MOUSE.ROTATE,MIDDLE:s.MOUSE.DOLLY,RIGHT:s.MOUSE.PAN},a.touches={ONE:s.TOUCH.ROTATE,TWO:s.TOUCH.DOLLY_PAN},a.target0=a.target.clone(),a.position0=a.object.position.clone(),a.zoom0=a.object.zoom,a._domElementKeyEvents=null,a.getPolarAngle=function(){return g.phi},a.getAzimuthalAngle=function(){return g.theta},a.getDistance=function(){return this.object.position.distanceTo(this.target)},a.listenToKeyEvents=function(e){e.addEventListener("keydown",se),this._domElementKeyEvents=e},a.saveState=function(){d.target0.copy(d.target),d.position0.copy(d.object.position),d.zoom0=d.object.zoom},a.reset=function(){d.target.copy(d.target0),d.object.position.copy(d.position0),d.object.zoom=d.zoom0,d.object.updateProjectionMatrix(),d.dispatchEvent(T),d.update(),f=p.NONE},a.update=(i=new s.Vector3,o=(new s.Quaternion).setFromUnitVectors(r.up,new s.Vector3(0,1,0)),l=o.clone().invert(),c=new s.Vector3,u=new s.Quaternion,h=2*Math.PI,function(){var e=d.object.position,t=(i.copy(e).sub(d.target),i.applyQuaternion(o),g.setFromVector3(i),d.autoRotate&&f===p.NONE&&j(2*Math.PI/60/60*d.autoRotateSpeed),d.enableDamping?(g.theta+=v.theta*d.dampingFactor,g.phi+=v.phi*d.dampingFactor):(g.theta+=v.theta,g.phi+=v.phi),d.minAzimuthAngle),r=d.maxAzimuthAngle;return isFinite(t)&&isFinite(r)&&(t<-Math.PI?t+=h:t>Math.PI&&(t-=h),r<-Math.PI?r+=h:r>Math.PI&&(r-=h),g.theta=t<=r?Math.max(t,Math.min(r,g.theta)):g.theta>(t+r)/2?Math.max(t,g.theta):Math.min(r,g.theta)),g.phi=Math.max(d.minPolarAngle,Math.min(d.maxPolarAngle,g.phi)),g.makeSafe(),g.radius*=b,g.radius=Math.max(d.minDistance,Math.min(d.maxDistance,g.radius)),!0===d.enableDamping?d.target.addScaledVector(y,d.dampingFactor):d.target.add(y),i.setFromSpherical(g),i.applyQuaternion(l),e.copy(d.target).add(i),d.object.lookAt(d.target),!0===d.enableDamping?(v.theta*=1-d.dampingFactor,v.phi*=1-d.dampingFactor,y.multiplyScalar(1-d.dampingFactor)):(v.set(0,0,0),y.set(0,0,0)),b=1,!(!(x||c.distanceToSquared(d.object.position)>m||8*(1-u.dot(d.object.quaternion))>m)||(d.dispatchEvent(T),c.copy(d.object.position),u.copy(d.object.quaternion),x=!1))}),a.dispose=function(){d.domElement.removeEventListener("contextmenu",oe),d.domElement.removeEventListener("pointerdown",te),d.domElement.removeEventListener("pointercancel",ae),d.domElement.removeEventListener("wheel",ie),d.domElement.removeEventListener("pointermove",re),d.domElement.removeEventListener("pointerup",ne),null!==d._domElementKeyEvents&&d._domElementKeyEvents.removeEventListener("keydown",se)};var a,i,o,l,c,u,h,d=S(a),p={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},f=p.NONE,m=1e-6,g=new s.Spherical,v=new s.Spherical,b=1,y=new s.Vector3,x=!1,w=new s.Vector2,M=new s.Vector2,k=new s.Vector2,D=new s.Vector2,O=new s.Vector2,P=new s.Vector2,A=new s.Vector2,C=new s.Vector2,R=new s.Vector2,L=[],I={};function B(){return Math.pow(.95,d.zoomSpeed)}function j(e){v.theta-=e}function U(e){v.phi-=e}N=new s.Vector3;var N,F,z,V=function(e,t){N.setFromMatrixColumn(t,0),N.multiplyScalar(-e),y.add(N)},G=(F=new s.Vector3,function(e,t){!0===d.screenSpacePanning?F.setFromMatrixColumn(t,1):(F.setFromMatrixColumn(t,0),F.crossVectors(d.object.up,F)),F.multiplyScalar(e),y.add(F)}),H=(z=new s.Vector3,function(e,t){var r,n=d.domElement;d.object.isPerspectiveCamera?(r=d.object.position,z.copy(r).sub(d.target),r=z.length(),r*=Math.tan(d.object.fov/2*Math.PI/180),V(2*e*r/n.clientHeight,d.object.matrix),G(2*t*r/n.clientHeight,d.object.matrix)):d.object.isOrthographicCamera?(V(e*(d.object.right-d.object.left)/d.object.zoom/n.clientWidth,d.object.matrix),G(t*(d.object.top-d.object.bottom)/d.object.zoom/n.clientHeight,d.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),d.enablePan=!1)});function W(e){d.object.isPerspectiveCamera?b/=e:d.object.isOrthographicCamera?(d.object.zoom=Math.max(d.minZoom,Math.min(d.maxZoom,d.object.zoom*e)),d.object.updateProjectionMatrix(),x=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),d.enableZoom=!1)}function K(e){d.object.isPerspectiveCamera?b*=e:d.object.isOrthographicCamera?(d.object.zoom=Math.max(d.minZoom,Math.min(d.maxZoom,d.object.zoom/e)),d.object.updateProjectionMatrix(),x=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),d.enableZoom=!1)}function q(e){w.set(e.clientX,e.clientY)}function Z(e){D.set(e.clientX,e.clientY)}function X(){var e,t;1===L.length?w.set(L[0].pageX,L[0].pageY):(e=.5*(L[0].pageX+L[1].pageX),t=.5*(L[0].pageY+L[1].pageY),w.set(e,t))}function Q(){var e,t;1===L.length?D.set(L[0].pageX,L[0].pageY):(e=.5*(L[0].pageX+L[1].pageX),t=.5*(L[0].pageY+L[1].pageY),D.set(e,t))}function Y(){var e=L[0].pageX-L[1].pageX,t=L[0].pageY-L[1].pageY;e=Math.sqrt(e*e+t*t),A.set(0,e)}function J(e){1==L.length?M.set(e.pageX,e.pageY):(r=ue(e),t=.5*(e.pageX+r.x),e=.5*(e.pageY+r.y),M.set(t,e)),k.subVectors(M,w).multiplyScalar(d.rotateSpeed);var t,r=d.domElement;j(2*Math.PI*k.x/r.clientHeight),U(2*Math.PI*k.y/r.clientHeight),w.copy(M)}function $(e){var t,r;1===L.length?O.set(e.pageX,e.pageY):(t=ue(e),r=.5*(e.pageX+t.x),e=.5*(e.pageY+t.y),O.set(r,e)),P.subVectors(O,D).multiplyScalar(d.panSpeed),H(P.x,P.y),D.copy(O)}function ee(e){var t=ue(e),r=e.pageX-t.x;e=e.pageY-t.y,t=Math.sqrt(r*r+e*e),C.set(0,t),R.set(0,Math.pow(C.y/A.y,d.zoomSpeed)),W(R.y),A.copy(C)}function te(e){if(!1!==d.enabled)if(0===L.length&&(d.domElement.setPointerCapture(e.pointerId),d.domElement.addEventListener("pointermove",re),d.domElement.addEventListener("pointerup",ne)),L.push(e),"touch"===e.pointerType){switch(ce(e),L.length){case 1:switch(d.touches.ONE){case s.TOUCH.ROTATE:if(!1===d.enableRotate)return;X(),f=p.TOUCH_ROTATE;break;case s.TOUCH.PAN:if(!1===d.enablePan)return;Q(),f=p.TOUCH_PAN;break;default:f=p.NONE}break;case 2:switch(d.touches.TWO){case s.TOUCH.DOLLY_PAN:if(!1===d.enableZoom&&!1===d.enablePan)return;d.enableZoom&&Y(),d.enablePan&&Q(),f=p.TOUCH_DOLLY_PAN;break;case s.TOUCH.DOLLY_ROTATE:if(!1===d.enableZoom&&!1===d.enableRotate)return;d.enableZoom&&Y(),d.enableRotate&&X(),f=p.TOUCH_DOLLY_ROTATE;break;default:f=p.NONE}break;default:f=p.NONE}f!==p.NONE&&d.dispatchEvent(_)}else{var t,r=e;switch(r.button){case 0:t=d.mouseButtons.LEFT;break;case 1:t=d.mouseButtons.MIDDLE;break;case 2:t=d.mouseButtons.RIGHT;break;default:t=-1}switch(t){case s.MOUSE.DOLLY:if(!1===d.enableZoom)return;!function(e){A.set(e.clientX,e.clientY)}(r),f=p.DOLLY;break;case s.MOUSE.ROTATE:if(r.ctrlKey||r.metaKey||r.shiftKey){if(!1===d.enablePan)return;Z(r),f=p.PAN}else{if(!1===d.enableRotate)return;q(r),f=p.ROTATE}break;case s.MOUSE.PAN:if(r.ctrlKey||r.metaKey||r.shiftKey){if(!1===d.enableRotate)return;q(r),f=p.ROTATE}else{if(!1===d.enablePan)return;Z(r),f=p.PAN}break;default:f=p.NONE}f!==p.NONE&&d.dispatchEvent(_)}}function re(e){if(!1!==d.enabled)if("touch"===e.pointerType){var t=e;switch(ce(t),f){case p.TOUCH_ROTATE:if(!1===d.enableRotate)return;J(t),d.update();break;case p.TOUCH_PAN:if(!1===d.enablePan)return;$(t),d.update();break;case p.TOUCH_DOLLY_PAN:if(!1===d.enableZoom&&!1===d.enablePan)return;!function(e){d.enableZoom&&ee(e),d.enablePan&&$(e)}(t),d.update();break;case p.TOUCH_DOLLY_ROTATE:if(!1===d.enableZoom&&!1===d.enableRotate)return;!function(e){d.enableZoom&&ee(e),d.enableRotate&&J(e)}(t),d.update();break;default:f=p.NONE}}else{var r=e;switch(f){case p.ROTATE:if(!1===d.enableRotate)return;!function(e){M.set(e.clientX,e.clientY),k.subVectors(M,w).multiplyScalar(d.rotateSpeed),e=d.domElement,j(2*Math.PI*k.x/e.clientHeight),U(2*Math.PI*k.y/e.clientHeight),w.copy(M),d.update()}(r);break;case p.DOLLY:if(!1===d.enableZoom)return;!function(e){C.set(e.clientX,e.clientY),R.subVectors(C,A),0<R.y?W(B()):R.y<0&&K(B()),A.copy(C),d.update()}(r);break;case p.PAN:if(!1===d.enablePan)return;!function(e){O.set(e.clientX,e.clientY),P.subVectors(O,D).multiplyScalar(d.panSpeed),H(P.x,P.y),D.copy(O),d.update()}(r)}}}function ne(e){le(e),0===L.length&&(d.domElement.releasePointerCapture(e.pointerId),d.domElement.removeEventListener("pointermove",re),d.domElement.removeEventListener("pointerup",ne)),d.dispatchEvent(E),f=p.NONE}function ae(e){le(e)}function ie(e){!1!==d.enabled&&!1!==d.enableZoom&&f===p.NONE&&(e.preventDefault(),d.dispatchEvent(_),e.deltaY<0?K(B()):0<e.deltaY&&W(B()),d.update(),d.dispatchEvent(E))}function se(e){if(!1!==d.enabled&&!1!==d.enablePan){var t=e,r=!1;switch(t.code){case d.keys.UP:t.ctrlKey||t.metaKey||t.shiftKey?U(2*Math.PI*d.rotateSpeed/d.domElement.clientHeight):H(0,d.keyPanSpeed),r=!0;break;case d.keys.BOTTOM:t.ctrlKey||t.metaKey||t.shiftKey?U(-2*Math.PI*d.rotateSpeed/d.domElement.clientHeight):H(0,-d.keyPanSpeed),r=!0;break;case d.keys.LEFT:t.ctrlKey||t.metaKey||t.shiftKey?j(2*Math.PI*d.rotateSpeed/d.domElement.clientHeight):H(d.keyPanSpeed,0),r=!0;break;case d.keys.RIGHT:t.ctrlKey||t.metaKey||t.shiftKey?j(-2*Math.PI*d.rotateSpeed/d.domElement.clientHeight):H(-d.keyPanSpeed,0),r=!0}r&&(t.preventDefault(),d.update())}}function oe(e){!1!==d.enabled&&e.preventDefault()}function le(e){delete I[e.pointerId];for(var t=0;t<L.length;t++)if(L[t].pointerId==e.pointerId)return void L.splice(t,1)}function ce(e){var t=I[e.pointerId];void 0===t&&(t=new s.Vector2,I[e.pointerId]=t),t.set(e.pageX,e.pageY)}function ue(e){return e=e.pointerId===L[0].pointerId?L[1]:L[0],I[e.pointerId]}return d.domElement.addEventListener("contextmenu",oe),d.domElement.addEventListener("pointerdown",te),d.domElement.addEventListener("pointercancel",ae),d.domElement.addEventListener("wheel",ie,{passive:!1}),a.update(),a}return function(e,t,r){return Object.defineProperty(e,"prototype",{writable:!1}),e}(t)}(),D=r(3263);const O={autoRotate:!1,autoRotateSpeed:2,dampingFactor:.05,enableDamping:!1,enablePan:!0,enableRotate:!0,enableZoom:!0,maxAzimuthAngle:1/0,maxDistance:1/0,maxPolarAngle:Math.PI,minAzimuthAngle:-1/0,minDistance:0,minPolarAngle:0,panSpeed:1,rotateSpeed:1,screenSpacePanning:!0,zoomSpeed:1,target:{x:0,y:0,z:0}};class P{constructor(e){this.inited=()=>{const e=this.runScene.assetsEx.controls;this.runScene.exporter.gltf.options.addOption({type:"controls",process:()=>{var t=(0,u.getDiff)(O,e);return JSON.stringify(t)},parse:e=>{e&&this.parse(JSON.parse(e))}})},this.parse=e=>{const t=this.runScene.assetsEx.controls;(0,i.mapObj)(e,((e,r)=>{void 0!==r&&(D.YD.is(r)?t[e].set(r.x,r.y,r.z):t[e]=r)})),t.update()},(this.runScene=e).cb.inited.add("controls",this.inited)}reset(){this.parse(O)}create(e,t){return new k(e,t)}static toJSON(e){return e.target}static setTarget(e,t,r){var{x:n,y:a,z:i}=t,{x:r,y:s,z:o}=r||e.target;this.setTargetData.anima&&(this.setTargetData.anima.kill(),this.setTargetData.anima=null,this.setTarget(e,t,this.setTargetData.nowData)),this.setTargetData.anima=(0,u.anima)({x:r,y:s,z:o},{x:n,y:a,z:i},.5,(t=>{var{x:r,y:n,z:a}=t;e.target.set(r,n,a),e.update(),this.setTargetData.nowData=t}),(()=>{this.setTargetData.anima=null}))}}P.setTargetData={anima:null,nowData:null};var A=r(1794);const C=i.type.fnDebounce;class R{constructor(e){this.alt=!1,this.ctrl=!1,this.shift=!1,this.unExec=new A.Z,this.specialKeyDebounce=C((()=>{this.ctrl=!1,this.shift=!1,this.alt=!1}),1e3),this.fns={down:{s:e=>{this.ctrl&&(e.preventDefault(),this.allFn.s_saveScene())},d:e=>{this.ctrl&&(e.preventDefault(),this.allFn.d_copyModel())},alt:()=>{this.alt=!0,this.specialKeyDebounce()},control:()=>{this.ctrl=!0,this.specialKeyDebounce()},ctrl:()=>{this.ctrl=!0,this.specialKeyDebounce()},shift:()=>{this.shift=!0,this.specialKeyDebounce()},f11:()=>{this.events.runScene.cb.resize.cb(this.events.runScene.renderEx.getDomSize())},w:e=>{e.preventDefault(),e.stopPropagation(),this.events.runScene.helperEx.transContro.changeMode("position")},e:()=>{this.events.runScene.helperEx.transContro.changeMode("rotation")},f:()=>{this.allFn.f_focusModel()},delete:()=>{this.events.runScene.helperEx.unfocus();var e=this.events.runScene.multipSelector.getSelectedList("value");this.events.runScene.sceneEx.remove(this.events.runScene.modelEx.select||e),e&&this.events.runScene.multipSelector.delete()},z:e=>{this.ctrl&&(this.allFn.z_undo(e),this.specialKeyDebounce())},y:e=>{this.ctrl&&(this.allFn.y_redo(e),this.specialKeyDebounce())},r:e=>{this.events.runScene.helperEx.transContro.changeMode("scale"),e.preventDefault()}},up:{s:()=>{this.ctrl},alt:()=>{this.alt=!1},control:()=>{this.ctrl=!1},ctrl:()=>{this.ctrl=!1},shift:()=>{this.shift=!1}}},this.allFn={s_saveScene:()=>function(e,t,r,n){return new(r=r||Promise)((function(t,a){function i(e){try{o(n.next(e))}catch(e){a(e)}}function s(e){try{o(n.throw(e))}catch(e){a(e)}}function o(e){var n;e.done?t(e.value):((n=e.value)instanceof r?n:new r((function(e){e(n)}))).then(i,s)}o((n=n.apply(e,[])).next())}))}(this,0,void 0,(function*(){this.events.runScene.optionsEx.log("正在保存","base","info"),this.events.runScene.cb.scene.saveNet.cb("")})),d_copyModel:()=>{var e,t=this.events.runScene.modelEx.select;t&&(this.events.runScene.modelEx.selectNull(),(e=this.events.runScene.modelEx.clone(t,!1))&&this.events.runScene.modelEx.add(e,t.parent,{isClone:!0,select:!0}))},f_focusModel:()=>{var e=this.events.runScene.modelEx.select;e&&this.events.runScene.modelEx.focus(e)},z_undo:e=>{this.events.runScene.undoEx.undo()},y_redo:e=>{this.events.runScene.undoEx.redo()}},this.events=e}init(e){"running"!==this.events.runScene.optionsEx.options.mode&&(document.addEventListener("keydown",this.keyDown.bind(this)),document.addEventListener("keyup",this.keyUp.bind(this)),this.events.runScene.cb.model.setSelect.add("reset-unexec",(()=>{this.unExec.delete("delete")})))}keyDown(e){var t,r;"INPUT"!==document.activeElement.nodeName&&(r=e.key.toLowerCase(),this.events.runScene.cb.events.key.down.cb({key:r,event:e}),this.unExec.get(r)||null!=(r=(t=this.fns.down)[r])&&r.call(t,e))}keyUp(e){var t,r;"INPUT"!==document.activeElement.nodeName&&(r=e.key.toLowerCase(),this.events.runScene.cb.events.key.up.cb({key:r,event:e}),null!=(r=(t=this.fns.up)[r])&&r.call(t,e))}}var L=r(3801),I=r(6272);class B{constructor(e){this.downPosition={0:{x:0,y:0},2:{x:0,y:0}},this.enableUp=!0,this.isMove=!1,this.moveEvent=new MouseEvent("move"),this.down=e=>{0!==e.button&&2!==e.button||(this.downPosition[e.button]={x:e.offsetX,y:e.offsetY}),this.isMove=!0},this.up=e=>{var t,r,n,a;this.isMove=!1,1===e.button||null!=(t=this.events.runScene.helperEx.transContro)&&t.isDraggingChange||(t=e.offsetX,r=e.offsetY,({x:n,y:a}=this.downPosition[e.button]),(0,I.nx)(t,n,10)&&(0,I.nx)(r,a,10)&&(0===e.button&&this.trigger(e),2===e.button&&(this.events.runScene.modelEx.select||this.trigger(e),this.events.runScene.cb.events.pointer.rightTrigger.cb(e))))},this.selectable=!0,this.events=e}init(e){var t=this.events.runScene.optionsEx.options.event.base;let r=e;"dom"===t?r=e:"canvas"===t?r=this.events.runScene.assetsEx.renderer.domElement:"window"===t&&(r=window),r.addEventListener("pointerdown",this.down.bind(this)),r.addEventListener("pointerup",this.up.bind(this)),r.addEventListener("pointerdown",this.events.runScene.cb.events.pointer.down.cb),r.addEventListener("pointerup",this.events.runScene.cb.events.pointer.up.cb),r.addEventListener("pointermove",(e=>{this.moveEvent=e,this.events.runScene.cb.events.pointer.move.cb(e)})),r.addEventListener("mousemove",this.events.runScene.cb.events.mouse.move.cb),r.addEventListener("mousedown",this.events.runScene.cb.events.mouse.down.cb),r.addEventListener("mouseup",this.events.runScene.cb.events.mouse.up.cb)}getTriggerModels(e,t){const r=new s.Raycaster,n=new s.Vector2,{engineDom:a,camera:i,scene:o}=this.events.runScene.assetsEx.get();var{top:l,left:c,width:u,height:h}=a.getBoundingClientRect(),c=e.pageX-c;e=e.pageY-l,n.x=c/u*2-1,n.y=-e/h*2+1,r.setFromCamera(n,i),l=(t||o.children).filter((e=>{if((!this.events.runScene.helperEx.isHelper(e)||e.userData.id)&&!e.userData.unClick)return e}));const d=r.intersectObjects(l,!0);return this.events.runScene.cb.events.pointer.trigger.cb(d),d.map((e=>e.object))}removeHideOrLockModel(e){return e.find((e=>this.events.runScene.modelEx.deepIsVisible(e)&&!L.zf.isLock(e,!0)&&h.selectableModel.is(e)))}trigger(e){let t=this.removeHideOrLockModel(this.getTriggerModels(e));if(this.selectable){if(!t)return this.events.runScene.multipSelector.setEmpty(),void this.events.runScene.modelEx.selectNull();if(this.events.runScene.helperEx.isHelper(t)&&(e=this.events.runScene.uniqueEx.getId(t),t=this.events.runScene.uniqueEx.model.get(e)),!this.enableUp){if(t===this.events.runScene.helperEx.transContro.multipObj)return;this.enableUp=!0}if(this.events.runScene.cb.model.click.cb(t),this.events.key.ctrl)return this.enableUp=!1,this.events.runScene.multipSelector.add(t);if(this.events.key.shift){const e=t.parent;return e?void e.children.map((e=>{this.events.runScene.multipSelector.add(e)})):void 0}this.events.runScene.modelEx.setSelectByModel(t),this.events.runScene.lightEx.isLight(t)&&this.events.runScene.lightEx.setSelect(t)}}}var j=r(272),U=r(3729);class N{constructor(e){this.options=new A.Z,this.enable=!0,this.lockData=new A.Z,this.foucedModel=new j.Z,this.addOptions=e=>{var{name:e,map:t}=e;this.options.set(e,t)},this.hoverModel=new j.Z,this.map={click:new A.Z,hover:new A.Z,mouseLeave:new A.Z},this.onClick=e=>{var t,r;this.enable&&(t=(0,U.Ki)(e))&&(r=this.map.click.get(t))&&this.triggerEvent({model:e,method:"click",saved:r,id:t})},this.onHover=e=>{var t,r=(0,U.Ki)(e);!r||(t=this.map.hover.get(r))&&(this.onFouce(r),this.triggerEvent({model:e,saved:t,method:"hover",id:r}))},this.onMouseLeave=()=>{this.events.runScene.modelEx.getById(this.foucedModel.toArray()).map((e=>{var t,r=(0,U.Ki)(e);!r||(t=this.map.mouseLeave.get(r))&&(this.foucedModel.delete(r),this.triggerEvent({model:e,method:"mouseLeave",saved:t,id:r}))}))},this.events=e}setState(e){this.enable=e}init(){this.events.runScene.cb.model.click.add("event-model",this.onClick),this.events.runScene.cb.events.model.addOptions.add("event-model",this.addOptions),this.events.runScene.cb.unique.model.add.add("event-model",(({model:e})=>{var t;null!=(t=e.userData.events)&&t.map((t=>{var[t,r,n]=t.split("-");this.set({model:e,method:t,child:n,type:r})}))})),this.events.runScene.cb.events.pointer.move.add("get-hover-from-models",(0,i.fnDebounce)((e=>{if(0!==this.hoverModel.size&&this.enable){const i=new s.Raycaster,o=new s.Vector2,{engineDom:l,camera:c}=this.events.runScene.assetsEx.get();var{top:t,left:r,width:n,height:a}=l.getBoundingClientRect(),r=e.pageX-r;e=e.pageY-t,o.x=r/n*2-1,o.y=-e/a*2+1,i.setFromCamera(o,c);const u=i.intersectObjects(this.hoverModel.toArray(),!0);0===u.length?this.onMouseLeave():(t=u.map((e=>e.object)),this.onHover(t[0]))}}),10))}del(e){const{model:t,type:r,child:n,method:a}=e;var i=(0,U.Ki)(t);if(i){let s=this.map[a].get(i);if(s){let i=s.get(r);i&&("hover"===a&&this.hoverModel.delete(this.hoverModel.find((e=>(0,U.Ki)(e)===(0,U.Ki)(t)))),i.remove(n),this.bindDataForModel(e,!1))}}}set(e){const{model:t,type:r,child:n,method:a}=e;var i=(0,U.Ki)(t);if(i){let s=this.map[a],o=s.get(i),l=(o||(o=new A.Z,s.set(i,o)),o.get(r));l||(l=new j.Z,o.set(r,l)),"hover"!==a||this.hoverModel.find((e=>(0,U.Ki)(e)===(0,U.Ki)(t)))||this.hoverModel.add(t),l.add(n),this.bindDataForModel(e)}}bindDataForModel(e,t=!0){const{model:r,type:n,child:a,method:i}=e;let s=r.userData.events;s||(r.userData.events=s=[]);const o=i+"-"+n+"-"+a;-1===(e=s.findIndex((e=>e===o)))?t&&s.push(o):t||s.splice(e,1)}hasEvent(e){const{model:t,method:r,type:n,child:a}=e,i=[r,n,a].join("-");return!!t.userData.events&&-1!==t.userData.events.findIndex((e=>e===i))}validCanBeTrigger(e,t){return null==(e=this.lockData.get(e))||!e.has(t)}triggerEvent(e){const{model:t,id:r,saved:n}=e;h.closeModelEvent.is(t)||n.map(((e,n)=>{if(this.validCanBeTrigger(r,e)){const a=this.options.get(e);a&&(this.setLock({id:r,type:e,isAdd:!0}),a.parse({model:t,childs:n.toArray()}).then((()=>{this.setLock({id:r,type:e,isAdd:!1})})))}}))}setLock(e){var{id:e,type:t,isAdd:r}=e;let n=this.lockData.get(e);n||(n=new j.Z,this.lockData.set(e,n)),r?n.add(t):n.delete(t)}onFouce(e){this.map.mouseLeave.get(e)&&this.foucedModel.add(e)}}function F(e){return(F="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})(e)}function z(){z=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n=(p="function"==typeof Symbol?Symbol:{}).iterator||"@@iterator",a=p.asyncIterator||"@@asyncIterator",i=p.toStringTag||"@@toStringTag";function s(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(t){s=function(e,t,r){return e[t]=r}}function o(e,t,r,n){var a,i,s,o;return t=t&&t.prototype instanceof u?t:u,t=Object.create(t.prototype),n=new x(n||[]),t._invoke=(a=e,i=r,s=n,o="suspendedStart",function(e,t){if("executing"===o)throw new Error("Generator is already running");if("completed"===o){if("throw"===e)throw t;return{value:void 0,done:!0}}for(s.method=e,s.arg=t;;){var r=s.delegate;if(r&&(r=function e(t,r){var n=t.iterator[r.method];if(void 0===n){if(r.delegate=null,"throw"===r.method){if(t.iterator.return&&(r.method="return",r.arg=void 0,e(t,r),"throw"===r.method))return c;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return c}return"throw"===(n=l(n,t.iterator,r.arg)).type?(r.method="throw",r.arg=n.arg,r.delegate=null,c):(n=n.arg)?n.done?(r[t.resultName]=n.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=void 0),r.delegate=null,c):n:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,c)}(r,s),r)){if(r===c)continue;return r}if("next"===s.method)s.sent=s._sent=s.arg;else if("throw"===s.method){if("suspendedStart"===o)throw o="completed",s.arg;s.dispatchException(s.arg)}else"return"===s.method&&s.abrupt("return",s.arg);if(o="executing","normal"===(r=l(a,i,s)).type){if(o=s.done?"completed":"suspendedYield",r.arg===c)continue;return{value:r.arg,done:s.done}}"throw"===r.type&&(o="completed",s.method="throw",s.arg=r.arg)}}),t}function l(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=o;var c={};function u(){}function h(){}function d(){}var p,f,m=(s(p={},n,(function(){return this})),(f=(f=Object.getPrototypeOf)&&f(f(w([]))))&&f!==t&&r.call(f,n)&&(p=f),d.prototype=u.prototype=Object.create(p));function g(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function v(e,t){var n;this._invoke=function(a,i){function s(){return new t((function(n,s){!function n(a,i,s,o){var c;if("throw"!==(a=l(e[a],e,i)).type)return(i=(c=a.arg).value)&&"object"==F(i)&&r.call(i,"__await")?t.resolve(i.__await).then((function(e){n("next",e,s,o)}),(function(e){n("throw",e,s,o)})):t.resolve(i).then((function(e){c.value=e,s(c)}),(function(e){return n("throw",e,s,o)}));o(a.arg)}(a,i,n,s)}))}return n=n?n.then(s,s):s()}}function b(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function y(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function x(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(b,this),this.reset(!0)}function w(e){if(e){var t,a=e[n];if(a)return a.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return t=-1,(a=function n(){for(;++t<e.length;)if(r.call(e,t))return n.value=e[t],n.done=!1,n;return n.value=void 0,n.done=!0,n}).next=a}return{next:S}}function S(){return{value:void 0,done:!0}}return s(m,"constructor",h.prototype=d),s(d,"constructor",h),h.displayName=s(d,i,"GeneratorFunction"),e.isGeneratorFunction=function(e){return!!(e="function"==typeof e&&e.constructor)&&(e===h||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,d):(e.__proto__=d,s(e,i,"GeneratorFunction")),e.prototype=Object.create(m),e},e.awrap=function(e){return{__await:e}},g(v.prototype),s(v.prototype,a,(function(){return this})),e.AsyncIterator=v,e.async=function(t,r,n,a,i){void 0===i&&(i=Promise);var s=new v(o(t,r,n,a),i);return e.isGeneratorFunction(r)?s:s.next().then((function(e){return e.done?e.value:s.next()}))},g(m),s(m,i,"Generator"),s(m,n,(function(){return this})),s(m,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t,r=[];for(t in e)r.push(t);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=w,x.prototype={constructor:x,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(y),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(r,n){return s.type="throw",s.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var a=this.tryEntries.length-1;0<=a;--a){var i=this.tryEntries[a],s=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var o=r.call(i,"catchLoc"),l=r.call(i,"finallyLoc");if(o&&l){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(o){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;0<=n;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var i=a;break}}var s=(i=i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc?null:i)?i.completion:{};return s.type=e,s.arg=t,i?(this.method="next",this.next=i.finallyLoc,c):this.complete(s)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),c},finish:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),y(r),c}},catch:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var r,n,a=this.tryEntries[t];if(a.tryLoc===e)return"throw"===(r=a.completion).type&&(n=r.arg,y(a)),n}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:w(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),c}},e}function V(e,t,r,n,a,i,s){try{var o=e[i](s),l=o.value}catch(e){return void r(e)}o.done?t(l):Promise.resolve(l).then(n,a)}function G(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function H(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function W(e,t,r){t&&H(e.prototype,t),r&&H(e,r),Object.defineProperty(e,"prototype",{writable:!1})}var K={POSITION:["byte","byte normalized","unsigned byte","unsigned byte normalized","short","short normalized","unsigned short","unsigned short normalized"],NORMAL:["byte normalized","short normalized"],TANGENT:["byte normalized","short normalized"],TEXCOORD:["byte","byte normalized","unsigned byte","short","short normalized","unsigned short"]},q=function(){function e(){G(this,e),this.pluginCallbacks=[],this.register((function(e){return new ge(e)})),this.register((function(e){return new ve(e)})),this.register((function(e){return new xe(e)})),this.register((function(e){return new we(e)})),this.register((function(e){return new Se(e)})),this.register((function(e){return new Me(e)})),this.register((function(e){return new be(e)})),this.register((function(e){return new ye(e)})),this.register((function(e){return new Te(e)})),this.register((function(e){return new _e(e)}))}return W(e,[{key:"register",value:function(e){return-1===this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.push(e),this}},{key:"unregister",value:function(e){return-1!==this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}},{key:"parse",value:function(e,t,r,n){for(var a=new me,i=[],s=0,o=this.pluginCallbacks.length;s<o;s++)i.push(this.pluginCallbacks[s](a));a.setPlugins(i),a.write(e,t,n).catch(r)}},{key:"parseAsync",value:function(e,t){var r=this;return new Promise((function(n,a){r.parse(e,n,a,t)}))}}]),e}(),Z=5120,X=5121,Q=5122,Y=5123,J=(n=9728,9729),$=9984,ee=9985,te=9986,re=9987,ne=33071,ae=33648,ie=10497,se="KHR_mesh_quantization",oe={},le=(oe[s.NearestFilter]=n,oe[s.NearestMipmapNearestFilter]=$,oe[s.NearestMipmapLinearFilter]=te,oe[s.LinearFilter]=J,oe[s.LinearMipmapNearestFilter]=ee,oe[s.LinearMipmapLinearFilter]=re,oe[s.ClampToEdgeWrapping]=ne,oe[s.RepeatWrapping]=ie,oe[s.MirroredRepeatWrapping]=ae,{scale:"scale",position:"translation",quaternion:"rotation",morphTargetInfluences:"weights"}),ce=new s.Color;function ue(e,t){return e.length===t.length&&e.every((function(e,r){return e===t[r]}))}function he(e){return 4*Math.ceil(e/4)}function de(e,t){var r=1<arguments.length&&void 0!==t?t:0,n=he(e.byteLength);if(n===e.byteLength)return e;var a=new Uint8Array(n);if(a.set(new Uint8Array(e)),0!==r)for(var i=e.byteLength;i<n;i++)a[i]=r;return a.buffer}function pe(){return"undefined"==typeof document&&"undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas")}function fe(e,t){return void 0!==e.toBlob?new Promise((function(r){return e.toBlob(r,t)})):("image/jpeg"===t?r=.92:"image/webp"===t&&(r=.8),e.convertToBlob({type:t,quality:r}));var r}var me=function(){function e(){G(this,e),this.plugins=[],this.options={},this.pending=[],this.buffers=[],this.byteOffset=0,this.buffers=[],this.nodeMap=new Map,this.skins=[],this.extensionsUsed={},this.extensionsRequired={},this.uids=new Map,this.uid=0,this.json={asset:{version:"2.0",generator:"THREE.GLTFExporter"}},this.cache={meshes:new Map,attributes:new Map,attributesNormalized:new Map,materials:new Map,textures:new Map,images:new Map}}var t,r;return W(e,[{key:"setPlugins",value:function(e){this.plugins=e}},{key:"write",value:(t=z().mark((function e(t,r){var n,a,i,s,o,l,c,u,h,d=arguments;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=2<d.length&&void 0!==d[2]?d[2]:{},this.options=Object.assign({binary:!1,trs:!1,onlyVisible:!0,maxTextureSize:1/0,animations:[],includeCustomExtensions:!1},n),0<this.options.animations.length&&(this.options.trs=!0),this.processInput(t),e.next=6,Promise.all(this.pending);case 6:return i=(a=this).buffers,s=a.json,n=a.options,e.next=12,a.options.myOptions.helper.done(s);case 12:l=a.extensionsUsed,c=a.extensionsRequired,o=new Blob(i,{type:"application/octet-stream"}),l=Object.keys(l),c=Object.keys(c),0<l.length&&(s.extensionsUsed=l),0<c.length&&(s.extensionsRequired=c),s.buffers&&0<s.buffers.length&&(s.buffers[0].byteLength=o.size),!0===n.binary?((u=new FileReader).readAsArrayBuffer(o),u.onloadend=function(){var e=de(u.result),t=new DataView(new ArrayBuffer(8)),n=(t.setUint32(0,e.byteLength,!0),t.setUint32(4,5130562,!0),de((n=JSON.stringify(s),(new TextEncoder).encode(n).buffer),32)),a=new DataView(new ArrayBuffer(8)),i=(a.setUint32(0,n.byteLength,!0),a.setUint32(4,1313821514,!0),new ArrayBuffer(12)),o=((l=new DataView(i)).setUint32(0,1179937895,!0),l.setUint32(4,2,!0),12+a.byteLength+n.byteLength+t.byteLength+e.byteLength),l=(l.setUint32(8,o,!0),new Blob([i,a,n,t,e],{type:"application/octet-stream"})),c=new FileReader;c.readAsArrayBuffer(l),c.onloadend=function(){r(c.result)}}):s.buffers&&0<s.buffers.length?((h=new FileReader).readAsDataURL(o),h.onloadend=function(){var e=h.result;s.buffers[0].uri=e,r(s)}):r(s);case 21:case"end":return e.stop()}}),e,this)})),r=function(){var e=this,r=arguments;return new Promise((function(n,a){var i=t.apply(e,r);function s(e){V(i,n,a,s,o,"next",e)}function o(e){V(i,n,a,s,o,"throw",e)}s(void 0)}))},function(e,t){return r.apply(this,arguments)})},{key:"serializeUserData",value:function(e,t){if(0!==Object.keys(e.userData).length){var r=this.options,n=this.extensionsUsed;try{var a=JSON.parse(JSON.stringify(e.userData));if(r.includeCustomExtensions&&a.gltfExtensions){for(var i in void 0===t.extensions&&(t.extensions={}),a.gltfExtensions)t.extensions[i]=a.gltfExtensions[i],n[i]=!0;delete a.gltfExtensions}0<Object.keys(a).length&&(t.extras=a)}catch(t){console.warn("THREE.GLTFExporter: userData of '"+e.name+"' won't be serialized because of JSON.stringify error - "+t.message)}}}},{key:"getUID",value:function(e){var t,r=1<arguments.length&&void 0!==arguments[1]&&arguments[1];return!1===this.uids.has(e)&&((t=new Map).set(!0,this.uid++),t.set(!1,this.uid++),this.uids.set(e,t)),this.uids.get(e).get(r)}},{key:"isNormalizedNormalAttribute",value:function(e){if(this.cache.attributesNormalized.has(e))return!1;for(var t=new s.Vector3,r=0,n=e.count;r<n;r++)if(5e-4<Math.abs(t.fromBufferAttribute(e,r).length()-1))return!1;return!0}},{key:"createNormalizedNormalAttribute",value:function(e){var t=this.cache;if(t.attributesNormalized.has(e))return t.attributesNormalized.get(e);for(var r=e.clone(),n=new s.Vector3,a=0,i=r.count;a<i;a++)n.fromBufferAttribute(r,a),0===n.x&&0===n.y&&0===n.z?n.setX(1):n.normalize(),r.setXYZ(a,n.x,n.y,n.z);return t.attributesNormalized.set(e,r),r}},{key:"applyTextureTransform",value:function(e,t){var r=!1,n={};0===t.offset.x&&0===t.offset.y||(n.offset=t.offset.toArray(),r=!0),0!==t.rotation&&(n.rotation=t.rotation,r=!0),1===t.repeat.x&&1===t.repeat.y||(n.scale=t.repeat.toArray(),r=!0),r&&(e.extensions=e.extensions||{},e.extensions.KHR_texture_transform=n,this.extensionsUsed.KHR_texture_transform=!0)}},{key:"buildMetalRoughTexture",value:function(e,t){if(e===t)return e;function r(e){return e.encoding===s.sRGBEncoding?function(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}:function(e){return e}}console.warn("THREE.GLTFExporter: Merged metalnessMap and roughnessMap textures.");var n=e?e.image:null,a=t?t.image:null,i=Math.max(n?n.width:0,a?a.width:0),o=Math.max(n?n.height:0,a?a.height:0),l=pe(),c=(l.width=i,l.height=o,l.getContext("2d")),u=(c.fillStyle="#00ffff",c.fillRect(0,0,i,o),c.getImageData(0,0,i,o));if(n){c.drawImage(n,0,0,i,o);for(var h=r(e),d=c.getImageData(0,0,i,o).data,p=2;p<d.length;p+=4)u.data[p]=256*h(d[p]/256)}if(a){c.drawImage(a,0,0,i,o);for(var f=r(t),m=c.getImageData(0,0,i,o).data,g=1;g<m.length;g+=4)u.data[g]=256*f(m[g]/256)}return c.putImageData(u,0,0),(n=(e||t).clone()).source=new s.Source(l),n.encoding=s.LinearEncoding,n}},{key:"processBuffer",value:function(e){var t=this.json,r=this.buffers;return t.buffers||(t.buffers=[{byteLength:0}]),r.push(e),0}},{key:"processBufferView",value:function(e,t,r,n,a){var i,o=this.json;switch(o.bufferViews||(o.bufferViews=[]),t){case Z:case X:i=1;break;case Q:case Y:i=2;break;default:i=4}for(var l=he(n*e.itemSize*i),c=new DataView(new ArrayBuffer(l)),u=0,h=r;h<r+n;h++)for(var d=0;d<e.itemSize;d++){var p=void 0;4<e.itemSize?p=e.array[h*e.itemSize+d]:(0===d?p=e.getX(h):1===d?p=e.getY(h):2===d?p=e.getZ(h):3===d&&(p=e.getW(h)),!0===e.normalized&&(p=s.MathUtils.normalize(p,e.array))),5126===t?c.setFloat32(u,p,!0):5124===t?c.setInt32(u,p,!0):5125===t?c.setUint32(u,p,!0):t===Q?c.setInt16(u,p,!0):t===Y?c.setUint16(u,p,!0):t===Z?c.setInt8(u,p):t===X&&c.setUint8(u,p),u+=i}var f={buffer:this.processBuffer(c.buffer),byteOffset:this.byteOffset,byteLength:l};return void 0!==a&&(f.target=a),34962===a&&(f.byteStride=e.itemSize*i),this.byteOffset+=l,o.bufferViews.push(f),{id:o.bufferViews.length-1,byteLength:0}}},{key:"processBufferViewImage",value:function(e){var t=this,r=t.json;return r.bufferViews||(r.bufferViews=[]),new Promise((function(n){var a=new FileReader;a.readAsArrayBuffer(e),a.onloadend=function(){var e=de(a.result),i={buffer:t.processBuffer(e),byteOffset:t.byteOffset,byteLength:e.byteLength};t.byteOffset+=e.byteLength,n(r.bufferViews.push(i)-1)}}))}},{key:"processAccessor",value:function(e,t,r,n){var a,i=this.json;if(e.array.constructor===Float32Array)a=5126;else if(e.array.constructor===Int32Array)a=5124;else if(e.array.constructor===Uint32Array)a=5125;else if(e.array.constructor===Int16Array)a=Q;else if(e.array.constructor===Uint16Array)a=Y;else if(e.array.constructor===Int8Array)a=Z;else{if(e.array.constructor!==Uint8Array)throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type.");a=X}if(0===(n=void 0===n?e.count:n))return null;var o,l=function(e,t,r){for(var n={min:new Array(e.itemSize).fill(Number.POSITIVE_INFINITY),max:new Array(e.itemSize).fill(Number.NEGATIVE_INFINITY)},a=t;a<t+r;a++)for(var i=0;i<e.itemSize;i++){var o=void 0;4<e.itemSize?o=e.array[a*e.itemSize+i]:(0===i?o=e.getX(a):1===i?o=e.getY(a):2===i?o=e.getZ(a):3===i&&(o=e.getW(a)),!0===e.normalized&&(o=s.MathUtils.normalize(o,e.array))),n.min[i]=Math.min(n.min[i],o),n.max[i]=Math.max(n.max[i],o)}return n}(e,r=void 0===r?0:r,n);return r={bufferView:(void 0!==t&&(o=e===t.index?34963:34962),t=this.processBufferView(e,a,r,n,o)).id,byteOffset:t.byteOffset,componentType:a,count:n,max:l.max,min:l.min,type:{1:"SCALAR",2:"VEC2",3:"VEC3",4:"VEC4",16:"MAT4"}[e.itemSize]},!0===e.normalized&&(r.normalized=!0),i.accessors||(i.accessors=[]),i.accessors.push(r)-1}},{key:"processImage",value:function(e,t,r,n){var a=4<arguments.length&&void 0!==arguments[4]?arguments[4]:"image/png";if(null===e)throw new Error("THREE.GLTFExporter: No valid image data found. Unable to process texture.");var i=this,o=i.cache,l=i.json,c=i.options,u=i.pending;if(void 0!==(o.images.has(e)||o.images.set(e,{}),o=o.images.get(e))[r=a+":flipY/"+r.toString()])return o[r];l.images||(l.images=[]);var h={mimeType:a},d=pe(),p=(d.width=Math.min(e.width,c.maxTextureSize),d.height=Math.min(e.height,c.maxTextureSize),d.getContext("2d"));if(void 0!==e.data){t!==s.RGBAFormat&&console.error("GLTFExporter: Only RGBAFormat is supported."),(e.width>c.maxTextureSize||e.height>c.maxTextureSize)&&console.warn("GLTFExporter: Image size is bigger than maxTextureSize",e);for(var f=new Uint8ClampedArray(e.height*e.width*4),m=0;m<f.length;m+=4)f[m+0]=e.data[m+0],f[m+1]=e.data[m+1],f[m+2]=e.data[m+2],f[m+3]=e.data[m+3];p.putImageData(new ImageData(f,e.width,e.height),0,0)}else p.drawImage(e,0,0,d.width,d.height);return!0===c.binary?(null==n||null==(t=n.userData)?void 0:t.blob)instanceof Blob?u.push(new Promise((function(e){i.processBufferViewImage(n.userData.blob).then((function(t){h.bufferView=t,e()}))}))):u.push(fe(d,a).then((function(e){return i.processBufferViewImage(e)})).then((function(e){h.bufferView=e}))):void 0!==d.toDataURL?h.uri=d.toDataURL(a):u.push(fe(d,a).then((function(e){return(new FileReader).readAsDataURL(e)})).then((function(e){h.uri=e}))),p=l.images.push(h)-1,o[r]=p}},{key:"processSampler",value:function(e){var t=this.json;return t.samplers||(t.samplers=[]),e={magFilter:oe[e.magFilter],minFilter:oe[e.minFilter],wrapS:oe[e.wrapS],wrapT:oe[e.wrapT]},t.samplers.push(e)-1}},{key:"processTexture",value:function(e){var t=this.cache,r=this.json;if(t.textures.has(e))return t.textures.get(e);r.textures||(r.textures=[]);var n=("image/webp"===(a=e.userData.mimeType)&&(a="image/png"),{sampler:this.processSampler(e),source:this.processImage(e.image,e.format,e.flipY,e,a)}),a=(e.name&&(n.name=e.name),this._invokeAll((function(t){t.writeTexture&&t.writeTexture(e,n)})),r.textures.push(n)-1);return t.textures.set(e,a),this.options.myOptions.helper.parseTexture({texture:e,textureDef:n}),a}},{key:"processMaterial",value:function(e){var t=this.cache,r=this.json;if(t.materials.has(e))return t.materials.get(e);if(e.isShaderMaterial)return console.warn("GLTFExporter: THREE.ShaderMaterial not supported."),null;r.materials||(r.materials=[]);var n={pbrMetallicRoughness:{}},a=(this.options.myOptions.helper.parseMaterial({material:e,materialDef:n,options:this}),!0!==e.isMeshStandardMaterial&&!0!==e.isMeshBasicMaterial&&console.warn("GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results."),e.color.toArray().concat([e.opacity])),i=(ue(a,[1,1,1,1])||(n.pbrMetallicRoughness.baseColorFactor=a),e.isMeshStandardMaterial?(n.pbrMetallicRoughness.metallicFactor=e.metalness,n.pbrMetallicRoughness.roughnessFactor=e.roughness):(n.pbrMetallicRoughness.metallicFactor=.5,n.pbrMetallicRoughness.roughnessFactor=.5),(e.metalnessMap||e.roughnessMap)&&(a=this.buildMetalRoughTexture(e.metalnessMap,e.roughnessMap),i={index:this.processTexture(a)},this.applyTextureTransform(i,a),n.pbrMetallicRoughness.metallicRoughnessTexture=i),e.map&&(a={index:this.processTexture(e.map)},this.applyTextureTransform(a,e.map),n.pbrMetallicRoughness.baseColorTexture=a),e.emissive&&(i=e.emissive,0<Math.max(i.r,i.g,i.b)&&(n.emissiveFactor=e.emissive.toArray()),e.emissiveMap&&(a={index:this.processTexture(e.emissiveMap)},this.applyTextureTransform(a,e.emissiveMap),n.emissiveTexture=a)),e.normalMap&&(i={index:this.processTexture(e.normalMap)},e.normalScale&&1!==e.normalScale.x&&(i.scale=e.normalScale.x),this.applyTextureTransform(i,e.normalMap),n.normalTexture=i),e.aoMap&&(a={index:this.processTexture(e.aoMap),texCoord:1},1!==e.aoMapIntensity&&(a.strength=e.aoMapIntensity),this.applyTextureTransform(a,e.aoMap),n.occlusionTexture=a),e.transparent?n.alphaMode="BLEND":0<e.alphaTest&&(n.alphaMode="MASK",n.alphaCutoff=e.alphaTest),e.side===s.DoubleSide&&(n.doubleSided=!0),""!==e.name&&(n.name=e.name),this.serializeUserData(e,n),this._invokeAll((function(t){t.writeMaterial&&t.writeMaterial(e,n)})),r.materials.push(n)-1);return t.materials.set(e,i),i}},{key:"processMesh",value:function(e){var t=this.cache,r=this.json,n=[e.geometry.uuid];if(Array.isArray(e.material))for(var a=0,i=e.material.length;a<i;a++)n.push(e.material[a].uuid);else n.push(e.material.uuid);var o=n.join(":");if(t.meshes.has(o))return t.meshes.get(o);var l,c,u,h=e.geometry,d=e.isLineSegments?1:e.isLineLoop?2:e.isLine?3:e.isPoints?0:e.material.wireframe?1:4,p={},f={},m=[],g=[],v={uv:"TEXCOORD_0",uv2:"TEXCOORD_1",color:"COLOR_0",skinWeight:"WEIGHTS_0",skinIndex:"JOINTS_0"},b=h.getAttribute("normal"),y=(void 0===b||this.isNormalizedNormalAttribute(b)||(console.warn("THREE.GLTFExporter: Creating normalized normal attribute from the non-normalized one."),h.setAttribute("normal",this.createNormalizedNormalAttribute(b))),null);for(c in h.attributes)"morph"!==c.slice(0,5)&&(l=h.attributes[c],c=v[c]||c.toUpperCase(),/^(POSITION|NORMAL|TANGENT|TEXCOORD_\d+|COLOR_\d+|JOINTS_\d+|WEIGHTS_\d+)$/.test(c)||(c="_"+c),t.attributes.has(this.getUID(l))?f[c]=t.attributes.get(this.getUID(l)):(y=null,u=l.array,"JOINTS_0"!==c||u instanceof Uint16Array||u instanceof Uint8Array||(console.warn('GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.'),y=new s.BufferAttribute(new Uint16Array(u),l.itemSize,l.normalized)),null!==(u=this.processAccessor(y||l,h))&&(c.startsWith("_")||this.detectMeshQuantization(c,l),f[c]=u,t.attributes.set(this.getUID(l),u))));if(void 0!==b&&h.setAttribute("normal",b),0===Object.keys(f).length)return null;if(void 0!==e.morphTargetInfluences&&0<e.morphTargetInfluences.length){var x=[],w=[],S={};if(void 0!==e.morphTargetDictionary)for(var M in e.morphTargetDictionary)S[e.morphTargetDictionary[M]]=M;for(var T=0;T<e.morphTargetInfluences.length;++T){var _,E={},k=!1;for(_ in h.morphAttributes)if("position"!==_&&"normal"!==_)k||(console.warn("GLTFExporter: Only POSITION and NORMAL morph are supported."),k=!0);else{var D=h.morphAttributes[_][T],O=_.toUpperCase(),P=h.attributes[_];if(t.attributes.has(this.getUID(D,!0)))E[O]=t.attributes.get(this.getUID(D,!0));else{var A=D.clone();if(!h.morphTargetsRelative)for(var C=0,R=D.count;C<R;C++)for(var L=0;L<D.itemSize;L++)0===L&&A.setX(C,D.getX(C)-P.getX(C)),1===L&&A.setY(C,D.getY(C)-P.getY(C)),2===L&&A.setZ(C,D.getZ(C)-P.getZ(C)),3===L&&A.setW(C,D.getW(C)-P.getW(C));E[O]=this.processAccessor(A,h),t.attributes.set(this.getUID(P,!0),E[O])}}g.push(E),x.push(e.morphTargetInfluences[T]),void 0!==e.morphTargetDictionary&&w.push(S[T])}p.weights=x,0<w.length&&(p.extras={},p.extras.targetNames=w)}if((b=Array.isArray(e.material))&&0===h.groups.length)return null;for(var I=b?e.material:[e.material],B=b?h.groups:[{materialIndex:0,start:void 0,count:void 0}],j=0,U=B.length;j<U;j++){var N={mode:d,attributes:f},F=(this.serializeUserData(h,N),0<g.length&&(N.targets=g),null!==h.index&&(F=this.getUID(h.index),void 0===B[j].start&&void 0===B[j].count||(F+=":"+B[j].start+":"+B[j].count),t.attributes.has(F)?N.indices=t.attributes.get(F):(N.indices=this.processAccessor(h.index,h,B[j].start,B[j].count),t.attributes.set(F,N.indices)),null===N.indices&&delete N.indices),this.processMaterial(I[B[j].materialIndex]));null!==F&&(N.material=F),m.push(N)}return p.primitives=m,r.meshes||(r.meshes=[]),this._invokeAll((function(t){t.writeMesh&&t.writeMesh(e,p)})),b=r.meshes.push(p)-1,t.meshes.set(o,b),b}},{key:"detectMeshQuantization",value:function(e,t){if(!this.extensionsUsed[se]){var r=void 0;switch(t.array.constructor){case Int8Array:r="byte";break;case Uint8Array:r="unsigned byte";break;case Int16Array:r="short";break;case Uint16Array:r="unsigned short";break;default:return}t.normalized&&(r+=" normalized"),t=e.split("_",1)[0],null!=(e=K[t])&&e.includes(r)&&(this.extensionsUsed[se]=!0,this.extensionsRequired[se]=!0)}}},{key:"processCamera",value:function(e){var t=this.json,r=(t.cameras||(t.cameras=[]),e.isOrthographicCamera),n={type:r?"orthographic":"perspective"};return r?n.orthographic={xmag:2*e.right,ymag:2*e.top,zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near}:n.perspective={aspectRatio:e.aspect,yfov:s.MathUtils.degToRad(e.fov),zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near},""!==e.name&&(n.name=e.type),t.cameras.push(n)-1}},{key:"processAnimation",value:function(e,t){for(var r=this.json,n=this.nodeMap,a=(r.animations||(r.animations=[]),(e=q.Utils.mergeMorphTargetTracks(e.clone(),t)).tracks),i=[],o=[],l=0;l<a.length;++l){var c=a[l],u=s.PropertyBinding.parseTrackName(c.name),h=s.PropertyBinding.findNode(t,u.nodeName),d=le[u.propertyName];if(!(h="bones"===u.objectName?!0===h.isSkinnedMesh?h.skeleton.getBoneByName(u.objectIndex):void 0:h)||!d)return console.warn('THREE.GLTFExporter: Could not export animation track "%s".',c.name),null;u=c.values.length/c.times.length;var p=void(d===le.morphTargetInfluences&&(u/=h.morphTargetInfluences.length));!0===c.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline?(p="CUBICSPLINE",u/=3):p=c.getInterpolation()===s.InterpolateDiscrete?"STEP":"LINEAR",o.push({input:this.processAccessor(new s.BufferAttribute(c.times,1)),output:this.processAccessor(new s.BufferAttribute(c.values,u)),interpolation:p}),i.push({sampler:o.length-1,target:{node:n.get(h),path:d}})}return r.animations.push({name:e.name||"clip_"+r.animations.length,samplers:o,channels:i}),r.animations.length-1}},{key:"processSkin",value:function(e){var t=this.json,r=this.nodeMap,n=t.nodes[r.get(e)],a=e.skeleton;if(void 0===a)return null;var i=e.skeleton.bones[0];if(void 0===i)return null;for(var o=[],l=new Float32Array(16*a.bones.length),c=new s.Matrix4,u=0;u<a.bones.length;++u){var h=a.bones[u];h=this.options.myOptions.helper.getNodeMapValueWithBone(h,r),o.push(h),c.copy(a.boneInverses[u]),c.multiply(e.bindMatrix).toArray(l,16*u)}return void 0===t.skins&&(t.skins=[]),t.skins.push({inverseBindMatrices:this.processAccessor(new s.BufferAttribute(l,16)),joints:o,skeleton:r.get(i)}),n.skin=t.skins.length-1}},{key:"processNode",value:function(e){var t,r,n=this.json,a=this.options,i=this.nodeMap,s=(n.nodes||(n.nodes=[]),{});if(e=a.myOptions.helper.parseNode({object:e,nodeDef:s,options:this}),a.trs?(r=e.quaternion.toArray(),h=e.position.toArray(),t=e.scale.toArray(),ue(r,[0,0,0,1])||(s.rotation=r),ue(h,[0,0,0])||(s.translation=h),ue(t,[1,1,1])||(s.scale=t)):(e.matrixAutoUpdate&&e.updateMatrix(),!1===ue(e.matrix.elements,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])&&(s.matrix=e.matrix.elements)),""!==e.name&&(s.name=String(e.name)),this.serializeUserData(e,s),e.isMesh||e.isLine||e.isPoints?null!==(r=this.processMesh(e))&&(s.mesh=r):e.isCamera&&(s.camera=this.processCamera(e)),e.isSkinnedMesh&&this.skins.push(e),0<e.children.length){for(var o=[],l=0,c=e.children.length;l<c;l++){var u=e.children[l];u.userData.isTemp||!u.visible&&!1!==a.onlyVisible||null!==(u=this.processNode(u))&&o.push(u)}0<o.length&&(s.children=o)}this._invokeAll((function(t){t.writeNode&&t.writeNode(e,s)}));var h=n.nodes.push(s)-1;return i.set(e,h),h}},{key:"processScene",value:function(e){for(var t=this.json,r=this.options,n=(t.scenes||(t.scenes=[],t.scene=0),{}),a=(""!==e.name&&(n.name=e.name),t.scenes.push(n),[]),i=0,s=e.children.length;i<s;i++){var o=e.children[i];o.userData.isTemp||!o.visible&&!1!==r.onlyVisible||null!==(o=this.processNode(o))&&a.push(o)}0<a.length&&(n.nodes=a),this.serializeUserData(e,n)}},{key:"processObjects",value:function(e){var t=new s.Scene;t.name="AuxScene";for(var r=0;r<e.length;r++)t.children.push(e[r]);this.processScene(t)}},{key:"processInput",value:function(e){for(var t,r,n=this.options,a=(e=e instanceof Array?e:[e],this._invokeAll((function(t){t.beforeParse&&t.beforeParse(e)})),[]),i=0;i<e.length;i++)e[i]instanceof s.Scene?this.processScene(e[i]):a.push(e[i]);1===a.length?(t=a[0],"model"===n.myOptions.helper.type&&((r=new s.Group).name="glb_model",r.add(t),t=r),this.processScene(t)):1<a.length&&this.processObjects(a);for(var o=0;o<this.skins.length;++o)this.processSkin(this.skins[o]);for(var l=0;l<n.animations.length;++l)this.processAnimation(n.animations[l],e[0]);this._invokeAll((function(t){t.afterParse&&t.afterParse(e)}))}},{key:"_invokeAll",value:function(e){for(var t=0,r=this.plugins.length;t<r;t++)e(this.plugins[t])}}]),e}(),ge=function(){function e(t){G(this,e),this.writer=t,this.name="KHR_lights_punctual"}return W(e,[{key:"writeNode",value:function(e,t){var r,n,a;e.isLight&&(e.isDirectionalLight||e.isPointLight||e.isSpotLight?(r=(a=this.writer).json,a=a.extensionsUsed,n={},e.name&&(n.name=e.name),n.color=e.color.toArray(),n.intensity=e.intensity,e.isDirectionalLight?n.type="directional":e.isPointLight?(n.type="point",0<e.distance&&(n.range=e.distance)):e.isSpotLight&&(n.type="spot",0<e.distance&&(n.range=e.distance),n.spot={},n.spot.innerConeAngle=(e.penumbra-1)*e.angle*-1,n.spot.outerConeAngle=e.angle),void 0!==e.decay&&2!==e.decay&&console.warn("THREE.GLTFExporter: Light decay may be lost. glTF is physically-based, and expects light.decay=2."),!e.target||e.target.parent===e&&0===e.target.position.x&&0===e.target.position.y&&-1===e.target.position.z||console.warn("THREE.GLTFExporter: Light direction may be lost. For best results, make light.target a child of the light with position 0,0,-1."),a[this.name]||(r.extensions=r.extensions||{},r.extensions[this.name]={lights:[]},a[this.name]=!0),(a=r.extensions[this.name].lights).push(n),t.extensions=t.extensions||{},t.extensions[this.name]={light:a.length-1}):console.warn("THREE.GLTFExporter: Only directional, point, and spot lights are supported.",e))}}]),e}(),ve=function(){function e(t){G(this,e),this.writer=t,this.name="KHR_materials_unlit"}return W(e,[{key:"writeMaterial",value:function(e,t){e.isMeshBasicMaterial&&(e=this.writer.extensionsUsed,t.extensions=t.extensions||{},t.extensions[this.name]={},e[this.name]=!0,t.pbrMetallicRoughness.metallicFactor=0,t.pbrMetallicRoughness.roughnessFactor=.9)}}]),e}(),be=function(){function e(t){G(this,e),this.writer=t,this.name="KHR_materials_clearcoat"}return W(e,[{key:"writeMaterial",value:function(e,t){var r,n,a,i;e.isMeshPhysicalMaterial&&0!==e.clearcoat&&(n=(r=this.writer).extensionsUsed,(a={}).clearcoatFactor=e.clearcoat,e.clearcoatMap&&(i={index:r.processTexture(e.clearcoatMap)},r.applyTextureTransform(i,e.clearcoatMap),a.clearcoatTexture=i),a.clearcoatRoughnessFactor=e.clearcoatRoughness,e.clearcoatRoughnessMap&&(i={index:r.processTexture(e.clearcoatRoughnessMap)},r.applyTextureTransform(i,e.clearcoatRoughnessMap),a.clearcoatRoughnessTexture=i),e.clearcoatNormalMap&&(i={index:r.processTexture(e.clearcoatNormalMap)},r.applyTextureTransform(i,e.clearcoatNormalMap),a.clearcoatNormalTexture=i),t.extensions=t.extensions||{},t.extensions[this.name]=a,n[this.name]=!0)}}]),e}(),ye=function(){function e(t){G(this,e),this.writer=t,this.name="KHR_materials_iridescence"}return W(e,[{key:"writeMaterial",value:function(e,t){var r,n,a,i;e.isMeshPhysicalMaterial&&0!==e.iridescence&&(n=(r=this.writer).extensionsUsed,(a={}).iridescenceFactor=e.iridescence,e.iridescenceMap&&(i={index:r.processTexture(e.iridescenceMap)},r.applyTextureTransform(i,e.iridescenceMap),a.iridescenceTexture=i),a.iridescenceIor=e.iridescenceIOR,a.iridescenceThicknessMinimum=e.iridescenceThicknessRange[0],a.iridescenceThicknessMaximum=e.iridescenceThicknessRange[1],e.iridescenceThicknessMap&&(i={index:r.processTexture(e.iridescenceThicknessMap)},r.applyTextureTransform(i,e.iridescenceThicknessMap),a.iridescenceThicknessTexture=i),t.extensions=t.extensions||{},t.extensions[this.name]=a,n[this.name]=!0)}}]),e}(),xe=function(){function e(t){G(this,e),this.writer=t,this.name="KHR_materials_transmission"}return W(e,[{key:"writeMaterial",value:function(e,t){var r,n,a,i;e.isMeshPhysicalMaterial&&0!==e.transmission&&(n=(r=this.writer).extensionsUsed,(a={}).transmissionFactor=e.transmission,e.transmissionMap&&(i={index:r.processTexture(e.transmissionMap)},r.applyTextureTransform(i,e.transmissionMap),a.transmissionTexture=i),t.extensions=t.extensions||{},t.extensions[this.name]=a,n[this.name]=!0)}}]),e}(),we=function(){function e(t){G(this,e),this.writer=t,this.name="KHR_materials_volume"}return W(e,[{key:"writeMaterial",value:function(e,t){var r,n,a,i;e.isMeshPhysicalMaterial&&0!==e.transmission&&(n=(r=this.writer).extensionsUsed,(a={}).thicknessFactor=e.thickness,e.thicknessMap&&(i={index:r.processTexture(e.thicknessMap)},r.applyTextureTransform(i,e.thicknessMap),a.thicknessTexture=i),a.attenuationDistance=e.attenuationDistance,a.attenuationColor=e.attenuationColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=a,n[this.name]=!0)}}]),e}(),Se=function(){function e(t){G(this,e),this.writer=t,this.name="KHR_materials_ior"}return W(e,[{key:"writeMaterial",value:function(e,t){var r,n;e.isMeshPhysicalMaterial&&1.5!==e.ior&&(r=this.writer.extensionsUsed,(n={}).ior=e.ior,t.extensions=t.extensions||{},t.extensions[this.name]=n,r[this.name]=!0)}}]),e}(),Me=function(){function e(t){G(this,e),this.writer=t,this.name="KHR_materials_specular"}return W(e,[{key:"writeMaterial",value:function(e,t){var r,n,a,i;e.isMeshPhysicalMaterial&&(1!==e.specularIntensity||!e.specularColor.equals(ce)||e.specularIntensityMap||e.specularColorTexture)&&(n=(r=this.writer).extensionsUsed,a={},e.specularIntensityMap&&(i={index:r.processTexture(e.specularIntensityMap)},r.applyTextureTransform(i,e.specularIntensityMap),a.specularTexture=i),e.specularColorMap&&(i={index:r.processTexture(e.specularColorMap)},r.applyTextureTransform(i,e.specularColorMap),a.specularColorTexture=i),a.specularFactor=e.specularIntensity,a.specularColorFactor=e.specularColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=a,n[this.name]=!0)}}]),e}(),Te=function(){function e(t){G(this,e),this.writer=t,this.name="KHR_materials_sheen"}return W(e,[{key:"writeMaterial",value:function(e,t){var r,n,a,i;e.isMeshPhysicalMaterial&&0!=e.sheen&&(n=(r=this.writer).extensionsUsed,a={},e.sheenRoughnessMap&&(i={index:r.processTexture(e.sheenRoughnessMap)},r.applyTextureTransform(i,e.sheenRoughnessMap),a.sheenRoughnessTexture=i),e.sheenColorMap&&(i={index:r.processTexture(e.sheenColorMap)},r.applyTextureTransform(i,e.sheenColorMap),a.sheenColorTexture=i),a.sheenRoughnessFactor=e.sheenRoughness,a.sheenColorFactor=e.sheenColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=a,n[this.name]=!0)}}]),e}(),_e=function(){function e(t){G(this,e),this.writer=t,this.name="KHR_materials_emissive_strength"}return W(e,[{key:"writeMaterial",value:function(e,t){var r,n;e.isMeshStandardMaterial&&1!==e.emissiveIntensity&&(r=this.writer.extensionsUsed,(n={}).emissiveStrength=e.emissiveIntensity,t.extensions=t.extensions||{},t.extensions[this.name]=n,r[this.name]=!0)}}]),e}();function Ee(e){return(Ee="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})(e)}function ke(){ke=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n=(p="function"==typeof Symbol?Symbol:{}).iterator||"@@iterator",a=p.asyncIterator||"@@asyncIterator",i=p.toStringTag||"@@toStringTag";function s(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(t){s=function(e,t,r){return e[t]=r}}function o(e,t,r,n){var a,i,s,o;return t=t&&t.prototype instanceof u?t:u,t=Object.create(t.prototype),n=new x(n||[]),t._invoke=(a=e,i=r,s=n,o="suspendedStart",function(e,t){if("executing"===o)throw new Error("Generator is already running");if("completed"===o){if("throw"===e)throw t;return{value:void 0,done:!0}}for(s.method=e,s.arg=t;;){var r=s.delegate;if(r&&(r=function e(t,r){var n=t.iterator[r.method];if(void 0===n){if(r.delegate=null,"throw"===r.method){if(t.iterator.return&&(r.method="return",r.arg=void 0,e(t,r),"throw"===r.method))return c;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return c}return"throw"===(n=l(n,t.iterator,r.arg)).type?(r.method="throw",r.arg=n.arg,r.delegate=null,c):(n=n.arg)?n.done?(r[t.resultName]=n.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=void 0),r.delegate=null,c):n:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,c)}(r,s),r)){if(r===c)continue;return r}if("next"===s.method)s.sent=s._sent=s.arg;else if("throw"===s.method){if("suspendedStart"===o)throw o="completed",s.arg;s.dispatchException(s.arg)}else"return"===s.method&&s.abrupt("return",s.arg);if(o="executing","normal"===(r=l(a,i,s)).type){if(o=s.done?"completed":"suspendedYield",r.arg===c)continue;return{value:r.arg,done:s.done}}"throw"===r.type&&(o="completed",s.method="throw",s.arg=r.arg)}}),t}function l(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=o;var c={};function u(){}function h(){}function d(){}var p,f,m=(s(p={},n,(function(){return this})),(f=(f=Object.getPrototypeOf)&&f(f(w([]))))&&f!==t&&r.call(f,n)&&(p=f),d.prototype=u.prototype=Object.create(p));function g(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function v(e,t){var n;this._invoke=function(a,i){function s(){return new t((function(n,s){!function n(a,i,s,o){var c;if("throw"!==(a=l(e[a],e,i)).type)return(i=(c=a.arg).value)&&"object"==Ee(i)&&r.call(i,"__await")?t.resolve(i.__await).then((function(e){n("next",e,s,o)}),(function(e){n("throw",e,s,o)})):t.resolve(i).then((function(e){c.value=e,s(c)}),(function(e){return n("throw",e,s,o)}));o(a.arg)}(a,i,n,s)}))}return n=n?n.then(s,s):s()}}function b(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function y(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function x(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(b,this),this.reset(!0)}function w(e){if(e){var t,a=e[n];if(a)return a.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return t=-1,(a=function n(){for(;++t<e.length;)if(r.call(e,t))return n.value=e[t],n.done=!1,n;return n.value=void 0,n.done=!0,n}).next=a}return{next:S}}function S(){return{value:void 0,done:!0}}return s(m,"constructor",h.prototype=d),s(d,"constructor",h),h.displayName=s(d,i,"GeneratorFunction"),e.isGeneratorFunction=function(e){return!!(e="function"==typeof e&&e.constructor)&&(e===h||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,d):(e.__proto__=d,s(e,i,"GeneratorFunction")),e.prototype=Object.create(m),e},e.awrap=function(e){return{__await:e}},g(v.prototype),s(v.prototype,a,(function(){return this})),e.AsyncIterator=v,e.async=function(t,r,n,a,i){void 0===i&&(i=Promise);var s=new v(o(t,r,n,a),i);return e.isGeneratorFunction(r)?s:s.next().then((function(e){return e.done?e.value:s.next()}))},g(m),s(m,i,"Generator"),s(m,n,(function(){return this})),s(m,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t,r=[];for(t in e)r.push(t);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=w,x.prototype={constructor:x,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(y),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(r,n){return s.type="throw",s.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var a=this.tryEntries.length-1;0<=a;--a){var i=this.tryEntries[a],s=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var o=r.call(i,"catchLoc"),l=r.call(i,"finallyLoc");if(o&&l){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(o){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;0<=n;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var i=a;break}}var s=(i=i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc?null:i)?i.completion:{};return s.type=e,s.arg=t,i?(this.method="next",this.next=i.finallyLoc,c):this.complete(s)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),c},finish:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),y(r),c}},catch:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var r,n,a=this.tryEntries[t];if(a.tryLoc===e)return"throw"===(r=a.completion).type&&(n=r.arg,y(a)),n}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:w(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),c}},e}function De(e,t,r,n,a,i,s){try{var o=e[i](s),l=o.value}catch(e){return void r(e)}o.done?t(l):Promise.resolve(l).then(n,a)}function Oe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Pe(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Ae(e,t,r){t&&Pe(e.prototype,t),r&&Pe(e,r),Object.defineProperty(e,"prototype",{writable:!1})}q.Utils={insertKeyframe:function(e,t){var r,n=e.getValueSize(),a=new e.TimeBufferType(e.times.length+1),i=new e.ValueBufferType(e.values.length+n),s=e.createInterpolant(new e.ValueBufferType(n));if(0===e.times.length){a[0]=t;for(var o=0;o<n;o++)i[o]=0;r=0}else if(t<e.times[0]){if(Math.abs(e.times[0]-t)<.001)return 0;a[0]=t,a.set(e.times,1),i.set(s.evaluate(t),0),i.set(e.values,n),r=0}else if(t>e.times[e.times.length-1]){if(Math.abs(e.times[e.times.length-1]-t)<.001)return e.times.length-1;a[a.length-1]=t,a.set(e.times,0),i.set(e.values,0),i.set(s.evaluate(t),e.values.length),r=a.length-1}else for(var l=0;l<e.times.length;l++){if(Math.abs(e.times[l]-t)<.001)return l;if(e.times[l]<t&&e.times[l+1]>t){a.set(e.times.slice(0,l+1),0),a[l+1]=t,a.set(e.times.slice(l+1),l+2),i.set(e.values.slice(0,(l+1)*n),0),i.set(s.evaluate(t),(l+1)*n),i.set(e.values.slice((l+1)*n),(l+2)*n),r=l+1;break}}return e.times=a,e.values=i,r},mergeMorphTargetTracks:function(e,t){for(var r=[],n={},a=e.tracks,i=0;i<a.length;++i){var o=a[i],l=s.PropertyBinding.parseTrackName(o.name),c=s.PropertyBinding.findNode(t,l.nodeName);if("morphTargetInfluences"!==l.propertyName||void 0===l.propertyIndex)r.push(o);else{if(o.createInterpolant!==o.InterpolantFactoryMethodDiscrete&&o.createInterpolant!==o.InterpolantFactoryMethodLinear){if(o.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline)throw new Error("THREE.GLTFExporter: Cannot merge tracks with glTF CUBICSPLINE interpolation.");console.warn("THREE.GLTFExporter: Morph target interpolation mode not yet supported. Using LINEAR instead."),(o=o.clone()).setInterpolation(s.InterpolateLinear)}var u=c.morphTargetInfluences.length,h=c.morphTargetDictionary[l.propertyIndex];if(void 0===h)throw new Error("THREE.GLTFExporter: Morph target name not found: "+l.propertyIndex);var d=void 0;if(void 0===n[c.uuid]){for(var p=new((d=o.clone()).ValueBufferType)(u*d.times.length),f=0;f<d.times.length;f++)p[f*u+h]=d.values[f];d.name=(l.nodeName||"")+".morphTargetInfluences",d.values=p,n[c.uuid]=d,r.push(d)}else{var m=o.createInterpolant(new o.ValueBufferType(1));d=n[c.uuid];for(var g=0;g<d.times.length;g++)d.values[g*u+h]=m.evaluate(d.times[g]);for(var v=0;v<o.times.length;v++){var b=this.insertKeyframe(d,o.times[v]);d.values[b*u+h]=o.values[v]}}}}return e.tracks=r,e}};var Ce={POSITION:["byte","byte normalized","unsigned byte","unsigned byte normalized","short","short normalized","unsigned short","unsigned short normalized"],NORMAL:["byte normalized","short normalized"],TANGENT:["byte normalized","short normalized"],TEXCOORD:["byte","byte normalized","unsigned byte","short","short normalized","unsigned short"]},Re=function(){function e(){Oe(this,e),this.pluginCallbacks=[],this.register((function(e){return new Ze(e)})),this.register((function(e){return new Xe(e)})),this.register((function(e){return new Je(e)})),this.register((function(e){return new $e(e)})),this.register((function(e){return new et(e)})),this.register((function(e){return new tt(e)})),this.register((function(e){return new Qe(e)})),this.register((function(e){return new Ye(e)})),this.register((function(e){return new rt(e)})),this.register((function(e){return new nt(e)}))}return Ae(e,[{key:"register",value:function(e){return-1===this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.push(e),this}},{key:"unregister",value:function(e){return-1!==this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}},{key:"parse",value:function(e,t,r,n){for(var a=new qe,i=[],s=0,o=this.pluginCallbacks.length;s<o;s++)i.push(this.pluginCallbacks[s](a));a.setPlugins(i),a.write(e,t,n).catch(r)}},{key:"parseAsync",value:function(e,t){var r=this;return new Promise((function(n,a){r.parse(e,n,a,t)}))}}]),e}(),Le=5120,Ie=5121,Be=5122,je=5123,Ue=(n=9728,$=9729,te=9984,J=9985,ee=9986,re=9987,ne=33071,ie=33648,ae=10497,"KHR_mesh_quantization"),Ne={},Fe=(Ne[s.NearestFilter]=n,Ne[s.NearestMipmapNearestFilter]=te,Ne[s.NearestMipmapLinearFilter]=ee,Ne[s.LinearFilter]=$,Ne[s.LinearMipmapNearestFilter]=J,Ne[s.LinearMipmapLinearFilter]=re,Ne[s.ClampToEdgeWrapping]=ne,Ne[s.RepeatWrapping]=ae,Ne[s.MirroredRepeatWrapping]=ie,{scale:"scale",position:"translation",quaternion:"rotation",morphTargetInfluences:"weights"}),ze=new s.Color;function Ve(e,t){return e.length===t.length&&e.every((function(e,r){return e===t[r]}))}function Ge(e){return 4*Math.ceil(e/4)}function He(e,t){var r=1<arguments.length&&void 0!==t?t:0,n=Ge(e.byteLength);if(n===e.byteLength)return e;var a=new Uint8Array(n);if(a.set(new Uint8Array(e)),0!==r)for(var i=e.byteLength;i<n;i++)a[i]=r;return a.buffer}function We(){return"undefined"==typeof document&&"undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas")}function Ke(e,t){return void 0!==e.toBlob?new Promise((function(r){return e.toBlob(r,t)})):("image/jpeg"===t?r=.92:"image/webp"===t&&(r=.8),e.convertToBlob({type:t,quality:r}));var r}var qe=function(){function e(){Oe(this,e),this.plugins=[],this.options={},this.pending=[],this.buffers=[],this.byteOffset=0,this.buffers=[],this.nodeMap=new Map,this.skins=[],this.extensionsUsed={},this.extensionsRequired={},this.uids=new Map,this.uid=0,this.json={asset:{version:"2.0",generator:"THREE.GLTFExporter"}},this.cache={meshes:new Map,attributes:new Map,attributesNormalized:new Map,materials:new Map,textures:new Map,images:new Map}}var t,r;return Ae(e,[{key:"setPlugins",value:function(e){this.plugins=e}},{key:"write",value:(t=ke().mark((function e(t,r){var n,a,i,s,o,l,c,u=arguments;return ke().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=2<u.length&&void 0!==u[2]?u[2]:{},this.options=Object.assign({binary:!1,trs:!1,onlyVisible:!0,maxTextureSize:1/0,animations:[],includeCustomExtensions:!1},n),0<this.options.animations.length&&(this.options.trs=!0),this.processInput(t),e.next=6,Promise.all(this.pending);case 6:i=(o=this).buffers,a=o.json,n=o.options,s=o.extensionsUsed,o=o.extensionsRequired,i=new Blob(i,{type:"application/octet-stream"}),s=Object.keys(s),o=Object.keys(o),0<s.length&&(a.extensionsUsed=s),0<o.length&&(a.extensionsRequired=o),a.buffers&&0<a.buffers.length&&(a.buffers[0].byteLength=i.size),!0===n.binary?((l=new FileReader).readAsArrayBuffer(i),l.onloadend=function(){var e=He(l.result),t=new DataView(new ArrayBuffer(8)),n=(t.setUint32(0,e.byteLength,!0),t.setUint32(4,5130562,!0),He((n=JSON.stringify(a),(new TextEncoder).encode(n).buffer),32)),i=new DataView(new ArrayBuffer(8)),s=(i.setUint32(0,n.byteLength,!0),i.setUint32(4,1313821514,!0),new ArrayBuffer(12)),o=((c=new DataView(s)).setUint32(0,1179937895,!0),c.setUint32(4,2,!0),12+i.byteLength+n.byteLength+t.byteLength+e.byteLength),c=(c.setUint32(8,o,!0),new Blob([s,i,n,t,e],{type:"application/octet-stream"})),u=new FileReader;u.readAsArrayBuffer(c),u.onloadend=function(){r(u.result)}}):a.buffers&&0<a.buffers.length?((c=new FileReader).readAsDataURL(i),c.onloadend=function(){var e=c.result;a.buffers[0].uri=e,r(a)}):r(a);case 19:case"end":return e.stop()}}),e,this)})),r=function(){var e=this,r=arguments;return new Promise((function(n,a){var i=t.apply(e,r);function s(e){De(i,n,a,s,o,"next",e)}function o(e){De(i,n,a,s,o,"throw",e)}s(void 0)}))},function(e,t){return r.apply(this,arguments)})},{key:"serializeUserData",value:function(e,t){if(0!==Object.keys(e.userData).length){var r=this.options,n=this.extensionsUsed;try{var a=JSON.parse(JSON.stringify(e.userData));if(r.includeCustomExtensions&&a.gltfExtensions){for(var i in void 0===t.extensions&&(t.extensions={}),a.gltfExtensions)t.extensions[i]=a.gltfExtensions[i],n[i]=!0;delete a.gltfExtensions}0<Object.keys(a).length&&(t.extras=a)}catch(t){console.warn("THREE.GLTFExporter: userData of '"+e.name+"' won't be serialized because of JSON.stringify error - "+t.message)}}}},{key:"getUID",value:function(e){var t,r=1<arguments.length&&void 0!==arguments[1]&&arguments[1];return!1===this.uids.has(e)&&((t=new Map).set(!0,this.uid++),t.set(!1,this.uid++),this.uids.set(e,t)),this.uids.get(e).get(r)}},{key:"isNormalizedNormalAttribute",value:function(e){if(this.cache.attributesNormalized.has(e))return!1;for(var t=new s.Vector3,r=0,n=e.count;r<n;r++)if(5e-4<Math.abs(t.fromBufferAttribute(e,r).length()-1))return!1;return!0}},{key:"createNormalizedNormalAttribute",value:function(e){var t=this.cache;if(t.attributesNormalized.has(e))return t.attributesNormalized.get(e);for(var r=e.clone(),n=new s.Vector3,a=0,i=r.count;a<i;a++)n.fromBufferAttribute(r,a),0===n.x&&0===n.y&&0===n.z?n.setX(1):n.normalize(),r.setXYZ(a,n.x,n.y,n.z);return t.attributesNormalized.set(e,r),r}},{key:"applyTextureTransform",value:function(e,t){var r=!1,n={};0===t.offset.x&&0===t.offset.y||(n.offset=t.offset.toArray(),r=!0),0!==t.rotation&&(n.rotation=t.rotation,r=!0),1===t.repeat.x&&1===t.repeat.y||(n.scale=t.repeat.toArray(),r=!0),r&&(e.extensions=e.extensions||{},e.extensions.KHR_texture_transform=n,this.extensionsUsed.KHR_texture_transform=!0)}},{key:"buildMetalRoughTexture",value:function(e,t){if(e===t)return e;function r(e){return e.encoding===s.sRGBEncoding?function(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}:function(e){return e}}console.warn("THREE.GLTFExporter: Merged metalnessMap and roughnessMap textures.");var n=e?e.image:null,a=t?t.image:null,i=Math.max(n?n.width:0,a?a.width:0),o=Math.max(n?n.height:0,a?a.height:0),l=We(),c=(l.width=i,l.height=o,l.getContext("2d")),u=(c.fillStyle="#00ffff",c.fillRect(0,0,i,o),c.getImageData(0,0,i,o));if(n){c.drawImage(n,0,0,i,o);for(var h=r(e),d=c.getImageData(0,0,i,o).data,p=2;p<d.length;p+=4)u.data[p]=256*h(d[p]/256)}if(a){c.drawImage(a,0,0,i,o);for(var f=r(t),m=c.getImageData(0,0,i,o).data,g=1;g<m.length;g+=4)u.data[g]=256*f(m[g]/256)}return c.putImageData(u,0,0),(n=(e||t).clone()).source=new s.Source(l),n.encoding=s.LinearEncoding,n}},{key:"processBuffer",value:function(e){var t=this.json,r=this.buffers;return t.buffers||(t.buffers=[{byteLength:0}]),r.push(e),0}},{key:"processBufferView",value:function(e,t,r,n,a){var i,o=this.json;switch(o.bufferViews||(o.bufferViews=[]),t){case Le:case Ie:i=1;break;case Be:case je:i=2;break;default:i=4}for(var l=Ge(n*e.itemSize*i),c=new DataView(new ArrayBuffer(l)),u=0,h=r;h<r+n;h++)for(var d=0;d<e.itemSize;d++){var p=void 0;4<e.itemSize?p=e.array[h*e.itemSize+d]:(0===d?p=e.getX(h):1===d?p=e.getY(h):2===d?p=e.getZ(h):3===d&&(p=e.getW(h)),!0===e.normalized&&(p=s.MathUtils.normalize(p,e.array))),5126===t?c.setFloat32(u,p,!0):5124===t?c.setInt32(u,p,!0):5125===t?c.setUint32(u,p,!0):t===Be?c.setInt16(u,p,!0):t===je?c.setUint16(u,p,!0):t===Le?c.setInt8(u,p):t===Ie&&c.setUint8(u,p),u+=i}var f={buffer:this.processBuffer(c.buffer),byteOffset:this.byteOffset,byteLength:l};return void 0!==a&&(f.target=a),34962===a&&(f.byteStride=e.itemSize*i),this.byteOffset+=l,o.bufferViews.push(f),{id:o.bufferViews.length-1,byteLength:0}}},{key:"processBufferViewImage",value:function(e){var t=this,r=t.json;return r.bufferViews||(r.bufferViews=[]),new Promise((function(n){var a=new FileReader;a.readAsArrayBuffer(e),a.onloadend=function(){var e=He(a.result),i={buffer:t.processBuffer(e),byteOffset:t.byteOffset,byteLength:e.byteLength};t.byteOffset+=e.byteLength,n(r.bufferViews.push(i)-1)}}))}},{key:"processAccessor",value:function(e,t,r,n){var a,i=this.json;if(e.array.constructor===Float32Array)a=5126;else if(e.array.constructor===Int32Array)a=5124;else if(e.array.constructor===Uint32Array)a=5125;else if(e.array.constructor===Int16Array)a=Be;else if(e.array.constructor===Uint16Array)a=je;else if(e.array.constructor===Int8Array)a=Le;else{if(e.array.constructor!==Uint8Array)throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type.");a=Ie}if(0===(n=void 0===n?e.count:n))return null;var o,l=function(e,t,r){for(var n={min:new Array(e.itemSize).fill(Number.POSITIVE_INFINITY),max:new Array(e.itemSize).fill(Number.NEGATIVE_INFINITY)},a=t;a<t+r;a++)for(var i=0;i<e.itemSize;i++){var o=void 0;4<e.itemSize?o=e.array[a*e.itemSize+i]:(0===i?o=e.getX(a):1===i?o=e.getY(a):2===i?o=e.getZ(a):3===i&&(o=e.getW(a)),!0===e.normalized&&(o=s.MathUtils.normalize(o,e.array))),n.min[i]=Math.min(n.min[i],o),n.max[i]=Math.max(n.max[i],o)}return n}(e,r=void 0===r?0:r,n);return r={bufferView:(void 0!==t&&(o=e===t.index?34963:34962),t=this.processBufferView(e,a,r,n,o)).id,byteOffset:t.byteOffset,componentType:a,count:n,max:l.max,min:l.min,type:{1:"SCALAR",2:"VEC2",3:"VEC3",4:"VEC4",16:"MAT4"}[e.itemSize]},!0===e.normalized&&(r.normalized=!0),i.accessors||(i.accessors=[]),i.accessors.push(r)-1}},{key:"processImage",value:function(e,t,r){var n=3<arguments.length&&void 0!==arguments[3]?arguments[3]:"image/png";if(null===e)throw new Error("THREE.GLTFExporter: No valid image data found. Unable to process texture.");var a=this,i=a.cache,o=a.json,l=a.options,c=a.pending,u=(i.images.has(e)||i.images.set(e,{}),i=i.images.get(e),n+":flipY/"+r.toString());if(void 0!==i[u])return i[u];o.images||(o.images=[]);var h={mimeType:n},d=We(),p=(d.width=Math.min(e.width,l.maxTextureSize),d.height=Math.min(e.height,l.maxTextureSize),d.getContext("2d"));if(!0===r&&(p.translate(0,d.height),p.scale(1,-1)),void 0!==e.data){t!==s.RGBAFormat&&console.error("GLTFExporter: Only RGBAFormat is supported."),(e.width>l.maxTextureSize||e.height>l.maxTextureSize)&&console.warn("GLTFExporter: Image size is bigger than maxTextureSize",e);for(var f=new Uint8ClampedArray(e.height*e.width*4),m=0;m<f.length;m+=4)f[m+0]=e.data[m+0],f[m+1]=e.data[m+1],f[m+2]=e.data[m+2],f[m+3]=e.data[m+3];p.putImageData(new ImageData(f,e.width,e.height),0,0)}else p.drawImage(e,0,0,d.width,d.height);return!0===l.binary?c.push(Ke(d,n).then((function(e){return a.processBufferViewImage(e)})).then((function(e){h.bufferView=e}))):void 0!==d.toDataURL?h.uri=d.toDataURL(n):c.push(Ke(d,n).then((function(e){return(new FileReader).readAsDataURL(e)})).then((function(e){h.uri=e}))),r=o.images.push(h)-1,i[u]=r}},{key:"processSampler",value:function(e){var t=this.json;return t.samplers||(t.samplers=[]),e={magFilter:Ne[e.magFilter],minFilter:Ne[e.minFilter],wrapS:Ne[e.wrapS],wrapT:Ne[e.wrapT]},t.samplers.push(e)-1}},{key:"processTexture",value:function(e){var t=this.cache,r=this.json;if(t.textures.has(e))return t.textures.get(e);r.textures||(r.textures=[]);var n=("image/webp"===(a=e.userData.mimeType)&&(a="image/png"),{sampler:this.processSampler(e),source:this.processImage(e.image,e.format,e.flipY,a)}),a=(e.name&&(n.name=e.name),this._invokeAll((function(t){t.writeTexture&&t.writeTexture(e,n)})),r.textures.push(n)-1);return t.textures.set(e,a),a}},{key:"processMaterial",value:function(e){var t=this.cache,r=this.json;if(t.materials.has(e))return t.materials.get(e);if(e.isShaderMaterial)return console.warn("GLTFExporter: THREE.ShaderMaterial not supported."),null;r.materials||(r.materials=[]);var n={pbrMetallicRoughness:{}},a=(!0!==e.isMeshStandardMaterial&&!0!==e.isMeshBasicMaterial&&console.warn("GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results."),e.color.toArray().concat([e.opacity])),i=(Ve(a,[1,1,1,1])||(n.pbrMetallicRoughness.baseColorFactor=a),e.isMeshStandardMaterial?(n.pbrMetallicRoughness.metallicFactor=e.metalness,n.pbrMetallicRoughness.roughnessFactor=e.roughness):(n.pbrMetallicRoughness.metallicFactor=.5,n.pbrMetallicRoughness.roughnessFactor=.5),(e.metalnessMap||e.roughnessMap)&&(a=this.buildMetalRoughTexture(e.metalnessMap,e.roughnessMap),i={index:this.processTexture(a)},this.applyTextureTransform(i,a),n.pbrMetallicRoughness.metallicRoughnessTexture=i),e.map&&(a={index:this.processTexture(e.map)},this.applyTextureTransform(a,e.map),n.pbrMetallicRoughness.baseColorTexture=a),e.emissive&&(i=e.emissive,0<Math.max(i.r,i.g,i.b)&&(n.emissiveFactor=e.emissive.toArray()),e.emissiveMap&&(a={index:this.processTexture(e.emissiveMap)},this.applyTextureTransform(a,e.emissiveMap),n.emissiveTexture=a)),e.normalMap&&(i={index:this.processTexture(e.normalMap)},e.normalScale&&1!==e.normalScale.x&&(i.scale=e.normalScale.x),this.applyTextureTransform(i,e.normalMap),n.normalTexture=i),e.aoMap&&(a={index:this.processTexture(e.aoMap),texCoord:1},1!==e.aoMapIntensity&&(a.strength=e.aoMapIntensity),this.applyTextureTransform(a,e.aoMap),n.occlusionTexture=a),e.transparent?n.alphaMode="BLEND":0<e.alphaTest&&(n.alphaMode="MASK",n.alphaCutoff=e.alphaTest),e.side===s.DoubleSide&&(n.doubleSided=!0),""!==e.name&&(n.name=e.name),this.serializeUserData(e,n),this._invokeAll((function(t){t.writeMaterial&&t.writeMaterial(e,n)})),r.materials.push(n)-1);return t.materials.set(e,i),i}},{key:"processMesh",value:function(e){var t=this.cache,r=this.json,n=[e.geometry.uuid];if(Array.isArray(e.material))for(var a=0,i=e.material.length;a<i;a++)n.push(e.material[a].uuid);else n.push(e.material.uuid);var o=n.join(":");if(t.meshes.has(o))return t.meshes.get(o);var l,c,u,h=e.geometry,d=e.isLineSegments?1:e.isLineLoop?2:e.isLine?3:e.isPoints?0:e.material.wireframe?1:4,p={},f={},m=[],g=[],v={uv:"TEXCOORD_0",uv2:"TEXCOORD_1",color:"COLOR_0",skinWeight:"WEIGHTS_0",skinIndex:"JOINTS_0"},b=h.getAttribute("normal"),y=(void 0===b||this.isNormalizedNormalAttribute(b)||(console.warn("THREE.GLTFExporter: Creating normalized normal attribute from the non-normalized one."),h.setAttribute("normal",this.createNormalizedNormalAttribute(b))),null);for(c in h.attributes)"morph"!==c.slice(0,5)&&(l=h.attributes[c],c=v[c]||c.toUpperCase(),/^(POSITION|NORMAL|TANGENT|TEXCOORD_\d+|COLOR_\d+|JOINTS_\d+|WEIGHTS_\d+)$/.test(c)||(c="_"+c),t.attributes.has(this.getUID(l))?f[c]=t.attributes.get(this.getUID(l)):(y=null,u=l.array,"JOINTS_0"!==c||u instanceof Uint16Array||u instanceof Uint8Array||(console.warn('GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.'),y=new s.BufferAttribute(new Uint16Array(u),l.itemSize,l.normalized)),null!==(u=this.processAccessor(y||l,h))&&(c.startsWith("_")||this.detectMeshQuantization(c,l),f[c]=u,t.attributes.set(this.getUID(l),u))));if(void 0!==b&&h.setAttribute("normal",b),0===Object.keys(f).length)return null;if(void 0!==e.morphTargetInfluences&&0<e.morphTargetInfluences.length){var x=[],w=[],S={};if(void 0!==e.morphTargetDictionary)for(var M in e.morphTargetDictionary)S[e.morphTargetDictionary[M]]=M;for(var T=0;T<e.morphTargetInfluences.length;++T){var _,E={},k=!1;for(_ in h.morphAttributes)if("position"!==_&&"normal"!==_)k||(console.warn("GLTFExporter: Only POSITION and NORMAL morph are supported."),k=!0);else{var D=h.morphAttributes[_][T],O=_.toUpperCase(),P=h.attributes[_];if(t.attributes.has(this.getUID(D,!0)))E[O]=t.attributes.get(this.getUID(D,!0));else{var A=D.clone();if(!h.morphTargetsRelative)for(var C=0,R=D.count;C<R;C++)for(var L=0;L<D.itemSize;L++)0===L&&A.setX(C,D.getX(C)-P.getX(C)),1===L&&A.setY(C,D.getY(C)-P.getY(C)),2===L&&A.setZ(C,D.getZ(C)-P.getZ(C)),3===L&&A.setW(C,D.getW(C)-P.getW(C));E[O]=this.processAccessor(A,h),t.attributes.set(this.getUID(P,!0),E[O])}}g.push(E),x.push(e.morphTargetInfluences[T]),void 0!==e.morphTargetDictionary&&w.push(S[T])}p.weights=x,0<w.length&&(p.extras={},p.extras.targetNames=w)}if((b=Array.isArray(e.material))&&0===h.groups.length)return null;for(var I=b?e.material:[e.material],B=b?h.groups:[{materialIndex:0,start:void 0,count:void 0}],j=0,U=B.length;j<U;j++){var N={mode:d,attributes:f},F=(this.serializeUserData(h,N),0<g.length&&(N.targets=g),null!==h.index&&(F=this.getUID(h.index),void 0===B[j].start&&void 0===B[j].count||(F+=":"+B[j].start+":"+B[j].count),t.attributes.has(F)?N.indices=t.attributes.get(F):(N.indices=this.processAccessor(h.index,h,B[j].start,B[j].count),t.attributes.set(F,N.indices)),null===N.indices&&delete N.indices),this.processMaterial(I[B[j].materialIndex]));null!==F&&(N.material=F),m.push(N)}return p.primitives=m,r.meshes||(r.meshes=[]),this._invokeAll((function(t){t.writeMesh&&t.writeMesh(e,p)})),b=r.meshes.push(p)-1,t.meshes.set(o,b),b}},{key:"detectMeshQuantization",value:function(e,t){if(!this.extensionsUsed[Ue]){var r=void 0;switch(t.array.constructor){case Int8Array:r="byte";break;case Uint8Array:r="unsigned byte";break;case Int16Array:r="short";break;case Uint16Array:r="unsigned short";break;default:return}t.normalized&&(r+=" normalized"),t=e.split("_",1)[0],null!=(e=Ce[t])&&e.includes(r)&&(this.extensionsUsed[Ue]=!0,this.extensionsRequired[Ue]=!0)}}},{key:"processCamera",value:function(e){var t=this.json,r=(t.cameras||(t.cameras=[]),e.isOrthographicCamera),n={type:r?"orthographic":"perspective"};return r?n.orthographic={xmag:2*e.right,ymag:2*e.top,zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near}:n.perspective={aspectRatio:e.aspect,yfov:s.MathUtils.degToRad(e.fov),zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near},""!==e.name&&(n.name=e.type),t.cameras.push(n)-1}},{key:"processAnimation",value:function(e,t){for(var r=this.json,n=this.nodeMap,a=(r.animations||(r.animations=[]),(e=Re.Utils.mergeMorphTargetTracks(e.clone(),t)).tracks),i=[],o=[],l=0;l<a.length;++l){var c=a[l],u=s.PropertyBinding.parseTrackName(c.name),h=s.PropertyBinding.findNode(t,u.nodeName),d=Fe[u.propertyName];if(!(h="bones"===u.objectName?!0===h.isSkinnedMesh?h.skeleton.getBoneByName(u.objectIndex):void 0:h)||!d)return console.warn('THREE.GLTFExporter: Could not export animation track "%s".',c.name),null;u=c.values.length/c.times.length;var p=void(d===Fe.morphTargetInfluences&&(u/=h.morphTargetInfluences.length));!0===c.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline?(p="CUBICSPLINE",u/=3):p=c.getInterpolation()===s.InterpolateDiscrete?"STEP":"LINEAR",o.push({input:this.processAccessor(new s.BufferAttribute(c.times,1)),output:this.processAccessor(new s.BufferAttribute(c.values,u)),interpolation:p}),i.push({sampler:o.length-1,target:{node:n.get(h),path:d}})}return r.animations.push({name:e.name||"clip_"+r.animations.length,samplers:o,channels:i}),r.animations.length-1}},{key:"processSkin",value:function(e){var t=this.json,r=this.nodeMap,n=t.nodes[r.get(e)],a=e.skeleton;if(void 0===a)return null;var i=e.skeleton.bones[0];if(void 0===i)return null;for(var o=[],l=new Float32Array(16*a.bones.length),c=new s.Matrix4,u=0;u<a.bones.length;++u)o.push(r.get(a.bones[u])),c.copy(a.boneInverses[u]),c.multiply(e.bindMatrix).toArray(l,16*u);return void 0===t.skins&&(t.skins=[]),t.skins.push({inverseBindMatrices:this.processAccessor(new s.BufferAttribute(l,16)),joints:o,skeleton:r.get(i)}),n.skin=t.skins.length-1}},{key:"processNode",value:function(e){var t,r,n=this.json,a=this.options,i=this.nodeMap,s=(n.nodes||(n.nodes=[]),{});if(a.trs?(r=e.quaternion.toArray(),h=e.position.toArray(),t=e.scale.toArray(),Ve(r,[0,0,0,1])||(s.rotation=r),Ve(h,[0,0,0])||(s.translation=h),Ve(t,[1,1,1])||(s.scale=t)):(e.matrixAutoUpdate&&e.updateMatrix(),!1===Ve(e.matrix.elements,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])&&(s.matrix=e.matrix.elements)),""!==e.name&&(s.name=String(e.name)),this.serializeUserData(e,s),e.isMesh||e.isLine||e.isPoints?null!==(r=this.processMesh(e))&&(s.mesh=r):e.isCamera&&(s.camera=this.processCamera(e)),e.isSkinnedMesh&&this.skins.push(e),0<e.children.length){for(var o=[],l=0,c=e.children.length;l<c;l++){var u=e.children[l];!u.visible&&!1!==a.onlyVisible||null!==(u=this.processNode(u))&&o.push(u)}0<o.length&&(s.children=o)}this._invokeAll((function(t){t.writeNode&&t.writeNode(e,s)}));var h=n.nodes.push(s)-1;return i.set(e,h),h}},{key:"processScene",value:function(e){for(var t=this.json,r=this.options,n=(t.scenes||(t.scenes=[],t.scene=0),{}),a=(""!==e.name&&(n.name=e.name),t.scenes.push(n),[]),i=0,s=e.children.length;i<s;i++){var o=e.children[i];!o.visible&&!1!==r.onlyVisible||null!==(o=this.processNode(o))&&a.push(o)}0<a.length&&(n.nodes=a),this.serializeUserData(e,n)}},{key:"processObjects",value:function(e){var t=new s.Scene;t.name="AuxScene";for(var r=0;r<e.length;r++)t.children.push(e[r]);this.processScene(t)}},{key:"processInput",value:function(e){for(var t=this.options,r=(e=e instanceof Array?e:[e],this._invokeAll((function(t){t.beforeParse&&t.beforeParse(e)})),[]),n=0;n<e.length;n++)e[n]instanceof s.Scene?this.processScene(e[n]):r.push(e[n]);0<r.length&&this.processObjects(r);for(var a=0;a<this.skins.length;++a)this.processSkin(this.skins[a]);for(var i=0;i<t.animations.length;++i)this.processAnimation(t.animations[i],e[0]);this._invokeAll((function(t){t.afterParse&&t.afterParse(e)}))}},{key:"_invokeAll",value:function(e){for(var t=0,r=this.plugins.length;t<r;t++)e(this.plugins[t])}}]),e}(),Ze=function(){function e(t){Oe(this,e),this.writer=t,this.name="KHR_lights_punctual"}return Ae(e,[{key:"writeNode",value:function(e,t){var r,n,a;e.isLight&&(e.isDirectionalLight||e.isPointLight||e.isSpotLight?(r=(a=this.writer).json,a=a.extensionsUsed,n={},e.name&&(n.name=e.name),n.color=e.color.toArray(),n.intensity=e.intensity,e.isDirectionalLight?n.type="directional":e.isPointLight?(n.type="point",0<e.distance&&(n.range=e.distance)):e.isSpotLight&&(n.type="spot",0<e.distance&&(n.range=e.distance),n.spot={},n.spot.innerConeAngle=(e.penumbra-1)*e.angle*-1,n.spot.outerConeAngle=e.angle),void 0!==e.decay&&2!==e.decay&&console.warn("THREE.GLTFExporter: Light decay may be lost. glTF is physically-based, and expects light.decay=2."),!e.target||e.target.parent===e&&0===e.target.position.x&&0===e.target.position.y&&-1===e.target.position.z||console.warn("THREE.GLTFExporter: Light direction may be lost. For best results, make light.target a child of the light with position 0,0,-1."),a[this.name]||(r.extensions=r.extensions||{},r.extensions[this.name]={lights:[]},a[this.name]=!0),(a=r.extensions[this.name].lights).push(n),t.extensions=t.extensions||{},t.extensions[this.name]={light:a.length-1}):console.warn("THREE.GLTFExporter: Only directional, point, and spot lights are supported.",e))}}]),e}(),Xe=function(){function e(t){Oe(this,e),this.writer=t,this.name="KHR_materials_unlit"}return Ae(e,[{key:"writeMaterial",value:function(e,t){e.isMeshBasicMaterial&&(e=this.writer.extensionsUsed,t.extensions=t.extensions||{},t.extensions[this.name]={},e[this.name]=!0,t.pbrMetallicRoughness.metallicFactor=0,t.pbrMetallicRoughness.roughnessFactor=.9)}}]),e}(),Qe=function(){function e(t){Oe(this,e),this.writer=t,this.name="KHR_materials_clearcoat"}return Ae(e,[{key:"writeMaterial",value:function(e,t){var r,n,a,i;e.isMeshPhysicalMaterial&&0!==e.clearcoat&&(n=(r=this.writer).extensionsUsed,(a={}).clearcoatFactor=e.clearcoat,e.clearcoatMap&&(i={index:r.processTexture(e.clearcoatMap)},r.applyTextureTransform(i,e.clearcoatMap),a.clearcoatTexture=i),a.clearcoatRoughnessFactor=e.clearcoatRoughness,e.clearcoatRoughnessMap&&(i={index:r.processTexture(e.clearcoatRoughnessMap)},r.applyTextureTransform(i,e.clearcoatRoughnessMap),a.clearcoatRoughnessTexture=i),e.clearcoatNormalMap&&(i={index:r.processTexture(e.clearcoatNormalMap)},r.applyTextureTransform(i,e.clearcoatNormalMap),a.clearcoatNormalTexture=i),t.extensions=t.extensions||{},t.extensions[this.name]=a,n[this.name]=!0)}}]),e}(),Ye=function(){function e(t){Oe(this,e),this.writer=t,this.name="KHR_materials_iridescence"}return Ae(e,[{key:"writeMaterial",value:function(e,t){var r,n,a,i;e.isMeshPhysicalMaterial&&0!==e.iridescence&&(n=(r=this.writer).extensionsUsed,(a={}).iridescenceFactor=e.iridescence,e.iridescenceMap&&(i={index:r.processTexture(e.iridescenceMap)},r.applyTextureTransform(i,e.iridescenceMap),a.iridescenceTexture=i),a.iridescenceIor=e.iridescenceIOR,a.iridescenceThicknessMinimum=e.iridescenceThicknessRange[0],a.iridescenceThicknessMaximum=e.iridescenceThicknessRange[1],e.iridescenceThicknessMap&&(i={index:r.processTexture(e.iridescenceThicknessMap)},r.applyTextureTransform(i,e.iridescenceThicknessMap),a.iridescenceThicknessTexture=i),t.extensions=t.extensions||{},t.extensions[this.name]=a,n[this.name]=!0)}}]),e}(),Je=function(){function e(t){Oe(this,e),this.writer=t,this.name="KHR_materials_transmission"}return Ae(e,[{key:"writeMaterial",value:function(e,t){var r,n,a,i;e.isMeshPhysicalMaterial&&0!==e.transmission&&(n=(r=this.writer).extensionsUsed,(a={}).transmissionFactor=e.transmission,e.transmissionMap&&(i={index:r.processTexture(e.transmissionMap)},r.applyTextureTransform(i,e.transmissionMap),a.transmissionTexture=i),t.extensions=t.extensions||{},t.extensions[this.name]=a,n[this.name]=!0)}}]),e}(),$e=function(){function e(t){Oe(this,e),this.writer=t,this.name="KHR_materials_volume"}return Ae(e,[{key:"writeMaterial",value:function(e,t){var r,n,a,i;e.isMeshPhysicalMaterial&&0!==e.transmission&&(n=(r=this.writer).extensionsUsed,(a={}).thicknessFactor=e.thickness,e.thicknessMap&&(i={index:r.processTexture(e.thicknessMap)},r.applyTextureTransform(i,e.thicknessMap),a.thicknessTexture=i),a.attenuationDistance=e.attenuationDistance,a.attenuationColor=e.attenuationColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=a,n[this.name]=!0)}}]),e}(),et=function(){function e(t){Oe(this,e),this.writer=t,this.name="KHR_materials_ior"}return Ae(e,[{key:"writeMaterial",value:function(e,t){var r,n;e.isMeshPhysicalMaterial&&1.5!==e.ior&&(r=this.writer.extensionsUsed,(n={}).ior=e.ior,t.extensions=t.extensions||{},t.extensions[this.name]=n,r[this.name]=!0)}}]),e}(),tt=function(){function e(t){Oe(this,e),this.writer=t,this.name="KHR_materials_specular"}return Ae(e,[{key:"writeMaterial",value:function(e,t){var r,n,a,i;e.isMeshPhysicalMaterial&&(1!==e.specularIntensity||!e.specularColor.equals(ze)||e.specularIntensityMap||e.specularColorTexture)&&(n=(r=this.writer).extensionsUsed,a={},e.specularIntensityMap&&(i={index:r.processTexture(e.specularIntensityMap)},r.applyTextureTransform(i,e.specularIntensityMap),a.specularTexture=i),e.specularColorMap&&(i={index:r.processTexture(e.specularColorMap)},r.applyTextureTransform(i,e.specularColorMap),a.specularColorTexture=i),a.specularFactor=e.specularIntensity,a.specularColorFactor=e.specularColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=a,n[this.name]=!0)}}]),e}(),rt=function(){function e(t){Oe(this,e),this.writer=t,this.name="KHR_materials_sheen"}return Ae(e,[{key:"writeMaterial",value:function(e,t){var r,n,a,i;e.isMeshPhysicalMaterial&&0!=e.sheen&&(n=(r=this.writer).extensionsUsed,a={},e.sheenRoughnessMap&&(i={index:r.processTexture(e.sheenRoughnessMap)},r.applyTextureTransform(i,e.sheenRoughnessMap),a.sheenRoughnessTexture=i),e.sheenColorMap&&(i={index:r.processTexture(e.sheenColorMap)},r.applyTextureTransform(i,e.sheenColorMap),a.sheenColorTexture=i),a.sheenRoughnessFactor=e.sheenRoughness,a.sheenColorFactor=e.sheenColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=a,n[this.name]=!0)}}]),e}(),nt=function(){function e(t){Oe(this,e),this.writer=t,this.name="KHR_materials_emissive_strength"}return Ae(e,[{key:"writeMaterial",value:function(e,t){var r,n;e.isMeshStandardMaterial&&1!==e.emissiveIntensity&&(r=this.writer.extensionsUsed,(n={}).emissiveStrength=e.emissiveIntensity,t.extensions=t.extensions||{},t.extensions[this.name]=n,r[this.name]=!0)}}]),e}();Re.Utils={insertKeyframe:function(e,t){var r,n=e.getValueSize(),a=new e.TimeBufferType(e.times.length+1),i=new e.ValueBufferType(e.values.length+n),s=e.createInterpolant(new e.ValueBufferType(n));if(0===e.times.length){a[0]=t;for(var o=0;o<n;o++)i[o]=0;r=0}else if(t<e.times[0]){if(Math.abs(e.times[0]-t)<.001)return 0;a[0]=t,a.set(e.times,1),i.set(s.evaluate(t),0),i.set(e.values,n),r=0}else if(t>e.times[e.times.length-1]){if(Math.abs(e.times[e.times.length-1]-t)<.001)return e.times.length-1;a[a.length-1]=t,a.set(e.times,0),i.set(e.values,0),i.set(s.evaluate(t),e.values.length),r=a.length-1}else for(var l=0;l<e.times.length;l++){if(Math.abs(e.times[l]-t)<.001)return l;if(e.times[l]<t&&e.times[l+1]>t){a.set(e.times.slice(0,l+1),0),a[l+1]=t,a.set(e.times.slice(l+1),l+2),i.set(e.values.slice(0,(l+1)*n),0),i.set(s.evaluate(t),(l+1)*n),i.set(e.values.slice((l+1)*n),(l+2)*n),r=l+1;break}}return e.times=a,e.values=i,r},mergeMorphTargetTracks:function(e,t){for(var r=[],n={},a=e.tracks,i=0;i<a.length;++i){var o=a[i],l=s.PropertyBinding.parseTrackName(o.name),c=s.PropertyBinding.findNode(t,l.nodeName);if("morphTargetInfluences"!==l.propertyName||void 0===l.propertyIndex)r.push(o);else{if(o.createInterpolant!==o.InterpolantFactoryMethodDiscrete&&o.createInterpolant!==o.InterpolantFactoryMethodLinear){if(o.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline)throw new Error("THREE.GLTFExporter: Cannot merge tracks with glTF CUBICSPLINE interpolation.");console.warn("THREE.GLTFExporter: Morph target interpolation mode not yet supported. Using LINEAR instead."),(o=o.clone()).setInterpolation(s.InterpolateLinear)}var u=c.morphTargetInfluences.length,h=c.morphTargetDictionary[l.propertyIndex];if(void 0===h)throw new Error("THREE.GLTFExporter: Morph target name not found: "+l.propertyIndex);var d=void 0;if(void 0===n[c.uuid]){for(var p=new((d=o.clone()).ValueBufferType)(u*d.times.length),f=0;f<d.times.length;f++)p[f*u+h]=d.values[f];d.name=(l.nodeName||"")+".morphTargetInfluences",d.values=p,n[c.uuid]=d,r.push(d)}else{var m=o.createInterpolant(new o.ValueBufferType(1));d=n[c.uuid];for(var g=0;g<d.times.length;g++)d.values[g*u+h]=m.evaluate(d.times[g]);for(var v=0;v<o.times.length;v++){var b=this.insertKeyframe(d,o.times[v]);d.values[b*u+h]=o.values[v]}}}}return e.tracks=r,e}};class at{constructor(e){this.map=new j.Z,this.loadMap=new A.Z,this.exportMap=new A.Z,this.runScene=e,this.loadMap}bind(e){this.processMap(e),this.map.add(e)}processMap(e){e.loadCallBacks.map(((e,t)=>{let r=this.loadMap.get(e);r||(r=new j.Z,this.loadMap.set(e,r)),r.add(t)})),e.exportCallBacks.map(((e,t)=>{let r=this.exportMap.get(e);r||(r=new j.Z,this.exportMap.set(e,r)),r.add(t)}))}loadCallback(e){const{type:t,json:r,data:n,config:a,core:i}=e;return null==(e=this.loadMap.get(t))?void 0:e.map((e=>e({json:r,data:n,config:a,core:i})))}}var it=r(3625),st=r(4330),ot=r(932),lt=r(3736);class ct{constructor(e){this.materialMap={},this.textureMap={},this.geoDefMaterialMap=new A.Z;var{type:e,runScene:t,helper:r}=e;this.type=e,this.helper=r,this.runScene=t}parse(e){var t=this.createTextureGroup(e);"scene"===this.type&&this.parseScene(t),this.parseModel(e),this.materialMapToJson(),this.setMultipMaterial(t,Object.keys(this.textureMap))}createTextureGroup(e){const t=new s.Group;return t.name="back-texture-ex",t.userData.isHelper=!0,e.add(t),t}parseUnDelAbleTexture(){(0,i.mapObj)(this.runScene.uniqueEx.texture.map,((e,t)=>{t=t.texture,it.unDelAbleTexture.is(t)&&(this.mergeSame(t).isSame||this.parseTexture(t))}))}parseScene(e){this.helper.ex=Object.assign(Object.assign({},this.helper.ex),this._getBaseEx(e)),this.parseUnDelAbleTexture()}_getBaseEx(e){var t=this.runScene.sceneEx.get(),r=this.runScene.optionsEx.exporterOptions.outTime,n=this.runScene.sceneEx.envStrength;return{version:{core:"0.0.87",editor:"0.0.2"},base64:(0,I.Ni)(String(r)),camera:b.Z.toJSON(this.runScene),sceneEx:Object.assign(Object.assign({},lt.ZP.toJSON(t,this.runScene)),this._bindSceneTextures(e)),timeLine:this.runScene.timeLineEx.getSavedData(),envStrength:n,objects:this.runScene.objects.toJSON(),tags:this.runScene.tags.toJSON(),options:this.runScene.exporter.gltf.options.getOptions(t)}}_bindSceneTextures(e){var t=this.runScene.sceneEx.get();const r={};if((0,it.isTexture)(t.background)||(0,it.isTexture)(t.environment)){this.runScene.pp.setUpdate(!1);const{background:n,environment:a}=t,i=(this.runScene.pp.setUpdate(!0),(0,h.createDefModel)("Box")),s=(0,ot.createDefMaterial)();i.material=s,e.add(i),t=s.userData.id,r.materialId=t;let o=[];(0,it.isTexture)(n)&&(n.userData.notCompress=!0,o.push({type:"map",texture:n}),303===(s.map=n).mapping&&(r.backgroundMapping=303)),(0,it.isTexture)(a)&&(a.userData.notCompress=!0,o.push({type:"envMap",texture:a}),s.envMap=a),this.materialMap[t]={normalMaterial:s,models:[],normal:{},textures:o}}return r}compressLocal(e){var{x:t,y:r,z:n}=e.position;0===t&&0===r&&0===n||(e.position.set(0,0,0),e.userData.local=t+","+r+","+n)}parseModel(e){const t=new Set;e.traverse((e=>t.add(e))),t.forEach((e=>{this._processMaterial(e),this._processModel(e)}))}_processModel(e){(0,h.withAnima)(e)&&(t=e.animations.map((e=>e.toJSON())),(0,lt.M)(e,"animations",t));var t=this.runScene.modelEx.importAndExport.toNromal({type:(null==(t=null==(t=e.userData)?void 0:t.normal)?void 0:t.type)||e.type,model:e,runScene:this.runScene});t!==e&&(e.parent.add(t),e.parent.remove(e)),this.runScene.optionsEx.options.hideLocal&&this.compressLocal(t)}_processMaterial(e){if((0,ot.isMaterial)(e.material)){const n=this.materialMap[e.material.userData.id];if(n)return n.normalMaterial&&(e.material=n.normalMaterial),void n.models.push(e);var t=this.runScene.materialEx.isBaseMaterial(e.material),r=e.material;const{material:a,normal:i,textures:s}=t||this.runScene.optionsEx.exporterOptions.notMaterial?this.getMaterialFromModel(e):this.runScene.materialEx.toNromal(e.material);e.material=a,t=r.userData.id,a.userData.id=t,this.materialMap[t]={oldMaterial:r,normalMaterial:a,models:[e],normal:i,textures:s}}}materialMapToJson(){(0,i.mapObj)(this.materialMap,((e,t)=>{var{normalMaterial:t,textures:r,normal:n}=t,a=t.userData.id;this.helper.ex.materialMap[a]||(this.helper.ex.materialMap[a]={normal:n,textures:{}},this.mergeAndRemoveTexture(r,t))}))}mergeSame(e){e.userData||(e.userData={});var t=e.userData;if((0,it.isClonedTexture)(e))e=this.parseCloneTexture(e);else for(const i in this.textureMap){var r=this.textureMap[i],{md5:n,texture:a}=r;if(t.md5===n&&e.mapping===a.mapping&&!(0,it.isClonedTexture)(r.texture))return{isSame:!0,texture:a}}return this.textureMap[e.userData.id]=Object.assign(Object.assign({},t),{texture:e}),{isSame:!1,texture:e}}parseTexture(e){var t,{format:r,repeat:n,center:a,rotation:i,offset:s}=e;const o={format:r};this.runScene.modelEx.isNavieV2(n,1)||(({x:r,y:t}=n),o.repeat=r===t?r:n),this.runScene.modelEx.isNavieV2(a,0)||(({x:t,y:r}=a),o.center=t===r?t:a),this.runScene.modelEx.isNavieV2(s,0)||(({x:n,y:r}=s),o.offset=n===r?n:s),0!==i&&(o.rotation=i),this.helper.ex.textureMap[e.userData.id]=o}mergeAndRemoveTexture(e,t){return function(e,t,r,n){return new(r=r||Promise)((function(t,a){function i(e){try{o(n.next(e))}catch(e){a(e)}}function s(e){try{o(n.throw(e))}catch(e){a(e)}}function o(e){var n;e.done?t(e.value):((n=e.value)instanceof r?n:new r((function(e){e(n)}))).then(i,s)}o((n=n.apply(e,[])).next())}))}(this,0,void 0,(function*(){return e.map((e=>{if(!(0,it.isInvalidTexture)(e.texture)){var{type:e,texture:r}=e;this.runScene.uniqueEx.texture.add(r),t[e]=null;const n=this.mergeSame(r).texture;this.helper.ex.textureMap[n.userData.id]||this.parseTexture(n),"normalMap"!==e||n.userData.isNormalMap||(n.userData.isNormalMap=!0),this.helper.ex.materialMap[t.userData.id].textures[e]=n.userData.id}}))}))}parseCloneTexture(e){const t=e.clone();t.userData=Object.assign({},e.userData);var{width:e,height:r}=e.image;const n=document.createElement("canvas");return n.width=e,n.height=r,t.image=n,t.userData.blob=new Blob([]),t}setMultipMaterial(e,t){const r=this.runScene.modelEx.create("Box"),n=(0,ot.createDefMaterial)();r.material=n,e.add(r);for(const e of st.sG){if(!t.length)return;var a=t.pop();if(!a)return;n[e]=this.textureMap[a].texture}t.length&&this.setMultipMaterial(e,t)}getMaterialFromModel(e){return e&&e.geometry?(e=e.geometry.uuid,this.geoDefMaterialMap.get(e)||this.geoDefMaterialMap.set(e,(0,ot.createDefMaterial)()),{material:this.geoDefMaterialMap.get(e),normal:{},textures:[]}):{material:this.runScene.materialEx.defMaterial,normal:{},textures:[]}}}class ut extends o{constructor(){super(...arguments),this.savedMap=new A.Z,this.clonedMap=new A.Z}getSameNode(e){return this.savedMap.find(((t,r)=>r.materialUuid===e.material.uuid&&r.geometryUuid===e.geometry.uuid))}parseUnClonedModel(e){var t,r=(0,U.Ki)(e);e.material&&e.geometry&&((t=this.getSameNode(e))&&(0,h.setClonedModel)(e,t.id),this.savedMap.set(r,{id:r,geometryUuid:e.geometry.uuid,materialUuid:e.material.uuid}))}parseClonedModel(e){var t=(0,h.getClonedIdModel)(e),r=(0,U.Ki)(e);this.clonedMap.get(t)||this.clonedMap.set(t,{newId:void 0,ids:new Set});const n=this.clonedMap.get(t);n&&(n.ids.add(r),n.newId||this.runScene.uniqueEx.model.get(t)||(t=(0,U.Ki)(e),n.newId=t),n.newId&&(n.newId!==r?(0,h.setClonedModel)(e,n.newId):(0,h.delClonedModel)(e)))}parseNode(e){(0,h.getClonedIdModel)(e)?this.parseClonedModel(e):this.parseUnClonedModel(e)}}class ht{constructor(){this.savedMap=new A.Z}getSameCount(e){return this.savedMap.filter(((t,r)=>r.geometry.attributes.normal.count===e),"value")}setSameNode(e,t){e.geometry=t}getSameGeo(e,t){var{normal:r,position:n,uv:a}=e.attributes;for(const e of t){var{normal:i,position:s,uv:o}=e.attributes;if(r.array.length===i.array.length&&n.array.length===s.array.length&&a.array.length===o.array.length&&(i=(0,I.F1)([...r.array],[...i.array],2e3<r.length?2e3:"fill"),s=(0,I.F1)([...n.array],[...s.array],2e3<n.length?2e3:"fill"),o=(0,I.F1)([...a.array],[...o.array],2e3<a.length?2e3:"fill"),i&&s&&o))return e}}parseNode(e){if(e&&e.geometry&&e.geometry.attributes&&e.geometry.attributes.normal&&e.geometry.attributes.position&&e.geometry.attributes.uv&&!this.savedMap.get(e.geometry.uuid)){var t=e.geometry,r=(r=t.attributes.normal).count;const a=this.getSameCount(r);if(a){var n=this.getSameGeo(t,a.map((e=>e.geometry)));if(n)return this.setSameNode(e,n)}this.savedMap.set(t.uuid,{count:r,geometry:t})}}}class dt{constructor(){this.optionsConfigs={}}getParse(e){return this.optionsConfigs[e]}addOption(e){var t=e.type;if(this.optionsConfigs[t])throw TypeError("该配置项已被挂载");this.optionsConfigs[t]=e}getOptions(e){return Object.values(this.optionsConfigs).map((t=>{const{process:r,type:n}=t;return{type:n,data:r(e)}}))}}class pt{constructor(e){this.helperModels=[],this.mergeSameGeo=new ht;var{type:e,runScene:t,model:r}=e;this.runScene=t,this.type=e,this.bindClondId=new ut(t),this.ex={materialMap:{},textureMap:{},type:e},this.before=new ct({helper:this,type:e,runScene:t}),this.before.parse(r)}parseNode(e){let{object:t,nodeDef:r}=e;return this.mergeSameGeo.parseNode(t),this.bindClondId.parseNode(t),(0,i.mapObj)(this.runScene.modelEx.defNodeMap,((e,n)=>{t[e]!==n&&(r[e]=t[e])})),t.material&&t.material.wireframe&&(t.material.wireframe=!1,r.wireframe=!0),t}parseMaterial(e){const{material:t,materialDef:r}=e;r.id=t.userData.id,this.ex.materialMap[t.userData.id]||(this.ex.materialMap[t.userData.id]={normal:{},textures:{}}),this.ex.materialMap[t.userData.id].normal=Object.assign(Object.assign({},this.ex.materialMap[t.userData.id].normal),this.runScene.materialEx.getDefNromals(t))}parseTexture(e){const{texture:t,textureDef:r}=e;var{notCompress:e,minFilter:n}=t.userData,{width:e,height:n}=(e&&(r.notCompress=!0),r.unDelAble=t.userData.unDelAble,r.unDelAbleRef=t.userData.unDelAbleRef,r.uvScript=t.userData.uvScript,r.md5=t.userData.md5,r.id=t.userData.id,r.isHdr=t.userData.isHdr,n&&(r.minFilter=n),(0,it.isClonedTexture)(t)&&(r.cloneSourceId=(0,it.getCloneIdFromTexture)(t)),r.format=t.userData.format,(0,it.getSizeByTexture)(t));r.size={w:e,h:n}}getNodeMapValueWithBone(e,t){for(const r of t.keys())if(r.userData.id===e.userData.id)return t.get(r)}done(e){e.asset.ex=this.ex,this.runScene.optionsEx.log([e,"json"]),this.runScene.cb.exporter.gltf.complete.cb({json:e})}}var ft=function(e,t,r,n){return new(r=r||Promise)((function(a,i){function s(e){try{l(n.next(e))}catch(e){i(e)}}function o(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?a(e.value):((t=e.value)instanceof r?t:new r((function(e){e(t)}))).then(s,o)}l((n=n.apply(e,t||[])).next())}))};class mt extends o{constructor(e){super(e),this._gltf=new q,this._originGltf=new Re,this.options=new dt,this.module=new at(e)}getArrayBuffer(e=this.runScene.sceneEx.getClear(),t){return ft(this,void 0,void 0,(function*(){const r=new pt({type:t,runScene:this.runScene,model:e});return new Promise((t=>{this._gltf.parse(e,(e=>{t(e)}),(e=>{console.log(e,"e")}),{binary:!0,onlyVisible:!1,includeCustomExtensions:!0,myOptions:{helper:r,optionsEx:this.runScene.optionsEx}})}))}))}getOriginArrayBuffer(e){return ft(this,void 0,void 0,(function*(){return new Promise((t=>{this._originGltf.parse(e,(e=>{t(e)}),(()=>{}),{binary:!0,onlyVisible:!1,includeCustomExtensions:!0,animations:[...e.animations]})}))}))}model(e,t=!0){return ft(this,void 0,void 0,(function*(){let r=e||this.runScene.modelEx.select,n=[];if(0!==(n=r?[r]:this.runScene.multipSelector.getSelectedList("value")).length){var a=(r=n[0]).name||r.type;const e=new s.Group;e.name="models",h.uselessGroup.set(e,!0),n.map((t=>e.add(this.runScene.modelEx.clone(t,!1))));var o=yield this.getArrayBuffer(e,"model");return t&&(0,i.downloadFile)(new Blob([o]),a+".glb"),o}}))}material(e){var t;return ft(this,void 0,void 0,(function*(){if(r=e||(null==(t=this.runScene.modelEx.select)?void 0:t.material)){const e=(0,h.createDefModel)("Group");let t=r;(t=r instanceof Array?t:[r]).map((t=>{const r=(0,h.createDefModel)("Box");r.material=t,e.add(r)}));var r=r.name||"material",n=yield this.getArrayBuffer(e,"material");(0,i.downloadFile)(new Blob([n]),r+".glb")}}))}scene(e=!0,t="scene"){return ft(this,void 0,void 0,(function*(){this.runScene.cb.exporter.gltf.before.cb(null);var r=yield this.getArrayBuffer(this.runScene.sceneEx.getClear(),t);return e&&(0,i.downloadFile)(new Blob([r]),"scene.glb"),r}))}originModel(e){return ft(this,void 0,void 0,(function*(){var t,r;e&&(t=e.name||e.type,r=yield this.getOriginArrayBuffer(e),(0,i.downloadFile)(new Blob([r]),t+".glb"))}))}}class gt extends o{constructor(e){super(e),this.gltf=new mt(e)}}n=function(e){return URL.createObjectURL(new Blob([e],{type:"text/javascript"}))};try{URL.revokeObjectURL(n(""))}catch(r){n=function(e){return"data:application/javascript;charset=UTF-8,"+encodeURI(e)}}for(var vt=Uint8Array,bt=Uint16Array,yt=Uint32Array,xt=new vt([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),wt=new vt([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),St=new vt([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Mt=(te=function(e,t){for(var r=new bt(31),n=0;n<31;++n)r[n]=t+=1<<e[n-1];var a=new yt(r[30]);for(n=1;n<30;++n)for(var i=r[n];i<r[n+1];++i)a[i]=i-r[n]<<5|n;return[r,a]},(ee=te(xt,2))[0]),Tt=($=ee[1],(Mt[28]=258,$[258]=28,J=te(wt,0))[0]),_t=(J[1],new bt(32768)),Et=0;Et<32768;++Et){var kt=(43690&Et)>>>1|(21845&Et)<<1;_t[Et]=((65280&(kt=(61680&(kt=(52428&kt)>>>2|(13107&kt)<<2))>>>4|(3855&kt)<<4))>>>8|(255&kt)<<8)>>>1}var Dt=function(e,t,r){for(var n=e.length,a=0,i=new bt(t);a<n;++a)++i[e[a]-1];var s=new bt(t);for(a=0;a<t;++a)s[a]=s[a-1]+i[a-1]<<1;if(r){var o=new bt(1<<t),l=15-t;for(a=0;a<n;++a)if(e[a])for(var c=a<<4|e[a],u=t-e[a],h=s[e[a]-1]++<<u,d=h|(1<<u)-1;h<=d;++h)o[_t[h]>>>l]=c}else for(o=new bt(n),a=0;a<n;++a)e[a]&&(o[a]=_t[s[e[a]-1]++]>>>15-e[a]);return o},Ot=new vt(288);for(Et=0;Et<144;++Et)Ot[Et]=8;for(Et=144;Et<256;++Et)Ot[Et]=9;for(Et=256;Et<280;++Et)Ot[Et]=7;for(Et=280;Et<288;++Et)Ot[Et]=8;var Pt=new vt(32);for(Et=0;Et<32;++Et)Pt[Et]=5;var At=Dt(Ot,9,1),Ct=Dt(Pt,5,1),Rt=function(e){for(var t=e[0],r=1;r<e.length;++r)e[r]>t&&(t=e[r]);return t},Lt=function(e,t,r){var n=t/8|0;return(e[n]|e[1+n]<<8)>>(7&t)&r},It=function(e,t){var r=t/8|0;return(e[r]|e[1+r]<<8|e[2+r]<<16)>>(7&t)},Bt=function(e){return(e/8|0)+(7&e&&1)},jt=function(e,t,r){(null==r||r>e.length)&&(r=e.length);var n=new(e instanceof bt?bt:e instanceof yt?yt:vt)(r-(t=null==t||t<0?0:t));return n.set(e.subarray(t,r)),n};re=new vt(0),ne="undefined"!=typeof TextDecoder&&new TextDecoder;try{ne.decode(re,{stream:!0})}catch(r){}function Ut(e,t,r){var n=r.length-e-1;if(t>=r[n])return n-1;if(t<=r[e])return e;for(var a=e,i=n,s=Math.floor((a+i)/2);t<r[s]||t>=r[s+1];)t<r[s]?i=s:a=s,s=Math.floor((a+i)/2);return s}function Nt(e,t,r,n){for(var a=[],i=[],s=[],o=a[0]=1;o<=r;++o){i[o]=t-n[e+1-o],s[o]=n[e+o]-t;for(var l=0,c=0;c<o;++c){var u=s[c+1],h=i[o-c],d=a[c]/(u+h);a[c]=l+u*d,l=h*d}a[o]=l}return a}function Ft(e,t,r,n,a){for(var i=a<e?a:e,o=[],l=Ut(e,n,t),c=function(e,t,r,n,a){for(var i=[],s=0;s<=r;++s)i[s]=0;for(var o=[],l=0;l<=n;++l)o[l]=i.slice(0);for(var c=[],u=0;u<=r;++u)c[u]=i.slice(0);c[0][0]=1;for(var h=i.slice(0),d=i.slice(0),p=1;p<=r;++p){h[p]=t-a[e+1-p],d[p]=a[e+p]-t;for(var f=0,m=0;m<p;++m){var g=d[m+1],v=h[p-m],b=(c[p][m]=g+v,c[m][p-1]/c[p][m]);c[m][p]=f+g*b,f=v*b}c[p][p]=f}for(var y=0;y<=r;++y)o[0][y]=c[y][r];for(var x=0;x<=r;++x){for(var w=0,S=1,M=[],T=0;T<=r;++T)M[T]=i.slice(0);for(var _=M[0][0]=1;_<=n;++_){var E=0,k=x-_,D=r-_;_<=x&&(M[S][0]=M[w][0]/c[1+D][k],E=M[S][0]*c[k][D]);for(var O=x-1<=D?_-1:r-x,P=-1<=k?1:-k;P<=O;++P)M[S][P]=(M[w][P]-M[w][P-1])/c[1+D][k+P],E+=M[S][P]*c[k+P][D];x<=D&&(M[S][_]=-M[w][_-1]/c[1+D][x],E+=M[S][_]*c[x][D]),o[_][x]=E;var A=w;w=S,S=A}}for(var C=r,R=1;R<=n;++R){for(var L=0;L<=r;++L)o[R][L]*=C;C*=r-R}return o}(l,n,e,i,t),u=[],h=0;h<r.length;++h){var d=r[h].clone(),p=d.w;d.x*=p,d.y*=p,d.z*=p,u[h]=d}for(var f=0;f<=i;++f){for(var m=u[l-e].clone().multiplyScalar(c[f][0]),g=1;g<=e;++g)m.add(u[l-e+g].clone().multiplyScalar(c[f][g]));o[f]=m}for(var v=i+1;v<=a+1;++v)o[v]=new s.Vector4(0,0,0);return o}function zt(e){for(var t=e.length,r=[],n=[],a=0;a<t;++a){var i=e[a];r[a]=new s.Vector3(i.x,i.y,i.z),n[a]=i.w}for(var o=[],l=0;l<t;++l){for(var c=r[l].clone(),u=1;u<=l;++u)c.sub(o[l-u].clone().multiplyScalar(function(e,t){for(var r=1,n=2;n<=e;++n)r*=n;for(var a=1,i=2;i<=t;++i)a*=i;for(var s=2;s<=e-t;++s)a*=s;return r/a}(l,u)*n[u]));o[l]=c.divideScalar(n[0])}return o}function Vt(e){return(Vt="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})(e)}function Gt(e,t){return(Gt=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Ht(e){return(Ht=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Wt,Kt,qt,Zt=function(e){var t=n;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Gt(t,e);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Ht(e);if(r=t?(r=Ht(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===Vt(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(e,t,a,i,o){var l;if(!(this instanceof n))throw new TypeError("Cannot call a class as a function");(l=r.call(this)).degree=e,l.knots=t,l.controlPoints=[],l.startKnot=i||0,l.endKnot=o||l.knots.length-1;for(var c=0;c<a.length;++c){var u=a[c];l.controlPoints[c]=new s.Vector4(u.x,u.y,u.z,u.w)}return l}return t=n,(e=[{key:"getPoint",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new s.Vector3;return e=this.knots[this.startKnot]+e*(this.knots[this.endKnot]-this.knots[this.startKnot]),e=function(e,t,r,n){for(var a=Ut(e,n,t),i=Nt(a,n,e,t),o=new s.Vector4(0,0,0,0),l=0;l<=e;++l){var c=r[a-e+l],u=i[l],h=c.w*u;o.x+=c.x*h,o.y+=c.y*h,o.z+=c.z*h,o.w+=c.w*u}return o}(this.degree,this.knots,this.controlPoints,e),1!==e.w&&e.divideScalar(e.w),t.set(e.x,e.y,e.z)}},{key:"getTangent",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new s.Vector3,r=(e=this.knots[0]+e*(this.knots[this.knots.length-1]-this.knots[0]),zt(Ft(r=this.degree,this.knots,this.controlPoints,e,1)));return t.copy(r[1]).normalize(),t}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),n}(s.Curve);function Xt(e){return(Xt="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})(e)}function Qt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Yt(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Jt(e,t,r){t&&Yt(e.prototype,t),r&&Yt(e,r),Object.defineProperty(e,"prototype",{writable:!1})}function $t(e,t){return($t=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function er(e){return(er=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var tr=function(e){var t=n;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&$t(t,e);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=er(e);if(r=t?(r=er(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===Xt(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(e){return Qt(this,n),r.call(this,e)}return Jt(n,[{key:"load",value:function(e,t,r,n){var a=this,i=""===a.path?s.LoaderUtils.extractUrlBase(e):a.path,o=new s.FileLoader(this.manager);o.setPath(a.path),o.setResponseType("arraybuffer"),o.setRequestHeader(a.requestHeader),o.setWithCredentials(a.withCredentials),o.load(e,(function(r){try{t(a.parse(r,i))}catch(r){n?n(r):console.error(r),a.manager.itemError(e)}}),r,n)}},{key:"parse",value:function(e,t){if(n="Kaydara FBX Binary \0",(r=e).byteLength>=n.length&&n===br(r,0,n.length))Wt=(new sr).parse(e);else{if(!function(e){for(var t=["K","a","y","d","a","r","a","\\","F","B","X","\\","B","i","n","a","r","y","\\","\\"],r=0,n=0;n<t.length;++n)if(function(t){var n=e[0];return e=e.slice(r+1),r++,n}()===t[n])return;return 1}(r=br(e)))throw new Error("THREE.FBXLoader: Unknown format.");if(cr(r)<7e3)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+cr(r));Wt=(new ir).parse(r)}var r,n=new s.TextureLoader(this.manager).setPath(this.resourcePath||t).setCrossOrigin(this.crossOrigin);return new rr(n,this.manager).parse(Wt)}}]),n}(s.Loader),rr=function(){function e(t,r){Qt(this,e),this.textureLoader=t,this.manager=r}return Jt(e,[{key:"parse",value:function(){Kt=this.parseConnections();var e=this.parseImages(),t=(e=this.parseTextures(e),e=this.parseMaterials(e),this.parseDeformers()),r=(new nr).parse(t);return this.parseScene(t,r,e),qt}},{key:"parseConnections",value:function(){var e=new Map;return"Connections"in Wt&&Wt.Connections.connections.forEach((function(t){var r=t[0],n=t[1],a=(t=t[2],e.has(r)||e.set(r,{parents:[],children:[]}),{ID:n,relationship:t});e.get(r).parents.push(a),e.has(n)||e.set(n,{parents:[],children:[]}),a={ID:r,relationship:t},e.get(n).children.push(a)})),e}},{key:"parseImages",value:function(){var e,t={},r={};if("Video"in Wt.Objects){var n,a=Wt.Objects.Video;for(n in a){var i,s,o=a[n];t[parseInt(n)]=o.RelativeFilename||o.Filename,"Content"in o&&(s=o.Content instanceof ArrayBuffer&&0<o.Content.byteLength,i="string"==typeof o.Content&&""!==o.Content,(s||i)&&(s=this.parseImage(a[n]),r[o.RelativeFilename||o.Filename]=s))}}for(e in t){var l=t[e];void 0!==r[l]?t[e]=r[l]:t[e]=t[e].split("\\").pop()}return t}},{key:"parseImage",value:function(e){var t,r=e.Content,n=e.RelativeFilename||e.Filename,a=n.slice(n.lastIndexOf(".")+1).toLowerCase();switch(a){case"bmp":t="image/bmp";break;case"jpg":case"jpeg":t="image/jpeg";break;case"png":t="image/png";break;case"tif":t="image/tiff";break;case"tga":null===this.manager.getHandler(".tga")&&console.warn("FBXLoader: TGA loader not found, skipping ",n),t="image/tga";break;default:return void console.warn('FBXLoader: Image type "'+a+'" is not supported.')}return"string"==typeof r?"data:"+t+";base64,"+r:(e=new Uint8Array(r),window.URL.createObjectURL(new Blob([e],{type:t})))}},{key:"parseTextures",value:function(e){var t=new Map;if("Texture"in Wt.Objects){var r,n=Wt.Objects.Texture;for(r in n){var a=this.parseTexture(n[r],e);t.set(parseInt(r),a)}}return t}},{key:"parseTexture",value:function(e,t){var r=((t=this.loadTexture(e,t)).ID=e.id,t.name=e.attrName,e.WrapModeU),n=e.WrapModeV;return r=void 0!==r?r.value:0,n=void 0!==n?n.value:0,t.wrapS=0===r?s.RepeatWrapping:s.ClampToEdgeWrapping,t.wrapT=0===n?s.RepeatWrapping:s.ClampToEdgeWrapping,"Scaling"in e&&(r=e.Scaling.value,t.repeat.x=r[0],t.repeat.y=r[1]),"Translation"in e&&(n=e.Translation.value,t.offset.x=n[0],t.offset.y=n[1]),t}},{key:"loadTexture",value:function(e,t){var r,n=this.textureLoader.path,a=Kt.get(e.id).children;return a="tga"===(void 0!==a&&0<a.length&&void 0!==t[a[0].ID]&&(0!==(r=t[a[0].ID]).indexOf("blob:")&&0!==r.indexOf("data:")||this.textureLoader.setPath(void 0)),t=e.FileName.slice(-3).toLowerCase())?null===(a=this.manager.getHandler(".tga"))?(console.warn("FBXLoader: TGA loader not found, creating placeholder texture for",e.RelativeFilename),new s.Texture):(a.setPath(this.textureLoader.path),a.load(r)):"psd"===t?(console.warn("FBXLoader: PSD textures are not supported, creating placeholder texture for",e.RelativeFilename),new s.Texture):this.textureLoader.load(r),this.textureLoader.setPath(n),a}},{key:"parseMaterials",value:function(e){var t=new Map;if("Material"in Wt.Objects){var r,n=Wt.Objects.Material;for(r in n){var a=this.parseMaterial(n[r],e);null!==a&&t.set(parseInt(r),a)}}return t}},{key:"parseMaterial",value:function(e,t){var r,n=e.id,a=e.attrName,i=e.ShadingModel;if("object"===Xt(i)&&(i=i.value),!Kt.has(n))return null;switch(e=this.parseParameters(e,t,n),i.toLowerCase()){case"phong":r=new s.MeshPhongMaterial;break;case"lambert":r=new s.MeshLambertMaterial;break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.',i),r=new s.MeshPhongMaterial}return r.setValues(e),r.name=a,r}},{key:"parseParameters",value:function(e,t,r){var n={},a=(e.BumpFactor&&(n.bumpScale=e.BumpFactor.value),e.Diffuse?n.color=(new s.Color).fromArray(e.Diffuse.value):!e.DiffuseColor||"Color"!==e.DiffuseColor.type&&"ColorRGB"!==e.DiffuseColor.type||(n.color=(new s.Color).fromArray(e.DiffuseColor.value)),e.DisplacementFactor&&(n.displacementScale=e.DisplacementFactor.value),e.Emissive?n.emissive=(new s.Color).fromArray(e.Emissive.value):!e.EmissiveColor||"Color"!==e.EmissiveColor.type&&"ColorRGB"!==e.EmissiveColor.type||(n.emissive=(new s.Color).fromArray(e.EmissiveColor.value)),e.EmissiveFactor&&(n.emissiveIntensity=parseFloat(e.EmissiveFactor.value)),e.Opacity&&(n.opacity=parseFloat(e.Opacity.value)),n.opacity<1&&(n.transparent=!0),e.ReflectionFactor&&(n.reflectivity=e.ReflectionFactor.value),e.Shininess&&(n.shininess=e.Shininess.value),e.Specular?n.specular=(new s.Color).fromArray(e.Specular.value):e.SpecularColor&&"Color"===e.SpecularColor.type&&(n.specular=(new s.Color).fromArray(e.SpecularColor.value)),this);return Kt.get(r).children.forEach((function(e){var r=e.relationship;switch(r){case"Bump":n.bumpMap=a.getTexture(t,e.ID);break;case"Maya|TEX_ao_map":n.aoMap=a.getTexture(t,e.ID);break;case"DiffuseColor":case"Maya|TEX_color_map":n.map=a.getTexture(t,e.ID),void 0!==n.map&&(n.map.encoding=s.sRGBEncoding);break;case"DisplacementColor":n.displacementMap=a.getTexture(t,e.ID);break;case"EmissiveColor":n.emissiveMap=a.getTexture(t,e.ID),void 0!==n.emissiveMap&&(n.emissiveMap.encoding=s.sRGBEncoding);break;case"NormalMap":case"Maya|TEX_normal_map":n.normalMap=a.getTexture(t,e.ID);break;case"ReflectionColor":n.envMap=a.getTexture(t,e.ID),void 0!==n.envMap&&(n.envMap.mapping=s.EquirectangularReflectionMapping,n.envMap.encoding=s.sRGBEncoding);break;case"SpecularColor":n.specularMap=a.getTexture(t,e.ID),void 0!==n.specularMap&&(n.specularMap.encoding=s.sRGBEncoding);break;case"TransparentColor":case"TransparencyFactor":n.alphaMap=a.getTexture(t,e.ID),n.transparent=!0;break;default:console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.",r)}})),n}},{key:"getTexture",value:function(e,t){return"LayeredTexture"in Wt.Objects&&t in Wt.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),t=Kt.get(t).children[0].ID),e.get(t)}},{key:"parseDeformers",value:function(){var e={},t={};if("Deformer"in Wt.Objects){var r,n=Wt.Objects.Deformer;for(r in n){var a,i=n[r],s=Kt.get(parseInt(r));"Skin"===i.attrType?((a=this.parseSkeleton(s,n)).ID=r,1<s.parents.length&&console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."),a.geometryID=s.parents[0].ID,e[r]=a):"BlendShape"===i.attrType&&((a={id:r}).rawTargets=this.parseMorphTargets(s,n),a.id=r,1<s.parents.length&&console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),t[r]=a)}}return{skeletons:e,morphTargets:t}}},{key:"parseSkeleton",value:function(e,t){var r=[];return e.children.forEach((function(e){var n=t[e.ID];"Cluster"===n.attrType&&(e={ID:e.ID,indices:[],weights:[],transformLink:(new s.Matrix4).fromArray(n.TransformLink.a)},"Indexes"in n&&(e.indices=n.Indexes.a,e.weights=n.Weights.a),r.push(e))})),{rawBones:r,bones:[]}}},{key:"parseMorphTargets",value:function(e,t){for(var r=[],n=0;n<e.children.length;n++){var a=e.children[n],i=t[a.ID],s={name:i.attrName,initialWeight:i.DeformPercent,id:i.id,fullWeights:i.FullWeights.a};if("BlendShapeChannel"!==i.attrType)return;s.geoID=Kt.get(parseInt(a.ID)).children.filter((function(e){return void 0===e.relationship}))[0].ID,r.push(s)}return r}},{key:"parseScene",value:function(e,t,r){qt=new s.Group;var n=this.parseModels(e.skeletons,t,r),a=Wt.Objects.Model,i=this;n.forEach((function(e){var t=a[e.ID];i.setLookAtProperties(e,t),Kt.get(e.ID).parents.forEach((function(t){void 0!==(t=n.get(t.ID))&&t.add(e)})),null===e.parent&&qt.add(e)})),this.bindSkeleton(e.skeletons,t,n),this.createAmbientLight(),qt.traverse((function(e){var t;e.userData.transformData&&(e.parent&&(e.userData.transformData.parentMatrix=e.parent.matrix,e.userData.transformData.parentMatrixWorld=e.parent.matrixWorld),t=mr(e.userData.transformData),e.applyMatrix4(t),e.updateWorldMatrix())})),r=(new ar).parse(),1===qt.children.length&&qt.children[0].isGroup&&(qt.children[0].animations=r,qt=qt.children[0]),qt.animations=r}},{key:"parseModels",value:function(e,t,r){var n,a=new Map,i=Wt.Objects.Model;for(n in i){var o=parseInt(n),l=i[n],c=Kt.get(o),u=this.buildSkeleton(c,e,o,l.attrName);if(!u){switch(l.attrType){case"Camera":u=this.createCamera(c);break;case"Light":u=this.createLight(c);break;case"Mesh":u=this.createMesh(c,t,r);break;case"NurbsCurve":u=this.createCurve(c,t);break;case"LimbNode":case"Root":u=new s.Bone;break;default:u=new s.Group}u.name=l.attrName?s.PropertyBinding.sanitizeNodeName(l.attrName):"",u.ID=o}this.getTransformData(u,l),a.set(o,u)}return a}},{key:"buildSkeleton",value:function(e,t,r,n){var a=null;return e.parents.forEach((function(e){for(var i in t)!function(i){var o=t[i];o.rawBones.forEach((function(t,i){var l;t.ID===e.ID&&(l=a,(a=new s.Bone).matrixWorld.copy(t.transformLink),a.name=n?s.PropertyBinding.sanitizeNodeName(n):"",a.ID=r,o.bones[i]=a,null!==l&&a.add(l))}))}(i)})),a}},{key:"createCamera",value:function(e){var t,r;if(e.children.forEach((function(e){void 0!==(e=Wt.Objects.NodeAttribute[e.ID])&&(r=e)})),void 0===r)t=new s.Object3D;else{var n=0,a=(void 0!==r.CameraProjectionType&&1===r.CameraProjectionType.value&&(n=1),1),i=(void 0!==r.NearPlane&&(a=r.NearPlane.value/1e3),1e3),o=(void 0!==r.FarPlane&&(i=r.FarPlane.value/1e3),window.innerWidth),l=window.innerHeight,c=(void 0!==r.AspectWidth&&void 0!==r.AspectHeight&&(o=r.AspectWidth.value,l=r.AspectHeight.value),o/l),u=45,h=(void 0!==r.FieldOfView&&(u=r.FieldOfView.value),r.FocalLength?r.FocalLength.value:null);switch(n){case 0:t=new s.PerspectiveCamera(u,c,a,i),null!==h&&t.setFocalLength(h);break;case 1:t=new s.OrthographicCamera(-o/2,o/2,l/2,-l/2,a,i);break;default:console.warn("THREE.FBXLoader: Unknown camera type "+n+"."),t=new s.Object3D}}return t}},{key:"createLight",value:function(e){var t,r;if(e.children.forEach((function(e){void 0!==(e=Wt.Objects.NodeAttribute[e.ID])&&(r=e)})),void 0===r)t=new s.Object3D;else{e=void 0===r.LightType?0:r.LightType.value;var n=16777215,a=(void 0!==r.Color&&(n=(new s.Color).fromArray(r.Color.value)),void 0===r.Intensity?1:r.Intensity.value/100),i=(void 0!==r.CastLightOnObject&&0===r.CastLightOnObject.value&&(a=0),0);switch(void 0!==r.FarAttenuationEnd&&(i=void 0!==r.EnableFarAttenuation&&0===r.EnableFarAttenuation.value?0:r.FarAttenuationEnd.value),e){case 0:t=new s.PointLight(n,a,i,1);break;case 1:t=new s.DirectionalLight(n,a);break;case 2:var o=Math.PI/3,l=(void 0!==r.InnerAngle&&(o=s.MathUtils.degToRad(r.InnerAngle.value)),0);void 0!==r.OuterAngle&&(l=s.MathUtils.degToRad(r.OuterAngle.value),l=Math.max(l,1)),t=new s.SpotLight(n,a,i,o,l,1);break;default:console.warn("THREE.FBXLoader: Unknown light type "+r.LightType.value+", defaulting to a PointLight."),t=new s.PointLight(n,a)}void 0!==r.CastShadows&&1===r.CastShadows.value&&(t.castShadow=!0)}return t}},{key:"createMesh",value:function(e,t,r){var n,a=null,i=null,o=[];return e.children.forEach((function(e){t.has(e.ID)&&(a=t.get(e.ID)),r.has(e.ID)&&o.push(r.get(e.ID))})),1<o.length?i=o:0<o.length?i=o[0]:(i=new s.MeshPhongMaterial({color:13421772}),o.push(i)),"color"in a.attributes&&o.forEach((function(e){e.vertexColors=!0})),a.FBX_Deformer?(n=new s.SkinnedMesh(a,i)).normalizeSkinWeights():n=new s.Mesh(a,i),n}},{key:"createCurve",value:function(e,t){e=e.children.reduce((function(e,r){return t.has(r.ID)?t.get(r.ID):e}),null);var r=new s.LineBasicMaterial({color:3342591,linewidth:1});return new s.Line(e,r)}},{key:"getTransformData",value:function(e,t){var r={};"InheritType"in t&&(r.inheritType=parseInt(t.InheritType.value)),r.eulerOrder="RotationOrder"in t?gr(t.RotationOrder.value):"ZYX","Lcl_Translation"in t&&(r.translation=t.Lcl_Translation.value),"PreRotation"in t&&(r.preRotation=t.PreRotation.value),"Lcl_Rotation"in t&&(r.rotation=t.Lcl_Rotation.value),"PostRotation"in t&&(r.postRotation=t.PostRotation.value),"Lcl_Scaling"in t&&(r.scale=t.Lcl_Scaling.value),"ScalingOffset"in t&&(r.scalingOffset=t.ScalingOffset.value),"ScalingPivot"in t&&(r.scalingPivot=t.ScalingPivot.value),"RotationOffset"in t&&(r.rotationOffset=t.RotationOffset.value),"RotationPivot"in t&&(r.rotationPivot=t.RotationPivot.value),e.userData.transformData=r}},{key:"setLookAtProperties",value:function(e,t){"LookAtProperty"in t&&Kt.get(e.ID).children.forEach((function(t){"LookAtProperty"===t.relationship&&"Lcl_Translation"in(t=Wt.Objects.Model[t.ID])&&(t=t.Lcl_Translation.value,void 0!==e.target?(e.target.position.fromArray(t),qt.add(e.target)):e.lookAt((new s.Vector3).fromArray(t)))}))}},{key:"bindSkeleton",value:function(e,t,r){var n,a=this.parsePoseNodes();for(n in e)!function(n){var i=e[n];Kt.get(parseInt(i.ID)).parents.forEach((function(e){t.has(e.ID)&&(e=e.ID,Kt.get(e).parents.forEach((function(e){r.has(e.ID)&&r.get(e.ID).bind(new s.Skeleton(i.bones),a[e.ID])})))}))}(n)}},{key:"parsePoseNodes",value:function(){var e={};if("Pose"in Wt.Objects){var t,r,n=Wt.Objects.Pose;for(t in n)"BindPose"===n[t].attrType&&0<n[t].NbPoseNodes&&(r=n[t].PoseNode,Array.isArray(r)?r.forEach((function(t){e[t.Node]=(new s.Matrix4).fromArray(t.Matrix.a)})):e[r.Node]=(new s.Matrix4).fromArray(r.Matrix.a))}return e}},{key:"createAmbientLight",value:function(){var e,t,r;"GlobalSettings"in Wt&&"AmbientColor"in Wt.GlobalSettings&&(r=(t=Wt.GlobalSettings.AmbientColor.value)[0],e=t[1],t=t[2],0===r&&0===e&&0===t||(r=new s.Color(r,e,t),qt.add(new s.AmbientLight(r,1))))}}]),e}(),nr=function(){function e(){Qt(this,e),this.negativeMaterialIndices=!1}return Jt(e,[{key:"parse",value:function(e){var t=new Map;if("Geometry"in Wt.Objects){var r,n=Wt.Objects.Geometry;for(r in n){var a=Kt.get(parseInt(r));a=this.parseGeometry(a,n[r],e),t.set(parseInt(r),a)}}return!0===this.negativeMaterialIndices&&console.warn("THREE.FBXLoader: The FBX file contains invalid (negative) material indices. The asset might not render as expected."),t}},{key:"parseGeometry",value:function(e,t,r){switch(t.attrType){case"Mesh":return this.parseMeshGeometry(e,t,r);case"NurbsCurve":return this.parseNurbsGeometry(t)}}},{key:"parseMeshGeometry",value:function(e,t,r){var n,a=r.skeletons,i=[],s=e.parents.map((function(e){return Wt.Objects.Model[e.ID]}));if(0!==s.length)return n=e.children.reduce((function(e,t){return void 0!==a[t.ID]?a[t.ID]:e}),null),e.children.forEach((function(e){void 0!==r.morphTargets[e.ID]&&i.push(r.morphTargets[e.ID])})),e=s[0],s={},"RotationOrder"in e&&(s.eulerOrder=gr(e.RotationOrder.value)),"InheritType"in e&&(s.inheritType=parseInt(e.InheritType.value)),"GeometricTranslation"in e&&(s.translation=e.GeometricTranslation.value),"GeometricRotation"in e&&(s.rotation=e.GeometricRotation.value),"GeometricScaling"in e&&(s.scale=e.GeometricScaling.value),e=mr(s),this.genGeometry(t,n,i,e)}},{key:"genGeometry",value:function(e,t,r,n){var a,i,o=new s.BufferGeometry,l=(e.attrName&&(o.name=e.attrName),this.parseGeoNode(e,t)),c=this.genBuffers(l),u=new s.Float32BufferAttribute(c.vertex,3);return u.applyMatrix4(n),o.setAttribute("position",u),0<c.colors.length&&o.setAttribute("color",new s.Float32BufferAttribute(c.colors,3)),t&&(o.setAttribute("skinIndex",new s.Uint16BufferAttribute(c.weightsIndices,4)),o.setAttribute("skinWeight",new s.Float32BufferAttribute(c.vertexWeights,4)),o.FBX_Deformer=t),0<c.normal.length&&(u=(new s.Matrix3).getNormalMatrix(n),(t=new s.Float32BufferAttribute(c.normal,3)).applyNormalMatrix(u),o.setAttribute("normal",t)),c.uvs.forEach((function(e,t){var r="uv"+(t+1).toString();o.setAttribute(r=0===t?"uv":r,new s.Float32BufferAttribute(c.uvs[t],2))})),l.material&&"AllSame"!==l.material.mappingType&&(a=c.materialIndex[0],i=0,c.materialIndex.forEach((function(e,t){e!==a&&(o.addGroup(i,t-i,a),a=e,i=t)})),0<o.groups.length&&(t=(u=o.groups[o.groups.length-1]).start+u.count)!==c.materialIndex.length&&o.addGroup(t,c.materialIndex.length-t,a),0===o.groups.length&&o.addGroup(0,c.materialIndex.length,c.materialIndex[0])),this.addMorphTargets(o,e,r,n),o}},{key:"parseGeoNode",value:function(e,t){var r={};if(r.vertexPositions=void 0!==e.Vertices?e.Vertices.a:[],r.vertexIndices=void 0!==e.PolygonVertexIndex?e.PolygonVertexIndex.a:[],e.LayerElementColor&&(r.color=this.parseVertexColors(e.LayerElementColor[0])),e.LayerElementMaterial&&(r.material=this.parseMaterialIndices(e.LayerElementMaterial[0])),e.LayerElementNormal&&(r.normal=this.parseNormals(e.LayerElementNormal[0])),e.LayerElementUV){r.uv=[];for(var n=0;e.LayerElementUV[n];)e.LayerElementUV[n].UV&&r.uv.push(this.parseUVs(e.LayerElementUV[n])),n++}return r.weightTable={},null!==t&&(r.skeleton=t).rawBones.forEach((function(e,t){e.indices.forEach((function(n,a){void 0===r.weightTable[n]&&(r.weightTable[n]=[]),r.weightTable[n].push({id:t,weight:e.weights[a]})}))})),r}},{key:"genBuffers",value:function(e){var t={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]},r=0,n=0,a=!1,i=[],s=[],o=[],l=[],c=[],u=[],h=this;return e.vertexIndices.forEach((function(d,p){var f,m,g,v,b=!1,y=(d<0&&(d^=-1,b=!0),[]),x=[];if(i.push(3*d,3*d+1,3*d+2),e.color&&(v=dr(p,r,d,e.color),o.push(v[0],v[1],v[2])),e.skeleton){for(void 0!==e.weightTable[d]&&e.weightTable[d].forEach((function(e){x.push(e.weight),y.push(e.id)})),4<x.length&&(a||(console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."),a=!0),m=[0,0,0,0],g=[0,0,0,0],x.forEach((function(e,t){var r=e,n=y[t];g.forEach((function(e,t,a){e<r&&(a[t]=r,r=e,a=m[t],m[t]=n,n=a)}))})),y=m,x=g);x.length<4;)x.push(0),y.push(0);for(var w=0;w<4;++w)c.push(x[w]),u.push(y[w])}e.normal&&(v=dr(p,r,d,e.normal),s.push(v[0],v[1],v[2])),e.material&&"AllSame"!==e.material.mappingType&&(f=dr(p,r,d,e.material)[0])<0&&(h.negativeMaterialIndices=!0,f=0),e.uv&&e.uv.forEach((function(e,t){e=dr(p,r,d,e),void 0===l[t]&&(l[t]=[]),l[t].push(e[0]),l[t].push(e[1])})),n++,b&&(4<n&&console.warn("THREE.FBXLoader: Polygons with more than four sides are not supported. Make sure to triangulate the geometry during export."),h.genFace(t,e,i,f,s,o,l,c,u,n),r++,n=0,i=[],s=[],o=[],l=[],c=[],u=[])})),t}},{key:"genFace",value:function(e,t,r,n,a,i,s,o,l,c){for(var u=2;u<c;u++)!function(c){e.vertex.push(t.vertexPositions[r[0]]),e.vertex.push(t.vertexPositions[r[1]]),e.vertex.push(t.vertexPositions[r[2]]),e.vertex.push(t.vertexPositions[r[3*(c-1)]]),e.vertex.push(t.vertexPositions[r[3*(c-1)+1]]),e.vertex.push(t.vertexPositions[r[3*(c-1)+2]]),e.vertex.push(t.vertexPositions[r[3*c]]),e.vertex.push(t.vertexPositions[r[3*c+1]]),e.vertex.push(t.vertexPositions[r[3*c+2]]),t.skeleton&&(e.vertexWeights.push(o[0]),e.vertexWeights.push(o[1]),e.vertexWeights.push(o[2]),e.vertexWeights.push(o[3]),e.vertexWeights.push(o[4*(c-1)]),e.vertexWeights.push(o[4*(c-1)+1]),e.vertexWeights.push(o[4*(c-1)+2]),e.vertexWeights.push(o[4*(c-1)+3]),e.vertexWeights.push(o[4*c]),e.vertexWeights.push(o[4*c+1]),e.vertexWeights.push(o[4*c+2]),e.vertexWeights.push(o[4*c+3]),e.weightsIndices.push(l[0]),e.weightsIndices.push(l[1]),e.weightsIndices.push(l[2]),e.weightsIndices.push(l[3]),e.weightsIndices.push(l[4*(c-1)]),e.weightsIndices.push(l[4*(c-1)+1]),e.weightsIndices.push(l[4*(c-1)+2]),e.weightsIndices.push(l[4*(c-1)+3]),e.weightsIndices.push(l[4*c]),e.weightsIndices.push(l[4*c+1]),e.weightsIndices.push(l[4*c+2]),e.weightsIndices.push(l[4*c+3])),t.color&&(e.colors.push(i[0]),e.colors.push(i[1]),e.colors.push(i[2]),e.colors.push(i[3*(c-1)]),e.colors.push(i[3*(c-1)+1]),e.colors.push(i[3*(c-1)+2]),e.colors.push(i[3*c]),e.colors.push(i[3*c+1]),e.colors.push(i[3*c+2])),t.material&&"AllSame"!==t.material.mappingType&&(e.materialIndex.push(n),e.materialIndex.push(n),e.materialIndex.push(n)),t.normal&&(e.normal.push(a[0]),e.normal.push(a[1]),e.normal.push(a[2]),e.normal.push(a[3*(c-1)]),e.normal.push(a[3*(c-1)+1]),e.normal.push(a[3*(c-1)+2]),e.normal.push(a[3*c]),e.normal.push(a[3*c+1]),e.normal.push(a[3*c+2])),t.uv&&t.uv.forEach((function(t,r){void 0===e.uvs[r]&&(e.uvs[r]=[]),e.uvs[r].push(s[r][0]),e.uvs[r].push(s[r][1]),e.uvs[r].push(s[r][2*(c-1)]),e.uvs[r].push(s[r][2*(c-1)+1]),e.uvs[r].push(s[r][2*c]),e.uvs[r].push(s[r][2*c+1])}))}(u)}},{key:"addMorphTargets",value:function(e,t,r,n){var a;0!==r.length&&(e.morphTargetsRelative=!0,e.morphAttributes.position=[],a=this,r.forEach((function(r){r.rawTargets.forEach((function(r){var i=Wt.Objects.Geometry[r.geoID];void 0!==i&&a.genMorphGeometry(e,t,i,n,r.name)}))})))}},{key:"genMorphGeometry",value:function(e,t,r,n,a){t=void 0!==t.PolygonVertexIndex?t.PolygonVertexIndex.a:[];for(var i=void 0!==r.Vertices?r.Vertices.a:[],o=void 0!==r.Indexes?r.Indexes.a:[],l=3*e.attributes.position.count,c=new Float32Array(l),u=0;u<o.length;u++){var h=3*o[u];c[h]=i[3*u],c[1+h]=i[3*u+1],c[2+h]=i[3*u+2]}l=this.genBuffers({vertexIndices:t,vertexPositions:c}),(t=new s.Float32BufferAttribute(l.vertex,3)).name=a||r.attrName,t.applyMatrix4(n),e.morphAttributes.position.push(t)}},{key:"parseNormals",value:function(e){var t=e.MappingInformationType,r=e.ReferenceInformationType,n=e.Normals.a,a=[];return"IndexToDirect"===r&&("NormalIndex"in e?a=e.NormalIndex.a:"NormalsIndex"in e&&(a=e.NormalsIndex.a)),{dataSize:3,buffer:n,indices:a,mappingType:t,referenceType:r}}},{key:"parseUVs",value:function(e){var t=e.MappingInformationType,r=e.ReferenceInformationType,n=[];return{dataSize:2,buffer:e.UV.a,indices:n="IndexToDirect"===r?e.UVIndex.a:n,mappingType:t,referenceType:r}}},{key:"parseVertexColors",value:function(e){var t=e.MappingInformationType,r=e.ReferenceInformationType,n=[];return{dataSize:4,buffer:e.Colors.a,indices:n="IndexToDirect"===r?e.ColorIndex.a:n,mappingType:t,referenceType:r}}},{key:"parseMaterialIndices",value:function(e){var t=e.MappingInformationType,r=e.ReferenceInformationType;if("NoMappingInformation"===t)return{dataSize:1,buffer:[0],indices:[0],mappingType:"AllSame",referenceType:r};for(var n=e.Materials.a,a=[],i=0;i<n.length;++i)a.push(i);return{dataSize:1,buffer:n,indices:a,mappingType:t,referenceType:r}}},{key:"parseNurbsGeometry",value:function(e){var t=parseInt(e.Order);if(isNaN(t))return console.error("THREE.FBXLoader: Invalid Order %s given for geometry ID: %s",e.Order,e.id),new s.BufferGeometry;for(var r=t-1,n=(t=e.KnotVector.a,[]),a=e.Points.a,i=0,o=a.length;i<o;i+=4)n.push((new s.Vector4).fromArray(a,i));if("Closed"===e.Form)n.push(n[0]);else if("Periodic"===e.Form)for(var l=r,c=t.length-1-l,u=0;u<r;++u)n.push(n[u]);return e=new Zt(r,t,n,l,c).getPoints(12*n.length),(new s.BufferGeometry).setFromPoints(e)}}]),e}(),ar=function(){function e(){Qt(this,e)}return Jt(e,[{key:"parse",value:function(){var e=[],t=this.parseClips();if(void 0!==t)for(var r in t)r=t[r],r=this.addClip(r),e.push(r);return e}},{key:"parseClips",value:function(){var e;if(void 0!==Wt.Objects.AnimationCurve)return e=this.parseAnimationCurveNodes(),this.parseAnimationCurves(e),e=this.parseAnimationLayers(e),this.parseAnimStacks(e)}},{key:"parseAnimationCurveNodes",value:function(){var e,t=Wt.Objects.AnimationCurveNode,r=new Map;for(e in t){var n=t[e];null!==n.attrName.match(/S|R|T|DeformPercent/)&&(n={id:n.id,attr:n.attrName,curves:{}},r.set(n.id,n))}return r}},{key:"parseAnimationCurves",value:function(e){var t,r=Wt.Objects.AnimationCurve;for(t in r){var n,a={id:r[t].id,times:r[t].KeyTime.a.map(ur),values:r[t].KeyValueFloat.a},i=Kt.get(a.id);void 0!==i&&(n=i.parents[0].ID,(i=i.parents[0].relationship).match(/X/)?e.get(n).curves.x=a:i.match(/Y/)?e.get(n).curves.y=a:i.match(/Z/)?e.get(n).curves.z=a:i.match(/d|DeformPercent/)&&e.has(n)&&(e.get(n).curves.morph=a))}}},{key:"parseAnimationLayers",value:function(e){var t,r=Wt.Objects.AnimationLayer,n=new Map;for(t in r)!function(t){var r=[],a=Kt.get(parseInt(t));void 0!==a&&(a.children.forEach((function(t,n){if(e.has(t.ID)){var a=e.get(t.ID);if(void 0!==a.curves.x||void 0!==a.curves.y||void 0!==a.curves.z){if(void 0===r[n]){var i=Kt.get(t.ID).parents.filter((function(e){return void 0!==e.relationship}))[0].ID;if(void 0!==i){var o=Wt.Objects.Model[i.toString()];if(void 0===o)return void console.warn("THREE.FBXLoader: Encountered a unused curve.",t);var l={modelName:o.attrName?s.PropertyBinding.sanitizeNodeName(o.attrName):"",ID:o.id,initialPosition:[0,0,0],initialRotation:[0,0,0],initialScale:[1,1,1]};qt.traverse((function(e){e.ID===o.id&&(l.transform=e.matrix,e.userData.transformData&&(l.eulerOrder=e.userData.transformData.eulerOrder))})),l.transform||(l.transform=new s.Matrix4),"PreRotation"in o&&(l.preRotation=o.PreRotation.value),"PostRotation"in o&&(l.postRotation=o.PostRotation.value),r[n]=l}}r[n]&&(r[n][a.attr]=a)}else void 0!==a.curves.morph&&(void 0===r[n]&&(i=Kt.get(t.ID).parents.filter((function(e){return void 0!==e.relationship}))[0].ID,t=Kt.get(i).parents[0].ID,t=Kt.get(t).parents[0].ID,t=Kt.get(t).parents[0].ID,t={modelName:(t=Wt.Objects.Model[t]).attrName?s.PropertyBinding.sanitizeNodeName(t.attrName):"",morphName:Wt.Objects.Deformer[i].attrName},r[n]=t),r[n][a.attr]=a)}})),n.set(parseInt(t),r))}(t);return n}},{key:"parseAnimStacks",value:function(e){var t,r=Wt.Objects.AnimationStack,n={};for(t in r){var a=(1<(a=Kt.get(parseInt(t)).children).length&&console.warn("THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers."),e.get(a[0].ID));n[t]={name:r[t].attrName,layer:a}}return n}},{key:"addClip",value:function(e){var t=[],r=this;return e.layer.forEach((function(e){t=t.concat(r.generateTracks(e))})),new s.AnimationClip(e.name,-1,t)}},{key:"generateTracks",value:function(e){var t=[],r=new s.Vector3,n=new s.Quaternion,a=new s.Vector3;return e.transform&&e.transform.decompose(r,n,a),r=r.toArray(),n=(new s.Euler).setFromQuaternion(n,e.eulerOrder).toArray(),a=a.toArray(),void 0!==e.T&&0<Object.keys(e.T.curves).length&&void 0!==(r=this.generateVectorTrack(e.modelName,e.T.curves,r,"position"))&&t.push(r),void 0!==e.R&&0<Object.keys(e.R.curves).length&&void 0!==(r=this.generateRotationTrack(e.modelName,e.R.curves,n,e.preRotation,e.postRotation,e.eulerOrder))&&t.push(r),void 0!==e.S&&0<Object.keys(e.S.curves).length&&void 0!==(n=this.generateVectorTrack(e.modelName,e.S.curves,a,"scale"))&&t.push(n),void 0!==e.DeformPercent&&void 0!==(r=this.generateMorphTrack(e))&&t.push(r),t}},{key:"generateVectorTrack",value:function(e,t,r,n){var a=this.getTimesForAllAxes(t);return t=this.getKeyframeTrackValues(a,t,r),new s.VectorKeyframeTrack(e+"."+n,a,t)}},{key:"generateRotationTrack",value:function(e,t,r,n,a,i){void 0!==t.x&&(this.interpolateRotations(t.x),t.x.values=t.x.values.map(s.MathUtils.degToRad)),void 0!==t.y&&(this.interpolateRotations(t.y),t.y.values=t.y.values.map(s.MathUtils.degToRad)),void 0!==t.z&&(this.interpolateRotations(t.z),t.z.values=t.z.values.map(s.MathUtils.degToRad));for(var o=this.getTimesForAllAxes(t),l=this.getKeyframeTrackValues(o,t,r),c=(void 0!==n&&((n=n.map(s.MathUtils.degToRad)).push(i),n=(new s.Euler).fromArray(n),n=(new s.Quaternion).setFromEuler(n)),void 0!==a&&((a=a.map(s.MathUtils.degToRad)).push(i),a=(new s.Euler).fromArray(a),a=(new s.Quaternion).setFromEuler(a).invert()),new s.Quaternion),u=new s.Euler,h=[],d=0;d<l.length;d+=3)u.set(l[d],l[d+1],l[d+2],i),c.setFromEuler(u),void 0!==n&&c.premultiply(n),void 0!==a&&c.multiply(a),c.toArray(h,d/3*4);return new s.QuaternionKeyframeTrack(e+".quaternion",o,h)}},{key:"generateMorphTrack",value:function(e){var t=e.DeformPercent.curves.morph,r=t.values.map((function(e){return e/100})),n=qt.getObjectByName(e.modelName).morphTargetDictionary[e.morphName];return new s.NumberKeyframeTrack(e.modelName+".morphTargetInfluences["+n+"]",t.times,r)}},{key:"getTimesForAllAxes",value:function(e){var t=[];if(void 0!==e.x&&(t=t.concat(e.x.times)),void 0!==e.y&&(t=t.concat(e.y.times)),1<(t=(t=void 0!==e.z?t.concat(e.z.times):t).sort((function(e,t){return e-t}))).length){for(var r=1,n=t[0],a=1;a<t.length;a++){var i=t[a];i!==n&&(n=t[r]=i,r++)}t=t.slice(0,r)}return t}},{key:"getKeyframeTrackValues",value:function(e,t,r){var n=r,a=[],i=-1,s=-1,o=-1;return e.forEach((function(e){t.x&&(i=t.x.times.indexOf(e)),t.y&&(s=t.y.times.indexOf(e)),t.z&&(o=t.z.times.indexOf(e)),-1!==i?(e=t.x.values[i],a.push(e),n[0]=e):a.push(n[0]),-1!==s?(e=t.y.values[s],a.push(e),n[1]=e):a.push(n[1]),-1!==o?(e=t.z.values[o],a.push(e),n[2]=e):a.push(n[2])})),a}},{key:"interpolateRotations",value:function(e){for(var t=1;t<e.values.length;t++){var r=e.values[t-1],n=e.values[t]-r;if(180<=(a=Math.abs(n))){for(var a,i=n/(a/=180),s=r+i,o=(n=e.times[t-1],(e.times[t]-n)/a),l=n+o,c=[],u=[];l<e.times[t];)c.push(l),l+=o,u.push(s),s+=i;e.times=yr(e.times,t,c),e.values=yr(e.values,t,u)}}}}]),e}(),ir=function(){function e(){Qt(this,e)}return Jt(e,[{key:"getPrevNode",value:function(){return this.nodeStack[this.currentIndent-2]}},{key:"getCurrentNode",value:function(){return this.nodeStack[this.currentIndent-1]}},{key:"getCurrentProp",value:function(){return this.currentProp}},{key:"pushStack",value:function(e){this.nodeStack.push(e),this.currentIndent+=1}},{key:"popStack",value:function(){this.nodeStack.pop(),--this.currentIndent}},{key:"setCurrentProp",value:function(e,t){this.currentProp=e,this.currentPropName=t}},{key:"parse",value:function(e){this.currentIndent=0,this.allNodes=new lr,this.nodeStack=[],this.currentProp=[],this.currentPropName="";var t=this,r=e.split(/[\r\n]+/);return r.forEach((function(e,n){var a,i=e.match(/^[\s\t]*;/),s=e.match(/^[\s\t]*$/);i||s||(i=e.match("^\\t{"+t.currentIndent+"}(\\w+):(.*){",""),s=e.match("^\\t{"+t.currentIndent+"}(\\w+):[\\s\\t\\r\\n](.*)"),a=e.match("^\\t{"+(t.currentIndent-1)+"}}"),i?t.parseNodeBegin(e,i):s?t.parseNodeProperty(e,s,r[++n]):a?t.popStack():e.match(/^[^\s\t}]/)&&t.parseNodePropertyContinued(e))})),this.allNodes}},{key:"parseNodeBegin",value:function(e,t){var r=t[1].trim().replace(/^"/,"").replace(/"$/,""),n=(t=t[2].split(",").map((function(e){return e.trim().replace(/^"/,"").replace(/"$/,"")})),{name:r}),a=(t=this.parseNodeAttr(t),this.getCurrentNode());0===this.currentIndent?this.allNodes.add(r,n):r in a?("PoseNode"===r?a.PoseNode.push(n):void 0!==a[r].id&&(a[r]={},a[r][a[r].id]=a[r]),""!==t.id&&(a[r][t.id]=n)):"number"==typeof t.id?(a[r]={},a[r][t.id]=n):"Properties70"!==r&&(a[r]="PoseNode"===r?[n]:n),"number"==typeof t.id&&(n.id=t.id),""!==t.name&&(n.attrName=t.name),""!==t.type&&(n.attrType=t.type),this.pushStack(n)}},{key:"parseNodeAttr",value:function(e){var t=e[0],r=(""!==e[0]&&(t=parseInt(e[0]),isNaN(t)&&(t=e[0])),""),n="";return 1<e.length&&(r=e[1].replace(/^(\w+)::/,""),n=e[2]),{id:t,name:r,type:n}}},{key:"parseNodeProperty",value:function(e,t,r){var n=t[1].replace(/^"/,"").replace(/"$/,"").trim();if(t=t[2].replace(/^"/,"").replace(/"$/,"").trim(),"Properties70"===("Content"===n&&","===t&&(t=r.replace(/"/g,"").replace(/,$/,"").trim()),r=this.getCurrentNode()).name)this.parseNodeSpecialProperty(e,n,t);else{if("C"===n){e=t.split(",").slice(1);for(var a=parseInt(e[0]),i=(e=parseInt(e[1]),(i=t.split(",").slice(3)).map((function(e){return e.trim().replace(/^"/,"")}))),s=(n="connections",t=[a,e]),o=i,l=0,c=s.length,u=o.length;l<u;l++,c++)s[c]=o[l];void 0===r[n]&&(r[n]=[])}"Node"===n&&(r.id=t),n in r&&Array.isArray(r[n])?r[n].push(t):"a"!==n?r[n]=t:r.a=t,this.setCurrentProp(r,n),"a"===n&&","!==t.slice(-1)&&(r.a=vr(t))}}},{key:"parseNodePropertyContinued",value:function(e){var t=this.getCurrentNode();t.a+=e,","!==e.slice(-1)&&(t.a=vr(t.a))}},{key:"parseNodeSpecialProperty",value:function(e,t,r){r=r.split('",').map((function(e){return e.trim().replace(/^\"/,"").replace(/\s/,"_")}));var n=r[0],a=r[1],i=r[2],s=r[3],o=r[4];switch(a){case"int":case"enum":case"bool":case"ULongLong":case"double":case"Number":case"FieldOfView":o=parseFloat(o);break;case"Color":case"ColorRGB":case"Vector3D":case"Lcl_Translation":case"Lcl_Rotation":case"Lcl_Scaling":o=vr(o)}this.getPrevNode()[n]={type:a,type2:i,flag:s,value:o},this.setCurrentProp(this.getPrevNode(),n)}}]),e}(),sr=function(){function e(){Qt(this,e)}return Jt(e,[{key:"parse",value:function(e){var t=new or(e),r=(t.skip(23),t.getUint32());if(r<6400)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+r);for(var n=new lr;!this.endOfContent(t);){var a=this.parseNode(t,r);null!==a&&n.add(a.name,a)}return n}},{key:"endOfContent",value:function(e){return e.size()%16==0?(e.getOffset()+160+16&-16)>=e.size():e.getOffset()+160+16>=e.size()}},{key:"parseNode",value:function(e,t){var r={},n=7500<=t?e.getUint64():e.getUint32(),a=7500<=t?e.getUint64():e.getUint32(),i=(7500<=t?e.getUint64():e.getUint32(),e.getUint8()),s=e.getString(i);if(0===n)return null;for(var o=[],l=0;l<a;l++)o.push(this.parseProperty(e));i=0<o.length?o[0]:"";var c=1<o.length?o[1]:"",u=2<o.length?o[2]:"";for(r.singleProperty=1===a&&e.getOffset()===n;n>e.getOffset();){var h=this.parseNode(e,t);null!==h&&this.parseSubNode(s,r,h)}return r.propertyList=o,"number"==typeof i&&(r.id=i),""!==c&&(r.attrName=c),""!==u&&(r.attrType=u),""!==s&&(r.name=s),r}},{key:"parseSubNode",value:function(e,t,r){var n,a,i,s,o;!0===r.singleProperty?(a=r.propertyList[0],Array.isArray(a)?(t[r.name]=r).a=a:t[r.name]=a):"Connections"===e&&"C"===r.name?(n=[],r.propertyList.forEach((function(e,t){0!==t&&n.push(e)})),void 0===t.connections&&(t.connections=[]),t.connections.push(n)):"Properties70"===r.name?Object.keys(r).forEach((function(e){t[e]=r[e]})):"Properties70"===e&&"P"===r.name?(a=r.propertyList[0],e=r.propertyList[1],i=r.propertyList[2],s=r.propertyList[3],0===a.indexOf("Lcl ")&&(a=a.replace("Lcl ","Lcl_")),o="Color"===(e=0===e.indexOf("Lcl ")?e.replace("Lcl ","Lcl_"):e)||"ColorRGB"===e||"Vector"===e||"Vector3D"===e||0===e.indexOf("Lcl_")?[r.propertyList[4],r.propertyList[5],r.propertyList[6]]:r.propertyList[4],t[a]={type:e,type2:i,flag:s,value:o}):void 0===t[r.name]?"number"==typeof r.id?(t[r.name]={},t[r.name][r.id]=r):t[r.name]=r:"PoseNode"===r.name?(Array.isArray(t[r.name])||(t[r.name]=[t[r.name]]),t[r.name].push(r)):void 0===t[r.name][r.id]&&(t[r.name][r.id]=r)}},{key:"parseProperty",value:function(e){var t=e.getString(1);switch(t){case"C":return e.getBoolean();case"D":return e.getFloat64();case"F":return e.getFloat32();case"I":return e.getInt32();case"L":return e.getInt64();case"R":return n=e.getUint32(),e.getArrayBuffer(n);case"S":return n=e.getUint32(),e.getString(n);case"Y":return e.getInt16();case"b":case"c":case"d":case"f":case"i":case"l":var r=e.getUint32(),n=e.getUint32(),a=e.getUint32();if(0===n)switch(t){case"b":case"c":return e.getBooleanArray(r);case"d":return e.getFloat64Array(r);case"f":return e.getFloat32Array(r);case"i":return e.getInt32Array(r);case"l":return e.getInt64Array(r)}n=function(e,t){return function(e,t,r){var n=e.length;if(!n||r&&!r.l&&n<5)return t||new vt(0);function a(e){var r=t.length;r<e&&((r=new vt(Math.max(2*r,e))).set(t),t=r)}var i=!t||r,s=!r||r.i,o=(r=r||{},t=t||new vt(3*n),r.f||0),l=r.p||0,c=r.b||0,u=r.l,h=r.d,d=r.m,p=r.n,f=8*n;do{if(!u){r.f=o=Lt(e,l,1);var m=Lt(e,l+1,3);if(l+=3,!m){var g=e[(_=Bt(l)+4)-4]|e[_-3]<<8;if(n<(S=_+g)){if(s)throw"unexpected EOF";break}i&&a(c+g),t.set(e.subarray(_,S),c),r.b=c+=g,r.p=l=8*S;continue}if(1==m)u=At,h=Ct,d=9,p=5;else{if(2!=m)throw"invalid block type";g=Lt(e,l,31)+257;for(var v=Lt(e,l+10,15)+4,b=g+Lt(e,l+5,31)+1,y=(l+=14,new vt(b)),x=new vt(19),w=0;w<v;++w)x[St[w]]=Lt(e,l+3*w,7);l+=3*v;var S,M=(1<<(S=Rt(x)))-1,T=Dt(x,S,1);for(w=0;w<b;){var _,E=T[Lt(e,l,M)];if(l+=15&E,(_=E>>>4)<16)y[w++]=_;else{var k=0,D=0;for(16==_?(D=3+Lt(e,l,3),l+=2,k=y[w-1]):17==_?(D=3+Lt(e,l,7),l+=3):18==_&&(D=11+Lt(e,l,127),l+=7);D--;)y[w++]=k}}m=y.subarray(0,g);var O=y.subarray(g);d=Rt(m),p=Rt(O),u=Dt(m,d,1),h=Dt(O,p,1)}if(f<l){if(s)throw"unexpected EOF";break}}i&&a(c+131072);for(var P=(1<<d)-1,A=(1<<p)-1,C=l;;C=l){var R=(k=u[It(e,l)&P])>>>4;if(f<(l+=15&k)){if(s)throw"unexpected EOF";break}if(!k)throw"invalid length/literal";if(R<256)t[c++]=R;else{if(256==R){C=l,u=null;break}var L,I=R-254,B=(264<R&&(L=xt[w=R-257],I=Lt(e,l,(1<<L)-1)+Mt[w],l+=L),(R=h[It(e,l)&A])>>>4);if(!R)throw"invalid distance";if(l+=15&R,O=Tt[B],3<B&&(L=wt[B],O+=It(e,l)&(1<<L)-1,l+=L),f<l){if(s)throw"unexpected EOF";break}i&&a(c+131072);for(var j=c+I;c<j;c+=4)t[c]=t[c-O],t[c+1]=t[c+1-O],t[c+2]=t[c+2-O],t[c+3]=t[c+3-O];c=j}}r.l=u,r.p=C,r.b=c,u&&(o=1,r.m=d,r.d=h,r.n=p)}while(!o);return c==t.length?t:jt(t,0,c)}((function(e){if(8!=(15&e[0])||7<e[0]>>>4||(e[0]<<8|e[1])%31)throw"invalid zlib data";if(32&e[1])throw"invalid zlib data: preset dictionaries not supported"}(e),e.subarray(2,-4)),t)}(new Uint8Array(e.getArrayBuffer(a)));var i=new or(n.buffer);switch(t){case"b":case"c":return i.getBooleanArray(r);case"d":return i.getFloat64Array(r);case"f":return i.getFloat32Array(r);case"i":return i.getInt32Array(r);case"l":return i.getInt64Array(r)}break;default:throw new Error("THREE.FBXLoader: Unknown property type "+t)}}}]),e}(),or=function(){function e(t,r){Qt(this,e),this.dv=new DataView(t),this.offset=0,this.littleEndian=void 0===r||r,this._textDecoder=new TextDecoder}return Jt(e,[{key:"getOffset",value:function(){return this.offset}},{key:"size",value:function(){return this.dv.buffer.byteLength}},{key:"skip",value:function(e){this.offset+=e}},{key:"getBoolean",value:function(){return 1==(1&this.getUint8())}},{key:"getBooleanArray",value:function(e){for(var t=[],r=0;r<e;r++)t.push(this.getBoolean());return t}},{key:"getUint8",value:function(){var e=this.dv.getUint8(this.offset);return this.offset+=1,e}},{key:"getInt16",value:function(){var e=this.dv.getInt16(this.offset,this.littleEndian);return this.offset+=2,e}},{key:"getInt32",value:function(){var e=this.dv.getInt32(this.offset,this.littleEndian);return this.offset+=4,e}},{key:"getInt32Array",value:function(e){for(var t=[],r=0;r<e;r++)t.push(this.getInt32());return t}},{key:"getUint32",value:function(){var e=this.dv.getUint32(this.offset,this.littleEndian);return this.offset+=4,e}},{key:"getInt64",value:function(){var e,t;return this.littleEndian?(e=this.getUint32(),t=this.getUint32()):(t=this.getUint32(),e=this.getUint32()),2147483648&t?(t=4294967295&~t,-(4294967296*(t=4294967295==(e=4294967295&~e)?t+1&4294967295:t)+(e=e+1&4294967295))):4294967296*t+e}},{key:"getInt64Array",value:function(e){for(var t=[],r=0;r<e;r++)t.push(this.getInt64());return t}},{key:"getUint64",value:function(){var e,t;return this.littleEndian?(e=this.getUint32(),t=this.getUint32()):(t=this.getUint32(),e=this.getUint32()),4294967296*t+e}},{key:"getFloat32",value:function(){var e=this.dv.getFloat32(this.offset,this.littleEndian);return this.offset+=4,e}},{key:"getFloat32Array",value:function(e){for(var t=[],r=0;r<e;r++)t.push(this.getFloat32());return t}},{key:"getFloat64",value:function(){var e=this.dv.getFloat64(this.offset,this.littleEndian);return this.offset+=8,e}},{key:"getFloat64Array",value:function(e){for(var t=[],r=0;r<e;r++)t.push(this.getFloat64());return t}},{key:"getArrayBuffer",value:function(e){var t=this.dv.buffer.slice(this.offset,this.offset+e);return this.offset+=e,t}},{key:"getString",value:function(e){var t=this.offset,r=new Uint8Array(this.dv.buffer,t,e);return 0<=(this.skip(e),e=r.indexOf(0))&&(r=new Uint8Array(this.dv.buffer,t,e)),this._textDecoder.decode(r)}}]),e}(),lr=function(){function e(){Qt(this,e)}return Jt(e,[{key:"add",value:function(e,t){this[e]=t}}]),e}();function cr(e){if(e=e.match(/FBXVersion: (\d+)/))return parseInt(e[1]);throw new Error("THREE.FBXLoader: Cannot find the version number for the file given.")}function ur(e){return e/46186158e3}var hr=[];function dr(e,t,r,n){var a;switch(n.mappingType){case"ByPolygonVertex":a=e;break;case"ByPolygon":a=t;break;case"ByVertice":a=r;break;case"AllSame":a=n.indices[0];break;default:console.warn("THREE.FBXLoader: unknown attribute mapping type "+n.mappingType)}for(var i=(a="IndexToDirect"===n.referenceType?n.indices[a]:a)*n.dataSize,s=i+n.dataSize,o=hr,l=n.buffer,c=s,u=i,h=0;u<c;u++,h++)o[h]=l[u];return o}var pr=new s.Euler,fr=new s.Vector3;function mr(e){var t=new s.Matrix4,r=new s.Matrix4,n=new s.Matrix4,a=new s.Matrix4,i=new s.Matrix4,o=new s.Matrix4,l=new s.Matrix4,c=new s.Matrix4,u=new s.Matrix4,h=new s.Matrix4,d=new s.Matrix4,p=new s.Matrix4,f=e.inheritType||0,m=(e.translation&&t.setPosition(fr.fromArray(e.translation)),e.preRotation&&((m=e.preRotation.map(s.MathUtils.degToRad)).push(e.eulerOrder||s.Euler.DEFAULT_ORDER),r.makeRotationFromEuler(pr.fromArray(m))),e.rotation&&((m=e.rotation.map(s.MathUtils.degToRad)).push(e.eulerOrder||s.Euler.DEFAULT_ORDER),n.makeRotationFromEuler(pr.fromArray(m))),e.postRotation&&((m=e.postRotation.map(s.MathUtils.degToRad)).push(e.eulerOrder||s.Euler.DEFAULT_ORDER),a.makeRotationFromEuler(pr.fromArray(m)),a.invert()),e.scale&&i.scale(fr.fromArray(e.scale)),e.scalingOffset&&l.setPosition(fr.fromArray(e.scalingOffset)),e.scalingPivot&&o.setPosition(fr.fromArray(e.scalingPivot)),e.rotationOffset&&c.setPosition(fr.fromArray(e.rotationOffset)),e.rotationPivot&&u.setPosition(fr.fromArray(e.rotationPivot)),e.parentMatrixWorld&&(d.copy(e.parentMatrix),h.copy(e.parentMatrixWorld)),r.clone().multiply(n).multiply(a)),g=(((e=new s.Matrix4).extractRotation(h),g=new s.Matrix4).copyPosition(h),g.clone().invert().multiply(h)),v=(g=e.clone().invert().multiply(g),i),b=new s.Matrix4;return 0===f?b.copy(e).multiply(m).multiply(g).multiply(v):1===f?b.copy(e).multiply(g).multiply(m).multiply(v):(f=(new s.Matrix4).scale((new s.Vector3).setFromMatrixScale(d)).clone().invert(),d=g.clone().multiply(f),b.copy(e).multiply(m).multiply(d).multiply(v)),g=u.clone().invert(),f=o.clone().invert(),e=t.clone().multiply(c).multiply(u).multiply(r).multiply(n).multiply(a).multiply(g).multiply(l).multiply(o).multiply(i).multiply(f),m=(new s.Matrix4).copyPosition(e),d=h.clone().multiply(m),p.copyPosition(d),(e=p.clone().multiply(b)).premultiply(h.invert()),e}function gr(e){var t=["ZYX","YZX","XZY","ZXY","YXZ","XYZ"];return 6===(e=e||0)?(console.warn("THREE.FBXLoader: unsupported Euler Order: Spherical XYZ. Animations and rotations may be incorrect."),t[0]):t[e]}function vr(e){return e.split(",").map((function(e){return parseFloat(e)}))}function br(e,t,r){return void 0===t&&(t=0),void 0===r&&(r=e.byteLength),(new TextDecoder).decode(new Uint8Array(e,t,r))}function yr(e,t,r){return e.slice(0,t).concat(r).concat(e.slice(t))}function xr(e){return(xr="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})(e)}function wr(e,t){return(wr=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Sr(e){return(Sr=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Mr=/^[og]\s*(.+)?/,Tr=/^mtllib /,_r=/^usemtl /,Er=/^usemap /,kr=/\s+/,Dr=new s.Vector3,Or=new s.Vector3,Pr=new s.Vector3,Ar=new s.Vector3,Cr=new s.Vector3,Rr=new s.Color;function Lr(){var e={objects:[],object:{},vertices:[],normals:[],colors:[],uvs:[],materials:{},materialLibraries:[],startObject:function(e,t){if(this.object&&!1===this.object.fromDeclaration)return this.object.name=e,void(this.object.fromDeclaration=!1!==t);var r=this.object&&"function"==typeof this.object.currentMaterial?this.object.currentMaterial():void 0;this.object&&"function"==typeof this.object._finalize&&this.object._finalize(!0),this.object={name:e||"",fromDeclaration:!1!==t,geometry:{vertices:[],normals:[],colors:[],uvs:[],hasUVIndices:!1},materials:[],smooth:!0,startMaterial:function(e,t){var r=this._finalize(!1);return r&&(r.inherited||r.groupCount<=0)&&this.materials.splice(r.index,1),e={index:this.materials.length,name:e||"",mtllib:Array.isArray(t)&&0<t.length?t[t.length-1]:"",smooth:(void 0!==r?r:this).smooth,groupStart:void 0!==r?r.groupEnd:0,groupEnd:-1,groupCount:-1,inherited:!1,clone:function(e){return(e={index:"number"==typeof e?e:this.index,name:this.name,mtllib:this.mtllib,smooth:this.smooth,groupStart:0,groupEnd:-1,groupCount:-1,inherited:!1}).clone=this.clone.bind(e),e}},this.materials.push(e),e},currentMaterial:function(){if(0<this.materials.length)return this.materials[this.materials.length-1]},_finalize:function(e){var t=this.currentMaterial();if(t&&-1===t.groupEnd&&(t.groupEnd=this.geometry.vertices.length/3,t.groupCount=t.groupEnd-t.groupStart,t.inherited=!1),e&&1<this.materials.length)for(var r=this.materials.length-1;0<=r;r--)this.materials[r].groupCount<=0&&this.materials.splice(r,1);return e&&0===this.materials.length&&this.materials.push({name:"",smooth:this.smooth}),t}},r&&r.name&&"function"==typeof r.clone&&((e=r.clone(0)).inherited=!0,this.object.materials.push(e)),this.objects.push(this.object)},finalize:function(){this.object&&"function"==typeof this.object._finalize&&this.object._finalize(!0)},parseVertexIndex:function(e,t){return 3*(0<=(e=parseInt(e,10))?e-1:e+t/3)},parseNormalIndex:function(e,t){return 3*(0<=(e=parseInt(e,10))?e-1:e+t/3)},parseUVIndex:function(e,t){return 2*(0<=(e=parseInt(e,10))?e-1:e+t/2)},addVertex:function(e,t,r){var n=this.vertices,a=this.object.geometry.vertices;a.push(n[e+0],n[e+1],n[e+2]),a.push(n[t+0],n[t+1],n[t+2]),a.push(n[r+0],n[r+1],n[r+2])},addVertexPoint:function(e){var t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addVertexLine:function(e){var t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addNormal:function(e,t,r){var n=this.normals,a=this.object.geometry.normals;a.push(n[e+0],n[e+1],n[e+2]),a.push(n[t+0],n[t+1],n[t+2]),a.push(n[r+0],n[r+1],n[r+2])},addFaceNormal:function(e,t,r){var n=this.vertices,a=this.object.geometry.normals;Dr.fromArray(n,e),Or.fromArray(n,t),Pr.fromArray(n,r),Cr.subVectors(Pr,Or),Ar.subVectors(Dr,Or),Cr.cross(Ar),Cr.normalize(),a.push(Cr.x,Cr.y,Cr.z),a.push(Cr.x,Cr.y,Cr.z),a.push(Cr.x,Cr.y,Cr.z)},addColor:function(e,t,r){var n=this.colors,a=this.object.geometry.colors;void 0!==n[e]&&a.push(n[e+0],n[e+1],n[e+2]),void 0!==n[t]&&a.push(n[t+0],n[t+1],n[t+2]),void 0!==n[r]&&a.push(n[r+0],n[r+1],n[r+2])},addUV:function(e,t,r){var n=this.uvs,a=this.object.geometry.uvs;a.push(n[e+0],n[e+1]),a.push(n[t+0],n[t+1]),a.push(n[r+0],n[r+1])},addDefaultUV:function(){var e=this.object.geometry.uvs;e.push(0,0),e.push(0,0),e.push(0,0)},addUVLine:function(e){var t=this.uvs;this.object.geometry.uvs.push(t[e+0],t[e+1])},addFace:function(e,t,r,n,a,i,s,o,l){var c=this.vertices.length;e=this.parseVertexIndex(e,c),t=this.parseVertexIndex(t,c),r=this.parseVertexIndex(r,c),this.addVertex(e,t,r),this.addColor(e,t,r),void 0!==s&&""!==s?(c=this.normals.length,e=this.parseNormalIndex(s,c),t=this.parseNormalIndex(o,c),r=this.parseNormalIndex(l,c),this.addNormal(e,t,r)):this.addFaceNormal(e,t,r),void 0!==n&&""!==n?(s=this.uvs.length,e=this.parseUVIndex(n,s),t=this.parseUVIndex(a,s),r=this.parseUVIndex(i,s),this.addUV(e,t,r),this.object.geometry.hasUVIndices=!0):this.addDefaultUV()},addPointGeometry:function(e){this.object.geometry.type="Points";for(var t=this.vertices.length,r=0,n=e.length;r<n;r++){var a=this.parseVertexIndex(e[r],t);this.addVertexPoint(a),this.addColor(a)}},addLineGeometry:function(e,t){this.object.geometry.type="Line";for(var r=this.vertices.length,n=this.uvs.length,a=0,i=e.length;a<i;a++)this.addVertexLine(this.parseVertexIndex(e[a],r));for(var s=0,o=t.length;s<o;s++)this.addUVLine(this.parseUVIndex(t[s],n))}};return e.startObject("",!1),e}var Ir=function(e){var t=n;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&wr(t,e);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Sr(e);if(r=t?(r=Sr(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===xr(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(e){if(this instanceof n)return(e=r.call(this,e)).materials=null,e;throw new TypeError("Cannot call a class as a function")}return t=n,(e=[{key:"load",value:function(e,t,r,n){var a=this,i=new s.FileLoader(this.manager);i.setPath(this.path),i.setRequestHeader(this.requestHeader),i.setWithCredentials(this.withCredentials),i.load(e,(function(r){try{t(a.parse(r))}catch(r){n?n(r):console.error(r),a.manager.itemError(e)}}),r,n)}},{key:"setMaterials",value:function(e){return this.materials=e,this}},{key:"parse",value:function(e){for(var t=new Lr,r=(e=-1!==(e=-1!==e.indexOf("\r\n")?e.replace(/\r\n/g,"\n"):e).indexOf("\\\n")?e.replace(/\\\n/g,""):e).split("\n"),n=[],a=0,i=r.length;a<i;a++){var o=r[a].trimStart();if(0!==o.length){var l,c=o.charAt(0);if("#"!==c)if("v"===c){var u=o.split(kr);switch(u[0]){case"v":t.vertices.push(parseFloat(u[1]),parseFloat(u[2]),parseFloat(u[3])),7<=u.length?(Rr.setRGB(parseFloat(u[4]),parseFloat(u[5]),parseFloat(u[6])).convertSRGBToLinear(),t.colors.push(Rr.r,Rr.g,Rr.b)):t.colors.push(void 0,void 0,void 0);break;case"vn":t.normals.push(parseFloat(u[1]),parseFloat(u[2]),parseFloat(u[3]));break;case"vt":t.uvs.push(parseFloat(u[1]),parseFloat(u[2]))}}else if("f"===c){for(var h=o.slice(1).trim().split(kr),d=[],p=0,f=h.length;p<f;p++){var m=h[p];0<m.length&&(m=m.split("/"),d.push(m))}for(var g=d[0],v=1,b=d.length-1;v<b;v++){var y=d[v],x=d[v+1];t.addFace(g[0],y[0],x[0],g[1],y[1],x[1],g[2],y[2],x[2])}}else if("l"===c){var w=o.substring(1).trim().split(" "),S=[],M=[];if(-1===o.indexOf("/"))S=w;else for(var T=0,_=w.length;T<_;T++){var E=w[T].split("/");""!==E[0]&&S.push(E[0]),""!==E[1]&&M.push(E[1])}t.addLineGeometry(S,M)}else"p"===c?(l=o.slice(1).trim().split(" "),t.addPointGeometry(l)):null!==(n=Mr.exec(o))?(l=(" "+n[0].slice(1).trim()).slice(1),t.startObject(l)):_r.test(o)?t.object.startMaterial(o.substring(7).trim(),t.materialLibraries):Tr.test(o)?t.materialLibraries.push(o.substring(7).trim()):Er.test(o)?console.warn('THREE.OBJLoader: Rendering identifier "usemap" not supported. Textures must be defined in MTL files.'):"s"===c?(1<(n=o.split(" ")).length?(c=n[1].trim().toLowerCase(),t.object.smooth="0"!==c&&"off"!==c):t.object.smooth=!0,(c=t.object.currentMaterial())&&(c.smooth=t.object.smooth)):"\0"!==o&&console.warn('THREE.OBJLoader: Unexpected line: "'+o+'"')}}t.finalize();var k,D=new s.Group;if(1==(D.materialLibraries=[].concat(t.materialLibraries),e=!(1===t.objects.length&&0===t.objects[0].geometry.vertices.length)))for(var O=0,P=t.objects.length;O<P;O++){var A=t.objects[O],C=A.geometry,R=A.materials,L="Line"===C.type,I="Points"===C.type,B=!1;if(0!==C.vertices.length){for(var j=new s.BufferGeometry,U=(j.setAttribute("position",new s.Float32BufferAttribute(C.vertices,3)),0<C.normals.length&&j.setAttribute("normal",new s.Float32BufferAttribute(C.normals,3)),0<C.colors.length&&(B=!0,j.setAttribute("color",new s.Float32BufferAttribute(C.colors,3))),!0===C.hasUVIndices&&j.setAttribute("uv",new s.Float32BufferAttribute(C.uvs,2)),[]),N=0,F=R.length;N<F;N++){var z,V=R[N],G=V.name+"_"+V.smooth+"_"+B,H=t.materials[G];null!==this.materials&&(H=this.materials.create(V.name),!L||!H||H instanceof s.LineBasicMaterial?!I||!H||H instanceof s.PointsMaterial||(z=new s.PointsMaterial({size:10,sizeAttenuation:!1}),s.Material.prototype.copy.call(z,H),z.color.copy(H.color),z.map=H.map,H=z):(z=new s.LineBasicMaterial,s.Material.prototype.copy.call(z,H),z.color.copy(H.color),H=z)),void 0===H&&((H=L?new s.LineBasicMaterial:I?new s.PointsMaterial({size:1,sizeAttenuation:!1}):new s.MeshPhongMaterial).name=V.name,H.flatShading=!V.smooth,H.vertexColors=B,t.materials[G]=H),U.push(H)}if(C=void 0,1<U.length){for(var W=0,K=R.length;W<K;W++){var q=R[W];j.addGroup(q.groupStart,q.groupCount,W)}C=new(L?s.LineSegments:I?s.Points:s.Mesh)(j,U)}else C=new(L?s.LineSegments:I?s.Points:s.Mesh)(j,U[0]);C.name=A.name,D.add(C)}}else 0<t.vertices.length&&(e=new s.PointsMaterial({size:1,sizeAttenuation:!1}),(k=new s.BufferGeometry).setAttribute("position",new s.Float32BufferAttribute(t.vertices,3)),0<t.colors.length&&void 0!==t.colors[0]&&(k.setAttribute("color",new s.Float32BufferAttribute(t.colors,3)),e.vertexColors=!0),k=new s.Points(k,e),D.add(k));return D}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),n}(s.Loader),Br=function(e,t,r,n){return new(r=r||Promise)((function(a,i){function s(e){try{l(n.next(e))}catch(e){i(e)}}function o(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?a(e.value):((t=e.value)instanceof r?t:new r((function(e){e(t)}))).then(s,o)}l((n=n.apply(e,t||[])).next())}))};const jr=t.FBXLoader;class Ur{constructor(e){this.parses={fbx:new jr,obj:new Ir,object:new s.ObjectLoader},this.runScene=e}getBack(e){return e.name.substring(e.name.lastIndexOf(".")+1).toLowerCase()}parseFiles(e){return Promise.all(e.map((e=>this.parse(e))))}parse(e){return Br(this,void 0,void 0,(function*(){let t;switch(this.getBack(e).toLowerCase()){case"gltf":case"glb":t=this.glb(e);break;case"fbx":t=this.fbx(e);break;case"obj":t=this.obj(e);break;case"json":t=this.json(e)}return t}))}img(e){console.log(e,"file")}glb(e){return Br(this,void 0,void 0,(function*(){var t=yield(0,i.parseFile)(e,"arrayBuffer");let r="model";return t=yield this.runScene.loaderer.gltf.parse(t,{triggerCb:!0,callBack:{beforeParse:e=>{"scene"===(e=(e.asset.ex||{}).type)&&this.runScene.clean()},getJSON(e){r=(null==(e=e.asset.ex)?void 0:e.type)||"model"}}}),{type:r,result:t}}))}fbx(e){return Br(this,void 0,void 0,(function*(){var t=e instanceof ArrayBuffer?e:yield(0,i.parseFile)(e,"arrayBuffer");const r=this.parses.fbx.parse(t,"");return r.traverse((e=>{e.material&&(e.material=this.runScene.materialEx.create())})),{type:"model",result:this.runScene.sceneEx.cleanUnlessLevel(r)}}))}obj(e){return Br(this,void 0,void 0,(function*(){var t=e instanceof File?yield(0,i.parseFile)(e,"text"):e;const r=this.parses.obj.parse(t);return r.traverse((e=>{e.material&&(e.material=this.runScene.materialEx.create())})),{type:"model",result:this.runScene.sceneEx.cleanUnlessLevel(r)}}))}json(e){return Br(this,void 0,void 0,(function*(){var t=e instanceof File?yield(0,i.parseFile)(e,"text"):e,r=JSON.parse(t);return"timeLine"===r.type?{type:"timeLine",result:r.data}:{type:"model",result:this.runScene.loaderer.json.parse(t)}}))}}class Nr extends o{constructor(e){super(e),this._lastRenderMode=null,this.setRenderMode=(()=>{let e=!1;const t=()=>{e||(this.runScene.cb.loaderer.gltf.loaded.add("global-config",(()=>{"controlsChange"===this._lastRenderMode&&this.runScene.render()})),this.runScene.cb.loaderer.gltf.complete.add("global-config",(()=>{"controlsChange"===this._lastRenderMode&&this.runScene.render()})),e=!0)},r=()=>{const{renderer:e,controls:t}=this.runScene.assetsEx;var r=this.runScene.render;"tick"===this._lastRenderMode?e.setAnimationLoop(null):"controlsChange"===this._lastRenderMode&&t.removeEventListener("change",r)},n=e=>{var t=this.runScene.render;const{renderer:r,controls:n}=this.runScene.assetsEx;"tick"===e?r.setAnimationLoop(t):"controlsChange"===e&&n.addEventListener("change",t)};return e=>{this._lastRenderMode!==e&&(t(),r(),n(e),this._lastRenderMode=e)}})()}setGlow(e){this.runScene.pp.params.glow.isBloom=e}setRender2(e){this.runScene.assetsEx.setRender2(e)}setRender3(e){this.runScene.assetsEx.setRender3(e)}}var Fr=r(1269);class zr extends r(8624).Ys{constructor(e,t){super(e,t),this.transGizmo=this.children[0],this.scaleCoefficient=new s.Vector3,this.beginScale=new s.Vector3,this.posStart=new s.Vector2,this.posEnd=new s.Vector2,this.deleteRedundantParts()}deleteRedundantParts(){this.transGizmo.gizmo.translate.children.splice(1,1),this.transGizmo.gizmo.translate.children.splice(3,1),this.transGizmo.gizmo.translate.children.splice(5,1),this.transGizmo.gizmo.scale.children.splice(0,1),this.transGizmo.gizmo.scale.children.splice(2,1),this.transGizmo.gizmo.scale.children.splice(4,1)}pointerDown(e){void 0===this.object||null===this.axis||this.dragging||0!==e.button||(this.posStart.set(e.x,e.y),this.beginScale.set(this.object.scale.x,this.object.scale.y,this.object.scale.z),super.pointerDown(e))}pointerMove(e){if(super.pointerMove(e),void 0!==this.object&&null!==this.axis&&this.dragging&&-1===e.button&&"scale"===this.mode&&-1!==this.axis.search("XYZ")){this.posEnd.set(e.x,e.y),e=(Math.abs(this.beginScale.x)+Math.abs(this.beginScale.y)+Math.abs(this.beginScale.z))/3;let t=12*this.pointStart.distanceTo(this.pointEnd)/e;this.posEnd.x>this.posStart.x&&(t*=-1),(t=-1.1<t&&t<1.1?1:t)<0&&(t=-1.1/t),this.scaleCoefficient.set(t,t,t),this.object.scale.copy(this._scaleStart).multiply(this.scaleCoefficient)}}}class Vr extends s.Object3D{constructor(e){super(),this.isViewHelper=!0,this.animating=!1,this.controls=null,this.dummy=new s.Object3D,this.turnRate=2*Math.PI,this.targetPosition=new s.Vector3,this.targetQuaternion=new s.Quaternion,this.q1=new s.Quaternion,this.q2=new s.Quaternion,this.radius=0,this.clock=new s.Clock,this.runScene=e,e=this.runScene.assetsEx.get().controls,this.controls=e,this.runScene.cb.render.add("view-helper",(()=>{this.update(this.clock.getDelta())}))}prepareAnimationData(e){const t=this.runScene.assetsEx.get().camera;var r=this.controls.target;switch(e){case"posX":this.targetPosition.set(1,0,0),this.targetQuaternion.setFromEuler(new s.Euler(0,.5*Math.PI,0));break;case"posY":this.targetPosition.set(0,1,0),this.targetQuaternion.setFromEuler(new s.Euler(.5*-Math.PI,0,0));break;case"posZ":this.targetPosition.set(0,0,1),this.targetQuaternion.setFromEuler(new s.Euler);break;case"negX":this.targetPosition.set(-1,0,0),this.targetQuaternion.setFromEuler(new s.Euler(0,.5*-Math.PI,0));break;case"negY":this.targetPosition.set(0,-1,0),this.targetQuaternion.setFromEuler(new s.Euler(.5*Math.PI,0,0));break;case"negZ":this.targetPosition.set(0,0,-1),this.targetQuaternion.setFromEuler(new s.Euler(0,Math.PI,0));break;default:console.error("ViewHelper: Invalid axis.")}this.radius=t.position.distanceTo(r),this.targetPosition.multiplyScalar(this.radius).add(r),this.dummy.position.copy(r),this.dummy.lookAt(t.position),this.q1.copy(this.dummy.quaternion),this.dummy.lookAt(this.targetPosition),this.q2.copy(this.dummy.quaternion),this.animating=!0}update(e){if(this.animating){const r=this.runScene.assetsEx.get().camera;e*=this.turnRate;var t=this.controls.target;this.q1.rotateTowards(this.q2,e),r.position.set(0,0,1).applyQuaternion(this.q1).multiplyScalar(this.radius).add(t),r.quaternion.rotateTowards(this.targetQuaternion,e),0===this.q1.angleTo(this.q2)&&(this.animating=!1)}}}class Gr{constructor(e){this.grid=null,this.transContro=null,this.boxHelper=null,this.clean=()=>{this.unfocus()},this.deepIsHelper=e=>"Scene"===e.type||!this.isHelper(e)&&!!e.parent&&this.deepIsHelper(e.parent),this.getBoxHelper=e=>(e=new s.BoxHelper(e),this.setHelper(e),this.runScene.assetsEx.get().scene.add(e),e),this.runScene=e,"running"!==this.runScene.optionsEx.options.mode&&(this.runScene.cb.clean.add("EngineHelper",this.clean),this.transContro=new class{constructor(e){this.tansControls=null,this.controlsMode="position",this.isDraggingChange=!1,this.modelNewVal=new c.Z.Vector3,this.transControlsStatusMap={position:"translate",rotation:"rotate",scale:"scale"},this.multipObj=null,this.speaceType="world",this.draggingChanged=e=>{var t=this.runScene.assetsEx.get().controls,r=this.controlsMode,n=this.runScene.modelEx.select||this.runScene.multipSelector.getLast();n&&(this.runScene.multipSelector.draggingchanged(e),t.enabled?(this.modelNewVal=this.runScene.modelEx.cloneV3(n[r]),this.isDraggingChange=!0):(this.runScene.multipSelector.isEmpty()&&this.runScene.modelEx.setV3({model:n,info:r,newV3:this.runScene.modelEx.cloneV3(n[r]),oldV3:this.modelNewVal},!0,!1),this.isDraggingChange=!1),this.runScene.assetsEx.get().controls.enabled=!e.value)},this.runScene=e}init(){const{camera:e,scene:t,engineDom:r}=this.runScene.assetsEx.get();this.tansControls=new zr(e,r),this.tansControls.addEventListener("dragging-changed",this.draggingChanged),this.tansControls.addEventListener("change",this.transChangeFn.bind(this)),this.tansControls.name="helper",t.add(this.tansControls),this.tansControls.traverse((e=>e.isHelper=!0))}changeMode(e){this.controlsMode=e,this.tansControls.setMode(this.transControlsStatusMap[e])}transControSize(e){this.tansControls.setSize(e?this.tansControls.size+.1:Math.max(this.tansControls.size-.1,.1))}changeState(e){this.tansControls.enabled=e}addObject(e){this.removeFocus(),this.tansControls.attach(e)}removeFocus(){this.tansControls.detach()}changeSpaceState(){this.tansControls.setSpace("local"===this.tansControls.space?"world":"local"),this.tansControls.detach()}setSpeace(e){e=e||("world"===this.speaceType?"local":"world"),this.speaceType=e,this.tansControls.setSpace(e),this.addObject(this.runScene.modelEx.select)}transChangeFn(e){var t=this.runScene.modelEx.select;t&&(this.runScene.lightEx.update(t),this.runScene.helperEx.boxHelper.setFromObject(t)),this.runScene.multipSelector.transChange(),this.runScene.cb.tranControls.changing.cb(t)}close(){this.tansControls.enabled=!1}open(){this.tansControls.enabled=!0}reset(){this.dispose(),this.init()}dispose(){this.tansControls&&(this.tansControls.removeEventListener("dragging-changed",this.draggingChanged),this.tansControls.removeEventListener("change",this.transChangeFn),this.tansControls.dispose(),this.runScene.assetsEx.get().scene.remove(this.tansControls))}}(e),this.viewHelper=new Vr(e),this.grid=this.createGrid(),this.init())}init(){this.transContro.init(),this.runScene.assetsEx.get().scene.add(this.grid)}createGrid(){const e=new c.Z.GridHelper(20,10);return e.name="helper",e.position.y=0,e.material.opacity=.75,e.material.transparent=!0,e}dispose(){}reset(){"running"!==this.runScene.optionsEx.options.mode&&this.transContro.reset()}isHelper(e){return"GridHelper"===e.type||"CubeCamera"===e.type||e.isTransformControls||e.userData.isHelper}setHelper(e,t=!1,r){return e.userData.isHelper=!0,t&&e.traverse((e=>{e.userData.isHelper=!0,r&&r(e)})),e}focus(e){"running"===this.runScene.optionsEx.options.mode||(0,h.isHelper)(e)||(this.boxHelper||(this.boxHelper=this.getBoxHelper(e)),(0,Fr.RQ)(e)||(this.boxHelper.visible=!0,this.boxHelper.setFromObject(e)),this.transContro.addObject(e),this.focusModelId=this.runScene.uniqueEx.getId(e))}unfocus(){"running"!==this.runScene.optionsEx.options.mode&&(this.transContro.removeFocus(),this.boxHelper&&(this.boxHelper.visible=!1),this.focusModelId=void 0)}}var Hr=r(2510),Wr=r(4380),Kr=r(8089);class qr{constructor(e){this.selectors={},this.boxHelperMap={},this.savedV3=new A.Z,this.tempOldval=new ga.Vector3,this.runScene=e}add(e,t=!1){if("array"===(0,i.getType)(e))return e.map((e=>this.add(e)));var r=this.runScene.modelEx.select;if(r&&(this.runScene.modelEx.selectNull(),delete this.selectors[e.uuid],this.add(r)),"BoxHelper"!==e.type){if(this.selectors[e.uuid]){if(this.remove(e),this.removeBoxHelper(e),!t)return;this.add(e)}this.addBoxHelper(e),this.selectors[e.uuid]=e,this.runScene.cb.model.focus.cb({model:e,status:!0,domActive:!0}),this.runScene.helperEx.focus(e)}}setInfo(e,t,r,n,a,i){"position"!==t&&(a=n,i=r);const s=this.getSelectedList("value");var{x:a,y:o,z:l}=a;const c=a-i.x,u=o-i.y,h=l-i.z,d=[new Wr.Z({target:e,info:t,oldV3:this.runScene.modelEx.cloneV3(r),newV3:n,runScene:this.runScene}).execute()];s.map((r=>{if(r!==e){var{x:n,y:a,z:i}=r[t],n=n+=c,a=a+=u,i=i+=h;let e=r[t].clone();e.x=n,e.y=a,e.z=i,n=new Wr.Z({target:r,info:t,oldV3:this.runScene.modelEx.cloneV3(r[t]),newV3:e,runScene:this.runScene}).execute(),d.push(n),this.boxHelperMap[r.uuid].setFromObject(r)}})),this.boxHelperMap[e.uuid].setFromObject(e),this.runScene.undoEx.addUndo(d)}draggingchanged(e){const t=this.runScene.assetsEx.get().controls;var r;this.isEmpty()?this.runScene.events.mouse.enableUp=!0:this.runScene.events.mouse.enableUp=!1,e.value?this.isEmpty()||(t.enabled=!1,e=this.getLast(),r=this.runScene.helperEx.transContro.controlsMode,this.tempOldval="position"===r?(0,Kr.VU)(e,this.runScene.sceneEx.get()):this.runScene.modelEx.cloneV3(e[r]),this.saveV3(r)):t.enabled||this.isEmpty()||(this.runScene.events.mouse.enableUp=!1,this.useV3())}transChange(){if(!this.isEmpty()&&!this.runScene.assetsEx.controls.enabled){var e=this.runScene.helperEx.transContro.controlsMode,t=this.getLast();let r;this.runScene.events.mouse.enableUp=!1,this.runScene.helperEx.boxHelper.setFromObject(this.runScene.assetsEx.get().scene),r="position"===e?(0,Kr.VU)(t,this.runScene.sceneEx.get()):this.runScene.modelEx.cloneV3(t[e]),this.getInfo({model:t,type:e,newV3:r,oldV3:this.tempOldval}),this.tempOldval.copy(r)}}saveV3(e){this.getSelectedList("value").map((t=>{var r=(0,U.Ki)(t);this.savedV3.set(r,{model:t,type:e,val:this.runScene.modelEx.cloneV3(t[e])})}))}useV3(){var e=this.savedV3.map(((e,{type:t,val:r,model:n})=>new Wr.Z({target:n,info:t,newV3:this.runScene.modelEx.cloneV3(n[t]),oldV3:r,runScene:this.runScene})));this.runScene.undoEx.addUndo(e),this.savedV3.clear()}getInfo(e){const{model:t,type:r,newV3:n,oldV3:a}=e,i=this.getSelectedList("value");var{x:e,y:s,z:o}=n;const l=e-a.x,c=s-a.y,u=o-a.z;t[r].copy(n),i.map((e=>{if(e!==t){var{x:n,y:a,z:i}=e[r],n=n+=l,a=a+=c,i=i+=u;let t=e[r].clone();t.x=n,t.y=a,t.z=i,e[r].copy(t),this.boxHelperMap[e.uuid].setFromObject(e)}})),this.boxHelperMap[t.uuid].setFromObject(t)}getLast(){var e=this.getSelectedList("value");return e[e.length-1]}addBoxHelper(e){var t=this.runScene.helperEx.getBoxHelper(e);this.boxHelperMap[e.uuid]=t}removeBoxHelper(e){this.runScene.assetsEx.get().scene.remove(this.boxHelperMap[e.uuid]),this.boxHelperMap[e.uuid]=null,delete this.selectors[e.uuid]}remove(e){if(e instanceof Array)return e.map((e=>this.remove(e)));this.runScene.cb.model.unFocus.cb(e),this.selectors[e.uuid]=null,delete this.selectors[e.uuid]}isEmpty(){return 0===this.getSelectedList("key").length}getSelectedList(e){return"key"===e?Object.keys(this.selectors):Object.values(this.selectors)}getSelect(){var e=Object.values(this.selectors);return 0!==e.length?e:void 0}selectedLoop(e){return Object.keys(this.selectors).map((t=>e(t,this.selectors[t])))}delete(){this.setBoxHelperEmpty(),this.setEmpty(),this.runScene.helperEx.unfocus()}setBoxHelperEmpty(){var e=Object.values(this.boxHelperMap);this.runScene.assetsEx.get().scene.remove(...e),this.boxHelperMap={}}setEmpty(){this.isEmpty()||(this.getSelectedList("value").map((e=>{this.runScene.cb.model.unFocus.cb(e)})),this.setBoxHelperEmpty(),this.selectors={},this.runScene.cb.model.multiSelect.setEmpty.cb())}createGroup(){this.runScene.helperEx.unfocus(),this.runScene.modelEx.selectNull();var e=new s.Group;const t=new s.Group;this.runScene.modelEx.add(e,void 0,{addUndo:!1}),this.runScene.modelEx.add(t);var r=[...this.getSelectedList("value")],n=(this.runScene.cb.model.multipDrop.cb({models:this.getSelectedList("value"),dropModel:e}),(0,Kr.qg)(e));t.position.copy(n),this.runScene.cb.model.multipDrop.cb({models:r,dropModel:t}),this.runScene.modelEx.remove(e,!1),this.runScene.modelEx.select=t}getSelectorGroup(){const e=this.getSelectedList("value"),t=new s.Group;return e.forEach((e=>t.add(e.clone()))),this.setEmpty(),t}rename(e){const{prefix:t,rmPrefixLength:r,back:n,rmBackLength:a,fullName:i,step:s}=e,o=this.getSelectedList("value");0!==o.length&&(e=o.map(((e,o)=>{let l=e.name;if(0===i.length){if(0!==r){if(r>l.length)return;l=l.substring(r)}if(0!==a){if(a>l.length)return;l=l.substring(0,l.length-a)}0<t.length&&(l=t+l),0<n.length&&(l+=n)}else l=i+(o+1)*s;return new Hr.Z({target:e,info:"name",newVal:l,oldVal:e.name,runScene:this.runScene}).execute()})),this.runScene.undoEx.addUndo(e))}align(e){const t=this.getSelectedList("value");if(0!==t.length){const[n]=t;var r=t.map((t=>{var r=t.position.clone();const a=("all"===e?n:t).position.clone();return"all"!==e&&(a[e]=n.position[e]),new Wr.Z({target:t,info:"position",oldV3:r,newV3:a,runScene:this.runScene}).execute()}));this.runScene.multipSelector.add(t,!0),this.runScene.undoEx.addUndo(r)}}}function Zr(e){return(Zr="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})(e)}function Xr(e,t){return(Xr=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Qr(e){return(Qr=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Yr=function(e){var t=n;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Xr(t,e);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Qr(e);if(r=t?(r=Qr(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===Zr(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(){if(!(this instanceof n))throw new TypeError("Cannot call a class as a function");var e=n.SkyShader;return e=new s.ShaderMaterial({name:"SkyShader",fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:s.UniformsUtils.clone(e.uniforms),side:s.BackSide,depthWrite:!1}),(e=r.call(this,new s.BoxGeometry(1,1,1),e)).isSky=!0,e}return t=n,Object.defineProperty(t,"prototype",{writable:!1}),t}(s.Mesh),Jr=(Yr.SkyShader={uniforms:{turbidity:{value:2},rayleigh:{value:1},mieCoefficient:{value:.005},mieDirectionalG:{value:.8},sunPosition:{value:new s.Vector3},up:{value:new s.Vector3(0,1,0)}},vertexShader:"\n\t\tuniform vec3 sunPosition;\n\t\tuniform float rayleigh;\n\t\tuniform float turbidity;\n\t\tuniform float mieCoefficient;\n\t\tuniform vec3 up;\n\n\t\tvarying vec3 vWorldPosition;\n\t\tvarying vec3 vSunDirection;\n\t\tvarying float vSunfade;\n\t\tvarying vec3 vBetaR;\n\t\tvarying vec3 vBetaM;\n\t\tvarying float vSunE;\n\n\t\t// constants for atmospheric scattering\n\t\tconst float e = 2.71828182845904523536028747135266249775724709369995957;\n\t\tconst float pi = 3.141592653589793238462643383279502884197169;\n\n\t\t// wavelength of used primaries, according to preetham\n\t\tconst vec3 lambda = vec3( 680E-9, 550E-9, 450E-9 );\n\t\t// this pre-calcuation replaces older TotalRayleigh(vec3 lambda) function:\n\t\t// (8.0 * pow(pi, 3.0) * pow(pow(n, 2.0) - 1.0, 2.0) * (6.0 + 3.0 * pn)) / (3.0 * N * pow(lambda, vec3(4.0)) * (6.0 - 7.0 * pn))\n\t\tconst vec3 totalRayleigh = vec3( 5.804542996261093E-6, 1.3562911419845635E-5, 3.0265902468824876E-5 );\n\n\t\t// mie stuff\n\t\t// K coefficient for the primaries\n\t\tconst float v = 4.0;\n\t\tconst vec3 K = vec3( 0.686, 0.678, 0.666 );\n\t\t// MieConst = pi * pow( ( 2.0 * pi ) / lambda, vec3( v - 2.0 ) ) * K\n\t\tconst vec3 MieConst = vec3( 1.8399918514433978E14, 2.7798023919660528E14, 4.0790479543861094E14 );\n\n\t\t// earth shadow hack\n\t\t// cutoffAngle = pi / 1.95;\n\t\tconst float cutoffAngle = 1.6110731556870734;\n\t\tconst float steepness = 1.5;\n\t\tconst float EE = 1000.0;\n\n\t\tfloat sunIntensity( float zenithAngleCos ) {\n\t\t\tzenithAngleCos = clamp( zenithAngleCos, -1.0, 1.0 );\n\t\t\treturn EE * max( 0.0, 1.0 - pow( e, -( ( cutoffAngle - acos( zenithAngleCos ) ) / steepness ) ) );\n\t\t}\n\n\t\tvec3 totalMie( float T ) {\n\t\t\tfloat c = ( 0.2 * T ) * 10E-18;\n\t\t\treturn 0.434 * c * MieConst;\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvec4 worldPosition = modelMatrix * vec4( position, 1.0 );\n\t\t\tvWorldPosition = worldPosition.xyz;\n\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\tgl_Position.z = gl_Position.w; // set z to camera.far\n\n\t\t\tvSunDirection = normalize( sunPosition );\n\n\t\t\tvSunE = sunIntensity( dot( vSunDirection, up ) );\n\n\t\t\tvSunfade = 1.0 - clamp( 1.0 - exp( ( sunPosition.y / 450000.0 ) ), 0.0, 1.0 );\n\n\t\t\tfloat rayleighCoefficient = rayleigh - ( 1.0 * ( 1.0 - vSunfade ) );\n\n\t\t\t// extinction (absorbtion + out scattering)\n\t\t\t// rayleigh coefficients\n\t\t\tvBetaR = totalRayleigh * rayleighCoefficient;\n\n\t\t\t// mie coefficients\n\t\t\tvBetaM = totalMie( turbidity ) * mieCoefficient;\n\n\t\t}",fragmentShader:"\n\t\tvarying vec3 vWorldPosition;\n\t\tvarying vec3 vSunDirection;\n\t\tvarying float vSunfade;\n\t\tvarying vec3 vBetaR;\n\t\tvarying vec3 vBetaM;\n\t\tvarying float vSunE;\n\n\t\tuniform float mieDirectionalG;\n\t\tuniform vec3 up;\n\n\t\tconst vec3 cameraPos = vec3( 0.0, 0.0, 0.0 );\n\n\t\t// constants for atmospheric scattering\n\t\tconst float pi = 3.141592653589793238462643383279502884197169;\n\n\t\tconst float n = 1.0003; // refractive index of air\n\t\tconst float N = 2.545E25; // number of molecules per unit volume for air at 288.15K and 1013mb (sea level -45 celsius)\n\n\t\t// optical length at zenith for molecules\n\t\tconst float rayleighZenithLength = 8.4E3;\n\t\tconst float mieZenithLength = 1.25E3;\n\t\t// 66 arc seconds -> degrees, and the cosine of that\n\t\tconst float sunAngularDiameterCos = 0.999956676946448443553574619906976478926848692873900859324;\n\n\t\t// 3.0 / ( 16.0 * pi )\n\t\tconst float THREE_OVER_SIXTEENPI = 0.05968310365946075;\n\t\t// 1.0 / ( 4.0 * pi )\n\t\tconst float ONE_OVER_FOURPI = 0.07957747154594767;\n\n\t\tfloat rayleighPhase( float cosTheta ) {\n\t\t\treturn THREE_OVER_SIXTEENPI * ( 1.0 + pow( cosTheta, 2.0 ) );\n\t\t}\n\n\t\tfloat hgPhase( float cosTheta, float g ) {\n\t\t\tfloat g2 = pow( g, 2.0 );\n\t\t\tfloat inverse = 1.0 / pow( 1.0 - 2.0 * g * cosTheta + g2, 1.5 );\n\t\t\treturn ONE_OVER_FOURPI * ( ( 1.0 - g2 ) * inverse );\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvec3 direction = normalize( vWorldPosition - cameraPos );\n\n\t\t\t// optical length\n\t\t\t// cutoff angle at 90 to avoid singularity in next formula.\n\t\t\tfloat zenithAngle = acos( max( 0.0, dot( up, direction ) ) );\n\t\t\tfloat inverse = 1.0 / ( cos( zenithAngle ) + 0.15 * pow( 93.885 - ( ( zenithAngle * 180.0 ) / pi ), -1.253 ) );\n\t\t\tfloat sR = rayleighZenithLength * inverse;\n\t\t\tfloat sM = mieZenithLength * inverse;\n\n\t\t\t// combined extinction factor\n\t\t\tvec3 Fex = exp( -( vBetaR * sR + vBetaM * sM ) );\n\n\t\t\t// in scattering\n\t\t\tfloat cosTheta = dot( direction, vSunDirection );\n\n\t\t\tfloat rPhase = rayleighPhase( cosTheta * 0.5 + 0.5 );\n\t\t\tvec3 betaRTheta = vBetaR * rPhase;\n\n\t\t\tfloat mPhase = hgPhase( cosTheta, mieDirectionalG );\n\t\t\tvec3 betaMTheta = vBetaM * mPhase;\n\n\t\t\tvec3 Lin = pow( vSunE * ( ( betaRTheta + betaMTheta ) / ( vBetaR + vBetaM ) ) * ( 1.0 - Fex ), vec3( 1.5 ) );\n\t\t\tLin *= mix( vec3( 1.0 ), pow( vSunE * ( ( betaRTheta + betaMTheta ) / ( vBetaR + vBetaM ) ) * Fex, vec3( 1.0 / 2.0 ) ), clamp( pow( 1.0 - dot( up, vSunDirection ), 5.0 ), 0.0, 1.0 ) );\n\n\t\t\t// nightsky\n\t\t\tfloat theta = acos( direction.y ); // elevation --\x3e y-axis, [-pi/2, pi/2]\n\t\t\tfloat phi = atan( direction.z, direction.x ); // azimuth --\x3e x-axis [-pi/2, pi/2]\n\t\t\tvec2 uv = vec2( phi, theta ) / vec2( 2.0 * pi, pi ) + vec2( 0.5, 0.0 );\n\t\t\tvec3 L0 = vec3( 0.1 ) * Fex;\n\n\t\t\t// composition + solar disc\n\t\t\tfloat sundisk = smoothstep( sunAngularDiameterCos, sunAngularDiameterCos + 0.00002, cosTheta );\n\t\t\tL0 += ( vSunE * 19000.0 * Fex ) * sundisk;\n\n\t\t\tvec3 texColor = ( Lin + L0 ) * 0.04 + vec3( 0.0, 0.0003, 0.00075 );\n\n\t\t\tvec3 retColor = pow( texColor, vec3( 1.0 / ( 1.2 + ( 1.2 * vSunfade ) ) ) );\n\n\t\t\tgl_FragColor = vec4( retColor, 1.0 );\n\n\t\t\t#include <tonemapping_fragment>\n\t\t\t#include <encodings_fragment>\n\n\t\t}"},r(7585)),$r=r(6651);const en={color:"#000000",intensity:1};class tn{diff(e,t){const r={};return(0,i.mapObj)(en,(n=>{var a=e[n];(0,I.Xq)(a,t[n])&&(r[n]=a)})),r}setConfig(e,t){var{color:t,intensity:r,shadow:n}=t,{mapSize:n,camera:a}=n||{},{far:a,near:i,scale:s}=a||{};void 0!==s&&(e.shadow.camera.scale.x=s,e.shadow.camera.scale.y=s,e.shadow.camera.scale.z=s),void 0!==i&&(e.shadow.camera.near=i),void 0!==a&&(e.shadow.camera.far=a),void 0!==n&&(e.shadow.mapSize.x=n,e.shadow.mapSize.y=n),void 0!==r&&(e.intensity=r),void 0!==t&&(e.color=(0,Kr.e9)(t)),e.shadow.camera.updateProjectionMatrix(),null!=(s=e.cameraHelper)&&s.update()}}class rn extends o{constructor(){super(...arguments),this.allState=["morning","noon","evening","night"],this.sun=new ga.Vector3,this.light=new tn,this.sky=new Yr,this.baseLightConfig={name:"天空定向光",type:"DirectionalLight",castShadow:!0},this.skyData=this.getData(),this.lastTime={index:0,name:"morning"},this.skyChangeArr=[],this.lightChangeArr=[],this.uniforms=null,this.inied=!1,this.currentLightConfig={},this.backUpSkyData=this.getData(),this.currentAnimas=[],this.awaitAnimas=[],this.animaInstance=null,this.animaIndex={begin:0,end:0},this.getNromalFn=()=>{this.playSky()},this.getSpecialFn=()=>{var e=this.allState[0];this.setSkyConfig(e),this.setLightSpecialConfig(e),this.lightAnima(e),0!==this.animaIndex.end&&(this.currentAnimas=this.getAnimasDataByState(this.allState[this.animaIndex.end],e),this.playSky())}}init(){this.addScene(),this.initSnapshot()}initSnapshot(){this.runScene.cb.snapshot.create.add("sky",(e=>{e.data.set("sky",{state:this.skyData.currentState})})),this.runScene.cb.snapshot.set.add("sky",(e=>{(e=e.snapshot.data.get("sky"))&&e.state!==this.skyData.currentState&&this.setState(e.state)}))}initLight(){if(!this.directionalLight){var e=new Jr.Z(this.runScene).get();const[t]=e;this.runScene.lightEx.add(e,{addToTree:!1}),(this.directionalLight=t).name="skyLight"}}addScene(){this.initLight(),ot.materialIgnore.set(this.sky.material,!0),(0,h.setHelper)(this.sky),h.selectableModel.close(this.sky),h.selectableModel.close(this.directionalLight),(0,h.setHelper)(this.directionalLight),this.directionalLight.helper&&(this.directionalLight.helper.visible=!1),this.runScene.modelEx.add(this.sky,void 0,{addToTree:!1})}setOpen(e){const t=this.runScene.assetsEx.get().renderer;this.sky.visible!==e&&this.directionalLight&&(this.directionalLight.visible=e,t.toneMapping=e?4:0,this.skyData.isShow=e,this.sky.visible=e)}toJSON(){var{currentState:e,effectController:t,isShow:r,lightConfig:n,size:a}=this.skyData,e={currentState:e,effectController:t,isShow:r,lightConfig:n,size:a};if(0!==D.YD.objLength((0,I.ad)(e,this.getData())))return e}parseJSON(e){var t,r,n;e&&(({isShow:t,currentState:r,size:n}=e),this.skyData.isShow=t,this.initLight(),this.parseLightConfig(e),this.inied||(this.init(),this.inied=!0),this.parseSkyConfig(r,n),this.setOpen(t))}parseLightConfig(e){var t,{isShow:r,effectController:n,currentState:a,lightConfig:i,size:s}=e;e&&i&&(e=i.shadow,t=n[a].lightConfig,Jr.Z.setConfig(this.directionalLight,Object.assign(Object.assign({shadow:e},t),this.baseLightConfig)),this.directionalLight.visible=r,this.skyData.lightConfig=i,this.skyData.isShow=r,this.skyData.effectController=n,this.skyData.currentState=a,this.skyData.size=s,this.sky.visible=r,this.setLightSpecialConfig(a),this.lightAnima(a))}parseSkyConfig(e,t){this.setSkyConfig(e),this.setSkyScale(t)}setState(e){var t=this.skyData.currentState;this.doAnimaByState(e,t),this.runScene.cb.objects.sky.setState.cb({state:e}),this.saveLastTimeState({oldState:t,state:e,index:this.allState.findIndex((t=>t===e))})}saveLastTimeState(e){var{oldState:e,state:t,index:r}=e;this.lastTime.name=e,this.lastTime.index=r,this.skyData.currentState=t}getLightDataByState(e){let t=new ga.Vector3,r=new ga.Vector3;switch(e){case"morning":t.x=0,t.y=0,t.z=-this.skyData.size,r.x=0,r.y=this.skyData.size/2*-1,r.z=this.skyData.size/2;break;case"noon":t.x=0,t.y=this.skyData.size/2,t.z=0,r.x=0,r.y=-1*this.skyData.size,r.z=0;break;case"evening":case"night":t.x=0,t.y=0,t.z=this.skyData.size,r.x=0,r.y=this.skyData.size/2*-1,r.z=this.skyData.size/2*-1}return{position:t,targetPosition:r}}getIdxByState(e){return this.allState.findIndex((t=>t===e))}setSkyConfig(e){const{renderer:t,scene:r,camera:n}=this.runScene.assetsEx.get();this.sky.material.uniforms.turbidity.value=this.skyData.effectController[e].turbidity,this.sky.material.uniforms.mieCoefficient.value=this.skyData.effectController[e].mieCoefficient,this.sky.material.uniforms.mieDirectionalG.value=this.skyData.effectController[e].mieDirectionalG,t.toneMappingExposure=this.skyData.effectController[e].exposure,t.render(r,n);var a=ga.MathUtils.degToRad(90-this.skyData.effectController[e].elevation);e=ga.MathUtils.degToRad(this.skyData.effectController[e].azimuth),this.sun.setFromSphericalCoords(1,a,e),this.sky.material.uniforms.sunPosition.value.copy(this.sun)}setSkyScale(e){this.sky.scale.setScalar(e),this.skyData.size=e}setSky(e){var{state:e,type:t,val:r}=e;this.skyData.effectController[e][t]=r,this.setSkyConfig(e)}setCurrentState(e){this.skyData.currentState=e}setStateTime(e){var{info:e,time:t}=e;this.skyData.effectController[e].time=t}clean(){this.setOpen(!1),this.skyData=this.getData(),this.directionalLight&&this.runScene.modelEx.remove(this.directionalLight)}setLight(e,t){switch(e){case"mapSize":this.skyData.lightConfig.shadow.mapSize=t,this.directionalLight.shadow.mapSize.x=t,this.directionalLight.shadow.mapSize.y=t;break;case"near":this.skyData.lightConfig.shadow.camera.near=t,this.directionalLight.shadow.camera.near=t;break;case"far":this.skyData.lightConfig.shadow.camera.far=t,this.directionalLight.shadow.camera.far=t;break;case"scale":this.skyData.lightConfig.shadow.camera.scale=t,this.directionalLight.shadow.camera.scale.set(t,t,t);break;case"top":this.skyData.lightConfig.shadow.camera.top=t,this.skyData.lightConfig.shadow.camera.bottom=t,this.skyData.lightConfig.shadow.camera.left=t,this.skyData.lightConfig.shadow.camera.right=t,this.directionalLight.shadow.camera.top=t,this.directionalLight.shadow.camera.bottom=t,this.directionalLight.shadow.camera.left=t,this.directionalLight.shadow.camera.right=t,this.directionalLight.shadow.camera.updateProjectionMatrix(),null!=(r=this.directionalLight.cameraHelper)&&r.update();break;case"color":this.skyData.effectController[this.skyData.currentState].lightConfig.color=t;var r=new ga.Color(t);this.directionalLight.color=r;break;case"intensity":this.skyData.effectController[this.skyData.currentState].lightConfig.intensity=t,this.directionalLight.intensity=t}}setLightSpecialConfig(e){var{color:e,intensity:t}=this.skyData.effectController[e].lightConfig;this.directionalLight.color=(0,Kr.e9)(e),this.directionalLight.intensity=t}getAnimasDataByState(e,t){e=this.getIdxByState(e);const r=[];if((t=this.getIdxByState(t))<e){this.animaIndex={begin:e,end:t};var n=e-t;let l=t;for(let e=0;e<n;e++){var{color:a,intensity:i}=this.skyData.effectController[this.allState[l]].lightConfig,{position:s,targetPosition:o}=this.getLightDataByState(this.allState[l]),{color:a,intensity:i}=(r.push({data:this.transDataToAnimaData({sky:this.skyData.effectController[this.allState[l]],color:a,intensity:i,position:s,targetPosition:o})}),l++,this.skyData.effectController[this.allState[l]].lightConfig),{position:s,targetPosition:o}=this.getLightDataByState(this.allState[l]);r.push({data:this.transDataToAnimaData({sky:this.skyData.effectController[this.allState[l]],color:a,intensity:i,position:s,targetPosition:o}),onDone:this.getNromalFn})}}else{var l=3-t;this.animaIndex={begin:t,end:e};let n=t;if(0==l)return r.push({onDone:this.getSpecialFn}),r;for(let e=0;e<l;e++){var{color:c,intensity:u}=this.skyData.effectController[this.allState[n]].lightConfig,{position:h,targetPosition:d}=this.getLightDataByState(this.allState[n]),{position:h,targetPosition:d}=(r.push({data:this.transDataToAnimaData({sky:this.skyData.effectController[this.allState[n]],color:c,intensity:u,position:h,targetPosition:d})}),n++,this.getLightDataByState(this.allState[n]));r.push({data:this.transDataToAnimaData({sky:this.skyData.effectController[this.allState[n]],color:c,intensity:u,position:h,targetPosition:d}),onDone:3===n?this.getSpecialFn:this.getNromalFn})}}return r}playSky(){if(0!==this.currentAnimas.length){const t=this.currentAnimas.shift();var e=this.currentAnimas.shift();if(!e)return t.onDone();this.playAnima(t,e)}}playAnima(e,t){const r=this.runScene.assetsEx.get().renderer;this.animaInstance=u.anima(Object.assign(Object.assign({},e.data),{x:this.directionalLight.position.x,y:this.directionalLight.position.y,z:this.directionalLight.position.z,tx:this.directionalLight.target.position.x,ty:this.directionalLight.target.position.y,tz:this.directionalLight.target.position.z}),Object.assign(Object.assign({},t.data),{ease:"none"}),e.data.time,(e=>{var{r:n,g:a,b:i}=e,s=(this.onUpdated(e),this.sky.material.uniforms.turbidity.value=e.turbidity,this.sky.material.uniforms.mieCoefficient.value=e.mieCoefficient,this.sky.material.uniforms.mieDirectionalG.value=e.mieDirectionalG,r.toneMappingExposure=e.exposure,ga.MathUtils.degToRad(90-e.elevation)),o=ga.MathUtils.degToRad(t.data.azimuth);this.sun.setFromSphericalCoords(1,s,o),this.sky.material.uniforms.sunPosition.value.copy(this.sun),s=new ga.Color(n,a,i),this.directionalLight.color=s,this.directionalLight.intensity=e.intensity,this.directionalLight.position.set(e.x,e.y,e.z),this.directionalLight.target.position.set(e.tx,e.ty,e.tz)}),(()=>{t.onDone(),this.animaInstance=null}))}doAnimaByState(e,t){e=this.getAnimasDataByState(e,t),this.animaInstance?this.awaitAnimas=e:(this.currentAnimas=e,this.playSky())}onUpdated(e){var t;0!==this.awaitAnimas.length&&(this.animaInstance.kill(),this.animaInstance=null,[t]=this.awaitAnimas,this.currentAnimas=[...this.awaitAnimas],this.awaitAnimas=[],null!=t&&t.data&&(this.currentAnimas.unshift({data:t.data,onDone:this.getNromalFn}),this.currentAnimas.unshift({data:e})),this.playSky())}lightAnima(e){var{position:e,targetPosition:t}=this.getLightDataByState(e);this.directionalLight.position.set(e.x,e.y,e.z),this.directionalLight.target.position.set(t.x,t.y,t.z)}transDataToAnimaData(e){var{sky:e,color:t,position:r,targetPosition:n,intensity:a}=e,{x:r,y:i,z:s}=r,{x:n,y:o,z:l}=n,{r:t,g:c,b:u}=(0,I.fh)((0,I.I8)(t));return Object.assign(Object.assign({},e),{r:t,g:c,b:u,x:r,y:i,z:s,tx:n,ty:o,tz:l,intensity:a})}getData(){return{isShow:!1,size:5e3,lightConfig:{shadow:{mapSize:512,camera:{near:.5,far:500,scale:1,top:5,bottom:5,left:5,right:5}}},effectController:{morning:{turbidity:2,rayleigh:1,mieCoefficient:.007,mieDirectionalG:.7,elevation:0,azimuth:180,exposure:.3,lightConfig:Object.assign(Object.assign({},(0,$r.d9)(en)),{color:"#3DC1F1"}),time:1},noon:{turbidity:1,rayleigh:1,mieCoefficient:.005,mieDirectionalG:.7,elevation:90,azimuth:180,exposure:1,time:1,lightConfig:Object.assign(Object.assign({},(0,$r.d9)(en)),{color:"#FFFFFF"})},evening:{turbidity:2,rayleigh:.3,mieCoefficient:.011,mieDirectionalG:.67,elevation:3,azimuth:0,exposure:.3762,lightConfig:Object.assign(Object.assign({},(0,$r.d9)(en)),{color:"#FFFFFF"}),time:1},night:{turbidity:1,rayleigh:1,mieCoefficient:.005,mieDirectionalG:.7,elevation:2,azimuth:0,exposure:.2624,lightConfig:Object.assign(Object.assign({},(0,$r.d9)(en)),{color:"#B8A277"}),time:1}},currentState:"morning"}}}class nn{constructor(e){this.clean=()=>{this.sky.clean()},this.sky=new rn(e),this.runScene=e,this.runScene.cb.clean.add("Objects",this.clean)}init(){}toJSON(){return{sky:this.sky.toJSON()}}parseJSON(e){this.sky.parseJSON(e.sky)}}function an(){var e=0,t=document.createElement("div");function r(e){return t.appendChild(e.dom),e}function n(r){for(var n=0;n<t.children.length;n++)t.children[n].style.display=n===r?"block":"none";e=r}t.style.cssText="position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000",t.addEventListener("click",(function(r){r.preventDefault(),n(++e%t.children.length)}),!1);var a,i=(performance||Date).now(),s=i,o=0,l=r(new an.Panel("FPS","#0ff","#002")),c=r(new an.Panel("MS","#0f0","#020"));return self.performance&&self.performance.memory&&(a=r(new an.Panel("MB","#f08","#201"))),n(0),{REVISION:16,dom:t,addPanel:r,showPanel:n,begin:function(){i=(performance||Date).now()},end:function(){o++;var e,t=(performance||Date).now();return c.update(t-i,200),s+1e3<=t&&(l.update(1e3*o/(t-s),100),s=t,o=0,a&&(e=performance.memory,a.update(e.usedJSHeapSize/1048576,e.jsHeapSizeLimit/1048576))),t},update:function(){i=this.end()},domElement:t,setMode:n}}an.Panel=function(e,t,r){var n=1/0,a=0,i=Math.round,s=i(window.devicePixelRatio||1),o=80*s,l=48*s,c=3*s,u=2*s,h=3*s,d=15*s,p=74*s,f=30*s,m=document.createElement("canvas"),g=(m.width=o,m.height=l,m.style.cssText="width:80px;height:48px",m.getContext("2d"));return g.font="bold "+9*s+"px Helvetica,Arial,sans-serif",g.textBaseline="top",g.fillStyle=r,g.fillRect(0,0,o,l),g.fillStyle=t,g.fillText(e,c,u),g.fillRect(h,d,p,f),g.fillStyle=r,g.globalAlpha=.9,g.fillRect(h,d,p,f),{dom:m,update:function(l,v){n=Math.min(n,l),a=Math.max(a,l),g.fillStyle=r,g.globalAlpha=1,g.fillRect(0,0,o,d),g.fillStyle=t,g.fillText(i(l)+" "+e+" ("+i(n)+"-"+i(a)+")",c,u),g.drawImage(m,h+s,d,p-s,f,h,d,p-s,f),g.fillRect(h+p-s,d,s,f),g.fillStyle=r,g.globalAlpha=.9,g.fillRect(h+p-s,d,s,i((1-l/v)*f))}}};const sn=an;class on{constructor(e,t){this.options={msg:{show:!1,level:"base"},run:!0,decodePath:"./draco/",showFps:!1,loadInterval:2e3,mode:"running",hideLocal:!1,instanceClone:!0,render2:!1,render3:!1,coverSameId:!1,renderConfig:{mode:"tick",frame:-1,scriptFrame:-1,matrixAutoUpdate:!1},event:{base:"dom"},texture:{load:!0,lazyLoad:{open:!1,intervalTime:16.6},quality:1}},this.exporterOptions={compressTexture:!1,notMaterial:!1,outTime:(0,u.getTime)(7)},this.sceneOptions={loaded:!1},this.setLoadInterval=(()=>{let e=null;return t=>{const{inputInterval:r,cb:n}=t;e&&clearTimeout(e),e=setTimeout((()=>{n(),e=null,clearTimeout(e)}),r)}})(),this.runScene=e,this.options=(0,u.deepMergeObject)(this.options,t||{})}init(e){this.options.showFps&&(this.addFps(e),this.runScene.cb.render.add("optionx-ex-render",this.render.bind(this)))}addFps(e){this.stats=sn(),this.stats.showPanel(0),e.appendChild(this.stats.dom)}render(){var e;null!=(e=this.stats)&&e.update()}log(e,t="detail",r="success"){var n;null!=(n=null==(n=this.options)?void 0:n.msg)&&n.show&&("base"===this.options.msg.level&&"base"===t&&this.runScene.cb.baseLog.cb({msg:e,type:r}),console.log(e))}}class ln{constructor(e){this.glowModelLength=new Set,this.outlineModelLength=new Set,this.runScene=e,this.initGlow(),this.initOutline()}initGlow(){const{setLayers:e,add:t,remove:r}=this.runScene.cb.model;e.add("pp-set-glow",(e=>{var{model:e,val:t}=e;0===t&&0===this.glowModelLength.size||this[0===t?"glowRemove":"glowAdd"](e)})),t.add("pp-set-glow",(({model:e})=>{1!==e.layers.mask&&this.glowAdd(e)})),r.add("pp-set-glow",(({model:e})=>{1!==e.layers.mask&&this.glowRemove(e)}))}glowAdd(e){this.glowModelLength.add(e.userData.id),0<this.glowModelLength.size&&(this.runScene.cb.pp.glow.setStatus.cb(!0),this.runScene.pp.params.glow.isBloom=!0)}glowRemove(e){this.glowModelLength.delete(e.userData.id),this.glowModelLength.size<=0&&(this.runScene.cb.pp.glow.setStatus.cb(!1),this.runScene.pp.params.glow.isBloom=!1)}initOutline(){const{setOutline:e,add:t,remove:r}=this.runScene.cb.model;e.add("pp-set-outline",(e=>{var{model:e,val:t}=e;!t&&0===this.outlineModelLength.size||this[t?"outlineAdd":"outlineRemove"](e)})),t.add("pp-set-outline",(({model:e})=>{e.userData.outline&&this.outlineAdd(e)})),r.add("pp-set-outline",(({model:e})=>{e.userData.outline&&this.outlineRemove(e)}))}outlineAdd(e){this.outlineModelLength.add(e.userData.id),0<this.outlineModelLength.size&&(this.runScene.cb.pp.outline.setStatus.cb(!0),this.runScene.pp.params.outline.isOutline=!0)}outlineRemove(e){this.outlineModelLength.delete(e.userData.id),this.outlineModelLength.size<=0&&(this.runScene.cb.pp.outline.setStatus.cb(!1),this.runScene.pp.params.outline.isOutline=!1)}}var cn=r(6608),un=r(5180),hn=r(4819),dn={shaderID:"luminosityHighPass",uniforms:{tDiffuse:{value:null},luminosityThreshold:{value:1},smoothWidth:{value:1},defaultColor:{value:new s.Color(0)},defaultOpacity:{value:0}},vertexShader:"\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",fragmentShader:"\n\n\t\tuniform sampler2D tDiffuse;\n\t\tuniform vec3 defaultColor;\n\t\tuniform float defaultOpacity;\n\t\tuniform float luminosityThreshold;\n\t\tuniform float smoothWidth;\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvec4 texel = texture2D( tDiffuse, vUv );\n\n\t\t\tvec3 luma = vec3( 0.299, 0.587, 0.114 );\n\n\t\t\tfloat v = dot( texel.xyz, luma );\n\n\t\t\tvec4 outputColor = vec4( defaultColor.rgb, defaultOpacity );\n\n\t\t\tfloat alpha = smoothstep( luminosityThreshold, luminosityThreshold + smoothWidth, v );\n\n\t\t\tgl_FragColor = mix( outputColor, texel, alpha );\n\n\t\t}"};function pn(e){return(pn="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})(e)}function fn(e,t){return(fn=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function mn(e){return(mn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var gn=function(e){var t=n;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&fn(t,e);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=mn(e);if(r=t?(r=mn(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===pn(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(e,t,a,i){var o;if(!(this instanceof n))throw new TypeError("Cannot call a class as a function");(o=r.call(this)).strength=void 0!==t?t:1,o.radius=a,o.threshold=i,o.resolution=void 0!==e?new s.Vector2(e.x,e.y):new s.Vector2(256,256),o.clearColor=new s.Color(0,0,0),o.renderTargetsHorizontal=[],o.renderTargetsVertical=[],o.nMips=5;var l=Math.round(o.resolution.x/2),c=Math.round(o.resolution.y/2);o.renderTargetBright=new s.WebGLRenderTarget(l,c),o.renderTargetBright.texture.name="UnrealBloomPass.bright",o.renderTargetBright.texture.generateMipmaps=!1;for(var u=0;u<o.nMips;u++){var h;((h=new s.WebGLRenderTarget(l,c)).texture.name="UnrealBloomPass.h"+u,h.texture.generateMipmaps=!1,o.renderTargetsHorizontal.push(h),h=new s.WebGLRenderTarget(l,c)).texture.name="UnrealBloomPass.v"+u,h.texture.generateMipmaps=!1,o.renderTargetsVertical.push(h),l=Math.round(l/2),c=Math.round(c/2)}a=dn;for(var d=(o.highPassUniforms=s.UniformsUtils.clone(a.uniforms),o.highPassUniforms.luminosityThreshold.value=i,o.highPassUniforms.smoothWidth.value=.01,o.materialHighPassFilter=new s.ShaderMaterial({uniforms:o.highPassUniforms,vertexShader:a.vertexShader,fragmentShader:a.fragmentShader,defines:{}}),o.separableBlurMaterials=[],[3,5,7,9,11]),p=(l=Math.round(o.resolution.x/2),c=Math.round(o.resolution.y/2),0);p<o.nMips;p++)o.separableBlurMaterials.push(o.getSeperableBlurMaterial(d[p])),o.separableBlurMaterials[p].uniforms.texSize.value=new s.Vector2(l,c),l=Math.round(l/2),c=Math.round(c/2);return o.compositeMaterial=o.getCompositeMaterial(o.nMips),o.compositeMaterial.uniforms.blurTexture1.value=o.renderTargetsVertical[0].texture,o.compositeMaterial.uniforms.blurTexture2.value=o.renderTargetsVertical[1].texture,o.compositeMaterial.uniforms.blurTexture3.value=o.renderTargetsVertical[2].texture,o.compositeMaterial.uniforms.blurTexture4.value=o.renderTargetsVertical[3].texture,o.compositeMaterial.uniforms.blurTexture5.value=o.renderTargetsVertical[4].texture,o.compositeMaterial.uniforms.bloomStrength.value=t,o.compositeMaterial.uniforms.bloomRadius.value=.1,o.compositeMaterial.needsUpdate=!0,o.compositeMaterial.uniforms.bloomFactors.value=[1,.8,.6,.4,.2],o.bloomTintColors=[new s.Vector3(1,1,1),new s.Vector3(1,1,1),new s.Vector3(1,1,1),new s.Vector3(1,1,1),new s.Vector3(1,1,1)],o.compositeMaterial.uniforms.bloomTintColors.value=o.bloomTintColors,e=cn.C,o.copyUniforms=s.UniformsUtils.clone(e.uniforms),o.copyUniforms.opacity.value=1,o.materialCopy=new s.ShaderMaterial({uniforms:o.copyUniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader,blending:s.AdditiveBlending,depthTest:!1,depthWrite:!1,transparent:!0}),o.enabled=!0,o.needsSwap=!1,o._oldClearColor=new s.Color,o.oldClearAlpha=1,o.basic=new s.MeshBasicMaterial,o.fsQuad=new hn.T(null),o}return t=n,(e=[{key:"dispose",value:function(){for(var e=0;e<this.renderTargetsHorizontal.length;e++)this.renderTargetsHorizontal[e].dispose();for(var t=0;t<this.renderTargetsVertical.length;t++)this.renderTargetsVertical[t].dispose();this.renderTargetBright.dispose();for(var r=0;r<this.separableBlurMaterials.length;r++)this.separableBlurMaterials[r].dispose();this.compositeMaterial.dispose(),this.materialCopy.dispose(),this.basic.dispose(),this.fsQuad.dispose()}},{key:"setSize",value:function(e,t){var r=Math.round(e/2),n=Math.round(t/2);this.renderTargetBright.setSize(r,n);for(var a=0;a<this.nMips;a++)this.renderTargetsHorizontal[a].setSize(r,n),this.renderTargetsVertical[a].setSize(r,n),this.separableBlurMaterials[a].uniforms.texSize.value=new s.Vector2(r,n),r=Math.round(r/2),n=Math.round(n/2)}},{key:"render",value:function(e,t,r,a,i){e.getClearColor(this._oldClearColor),this.oldClearAlpha=e.getClearAlpha();for(var s=e.autoClear,o=(e.autoClear=!1,e.setClearColor(this.clearColor,0),i&&e.state.buffers.stencil.setTest(!1),this.renderToScreen&&(this.fsQuad.material=this.basic,this.basic.map=r.texture,e.setRenderTarget(null),e.clear(),this.fsQuad.render(e)),this.highPassUniforms.tDiffuse.value=r.texture,this.highPassUniforms.luminosityThreshold.value=this.threshold,this.fsQuad.material=this.materialHighPassFilter,e.setRenderTarget(this.renderTargetBright),e.clear(),this.fsQuad.render(e),this.renderTargetBright),l=0;l<this.nMips;l++)this.fsQuad.material=this.separableBlurMaterials[l],this.separableBlurMaterials[l].uniforms.colorTexture.value=o.texture,this.separableBlurMaterials[l].uniforms.direction.value=n.BlurDirectionX,e.setRenderTarget(this.renderTargetsHorizontal[l]),e.clear(),this.fsQuad.render(e),this.separableBlurMaterials[l].uniforms.colorTexture.value=this.renderTargetsHorizontal[l].texture,this.separableBlurMaterials[l].uniforms.direction.value=n.BlurDirectionY,e.setRenderTarget(this.renderTargetsVertical[l]),e.clear(),this.fsQuad.render(e),o=this.renderTargetsVertical[l];this.fsQuad.material=this.compositeMaterial,this.compositeMaterial.uniforms.bloomStrength.value=this.strength,this.compositeMaterial.uniforms.bloomRadius.value=this.radius,this.compositeMaterial.uniforms.bloomTintColors.value=this.bloomTintColors,e.setRenderTarget(this.renderTargetsHorizontal[0]),e.clear(),this.fsQuad.render(e),this.fsQuad.material=this.materialCopy,this.copyUniforms.tDiffuse.value=this.renderTargetsHorizontal[0].texture,i&&e.state.buffers.stencil.setTest(!0),this.renderToScreen?e.setRenderTarget(null):e.setRenderTarget(r),this.fsQuad.render(e),e.setClearColor(this._oldClearColor,this.oldClearAlpha),e.autoClear=s}},{key:"getSeperableBlurMaterial",value:function(e){return new s.ShaderMaterial({defines:{KERNEL_RADIUS:e,SIGMA:e},uniforms:{colorTexture:{value:null},texSize:{value:new s.Vector2(.5,.5)},direction:{value:new s.Vector2(.5,.5)}},vertexShader:"varying vec2 vUv;\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}",fragmentShader:"#include <common>\n\t\t\t\tvarying vec2 vUv;\n\t\t\t\tuniform sampler2D colorTexture;\n\t\t\t\tuniform vec2 texSize;\n\t\t\t\tuniform vec2 direction;\n\n\t\t\t\tfloat gaussianPdf(in float x, in float sigma) {\n\t\t\t\t\treturn 0.39894 * exp( -0.5 * x * x/( sigma * sigma))/sigma;\n\t\t\t\t}\n\t\t\t\tvoid main() {\n\t\t\t\t\tvec2 invSize = 1.0 / texSize;\n\t\t\t\t\tfloat fSigma = float(SIGMA);\n\t\t\t\t\tfloat weightSum = gaussianPdf(0.0, fSigma);\n\t\t\t\t\tvec3 diffuseSum = texture2D( colorTexture, vUv).rgb * weightSum;\n\t\t\t\t\tfor( int i = 1; i < KERNEL_RADIUS; i ++ ) {\n\t\t\t\t\t\tfloat x = float(i);\n\t\t\t\t\t\tfloat w = gaussianPdf(x, fSigma);\n\t\t\t\t\t\tvec2 uvOffset = direction * invSize * x;\n\t\t\t\t\t\tvec3 sample1 = texture2D( colorTexture, vUv + uvOffset).rgb;\n\t\t\t\t\t\tvec3 sample2 = texture2D( colorTexture, vUv - uvOffset).rgb;\n\t\t\t\t\t\tdiffuseSum += (sample1 + sample2) * w;\n\t\t\t\t\t\tweightSum += 2.0 * w;\n\t\t\t\t\t}\n\t\t\t\t\tgl_FragColor = vec4(diffuseSum/weightSum, 1.0);\n\t\t\t\t}"})}},{key:"getCompositeMaterial",value:function(e){return new s.ShaderMaterial({defines:{NUM_MIPS:e},uniforms:{blurTexture1:{value:null},blurTexture2:{value:null},blurTexture3:{value:null},blurTexture4:{value:null},blurTexture5:{value:null},bloomStrength:{value:1},bloomFactors:{value:null},bloomTintColors:{value:null},bloomRadius:{value:0}},vertexShader:"varying vec2 vUv;\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}",fragmentShader:"varying vec2 vUv;\n\t\t\t\tuniform sampler2D blurTexture1;\n\t\t\t\tuniform sampler2D blurTexture2;\n\t\t\t\tuniform sampler2D blurTexture3;\n\t\t\t\tuniform sampler2D blurTexture4;\n\t\t\t\tuniform sampler2D blurTexture5;\n\t\t\t\tuniform float bloomStrength;\n\t\t\t\tuniform float bloomRadius;\n\t\t\t\tuniform float bloomFactors[NUM_MIPS];\n\t\t\t\tuniform vec3 bloomTintColors[NUM_MIPS];\n\n\t\t\t\tfloat lerpBloomFactor(const in float factor) {\n\t\t\t\t\tfloat mirrorFactor = 1.2 - factor;\n\t\t\t\t\treturn mix(factor, mirrorFactor, bloomRadius);\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\t\t\t\t\tgl_FragColor = bloomStrength * ( lerpBloomFactor(bloomFactors[0]) * vec4(bloomTintColors[0], 1.0) * texture2D(blurTexture1, vUv) +\n\t\t\t\t\t\tlerpBloomFactor(bloomFactors[1]) * vec4(bloomTintColors[1], 1.0) * texture2D(blurTexture2, vUv) +\n\t\t\t\t\t\tlerpBloomFactor(bloomFactors[2]) * vec4(bloomTintColors[2], 1.0) * texture2D(blurTexture3, vUv) +\n\t\t\t\t\t\tlerpBloomFactor(bloomFactors[3]) * vec4(bloomTintColors[3], 1.0) * texture2D(blurTexture4, vUv) +\n\t\t\t\t\t\tlerpBloomFactor(bloomFactors[4]) * vec4(bloomTintColors[4], 1.0) * texture2D(blurTexture5, vUv) );\n\t\t\t\t}"})}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),n}(hn.w);gn.BlurDirectionX=new s.Vector2(1,0),gn.BlurDirectionY=new s.Vector2(0,1);class vn extends hn.w{constructor(e,t,r){super(),this.baseTextureID=void 0!==t?t:"tDiffuse",this.effectTextureID=void 0!==r?r:"tDiffuse",e instanceof s.ShaderMaterial?(this.uniforms=e.uniforms,this.material=e):e&&(this.uniforms=s.UniformsUtils.clone(e.uniforms),this.material=new s.ShaderMaterial({defines:Object.assign({},e.defines),uniforms:this.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader})),this.fsQuad=new hn.T(this.material)}render(e,t,r){this.uniforms[this.baseTextureID]&&(this.uniforms[this.baseTextureID].value=t.texture),this.uniforms[this.effectTextureID]&&(this.uniforms[this.effectTextureID].value=r.texture),this.fsQuad.material=this.material,this.renderToScreen?e.setRenderTarget(null):(e.setRenderTarget(t),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil)),this.fsQuad.render(e)}}class bn extends hn.w{constructor(e,t,r,n,a){super(),this.scene=e,this.camera=t,this.layerIndex=0,this.overrideMaterial=r,this.clearColor=n,this.clearAlpha=void 0!==a?a:0,this.clear=!0,this.clearDepth=!1,this.needsSwap=!1,this.oldClearColor=new s.Color,this.oldCameraLayer=t.layers.mask}render(e,t,r){var n=e.autoClear;let a,i;e.autoClear=!1,void 0!==this.overrideMaterial&&(i=this.scene.overrideMaterial,this.scene.overrideMaterial=this.overrideMaterial),this.clearColor&&(e.getClearColor(this.oldClearColor),a=e.getClearAlpha(),e.setClearColor(this.clearColor,this.clearAlpha)),this.sceneBg&&(this.scene.background=null),e.setRenderTarget(this.renderToScreen?null:r),this.clear&&e.clear(e.autoClearColor,this.clearDepth,e.autoClearStencil),this.camera.layers.set(this.layerIndex),e.render(this.scene,this.camera),this.camera.layers.mask=this.oldCameraLayer,this.scene.background=this.sceneBg,this.clearColor&&e.setClearColor(this.oldClearColor,a),void 0!==this.overrideMaterial&&(this.scene.overrideMaterial=i),this.scene.background=this.sceneBg,e.autoClear=n}}const yn={uniforms:{baseTexture:{value:null},bloomTexture:{value:null}},vertexShader:"\n varying vec2 vUv;\n \n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n }\n ",fragmentShader:"\n uniform sampler2D baseTexture;\n uniform sampler2D bloomTexture;\n \n varying vec2 vUv;\n \n void main() {\n vec4 lastColor = texture2D(baseTexture, vUv);\n \n // gl_FragColor = lastColor;\n // gl_FragColor = texture2D(bloomTexture, vUv);\n gl_FragColor = lastColor + texture2D(bloomTexture, vUv);\n }\n "};class xn{constructor(e){this.mtuPP=e,this.mtuPP.renderer&&this.postProcessing()}postProcessing(){this.bloomRenderPass?(this.bloomRenderPass.scene=this.mtuPP.mainScene,this.bloomRenderPass.camera=this.mtuPP.mainCamera):(this.bloomRenderPass=new bn(this.mtuPP.mainScene,this.mtuPP.mainCamera),this.bloomRenderPass.layerIndex=this.mtuPP.BLOOM_SCENE,this.bloomRenderPass.clearDepth=!1),this.bloomPass?this.bloomPass.setSize(this.mtuPP.rtSize.x,this.mtuPP.rtSize.y):this.bloomPass=new gn(this.mtuPP.rtSize,1.5,.4,.85),this.bloomPass.radius=this.mtuPP.params.glow.radius,this.bloomPass.strength=this.mtuPP.params.glow.strength,this.bloomPass.threshold=this.mtuPP.params.glow.threshold,this.mixingPass||(this.mixingPass=new vn(yn,"baseTexture","bloomTexture"),this.mixingPass.renderToScreen=!1),this.effectCopy||(this.effectCopy=new un.T(cn.C),this.effectCopy.clear=!1,this.effectCopy.renderToScreen=!1,this.effectCopy.needsSwap=!1,this.effectCopy.material.depthWrite=!1),this.mtuPP.effectComposer.addPass(this.effectCopy),this.mtuPP.effectComposer.addPass(this.bloomRenderPass),this.mtuPP.effectComposer.addPass(this.bloomPass),this.mtuPP.effectComposer.addPass(this.mixingPass)}setGlowData(e,t){this.bloomPass[e]=t}dispose(){this.bloomRenderPass=null,this.bloomPass&&(this.bloomPass.dispose(),this.bloomPass=null),this.mixingPass=null,this.effectCopy=null}setSceneBg(){this.bloomRenderPass&&(this.bloomRenderPass.sceneBg=this.mtuPP.sceneBackground)}enablePass(e){this.bloomRenderPass&&this.bloomRenderPass.enabled!==e&&(this.bloomRenderPass.enabled=e,this.bloomPass.enabled=e,this.mixingPass.enabled=e,this.effectCopy.enabled=e)}}function wn(e){return(wn="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})(e)}function Sn(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Mn(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Tn(e,t,r){t&&Mn(e.prototype,t),r&&Mn(e,r),Object.defineProperty(e,"prototype",{writable:!1})}function _n(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&&En(e,t)}function En(e,t){return(En=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function kn(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Dn(e);if(r=t?(r=Dn(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===wn(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function Dn(e){return(Dn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var On=function(){_n(t,hn.w);var e=kn(t);function t(r,n){var a;return Sn(this,t),(a=e.call(this)).scene=r,a.camera=n,a.clear=!0,a.needsSwap=!1,a.inverse=!1,a}return Tn(t,[{key:"render",value:function(e,t,r){var n,a,i=e.getContext(),s=e.state;s.buffers.color.setMask(!1),s.buffers.depth.setMask(!1),s.buffers.color.setLocked(!0),s.buffers.depth.setLocked(!0),a=this.inverse?(n=0,1):(n=1,0),s.buffers.stencil.setTest(!0),s.buffers.stencil.setOp(i.REPLACE,i.REPLACE,i.REPLACE),s.buffers.stencil.setFunc(i.ALWAYS,n,4294967295),s.buffers.stencil.setClear(a),s.buffers.stencil.setLocked(!0),e.setRenderTarget(r),this.clear&&e.clear(),e.render(this.scene,this.camera),e.setRenderTarget(t),this.clear&&e.clear(),e.render(this.scene,this.camera),s.buffers.color.setLocked(!1),s.buffers.depth.setLocked(!1),s.buffers.stencil.setLocked(!1),s.buffers.stencil.setFunc(i.EQUAL,1,4294967295),s.buffers.stencil.setOp(i.KEEP,i.KEEP,i.KEEP),s.buffers.stencil.setLocked(!0)}}]),t}(),Pn=function(){_n(t,hn.w);var e=kn(t);function t(){var r;return Sn(this,t),(r=e.call(this)).needsSwap=!1,r}return Tn(t,[{key:"render",value:function(e){e.state.buffers.stencil.setLocked(!1),e.state.buffers.stencil.setTest(!1)}}]),t}();var An=function(){function e(t,r){var n;if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");this.renderer=t,void 0===r?(n=t.getSize(new s.Vector2),this._pixelRatio=t.getPixelRatio(),this._width=n.width,this._height=n.height,(r=new s.WebGLRenderTarget(this._width*this._pixelRatio,this._height*this._pixelRatio)).texture.name="EffectComposer.rt1"):(this._pixelRatio=1,this._width=r.width,this._height=r.height),this.renderTarget1=r,this.renderTarget2=r.clone(),this.renderTarget2.texture.name="EffectComposer.rt2",this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2,this.renderToScreen=!0,this.passes=[],this.copyPass=new un.T(cn.C),this.clock=new s.Clock}var t,r;return t=e,(r=[{key:"swapBuffers",value:function(){var e=this.readBuffer;this.readBuffer=this.writeBuffer,this.writeBuffer=e}},{key:"addPass",value:function(e){this.passes.push(e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}},{key:"insertPass",value:function(e,t){this.passes.splice(t,0,e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}},{key:"removePass",value:function(e){-1!==(e=this.passes.indexOf(e))&&this.passes.splice(e,1)}},{key:"isLastEnabledPass",value:function(e){for(var t=e+1;t<this.passes.length;t++)if(this.passes[t].enabled)return!1;return!0}},{key:"render",value:function(e){void 0===e&&(e=this.clock.getDelta());for(var t=this.renderer.getRenderTarget(),r=!1,n=0,a=this.passes.length;n<a;n++){var i,s,o=this.passes[n];!1!==o.enabled&&(o.renderToScreen=this.renderToScreen&&this.isLastEnabledPass(n),o.render(this.renderer,this.writeBuffer,this.readBuffer,e,r),o.needsSwap&&(r&&(i=this.renderer.getContext(),(s=this.renderer.state.buffers.stencil).setFunc(i.NOTEQUAL,1,4294967295),this.copyPass.render(this.renderer,this.writeBuffer,this.readBuffer,e),s.setFunc(i.EQUAL,1,4294967295)),this.swapBuffers()),void 0!==On&&(o instanceof On?r=!0:o instanceof Pn&&(r=!1)))}this.renderer.setRenderTarget(t)}},{key:"reset",value:function(e){var t;void 0===e&&(t=this.renderer.getSize(new s.Vector2),this._pixelRatio=this.renderer.getPixelRatio(),this._width=t.width,this._height=t.height,(e=this.renderTarget1.clone()).setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)),this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.renderTarget1=e,this.renderTarget2=e.clone(),this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2}},{key:"setSize",value:function(e,t){this._width=e,this._height=t;var r=this._width*this._pixelRatio,n=this._height*this._pixelRatio;this.renderTarget1.setSize(r,n),this.renderTarget2.setSize(r,n);for(var a=0;a<this.passes.length;a++)this.passes[a].setSize(r,n)}},{key:"setPixelRatio",value:function(e){this._pixelRatio=e,this.setSize(this._width,this._height)}},{key:"dispose",value:function(){this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.copyPass.dispose()}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,r),Object.defineProperty(t,"prototype",{writable:!1}),e}();const Cn="\n varying vec2 vUv;\n \n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n }\n ",Rn="\n uniform sampler2D baseTexture;\n uniform sampler2D bloomTexture;\n \n varying vec2 vUv;\n \n void main() {\n gl_FragColor = (texture2D(baseTexture, vUv) + vec4(1.0) * texture2D(bloomTexture, vUv));\n }\n ";class Ln{constructor(e){this.mtuPP=e,this.bloomLayer=new ga.Layers,this.bloomLayer.set(this.mtuPP.BLOOM_SCENE),this.darkMaterial=new ga.MeshBasicMaterial({color:"black"}),this.materials={},(e=this.mtuPP.mainScene).fog&&(this.mtuPP.sceneFogColor||(this.mtuPP.sceneFogColor=new ga.Color),this.mtuPP.sceneFogColor.copy(e.fog.color)),e.background&&(this.mtuPP.sceneBackground=e.background),this.mtuPP.renderer&&this.postProcessing()}postProcessing(){this.bloomPass=new gn(this.mtuPP.rtSize,1.5,.4,.85),this.bloomPass.radius=this.mtuPP.params.glow.radius,this.bloomPass.strength=this.mtuPP.params.glow.strength,this.bloomPass.threshold=this.mtuPP.params.glow.threshold,this.mtuPP.effectComposer.addPass(this.bloomPass),this.finalPass=new un.T(new ga.ShaderMaterial({uniforms:{baseTexture:{value:null},bloomTexture:{value:this.mtuPP.effectComposer.renderTarget2.texture}},vertexShader:Cn,fragmentShader:Rn,defines:{}}),"baseTexture"),this.finalPass.needsSwap=!0;var e=new ga.WebGLRenderTarget(this.mtuPP.rtSize.x,this.mtuPP.rtSize.y,{samples:this.mtuPP.params.pp.samples});this.finalComposer=new An(this.mtuPP.renderer,e),this.finalComposer.addPass(this.mtuPP.renderPass),this.finalComposer.addPass(this.finalPass)}renderBloom(e){var t;this.mtuPP.sceneFogColor&&null!=(t=this.mtuPP.mainScene.fog)&&t.color.copy(this.mtuPP.BLACK_COLOR),this.mtuPP.sceneBackground&&(this.mtuPP.mainScene.background=this.mtuPP.BLACK_COLOR),e?(this.mtuPP.mainScene.traverse((e=>{e.isMesh&&!this.bloomLayer.test(e.layers)&&(this.materials[e.uuid]=e.material,e.material=this.darkMaterial)})),this.mtuPP.effectComposer.render(),this.mtuPP.mainScene.traverse((e=>{this.materials[e.uuid]&&(e.material=this.materials[e.uuid],delete this.materials[e.uuid])}))):(this.mtuPP.mainCamera.layers.set(this.mtuPP.BLOOM_SCENE),this.mtuPP.effectComposer.render(),this.mtuPP.mainCamera.layers.set(this.mtuPP.ENTIRE_SCENE)),this.mtuPP.sceneFogColor&&null!=(t=this.mtuPP.mainScene.fog)&&t.color.copy(this.mtuPP.sceneFogColor),this.mtuPP.sceneBackground&&(this.mtuPP.mainScene.background=this.mtuPP.sceneBackground)}render(){this.renderBloom(!0),this.finalComposer.render()}setGlowData(e,t){this.bloomPass[e]=t}setSize(e,t){this.finalComposer&&this.finalComposer.setSize(e,t)}dispose(){this.bloomPass&&(this.bloomPass.dispose(),this.bloomPass=null),this.finalPass=null,this.finalComposer&&(this.finalComposer.renderTarget1&&(this.finalComposer.renderTarget1.dispose(),this.finalComposer.renderTarget1=null),this.finalComposer.renderTarget2&&(this.finalComposer.renderTarget2.dispose(),this.finalComposer.renderTarget2=null),this.finalComposer=null)}enablePass(e){this.bloomPass&&this.bloomPass.enabled!==e&&(this.bloomPass.enabled=e,this.finalPass.enabled=e)}}var In=r(228);class Bn extends s.ShaderMaterial{constructor(...e){super(...e),["opacity","map","emissiveMap","roughnessMap","metalnessMap"].forEach((e=>{Object.defineProperty(this,e,{get(){if(e in this.uniforms)return this.uniforms[e].value},set(t){e in this.uniforms&&(this.uniforms[e].value=t)}})}))}}class jn extends Bn{constructor(...e){super(...e),this.modifiedDefines={},this.modifiedUniforms={}}setDefine(e,t){const r=this.defines,n=this.modifiedDefines;null==t?e in r&&(e in n||(n[e]=r[e]),delete r[e]):r[e]!==t&&(e in n||(n[e]=e in r?r[e]:void 0),r[e]=t)}setTextureUniform(e,t){const r=this.uniforms,n=this.modifiedUniforms;e in n||(n[e]=r[e].value),r[e].value=t}finalize(){const e=this.modifiedDefines;var t=this.defines;for(const r in e)void 0===e[r]?r in t&&(this.needsUpdate=!0):t[r]!==e[r]&&(this.needsUpdate=!0),delete e[r];const r=this.modifiedUniforms;var n=this.uniforms;for(const e in r)r[e]!==n[e].value&&(this.needsUpdate=!0),delete r[e]}}const Un=new WeakMap;class Nn{constructor(e){this._replacementMaterial=new jn(e),this._replacementMaterials=new WeakMap,this.overrideUniforms={},this.overrideDefines={}}replace(e,t=!1,r=!0){const n=this;function a(e){if(!e.isHelper&&(e.isMesh||e.isSkinnedMesh)){if(!i.has(e)){const t=n.createMaterial(e);i.set(e,t)}const t=i.get(e);if(null!==t){let a=e.material;r?s.set(e,a):a=s.get(e),a||console.error("ShaderReplacement : Material for object was not cached before replacing shader.",e),n.updateUniforms(e,a,t),t.finalize&&t.finalize(),e.material=t}}}const i=this._replacementMaterials,s=Un;if(Array.isArray(e))if(t)for(let t=0,r=e.length;t<r;t++)e[t].traverse(a);else for(let t=0,r=e.length;t<r;t++)a(e[t]);else t?e.traverse(a):a(e)}reset(e,t){function r(e){e.isHelper||(n.has(e)?(e.material=n.get(e),n.delete(e)):(e.isSkinnedMesh||e.isMesh)&&console.error("ShaderReplacement : Material for object was not cached before resetting.",e))}const n=Un;if(Array.isArray(e))if(t)for(let t=0,n=e.length;t<n;t++)r(e[t]);else for(let t=0,n=e.length;t<n;t++)e[t].traverse(r);else t?e.traverse(r):r(e)}createMaterial(e){return this._replacementMaterial.clone()}updateUniforms(e,t,r){var n=this._replacementMaterial.defines,a=t.defines;const i=r.defines;if(r.side=t.side,r.flatShading=t.flatShading,r.skinning=t.skinning,a){for(const e in a)r.setDefine(e,a[e]);for(const e in i)e in a?r.setDefine(e,a[e]):r.setDefine(e,n[e])}const s=r.uniforms;if(t.isShaderMaterial){var o=t.uniforms;for(const e in s){var l=o[e];const t=s[e];l&&l.value!==t.value&&(t.value&&t.value.isTexture||l.value&&l.value.isTexture?r.setTextureUniform(e,l.value):t.value=l.value)}}else for(const e in s){const n=s[e];e in t&&t[e]!==n.value&&(n.value&&n.value.isTexture||t[e]&&t[e].isTexture?r.setTextureUniform(e,t[e]):n.value=t[e])}var{overrideDefines:c,overrideUniforms:u}=this;for(const e in c)null===c[e]||void 0===c[e]?delete i[e]:i[e]!==c[e]&&(i[e]=c[e],r.needsUpdate=!0);for(const e in u)e in s&&(s[e].value=u[e].value)}dispose(){}}class Fn extends Nn{constructor(){super({extensions:{derivatives:!0},defines:{USE_UV:""},uniforms:Object.assign(Object.assign({},s.ShaderLib.normal.uniforms),{alphaMap:{value:null},alphaTest:{value:0},map:{value:null},opacity:{value:1}}),vertexShader:s.ShaderLib.normal.vertexShader,fragmentShader:"\n\t\t\t\t#define NORMAL\n\t\t\t\tuniform float opacity;\n\t\t\t\t#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\t\t\t\t\tvarying vec3 vViewPosition;\n\t\t\t\t#endif\n\t\t\t\t#ifndef FLAT_SHADED\n\t\t\t\t\tvarying vec3 vNormal;\n\t\t\t\t\t#ifdef USE_TANGENT\n\t\t\t\t\t\tvarying vec3 vTangent;\n\t\t\t\t\t\tvarying vec3 vBitangent;\n\t\t\t\t\t#endif\n\t\t\t\t#endif\n\t\t\t\t#include <packing>\n\t\t\t\t#include <uv_pars_fragment>\n\t\t\t\t#include <map_pars_fragment>\n\t\t\t\t#include <bumpmap_pars_fragment>\n\t\t\t\t#include <normalmap_pars_fragment>\n\t\t\t\t#include <alphamap_pars_fragment>\n\t\t\t\t#include <logdepthbuf_pars_fragment>\n\t\t\t\t#include <clipping_planes_pars_fragment>\n\t\t\t\tvoid main() {\n\t\t\t\t\tvec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );\n\t\t\t\t\t#include <clipping_planes_fragment>\n\t\t\t\t\t#include <logdepthbuf_fragment>\n\t\t\t\t\t#include <map_fragment>\n\t\t\t\t\t#include <alphamap_fragment>\n\t\t\t\t\t#include <alphatest_fragment>\n\t\t\t\t\t#include <normal_fragment_begin>\n\t\t\t\t\t#include <normal_fragment_maps>\n\t\t\t\t\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n\t\t\t\t}\n\t\t\t"}),this.useNormalMaps=!1}createMaterial(...e){return super.createMaterial(...e)}updateUniforms(e,t,r){super.updateUniforms(e,t,r),r.setDefine("USE_NORMALMAP",this.useNormalMaps&&r.uniforms.normalMap.value?"":void 0),r.setDefine("TANGENTSPACE_NORMALMAP",this.useNormalMaps&&r.uniforms.normalMap.value?"":void 0),r.setDefine("ALPHATEST",r.uniforms.alphaTest.value||void 0),r.setDefine("USE_ALPHAMAP",0!==r.defines.ALPHATEST&&r.uniforms.alphaMap.value?"":void 0),r.setDefine("USE_MAP",0!==r.defines.ALPHATEST&&r.uniforms.map.value?"":void 0),r.setDefine("USE_UV","USE_ALPHAMAP"in r.defines||"USE_MAP"in r.defines?"":void 0)}}class zn extends Nn{constructor(){super({extensions:{derivatives:!0},defines:{USE_UV:""},uniforms:Object.assign(Object.assign({},s.ShaderLib.normal.uniforms),{alphaMap:{value:null},alphaTest:{value:0},map:{value:null},opacity:{value:1}}),vertexShader:"\n\t\t\t\tvarying vec3 vViewPosition;\n\t\t\t\t#include <common>\n\t\t\t\t#include <uv_pars_vertex>\n\t\t\t\t#include <displacementmap_pars_vertex>\n\t\t\t\t#include <morphtarget_pars_vertex>\n\t\t\t\t#include <skinning_pars_vertex>\n\t\t\t\t#include <logdepthbuf_pars_vertex>\n\t\t\t\t#include <clipping_planes_pars_vertex>\n\t\t\t\tvoid main() {\n\t\t\t\t\t#include <uv_vertex>\n\t\t\t\t\t#include <beginnormal_vertex>\n\t\t\t\t\t#include <morphnormal_vertex>\n\t\t\t\t\t#include <skinbase_vertex>\n\t\t\t\t\t#include <skinnormal_vertex>\n\t\t\t\t\t#include <defaultnormal_vertex>\n\t\t\t\t\t#include <begin_vertex>\n\t\t\t\t\t#include <morphtarget_vertex>\n\t\t\t\t\t#include <skinning_vertex>\n\t\t\t\t\t#include <displacementmap_vertex>\n\t\t\t\t\t#include <project_vertex>\n\t\t\t\t\t#include <logdepthbuf_vertex>\n\t\t\t\t\t#include <clipping_planes_vertex>\n\t\t\t\t\tvViewPosition = mvPosition.xyz;\n\t\t\t\t}\n\t\t\t",fragmentShader:"\n\t\t\t\tuniform float opacity;\n\t\t\t\tvarying vec3 vViewPosition;\n\t\t\t\t#include <uv_pars_fragment>\n\t\t\t\t#include <map_pars_fragment>\n\t\t\t\t#include <bumpmap_pars_fragment>\n\t\t\t\t#include <normalmap_pars_fragment>\n\t\t\t\t#include <alphamap_pars_fragment>\n\t\t\t\t#include <logdepthbuf_pars_fragment>\n\t\t\t\t#include <clipping_planes_pars_fragment>\n\t\t\t\tvoid main() {\n\t\t\t\t\tvec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );\n\t\t\t\t\t#include <clipping_planes_fragment>\n\t\t\t\t\t#include <logdepthbuf_fragment>\n\t\t\t\t\t#include <map_fragment>\n\t\t\t\t\t#include <alphamap_fragment>\n\t\t\t\t\t#include <alphatest_fragment>\n\t\t\t\t\tgl_FragColor = vec4( vViewPosition.z );\n\t\t\t\t}\n\t\t\t"}),this.invertSide=!1}updateUniforms(e,t,r){super.updateUniforms(e,t,r),this.invertSide&&(r.side=r.side===s.FrontSide?s.BackSide:s.FrontSide),e=r.defines.ALPHATEST,0===r.uniforms.alphaTest.value?delete r.defines.ALPHATEST:r.defines.ALPHATEST=r.uniforms.alphaTest.value,e!==r.defines.ALPHATEST&&(r.needsUpdate=!0),e=r.defines.USE_ALPHAMAP,0!==r.defines.ALPHATEST&&r.uniforms.alphaMap.value?r.defines.USE_ALPHAMAP="":delete r.defines.USE_ALPHAMAP,e!==r.defines.USE_ALPHAMAP&&(r.needsUpdate=!0),e=r.defines.USE_MAP,0!==r.defines.ALPHATEST&&r.uniforms.map.value?r.defines.USE_MAP="":delete r.defines.USE_MAP,e!==r.defines.USE_MAP&&(r.needsUpdate=!0),e=r.defines.USE_UV,"USE_ALPHAMAP"in r.defines||"USE_MAP"in r.defines?r.defines.USE_UV="":delete r.defines.USE_UV,e!==r.defines.USE_UV&&(r.needsUpdate=!0)}}const Vn={uniforms:{tex:{value:null},displayRoughness:{value:0}},vertexShader:"\n\t\tvarying vec3 vViewPosition;\n\t\tvarying vec2 vUv;\n\t\tvoid main() {\n\t\t\t#include <begin_vertex>\n\t\t\t#include <project_vertex>\n\t\t\tvViewPosition = mvPosition.xyz;\n\t\t\tvUv = uv;\n\t\t}\n\t",fragmentShader:"\n\t\tvarying vec2 vUv;\n\t\tuniform sampler2D tex;\n\t\tuniform float displayRoughness;\n\t\tvoid main() {\n\t\t\tvec4 texVal = texture2D( tex, vUv );\n\t\t\tfloat roughness = texVal.a;\n\t\t\tvec3 packedNormal = texVal.xyz;\n\t\t\tvec3 unpackedNormal = ( packedNormal - 0.5 ) * 2.0;\n\t\t\tgl_FragColor = mix(\n\t\t\t\tvec4( unpackedNormal, 1.0 ),\n\t\t\t\tvec4( roughness, roughness, roughness, 1.0 ),\n\t\t\t\tdisplayRoughness\n\t\t\t);\n\n\t\t}\n\t"},Gn={uniforms:{tex:{value:null}},vertexShader:"\n\t\tvarying vec3 vViewPosition;\n\t\tvarying vec2 vUv;\n\t\tvoid main() {\n\t\t\t#include <begin_vertex>\n\t\t\t#include <project_vertex>\n\t\t\tvViewPosition = mvPosition.xyz;\n\t\t\tvUv = uv;\n\t\t}\n\t",fragmentShader:"\n\t\tvarying vec2 vUv;\n\t\tuniform sampler2D tex;\n\t\tuniform float divide;\n\t\tvoid main() {\n\t\t\tvec4 texVal = texture2D( tex, vUv );\n\t\t\tfloat depthVal = mod( - texVal.r, 1.0 );\n\t\t\tgl_FragColor = vec4( depthVal );\n\n\t\t}\n\t"},Hn={defines:{NUM_DIRECTIONS:32,NUM_STEPS:16,RADIUS:"2.0",ENABLE_FALLOFF:1,FALLOFF_START2:"0.16",FALLOFF_END2:"4.0",ENABLE_ROTATION_JITTER:1,ENABLE_RADIUS_JITTER:1,ENABLE_COLOR_BOUNCE:1,JITTER_TYPE:0},uniforms:{colorBuffer:{value:null},normalBuffer:{value:null},depthBuffer:{value:null},renderSize:{value:new s.Vector2},blueNoiseTex:{value:null},blueNoiseSize:{value:1},clipInfo:{value:new s.Vector4},projInfo:{value:new s.Vector4},params:{value:new s.Vector2},lightBounceIntensity:{value:1}},vertexShader:"\n\t\tvarying vec2 vUv;\n\t\tvoid main() {\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t}\n\t",fragmentShader:"\n\t\t#define TWO_PI\t\t\t6.2831853071795864\n\t\t#define HALF_PI\t\t\t1.5707963267948966\n\t\t#define ONE_OVER_PI\t\t0.3183098861837906\n\n\t\t#include <common>\n\t\t#include <packing>\n\t\tvarying vec2 vUv;\n\n\t\tuniform sampler2D noiseTexture;\n\t\tuniform sampler2D normalBuffer;\n\t\tuniform sampler2D depthBuffer;\n\t\tuniform sampler2D colorBuffer;\n\t\tuniform vec2 renderSize;\n\n\t\tuniform vec4 projInfo;\n\t\tuniform vec4 clipInfo;\n\t\tuniform vec4 params;\n\t\tuniform float lightBounceIntensity;\n\n\t\t#if ENABLE_ROTATION_JITTER == 2 || ENABLE_RADIUS_JITTER == 2\n\t\tuniform float blueNoiseSize;\n\t\tuniform sampler2D blueNoiseTex;\n\t\t#endif\n\n\t\tfloat roundF(float f) {\n\t\t\treturn f < 0.5 ? floor(f) : ceil(f);\n\t\t}\n\n\t\tvec2 roundV2(vec2 v) {\n\t\t\tv.x = roundF(v.x);\n\t\t\tv.y = roundF(v.y);\n\t\t\treturn v;\n\t\t}\n\n\t\tvec3 UnpackNormal(vec4 d) {\n\t\t\treturn d.xyz * 2.0 - 1.0;\n\t\t}\n\n\t\tvec4 GetViewPosition( vec2 uv ) {\n\n\t\t\tfloat near = clipInfo.x;\n\t\t\tfloat far = clipInfo.y;\n\n\t\t\tvec2 basesize = renderSize;\n\t\t\tvec2 coord = ( uv / basesize );\n\n\t\t\t// d is expected to be [ 0.0, 1.0 ]\n\t\t\tfloat d = texture2D( depthBuffer, coord ).r;\n\t\t\td = d == 0.0 ? far : d;\n\t\t\td = ( abs( d ) - near ) / ( far - near );\n\n\t\t\tvec4 ret = vec4( 0.0 );\n\t\t\tret.w = d;\n\t\t\tret.z = near + d * ( far - near );\n\t\t\tret.xy = ( uv * projInfo.xy + projInfo.zw ) * ret.z;\n\n\t\t\treturn ret;\n\n\t\t}\n\n\t\tfloat Falloff( float dist2 ) {\n\n\t\t\treturn 2.0 * clamp(\n\t\t\t\t( dist2 - FALLOFF_START2 ) / ( FALLOFF_END2 - FALLOFF_START2 ),\n\t\t\t\t0.0,\n\t\t\t\t1.0\n\t\t\t);\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvec2 screenCoord = gl_FragCoord.xy;\n\t\t\tvec4 vpos = GetViewPosition( renderSize * vUv );\n\n\t\t\t// if it's the background\n\t\t\tif ( vpos.w == 1.0 ) {\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0);\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t\tvec4 s;\n\t\t\tvec3 vnorm\t= UnpackNormal( texture2D( normalBuffer, vUv ) );\n\t\t\tvec3 vdir\t= normalize( - vpos.xyz );\n\t\t\tvec3 dir, ws;\n\n\t\t\t// calculation uses left handed system\n\t\t\tvnorm.z = - vnorm.z;\n\n\t\t\tvec2 noises\t= vec2( 0.0 );\n\t\t\tvec2 offset;\n\t\t\tvec2 horizons = vec2( - 1.0, - 1.0 );\n\n\t\t\t// scale the search radius by the depth and camera FOV\n\t\t\tfloat radius = ( RADIUS * clipInfo.z ) / vpos.z;\n\t\t\tradius = max( float( NUM_STEPS ), radius );\n\n\t\t\tfloat stepSize\t= radius / float( NUM_STEPS );\n\t\t\tfloat phi\t\t= 0.0;\n\t\t\tfloat ao\t\t= 0.0;\n\t\t\tfloat division\t= noises.y * stepSize;\n\t\t\tfloat currStep\t= 1.0 + division + 0.25 * stepSize * params.y;\n\t\t\tfloat dist2, invdist, falloff, cosh;\n\n\t\t\t#if ENABLE_COLOR_BOUNCE\n\t\t\tvec3 color = vec3( 0.0 );\n\t\t\t#endif\n\n\t\t\t#if ENABLE_ROTATION_JITTER == 1\n\n\t\t\t// Rotation jitter approach from\n\t\t\t// https://github.com/MaxwellGengYF/Unity-Ground-Truth-Ambient-Occlusion/blob/9cc30e0f31eb950a994c71866d79b2798d1c508e/Shaders/GTAO_Common.cginc#L152-L155\n\t\t\tfloat rotJitterOffset = PI * fract( 52.9829189 * fract( dot( screenCoord, vec2( 0.06711056, 0.00583715 ) ) ) );\n\n\t\t\t#elif ENABLE_ROTATION_JITTER == 2\n\n\t\t\tfloat rotJitterOffset = PI * texture2D( blueNoiseTex, gl_FragCoord.xy / blueNoiseSize ).r;\n\n\t\t\t#endif\n\n\t\t\t#if ENABLE_RADIUS_JITTER == 1\n\n\t\t\tfloat jitterMod = ( gl_FragCoord.x + gl_FragCoord.y ) * 0.25;\n\t\t\tfloat radiusJitterOffset = mod( jitterMod, 1.0 ) * stepSize * 0.25;\n\n\t\t\t#elif ENABLE_RADIUS_JITTER == 2\n\n\t\t\tfloat radiusJitterOffset = PI * texture2D( blueNoiseTex, gl_FragCoord.xy / blueNoiseSize ).g;\n\n\t\t\t#endif\n\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = 0; i < NUM_DIRECTIONS; i ++ ) {\n\n\t\t\t\tphi = float( i ) * ( PI / float( NUM_DIRECTIONS ) ) + params.x * PI;\n\n\t\t\t\t#if ENABLE_ROTATION_JITTER != 0\n\n\t\t\t\tphi += rotJitterOffset;\n\n\t\t\t\t#endif\n\n\t\t\t\tcurrStep = 1.0 + 0.25 * stepSize * params.y;\n\n\n\t\t\t\t#if ENABLE_RADIUS_JITTER != 0\n\n\t\t\t\tcurrStep += radiusJitterOffset;\n\n\t\t\t\t#endif\n\n\t\t\t\tdir = vec3( cos( phi ), sin( phi ), 0.0 );\n\t\t\t\thorizons = vec2( - 1.0 );\n\n\t\t\t\t// calculate horizon angles\n\t\t\t\tfor ( int j = 0; j < NUM_STEPS; ++ j ) {\n\n\t\t\t\t\toffset = roundV2(dir.xy * currStep);\n\n\t\t\t\t\t// h1\n\t\t\t\t\ts = GetViewPosition( screenCoord + offset );\n\t\t\t\t\tws = s.xyz - vpos.xyz;\n\n\t\t\t\t\tdist2 = dot( ws, ws );\n\t\t\t\t\tinvdist = inversesqrt( dist2 );\n\t\t\t\t\tcosh = invdist * dot( ws, vdir );\n\n\t\t\t\t\t#if ENABLE_FALLOFF\n\n\t\t\t\t\tfalloff = Falloff( dist2 );\n\n\t\t\t\t\t#endif\n\n\t\t\t\t\thorizons.x = max( horizons.x, cosh - falloff );\n\n\t\t\t\t\t#if ENABLE_COLOR_BOUNCE\n\n\t\t\t\t\tvec3 ptColor, ptDir;\n\t\t\t\t\tfloat alpha;\n\t\t\t\t\tptColor = texture2D( colorBuffer, ( screenCoord + offset ) / renderSize ).rgb;\n\t\t\t\t\tptDir = normalize( ws );\n\t\t\t\t\talpha = saturate( length( ws ) / float( RADIUS ) );\n\t\t\t\t\tcolor += ptColor * saturate( dot( ptDir, vnorm ) ) * pow( ( 1.0 - alpha ), 2.0 );\n\n\t\t\t\t\t#endif\n\n\t\t\t\t\t// h2\n\t\t\t\t\ts = GetViewPosition( screenCoord - offset );\n\t\t\t\t\tws = s.xyz - vpos.xyz;\n\n\t\t\t\t\tdist2 = dot( ws, ws );\n\t\t\t\t\tinvdist = inversesqrt( dist2 );\n\t\t\t\t\tcosh = invdist * dot( ws, vdir );\n\n\t\t\t\t\t#if ENABLE_FALLOFF\n\n\t\t\t\t\tfalloff = Falloff( dist2 );\n\n\t\t\t\t\t#endif\n\n\t\t\t\t\thorizons.y = max( horizons.y, cosh - falloff );\n\n\t\t\t\t\t// increment\n\t\t\t\t\tcurrStep += stepSize;\n\n\t\t\t\t\t#if ENABLE_COLOR_BOUNCE\n\n\t\t\t\t\tptColor = texture2D( colorBuffer, ( screenCoord - offset ) / renderSize ).rgb;\n\t\t\t\t\tptDir = normalize( ws );\n\t\t\t\t\talpha = saturate( length( ws ) / float( RADIUS ) );\n\t\t\t\t\tcolor += ptColor * saturate( dot( ptDir, vnorm ) ) * pow( ( 1.0 - alpha ), 2.0 );\n\n\t\t\t\t\t#endif\n\n\t\t\t\t}\n\n\t\t\t\thorizons = acos( horizons );\n\n\t\t\t\t// calculate gamma\n\t\t\t\tvec3 bitangent\t= normalize( cross( dir, vdir ) );\n\t\t\t\tvec3 tangent\t= cross( vdir, bitangent );\n\t\t\t\tvec3 nx\t\t\t= vnorm - bitangent * dot( vnorm, bitangent );\n\n\t\t\t\tfloat nnx\t\t= length( nx );\n\t\t\t\tfloat invnnx\t= 1.0 / ( nnx + 1e-6 );\t\t\t// to avoid division with zero\n\t\t\t\tfloat cosxi\t\t= dot( nx, tangent ) * invnnx;\t// xi = gamma + HALF_PI\n\t\t\t\tfloat gamma\t\t= acos( cosxi ) - HALF_PI;\n\t\t\t\tfloat cosgamma\t= dot( nx, vdir ) * invnnx;\n\t\t\t\tfloat singamma2\t= - 2.0 * cosxi;\t\t\t\t\t// cos(x + HALF_PI) = -sin(x)\n\n\t\t\t\t// clamp to normal hemisphere\n\t\t\t\thorizons.x = gamma + max( - horizons.x - gamma, - HALF_PI );\n\t\t\t\thorizons.y = gamma + min( horizons.y - gamma, HALF_PI );\n\n\t\t\t\t// Riemann integral is additive\n\t\t\t\tao += nnx * 0.25 * (\n\t\t\t\t\t( horizons.x * singamma2 + cosgamma - cos( 2.0 * horizons.x - gamma ) ) +\n\t\t\t\t\t( horizons.y * singamma2 + cosgamma - cos( 2.0 * horizons.y - gamma ) ) );\n\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\n\t\t\t// PDF = 1 / pi and must normalize with pi because of Lambert\n\t\t\tao = ao / float( NUM_DIRECTIONS );\n\n\t\t\t#if ENABLE_COLOR_BOUNCE\n\n\t\t\tcolor /= float( NUM_STEPS * NUM_DIRECTIONS ) * 2.0 / lightBounceIntensity;\n\t\t\tgl_FragColor = vec4( color, ao );\n\n\t\t\t#else\n\n\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, ao );\n\n\t\t\t#endif\n\t\t}\n\t"},Wn={defines:{BLUR_ITERATIONS:5,BLUR_MODE:0,AO_ONLY:0,COLOR_ONLY:0,DEPTH_THRESHOLD:"5e-1"},uniforms:{fullSize:{value:new s.Vector2},aoSize:{value:new s.Vector2},normalBuffer:{value:null},depthBuffer:{value:null},colorBuffer:{value:null},gtaoBuffer:{value:null},intensity:{value:1},blurStride:{value:1},ambientColor:{value:new s.Color},ambientIntensity:{value:0}},vertexShader:"\n\t\tvarying vec2 vUv;\n\t\tvoid main() {\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t}\n\t",fragmentShader:"\n\t\tvarying vec2 vUv;\n\t\tuniform vec3 ambientColor;\n\t\tuniform float ambientIntensity;\n\t\tuniform vec2 aoSize;\n\t\tuniform vec2 fullSize;\n\t\tuniform sampler2D colorBuffer;\n\t\tuniform sampler2D depthBuffer;\n\t\tuniform sampler2D normalBuffer;\n\t\tuniform sampler2D gtaoBuffer;\n\t\tuniform float intensity;\n\t\tuniform int blurStride;\n\n\t\tvec3 UnpackNormal( vec4 d ) {\n\t\t\treturn d.xyz * 2.0 - 1.0;\n\t\t}\n\n\t\tvec3 MultiBounce( float ao, vec3 albedo ) {\n\t\t\tvec3 x = vec3( ao );\n\t\t\tvec3 a = 2.0404 * albedo - vec3( 0.3324 );\n\t\t\tvec3 b = -4.7951 * albedo + vec3( 0.6417 );\n\t\t\tvec3 c = 2.7552 * albedo + vec3( 0.6903 );\n\t\t\treturn max( x, ( ( x * a + b ) * x + c ) * x );\n\t\t}\n\n\t\tvoid main() {\n\t\t\tvec4 color = texture2D( colorBuffer, vUv );\n\t\t\t// NO_BLUR\n\t\t\t#if BLUR_MODE == 0\n\t\t\t\tvec4 accumSample = texture2D( gtaoBuffer, vUv );\n\t\t\t#else\n\t\t\tvec2 currTexel = vUv * fullSize;\n\t\t\tvec2 currAoTexel = vUv * aoSize;\n\n\t\t\t// aoPixels per full size ones. Should be 1/2 at\n\t\t\tvec2 texelRatio = aoSize / fullSize;\n\n\t\t\tvec3 currNormal = UnpackNormal( texture2D( normalBuffer, vUv ) );\n\t\t\tfloat currDepth = texture2D( depthBuffer, vUv ).r;\n\n\t\t\t// TODO: pull this sampling out into a function\n\t\t\tvec4 accumSample = vec4( 0.0 );\n\t\t\tfloat totalWeight = 1e-10;\n\t\t\tfloat pixelOffset = - float( BLUR_ITERATIONS ) / 2.0;\n\t\t\tpixelOffset += mod( float( BLUR_ITERATIONS ), 2.0 ) == 0.0 ? 0.0 : 0.5;\n\t\t\tpixelOffset *= float( blurStride );\n\n\t\t\t// BOX_BLUR\n\t\t\t#if BLUR_MODE == 1\n\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int x = 0; x < BLUR_ITERATIONS; x ++ ) {\n\n\t\t\t\t#pragma unroll_loop_start\n\t\t\t\tfor ( int y = 0; y < BLUR_ITERATIONS; y ++ ) {\n\n\t\t\t\t\tvec2 step = vec2( float( x ), float( y ) ) * float( blurStride );\n\n\t\t\t\t\t// iterate over full res pixels\n\t\t\t\t\tvec2 offsetUv = currTexel + ( pixelOffset + step ) / texelRatio;\n\t\t\t\t\toffsetUv /= fullSize;\n\n\t\t\t\t\t// get the associated pixel in the AO buffer\n\t\t\t\t\tvec2 aoUv = currAoTexel + pixelOffset + step;\n\t\t\t\t\taoUv /= aoSize;\n\n\t\t\t\t\t// if the pixels are close enough in space then blur them together\n\t\t\t\t\tfloat offsetDepth = texture2D( depthBuffer, offsetUv ).r;\n\t\t\t\t\tif ( abs( offsetDepth - currDepth ) <= DEPTH_THRESHOLD ) {\n\n\t\t\t\t\t\t// Weigh the sample based on normal similarity\n\t\t\t\t\t\tvec3 offsetNormal = UnpackNormal( texture2D( normalBuffer, offsetUv ) );\n\t\t\t\t\t\tfloat weight = max( 0.0, dot( offsetNormal, currNormal ) );\n\n\t\t\t\t\t\t// square the weight to give pixels with a closer normal even higher priority\n\t\t\t\t\t\tweight *= weight;\n\n\t\t\t\t\t\t// accumulate\n\t\t\t\t\t\tvec4 val = texture2D( gtaoBuffer, aoUv );\n\t\t\t\t\t\taccumSample += val * weight;\n\t\t\t\t\t\ttotalWeight += weight;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t\t#pragma unroll_loop_end\n\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\n\t\t\t// CROSS_BLUR\n\t\t\t#elif BLUR_MODE == 2\n\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = 0; i < BLUR_ITERATIONS; i ++ ) {\n\n\t\t\t\tvec2 offsetUv, aoUv;\n\t\t\t\tfloat offsetDepth;\n\n\t\t\t\t// X sample\n\t\t\t\t// iterate over full res pixels\n\t\t\t\toffsetUv = currTexel + vec2( pixelOffset + float( i * blurStride ), 0.0 ) / texelRatio;\n\t\t\t\toffsetUv /= fullSize;\n\n\t\t\t\taoUv = currAoTexel + vec2( pixelOffset + float( i * blurStride ), 0.0 );\n\t\t\t\taoUv /= aoSize;\n\n\t\t\t\t// further more negative\n\t\t\t\toffsetDepth = texture2D( depthBuffer, offsetUv ).r;\n\t\t\t\tif ( abs(offsetDepth - currDepth) <= DEPTH_THRESHOLD ) {\n\n\t\t\t\t\tvec3 offsetNormal = UnpackNormal( texture2D( normalBuffer, offsetUv ) );\n\t\t\t\t\tfloat weight = max(0.0, dot( offsetNormal, currNormal ) );\n\t\t\t\t\tweight *= weight;\n\n\t\t\t\t\tvec4 val = texture2D( gtaoBuffer, aoUv );\n\t\t\t\t\taccumSample += val * weight;\n\t\t\t\t\ttotalWeight += weight;\n\n\t\t\t\t}\n\n\t\t\t\t// TODO: this should not be here if on the center pixel\n\t\t\t\t// Y sample\n\t\t\t\t// iterate over full res pixels\n\t\t\t\toffsetUv = currTexel + vec2( 0.0, pixelOffset + float( i * blurStride ) ) / texelRatio;\n\t\t\t\toffsetUv /= fullSize;\n\n\t\t\t\taoUv = currAoTexel + vec2( 0.0, pixelOffset + float( i * blurStride ) );\n\t\t\t\taoUv /= aoSize;\n\n\t\t\t\t// further more negative\n\t\t\t\toffsetDepth = texture2D( depthBuffer, offsetUv ).r;\n\t\t\t\tif ( abs(offsetDepth - currDepth) <= DEPTH_THRESHOLD ) {\n\n\t\t\t\t\tvec3 offsetNormal = UnpackNormal( texture2D( normalBuffer, offsetUv ) );\n\t\t\t\t\tfloat weight = max(0.0, dot( offsetNormal, currNormal ) );\n\t\t\t\t\tweight *= weight;\n\n\t\t\t\t\tvec4 val = texture2D( gtaoBuffer, aoUv );\n\t\t\t\t\taccumSample += val * weight;\n\t\t\t\t\ttotalWeight += weight;\n\n\t\t\t\t}\n\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\n\t\t\t// DIAGONAL_BLUR\n\t\t\t#elif BLUR_MODE == 3\n\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = 0; i < BLUR_ITERATIONS; i ++ ) {\n\n\t\t\t\tvec2 offsetUv, aoUv;\n\t\t\t\tfloat offsetDepth;\n\n\t\t\t\t// X sample\n\t\t\t\t// iterate over full res pixels\n\t\t\t\toffsetUv = currTexel + vec2( pixelOffset + float( i * blurStride ), pixelOffset + float( i * blurStride ) ) / texelRatio;\n\t\t\t\toffsetUv /= fullSize;\n\n\t\t\t\taoUv = currAoTexel + vec2( pixelOffset + float( i * blurStride ), pixelOffset + float( i * blurStride ) );\n\t\t\t\taoUv /= aoSize;\n\n\t\t\t\t// further more negative\n\t\t\t\toffsetDepth = texture2D( depthBuffer, offsetUv ).r;\n\t\t\t\tif ( abs(offsetDepth - currDepth) <= DEPTH_THRESHOLD ) {\n\n\t\t\t\t\tvec3 offsetNormal = UnpackNormal( texture2D( normalBuffer, offsetUv ) );\n\t\t\t\t\tfloat weight = max(0.0, dot( offsetNormal, currNormal ) );\n\t\t\t\t\tweight *= weight;\n\n\t\t\t\t\tvec4 val = texture2D( gtaoBuffer, aoUv );\n\t\t\t\t\taccumSample += val * weight;\n\t\t\t\t\ttotalWeight += weight;\n\n\t\t\t\t}\n\n\t\t\t\t// TODO: this should not be here if on the center pixel\n\t\t\t\t// Y sample\n\t\t\t\t// iterate over full res pixels\n\t\t\t\toffsetUv = currTexel + vec2( - pixelOffset - float( i * blurStride ), pixelOffset + float( i * blurStride ) ) / texelRatio;\n\t\t\t\toffsetUv /= fullSize;\n\n\t\t\t\taoUv = currAoTexel + vec2( - pixelOffset - float( i * blurStride ), pixelOffset + float( i * blurStride ) );\n\t\t\t\taoUv /= aoSize;\n\n\t\t\t\t// further more negative\n\t\t\t\toffsetDepth = texture2D( depthBuffer, offsetUv ).r;\n\t\t\t\tif ( abs(offsetDepth - currDepth) <= DEPTH_THRESHOLD ) {\n\n\t\t\t\t\tvec3 offsetNormal = UnpackNormal( texture2D( normalBuffer, offsetUv ) );\n\t\t\t\t\tfloat weight = max(0.0, dot( offsetNormal, currNormal ) );\n\t\t\t\t\tweight *= weight;\n\n\t\t\t\t\tvec4 val = texture2D( gtaoBuffer, aoUv );\n\t\t\t\t\taccumSample += val * weight;\n\t\t\t\t\ttotalWeight += weight;\n\n\t\t\t\t}\n\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\n\t\t\t#endif\n\n\t\t\taccumSample /= totalWeight;\n\n\t\t\t#endif\n\n\t\t\tfloat gtao = accumSample.a;\n\n\t\t\t#if COLOR_ONLY\n\n\t\t\tgl_FragColor = vec4( accumSample.rgb, 1.0 );\n\n\t\t\t#elif AO_ONLY\n\n\t\t\tvec3 rgb = mix( vec3( 1.0 ), vec3( accumSample.a ), intensity );\n\t\t\tgl_FragColor = vec4( rgb, 1.0 );\n\n\t\t\t#else\n\n\t\t\tvec3 rgb = mix( color.rgb, color.rgb * MultiBounce( gtao, color.rgb ), intensity );\n\t\t\tvec3 delta = color.rgb - rgb;\n\t\t\tvec3 ambient = ambientColor * delta * ambientIntensity;\n\n\t\t\tfloat colorFade = ( 1.0 - pow( 1.0 - gtao, 2.0 ) );\n\t\t\tgl_FragColor = vec4( rgb + ambient + accumSample.rgb * ( 0.75 + colorFade * 0.25 ), color.a );\n\n\t\t\t#endif\n\n\t\t}\n\t\t"};class Kn{constructor(e){this.count=0,this.size=-1,this.sigma=-1,this.radius=-1,this.lookupTable=null,this.score=null,this.binaryPattern=null,this.resize(e),this.setSigma(1.5)}findVoid(){var e,{score:t,binaryPattern:r}=this;let n=1/0,a=-1;for(let i=0,s=r.length;i<s;i++)0===r[i]&&(e=t[i])<n&&(n=e,a=i);return a}findCluster(){var e,{score:t,binaryPattern:r}=this;let n=-1/0,a=-1;for(let i=0,s=r.length;i<s;i++)1===r[i]&&(e=t[i])>n&&(n=e,a=i);return a}setSigma(e){if(e!==this.sigma){var t=~~(Math.sqrt(20*Math.pow(e,2))+1),r=2*t+1;const s=new Float32Array(r*r);var n=e*e;for(let e=-t;e<=t;e++)for(let o=-t;o<=t;o++){var a=(t+o)*r+e+t,i=e*e+o*o;s[a]=Math.pow(Math.E,-i/(2*n))}this.lookupTable=s,this.sigma=e,this.radius=t}}resize(e){this.size!==e&&(this.size=e,this.score=new Float32Array(e*e),this.binaryPattern=new Uint8Array(e*e))}invert(){const{binaryPattern:e,score:t,size:r}=this;t.fill(0);for(let t=0,i=e.length;t<i;t++){var n,a;0===e[t]?(n=~~(t/r),a=t-n*r,this.updateScore(a,n,1),e[t]=1):e[t]=0}}updateScore(e,t,r){const{size:n,score:a,lookupTable:i}=this;var s=this.radius,o=2*s+1;for(let u=-s;u<=s;u++)for(let h=-s;h<=s;h++){var l=i[(s+h)*o+u+s];let d=e+u,p=(d=d<0?n+d:d%n,t+h);var c=(p=p<0?n+p:p%n)*n+d;a[c]+=r*l}}addPointIndex(e){this.binaryPattern[e]=1;var t=this.size,r=~~(e/t);this.updateScore(e-r*t,r,1),this.count++}removePointIndex(e){this.binaryPattern[e]=0;var t=this.size,r=~~(e/t);this.updateScore(e-r*t,r,-1),this.count--}copy(e){this.resize(e.size),this.score.set(e.score),this.binaryPattern.set(e.binaryPattern),this.setSigma(e.sigma),this.count=e.count}}class qn{constructor(){this.random=Math.random,this.sigma=1.5,this.size=64,this.majorityPointsRatio=.1,this.samples=new Kn(1),this.savedSamples=new Kn(1)}generate(){const{samples:e,savedSamples:t,sigma:r,majorityPointsRatio:n,size:a}=this;e.resize(a),e.setSigma(r);var i=Math.floor(a*a*n),s=e.binaryPattern,o=s,l=i;o.fill(0);for(let e=0;e<l;e++)o[e]=1;var[c,u=Math.random]=[s,this.random];for(let e=c.length-1;0<e;e--){var h=~~((u()-1e-6)*e),d=c[e];c[e]=c[h],c[h]=d}for(let t=0,r=s.length;t<r;t++)1===s[t]&&e.addPointIndex(t);for(;;){var p=e.findCluster(),f=(e.removePointIndex(p),e.findVoid());if(p===f){e.addPointIndex(p);break}e.addPointIndex(f)}const m=new Uint32Array(a*a);let g;for(t.copy(e),g=e.count-1;0<=g;){var v=e.findCluster();e.removePointIndex(v),m[v]=g,g--}var b=a*a;for(g=t.count;g<b/2;){var y=t.findVoid();t.addPointIndex(y),m[y]=g,g++}for(t.invert();g<b;){var x=t.findCluster();t.removePointIndex(x),m[x]=g,g++}return{data:m,maxValue:b}}}class Zn extends hn.w{constructor(e,t){super(),this.enabled=!0,this.needsSwap=!0,this.scene=e,this.camera=t,this.debug={display:Zn.DEFAULT},this.renderTargetScale=1,this.enableJitter=!0,this.radiusJitter=0,this.rotationJitter=0,this.numSteps=8,this.numDirections=8,this.intensity=1,this.radius=2,this.directionOffset=0,this.stepOffset=0,this.blurMode=Zn.BOX_BLUR,this.blurIterations=4,this.blurStride=1,this.enableFalloff=!0,this.falloffStart=.4,this.falloffEnd=2,this.ambientColor=new s.Color,this.ambientIntensity=0,this.lightBounceIntensity=1,this._gtaoBuffer=new s.WebGLRenderTarget(1,1,{format:s.RGBAFormat}),this._depthBuffer=new s.WebGLRenderTarget(1,1,{minFilter:s.NearestFilter,magFilter:s.NearestFilter,format:s.RGBAFormat,type:s.HalfFloatType}),this._depthReplacement=new zn,this._normalBuffer=new s.WebGLRenderTarget(1,1,{minFilter:s.NearestFilter,magFilter:s.NearestFilter,format:s.RGBAFormat}),this._normalReplacement=new Fn,this.gtaoQuad=new hn.T(new s.ShaderMaterial(Hn)),this.debugPackedQuad=new hn.T(new s.ShaderMaterial(Vn)),this.debugDepthQuad=new hn.T(new s.ShaderMaterial(Gn)),this.compositeQuad=new hn.T(new s.ShaderMaterial(Wn));const r=new qn,n=(r.size=32,new Uint8Array(4*Math.pow(32,2)));for(let e=0;e<4;e++){var a=r.generate(),i=a.data,o=a.maxValue;for(let t=0,r=i.length;t<r;t++)n[4*t+e]=i[t]/o*255}this.blueNoiseTex=new s.DataTexture(n,r.size,r.size,s.RGBAFormat),this.blueNoiseTex.wrapS=s.RepeatWrapping,this.blueNoiseTex.wrapT=s.RepeatWrapping,this.blueNoiseTex.minFilter=s.LinearFilter,this.blueNoiseTex.needsUpdate=!0}dispose(){}setSize(e,t){var r=this.renderTargetScale,n=Math.floor(e*r);r=Math.floor(t*r),this._depthBuffer.setSize(e,t),this._normalBuffer.setSize(e,t),this._gtaoBuffer.setSize(n,r)}render(e,t,r){t=this.renderToScreen?null:t;const{scene:n,camera:a,debug:i,debugPackedQuad:o,debugDepthQuad:l,compositeQuad:c,gtaoQuad:u}=this,h=u.material;Zn.RendererState.copy(e,n);var d=()=>{Zn.RendererState.restore(e,n),f.reset(n,!0)},p=this._depthBuffer;const f=this._depthReplacement;if(n.background=null,f.replace(n,!0,!0),e.setRenderTarget(p),e.setClearColor(Zn.BlackColor,0),e.clear(),e.render(n,a),i.display===Zn.DEPTH)return e.setRenderTarget(t),l.material.uniforms.texture.value=p.texture,l.render(e),void d();const m=this._normalReplacement;var g=this._normalBuffer;if(m.replace(n,!0,!1),e.setRenderTarget(g),e.clear(),e.render(n,a),i.display===Zn.NORMAL)return e.setRenderTarget(t),e.clear(),o.material.uniforms.displayRoughness.value=0,o.material.uniforms.texture.value=g.texture,o.render(e),void d();this.numSteps!==h.defines.NUM_STEPS&&(h.defines.NUM_STEPS=this.numSteps,h.needsUpdate=!0),this.numDirections!==h.defines.NUM_DIRECTIONS&&(h.defines.NUM_DIRECTIONS=this.numDirections,h.needsUpdate=!0),this.radius.toFixed(16)!==h.defines.RADIUS&&(h.defines.RADIUS=this.radius.toFixed(16),h.needsUpdate=!0),Math.pow(this.falloffStart,2).toFixed(16)===h.defines.FALLOFF_START2&&Math.pow(this.falloffEnd,2).toFixed(16)===h.defines.FALLOFF_END2&&this.enableFalloff===Boolean(h.defines.ENABLE_FALLOFF)||(h.defines.FALLOFF_START2=Math.pow(this.falloffStart,2).toFixed(16),h.defines.FALLOFF_END2=Math.pow(this.falloffEnd,2).toFixed(16),h.defines.ENABLE_FALLOFF=this.enableFalloff?1:0,h.needsUpdate=!0),this.rotationJitter!==h.defines.ENABLE_ROTATION_JITTER&&(h.defines.ENABLE_ROTATION_JITTER=this.rotationJitter,h.needsUpdate=!0),this.radiusJitter!==h.defines.ENABLE_RADIUS_JITTER&&(h.defines.ENABLE_RADIUS_JITTER=this.radiusJitter,h.needsUpdate=!0),0!==this.lightBounceIntensity!==Boolean(h.defines.ENABLE_COLOR_BOUNCE)&&(h.defines.ENABLE_COLOR_BOUNCE=0!==this.lightBounceIntensity?1:0,h.needsUpdate=!0);var v=this._gtaoBuffer,b=Math.floor(v.texture.image.width),y=Math.floor(v.texture.image.height),x=a.projectionMatrix,w=s.MathUtils.DEG2RAD*a.fov;h.uniforms.params.value.set(this.directionOffset,this.stepOffset),h.uniforms.projInfo.value.set(2/(b*x.elements[0]),2/(y*x.elements[5]),-1/x.elements[0],-1/x.elements[5]),h.uniforms.clipInfo.value.set(a.near,a.far,y/(2*Math.tan(.5*w))*.5,0),h.uniforms.normalBuffer.value=g.texture,h.uniforms.depthBuffer.value=p.texture,h.uniforms.colorBuffer.value=r.texture,h.uniforms.lightBounceIntensity.value=this.lightBounceIntensity,h.uniforms.renderSize.value.set(Math.floor(v.texture.image.width),Math.floor(v.texture.image.height)),h.uniforms.blueNoiseTex.value=this.blueNoiseTex,h.uniforms.blueNoiseSize.value=this.blueNoiseTex.image.width,e.setRenderTarget(v),e.clear(),u.render(e);const S=c.material;S.uniforms.depthBuffer.value=p.texture,S.uniforms.normalBuffer.value=g.texture,S.uniforms.colorBuffer.value=r.texture,S.uniforms.gtaoBuffer.value=v.texture,S.uniforms.intensity.value=this.intensity,S.uniforms.aoSize.value.set(v.width,v.height),S.uniforms.fullSize.value.set(r.width,r.height),S.uniforms.blurStride.value=this.blurStride,S.uniforms.ambientColor.value.copy(this.ambientColor),S.uniforms.ambientIntensity.value=this.ambientIntensity,this.blurIterations!==S.defines.BLUR_ITERATIONS&&(S.defines.BLUR_ITERATIONS=this.blurIterations,S.needsUpdate=!0),this.blurMode!==S.defines.BLUR_MODE&&(S.defines.BLUR_MODE=this.blurMode,S.needsUpdate=!0),i.display===Zn.AO_SAMPLE?1!==S.defines.AO_ONLY&&(S.defines.AO_ONLY=1,S.needsUpdate=!0):0!==S.defines.AO_ONLY&&(S.defines.AO_ONLY=0,S.needsUpdate=!0),i.display===Zn.COLOR_SAMPLE?1!==S.defines.COLOR_ONLY&&(S.defines.COLOR_ONLY=1,S.needsUpdate=!0):0!==S.defines.COLOR_ONLY&&(S.defines.COLOR_ONLY=0,S.needsUpdate=!0),e.setRenderTarget(t),e.clear(),c.render(e),d()}}Zn.NO_JITTER=0,Zn.RANDOM_JITTER=1,Zn.BLUENOISE_JITTER=2,Zn.DEFAULT=0,Zn.DEPTH=1,Zn.NORMAL=2,Zn.AO_SAMPLE=3,Zn.COLOR_SAMPLE=4,Zn.NO_BLUR=0,Zn.BOX_BLUR=1,Zn.CROSS_BLUR=2,Zn.DIAGONAL_BLUR=3,Zn.BlackColor=new s.Color(0),Zn.RendererState=new class{constructor(){this.clearAlpha=0,this.clearColor=new s.Color,this.renderTarget=null,this.outputEncoding=s.LinearEncoding,this.overrideMaterial=null,this.shadowsEnabled=!1,this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.background=null,this.autoUpdate=!0}copy(e,t){e&&(this.clearAlpha=e.getClearAlpha(),this.clearColor=e.getClearColor(this.clearColor),this.renderTarget=e.getRenderTarget(),this.shadowsEnabled=e.shadowMap.enabled,this.outputEncoding=e.outputEncoding,this.autoClear=e.autoClear,this.autoClearColor=e.autoClearColor,this.autoClearDepth=e.autoClearDepth,this.autoClearStencil=e.autoClearStencil),t&&(this.overrideMaterial=t.overrideMaterial,this.background=t.background,this.autoUpdate=t.autoUpdate)}restore(e,t){e&&(e.setClearAlpha(this.clearAlpha),e.setClearColor(this.clearColor),e.setRenderTarget(this.renderTarget),e.shadowMap.enabled=this.shadowsEnabled,e.outputEncoding=this.outputEncoding,e.autoClear=this.autoClear,e.autoClearColor=this.autoClearColor,e.autoClearDepth=this.autoClearDepth,e.autoClearStencil=this.autoClearStencil),t&&(t.overrideMaterial=this.overrideMaterial,t.background=this.background,t.autoUpdate=this.autoUpdate),this.renderTarget=null,this.overrideMaterial=null}};class Xn{constructor(e){this.mtuPP=e,this.mtuPP.renderer&&this.postProcessing()}postProcessing(){this.gtaoPass||(this.gtaoPass=new Zn(this.mtuPP.mainScene,this.mtuPP.mainCamera)),this.mtuPP.effectComposer.addPass(this.gtaoPass)}setAOData(e,t){"rotationJitter"===e||"radiusJitter"===e?"NONE"===t?this.gtaoPass[e]=0:"RANDOM"===t?this.gtaoPass[e]=1:"BLUE_NOISE"===t&&(this.gtaoPass[e]=2):"blurMode"===e?"NO_BLUR"===t?this.gtaoPass[e]=0:"BOX_BLUR"===t?this.gtaoPass[e]=1:"CROSS_BLUR"===t?this.gtaoPass[e]=2:"DIAGONAL_BLUR"===t&&(this.gtaoPass[e]=3):this.gtaoPass[e]="ambientColor"===e?new ga.Color(t):t}dispose(){this.gtaoPass&&(this.gtaoPass.dispose(),this.gtaoPass=null)}enablePass(e){this.gtaoPass&&this.gtaoPass.enabled!==e&&(this.gtaoPass.enabled=e)}}function Qn(e){return(Qn="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})(e)}function Yn(e,t){return(Yn=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Jn(e){return(Jn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var $n=function(e){var t=n;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Yn(t,e);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Jn(e);if(r=t?(r=Jn(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===Qn(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(e,t,a,i,o){var l;if(this instanceof n)return(l=r.call(this)).scene=e,l.camera=t,l.overrideMaterial=a,l.clearColor=i,l.clearAlpha=void 0!==o?o:0,l.clear=!0,l.clearDepth=!1,l.needsSwap=!1,l._oldClearColor=new s.Color,l;throw new TypeError("Cannot call a class as a function")}return t=n,(e=[{key:"render",value:function(e,t,r){var n,a,i=e.autoClear;e.autoClear=!1,void 0!==this.overrideMaterial&&(a=this.scene.overrideMaterial,this.scene.overrideMaterial=this.overrideMaterial),this.clearColor&&(e.getClearColor(this._oldClearColor),n=e.getClearAlpha(),e.setClearColor(this.clearColor,this.clearAlpha)),this.clearDepth&&e.clearDepth(),e.setRenderTarget(this.renderToScreen?null:r),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),e.render(this.scene,this.camera),this.clearColor&&e.setClearColor(this._oldClearColor,n),void 0!==this.overrideMaterial&&(this.scene.overrideMaterial=a),e.autoClear=i}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),n}(hn.w),ea={uniforms:{tDiffuse:{value:null},resolution:{value:new s.Vector2(1/1024,1/512)}},vertexShader:"\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",fragmentShader:"\n\tprecision highp float;\n\n\tuniform sampler2D tDiffuse;\n\n\tuniform vec2 resolution;\n\n\tvarying vec2 vUv;\n\n\t// FXAA 3.11 implementation by NVIDIA, ported to WebGL by Agost Biro (biro@archilogic.com)\n\n\t//----------------------------------------------------------------------------------\n\t// File: es3-keplerFXAAassetsshaders/FXAA_DefaultES.frag\n\t// SDK Version: v3.00\n\t// Email: gameworks@nvidia.com\n\t// Site: http://developer.nvidia.com/\n\t//\n\t// Copyright (c) 2014-2015, NVIDIA CORPORATION. All rights reserved.\n\t//\n\t// Redistribution and use in source and binary forms, with or without\n\t// modification, are permitted provided that the following conditions\n\t// are met:\n\t// * Redistributions of source code must retain the above copyright\n\t// notice, this list of conditions and the following disclaimer.\n\t// * Redistributions in binary form must reproduce the above copyright\n\t// notice, this list of conditions and the following disclaimer in the\n\t// documentation and/or other materials provided with the distribution.\n\t// * Neither the name of NVIDIA CORPORATION nor the names of its\n\t// contributors may be used to endorse or promote products derived\n\t// from this software without specific prior written permission.\n\t//\n\t// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY\n\t// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n\t// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n\t// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR\n\t// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\n\t// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\n\t// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n\t// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY\n\t// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n\t// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n\t// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\t//\n\t//----------------------------------------------------------------------------------\n\n\t#ifndef FXAA_DISCARD\n\t\t\t//\n\t\t\t// Only valid for PC OpenGL currently.\n\t\t\t// Probably will not work when FXAA_GREEN_AS_LUMA = 1.\n\t\t\t//\n\t\t\t// 1 = Use discard on pixels which don't need AA.\n\t\t\t// For APIs which enable concurrent TEX+ROP from same surface.\n\t\t\t// 0 = Return unchanged color on pixels which don't need AA.\n\t\t\t//\n\t\t\t#define FXAA_DISCARD 0\n\t#endif\n\n\t/*--------------------------------------------------------------------------*/\n\t#define FxaaTexTop(t, p) texture2D(t, p, -100.0)\n\t#define FxaaTexOff(t, p, o, r) texture2D(t, p + (o * r), -100.0)\n\t/*--------------------------------------------------------------------------*/\n\n\t#define NUM_SAMPLES 5\n\n\t// assumes colors have premultipliedAlpha, so that the calculated color contrast is scaled by alpha\n\tfloat contrast( vec4 a, vec4 b ) {\n\t\t\tvec4 diff = abs( a - b );\n\t\t\treturn max( max( max( diff.r, diff.g ), diff.b ), diff.a );\n\t}\n\n\t/*============================================================================\n\n\t\t\t\t\t\t\t\t\tFXAA3 QUALITY - PC\n\n\t============================================================================*/\n\n\t/*--------------------------------------------------------------------------*/\n\tvec4 FxaaPixelShader(\n\t\t\tvec2 posM,\n\t\t\tsampler2D tex,\n\t\t\tvec2 fxaaQualityRcpFrame,\n\t\t\tfloat fxaaQualityEdgeThreshold,\n\t\t\tfloat fxaaQualityinvEdgeThreshold\n\t) {\n\t\t\tvec4 rgbaM = FxaaTexTop(tex, posM);\n\t\t\tvec4 rgbaS = FxaaTexOff(tex, posM, vec2( 0.0, 1.0), fxaaQualityRcpFrame.xy);\n\t\t\tvec4 rgbaE = FxaaTexOff(tex, posM, vec2( 1.0, 0.0), fxaaQualityRcpFrame.xy);\n\t\t\tvec4 rgbaN = FxaaTexOff(tex, posM, vec2( 0.0,-1.0), fxaaQualityRcpFrame.xy);\n\t\t\tvec4 rgbaW = FxaaTexOff(tex, posM, vec2(-1.0, 0.0), fxaaQualityRcpFrame.xy);\n\t\t\t// . S .\n\t\t\t// W M E\n\t\t\t// . N .\n\n\t\t\tbool earlyExit = max( max( max(\n\t\t\t\t\tcontrast( rgbaM, rgbaN ),\n\t\t\t\t\tcontrast( rgbaM, rgbaS ) ),\n\t\t\t\t\tcontrast( rgbaM, rgbaE ) ),\n\t\t\t\t\tcontrast( rgbaM, rgbaW ) )\n\t\t\t\t\t< fxaaQualityEdgeThreshold;\n\t\t\t// . 0 .\n\t\t\t// 0 0 0\n\t\t\t// . 0 .\n\n\t\t\t#if (FXAA_DISCARD == 1)\n\t\t\t\t\tif(earlyExit) FxaaDiscard;\n\t\t\t#else\n\t\t\t\t\tif(earlyExit) return rgbaM;\n\t\t\t#endif\n\n\t\t\tfloat contrastN = contrast( rgbaM, rgbaN );\n\t\t\tfloat contrastS = contrast( rgbaM, rgbaS );\n\t\t\tfloat contrastE = contrast( rgbaM, rgbaE );\n\t\t\tfloat contrastW = contrast( rgbaM, rgbaW );\n\n\t\t\tfloat relativeVContrast = ( contrastN + contrastS ) - ( contrastE + contrastW );\n\t\t\trelativeVContrast *= fxaaQualityinvEdgeThreshold;\n\n\t\t\tbool horzSpan = relativeVContrast > 0.;\n\t\t\t// . 1 .\n\t\t\t// 0 0 0\n\t\t\t// . 1 .\n\n\t\t\t// 45 deg edge detection and corners of objects, aka V/H contrast is too similar\n\t\t\tif( abs( relativeVContrast ) < .3 ) {\n\t\t\t\t\t// locate the edge\n\t\t\t\t\tvec2 dirToEdge;\n\t\t\t\t\tdirToEdge.x = contrastE > contrastW ? 1. : -1.;\n\t\t\t\t\tdirToEdge.y = contrastS > contrastN ? 1. : -1.;\n\t\t\t\t\t// . 2 . . 1 .\n\t\t\t\t\t// 1 0 2 ~= 0 0 1\n\t\t\t\t\t// . 1 . . 0 .\n\n\t\t\t\t\t// tap 2 pixels and see which ones are \"outside\" the edge, to\n\t\t\t\t\t// determine if the edge is vertical or horizontal\n\n\t\t\t\t\tvec4 rgbaAlongH = FxaaTexOff(tex, posM, vec2( dirToEdge.x, -dirToEdge.y ), fxaaQualityRcpFrame.xy);\n\t\t\t\t\tfloat matchAlongH = contrast( rgbaM, rgbaAlongH );\n\t\t\t\t\t// . 1 .\n\t\t\t\t\t// 0 0 1\n\t\t\t\t\t// . 0 H\n\n\t\t\t\t\tvec4 rgbaAlongV = FxaaTexOff(tex, posM, vec2( -dirToEdge.x, dirToEdge.y ), fxaaQualityRcpFrame.xy);\n\t\t\t\t\tfloat matchAlongV = contrast( rgbaM, rgbaAlongV );\n\t\t\t\t\t// V 1 .\n\t\t\t\t\t// 0 0 1\n\t\t\t\t\t// . 0 .\n\n\t\t\t\t\trelativeVContrast = matchAlongV - matchAlongH;\n\t\t\t\t\trelativeVContrast *= fxaaQualityinvEdgeThreshold;\n\n\t\t\t\t\tif( abs( relativeVContrast ) < .3 ) { // 45 deg edge\n\t\t\t\t\t\t\t// 1 1 .\n\t\t\t\t\t\t\t// 0 0 1\n\t\t\t\t\t\t\t// . 0 1\n\n\t\t\t\t\t\t\t// do a simple blur\n\t\t\t\t\t\t\treturn mix(\n\t\t\t\t\t\t\t\t\trgbaM,\n\t\t\t\t\t\t\t\t\t(rgbaN + rgbaS + rgbaE + rgbaW) * .25,\n\t\t\t\t\t\t\t\t\t.4\n\t\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\thorzSpan = relativeVContrast > 0.;\n\t\t\t}\n\n\t\t\tif(!horzSpan) rgbaN = rgbaW;\n\t\t\tif(!horzSpan) rgbaS = rgbaE;\n\t\t\t// . 0 . 1\n\t\t\t// 1 0 1 -> 0\n\t\t\t// . 0 . 1\n\n\t\t\tbool pairN = contrast( rgbaM, rgbaN ) > contrast( rgbaM, rgbaS );\n\t\t\tif(!pairN) rgbaN = rgbaS;\n\n\t\t\tvec2 offNP;\n\t\t\toffNP.x = (!horzSpan) ? 0.0 : fxaaQualityRcpFrame.x;\n\t\t\toffNP.y = ( horzSpan) ? 0.0 : fxaaQualityRcpFrame.y;\n\n\t\t\tbool doneN = false;\n\t\t\tbool doneP = false;\n\n\t\t\tfloat nDist = 0.;\n\t\t\tfloat pDist = 0.;\n\n\t\t\tvec2 posN = posM;\n\t\t\tvec2 posP = posM;\n\n\t\t\tint iterationsUsed = 0;\n\t\t\tint iterationsUsedN = 0;\n\t\t\tint iterationsUsedP = 0;\n\t\t\tfor( int i = 0; i < NUM_SAMPLES; i++ ) {\n\t\t\t\t\titerationsUsed = i;\n\n\t\t\t\t\tfloat increment = float(i + 1);\n\n\t\t\t\t\tif(!doneN) {\n\t\t\t\t\t\t\tnDist += increment;\n\t\t\t\t\t\t\tposN = posM + offNP * nDist;\n\t\t\t\t\t\t\tvec4 rgbaEndN = FxaaTexTop(tex, posN.xy);\n\t\t\t\t\t\t\tdoneN = contrast( rgbaEndN, rgbaM ) > contrast( rgbaEndN, rgbaN );\n\t\t\t\t\t\t\titerationsUsedN = i;\n\t\t\t\t\t}\n\n\t\t\t\t\tif(!doneP) {\n\t\t\t\t\t\t\tpDist += increment;\n\t\t\t\t\t\t\tposP = posM - offNP * pDist;\n\t\t\t\t\t\t\tvec4 rgbaEndP = FxaaTexTop(tex, posP.xy);\n\t\t\t\t\t\t\tdoneP = contrast( rgbaEndP, rgbaM ) > contrast( rgbaEndP, rgbaN );\n\t\t\t\t\t\t\titerationsUsedP = i;\n\t\t\t\t\t}\n\n\t\t\t\t\tif(doneN || doneP) break;\n\t\t\t}\n\n\n\t\t\tif ( !doneP && !doneN ) return rgbaM; // failed to find end of edge\n\n\t\t\tfloat dist = min(\n\t\t\t\t\tdoneN ? float( iterationsUsedN ) / float( NUM_SAMPLES - 1 ) : 1.,\n\t\t\t\t\tdoneP ? float( iterationsUsedP ) / float( NUM_SAMPLES - 1 ) : 1.\n\t\t\t);\n\n\t\t\t// hacky way of reduces blurriness of mostly diagonal edges\n\t\t\t// but reduces AA quality\n\t\t\tdist = pow(dist, .5);\n\n\t\t\tdist = 1. - dist;\n\n\t\t\treturn mix(\n\t\t\t\t\trgbaM,\n\t\t\t\t\trgbaN,\n\t\t\t\t\tdist * .5\n\t\t\t);\n\t}\n\n\tvoid main() {\n\t\t\tconst float edgeDetectionQuality = .2;\n\t\t\tconst float invEdgeDetectionQuality = 1. / edgeDetectionQuality;\n\n\t\t\tgl_FragColor = FxaaPixelShader(\n\t\t\t\t\tvUv,\n\t\t\t\t\ttDiffuse,\n\t\t\t\t\tresolution,\n\t\t\t\t\tedgeDetectionQuality, // [0,1] contrast needed, otherwise early discard\n\t\t\t\t\tinvEdgeDetectionQuality\n\t\t\t);\n\n\t}\n\t"},ta={uniforms:{tDiffuse:{value:null},offset:{value:1},darkness:{value:1}},vertexShader:"\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",fragmentShader:"\n\n\t\tuniform float offset;\n\t\tuniform float darkness;\n\n\t\tuniform sampler2D tDiffuse;\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\t// Eskil's vignette\n\n\t\t\tvec4 texel = texture2D( tDiffuse, vUv );\n\t\t\tvec2 uv = ( vUv - vec2( 0.5 ) ) * vec2( offset );\n\t\t\tgl_FragColor = vec4( mix( texel.rgb, vec3( 1.0 - darkness ), dot( uv, uv ) ), texel.a );\n\n\t\t}"};const ra={radius:{type:"number",val:.6,shortKey:"r",onUpdate({type:e,data:t,runScene:r}){r.pp.setGlowData(e,t)}},strength:{type:"number",val:1.5,shortKey:"s",onUpdate({type:e,data:t,runScene:r}){r.pp.setGlowData(e,t)}},threshold:{type:"number",val:0,shortKey:"t",onUpdate({type:e,data:t,runScene:r}){r.pp.setGlowData(e,t)}}},na={edgeStrength:{type:"number",val:3,shortKey:"es",onUpdate({type:e,data:t,runScene:r}){r.pp.setOutlineData(e,t)}},edgeGlow:{type:"number",val:0,shortKey:"eg",onUpdate({type:e,data:t,runScene:r}){r.pp.setOutlineData(e,t)}},edgeThickness:{type:"number",val:1,shortKey:"et",onUpdate({type:e,data:t,runScene:r}){r.pp.setOutlineData(e,t)}},pulsePeriod:{type:"number",val:0,shortKey:"pp",onUpdate({type:e,data:t,runScene:r}){r.pp.setOutlineData(e,t)}},visibleEdgeColor:{type:"color_str",val:"#FFFFFF",shortKey:"vec",onUpdate({type:e,data:t,runScene:r}){r.pp.setOutlineData(e,t)}},hiddenEdgeColor:{type:"color_str",val:"#190A05",shortKey:"hec",onUpdate({type:e,data:t,runScene:r}){r.pp.setOutlineData(e,t)}}},aa={directionOffset:{type:"number",val:0,shortKey:"do",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},stepOffset:{type:"number",val:0,shortKey:"so",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},rotationJitter:{type:"other",val:"NONE",shortKey:"roj",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},radiusJitter:{type:"other",val:"NONE",shortKey:"raj",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},numSteps:{type:"number",val:8,shortKey:"ns",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},numDirections:{type:"number",val:1,shortKey:"nd",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},intensity:{type:"number",val:1,shortKey:"i",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},radius:{type:"number",val:2,shortKey:"r",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},enableFalloff:{type:"other",val:!0,shortKey:"ef",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},falloffStart:{type:"number",val:.4,shortKey:"fs",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},falloffEnd:{type:"number",val:2,shortKey:"fe",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},renderTargetScale:{type:"number",val:.5,shortKey:"rts",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},blurMode:{type:"other",val:"NO_BLUR",shortKey:"bm",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},blurIterations:{type:"number",val:5,shortKey:"bi",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},blurStride:{type:"number",val:1,shortKey:"bs",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},ambientColor:{type:"color_str",val:"#FFFFFF",shortKey:"ac",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},ambientIntensity:{type:"number",val:0,shortKey:"ai",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},lightBounceIntensity:{type:"number",val:0,shortKey:"lbi",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}}};var ia=r(1398);class sa{constructor(e){this.params=this.getDefaultParams(),this.clean=()=>{this.resetParams(),this.reset()},this.ENTIRE_SCENE=0,this.BLOOM_SCENE=1,this.BLACK_COLOR=new ga.Color(0),this.runScene=e,this.info=new ln(this.runScene),this.isSafari=-1<navigator.userAgent.indexOf("Safari"),this.isChrome=-1<navigator.userAgent.indexOf("Chrome"),this.rtSize=new ga.Vector2,this.sceneFogColor=null,this.sceneBackground=null,this.isUpdate=!0,this.runScene.exporter.gltf.options.addOption({type:"post-processing",process:e=>this.toJSON(),parse:e=>{e=JSON.parse(e),this.fromJSON(e)}}),this.runScene.cb.clean.add("pp",this.clean),this.runScene.cb.setScene.add("post-processing",(({type:e,val:t})=>{"fog"===e&&t&&t.show&&(this.sceneFogColor?this.sceneFogColor.copy(t.color):this.sceneFogColor=new ga.Color(t.color)),"background"===e&&(this.sceneBackground&&(0,it.isTexture)(this.sceneBackground)&&this.sceneBackground.dispose(),this.sceneBackground=t,this.isChrome&&this.mtuGlow?this.mtuGlow.setSceneBg():this.isSafari)})),this.runScene.snapshot.bind({name:"glow",target:this.params.glow,def:ra}),this.runScene.snapshot.bind({name:"outline",target:this.params.outline,def:na}),this.runScene.snapshot.bind({name:"ao",target:this.params.ao,def:aa,set:e=>{const t=e.snapshot.data.get("ao");t&&(ia.LV.set({def:aa,runScene:this.runScene,data:t,target:this.params.ao,map:e}),e.data.completedCbs.push((()=>{(0,i.mapObj)(aa,((e,r)=>{var{type:r,val:n,shortKey:a}=r;"other"===r&&this.setAOData(e,void 0!==t[a]?t[a]:n)}))})))}})}getDefaultParams(){return{pp:{samples:2},glow:{isBloom:!1,radius:.6,strength:1.5,threshold:0},outline:{isOutline:!1,edgeStrength:3,edgeGlow:0,edgeThickness:1,pulsePeriod:0,visibleEdgeColor:"#FFFFFF",hiddenEdgeColor:"#190A05"},ao:{isAO:!1,directionOffset:0,stepOffset:0,rotationJitter:"NONE",radiusJitter:"NONE",numSteps:8,numDirections:1,intensity:1,radius:2,enableFalloff:!0,falloffStart:.4,falloffEnd:2,renderTargetScale:.5,blurMode:"NO_BLUR",blurIterations:5,blurStride:1,ambientColor:"#FFFFFF",ambientIntensity:0,lightBounceIntensity:0},vignette:{isVignette:!1,offset:1,darkness:1}}}resetParams(){(0,I.U)(this.params,this.getDefaultParams())}init(){try{var{camera:e,scene:t,renderer:r}=this.runScene.assetsEx.get();this.mainScene=t,this.mainCamera=e,this.renderer=r,this.renderer&&(this.renderer.getSize(this.rtSize),this.postProcessing())}catch(e){console.log("Error: ",e)}this.runScene.cb.loaderer.gltf.loadNode.add("outline-objects",(({node:e,nodeDef:t})=>{t.extras&&t.extras.outline&&this.mtOutline.addSelectedObject(e)}))}postProcessing(){this.effectComposer=new An(this.renderer,this.getNewRenderTarget(this.params.pp.samples)),this.renderPass=new $n(this.mainScene,this.mainCamera),this.fxaaPass=new un.T(ea),this.fxaaPass.uniforms.resolution.value.set(1/window.innerWidth,1/window.innerHeight),this.vignettePass=new un.T(ta),this.effectComposer.addPass(this.renderPass),this.ppOutline(),this.ppGlow(),this.ppAO(),this.effectComposer.addPass(this.vignettePass)}getNewRenderTarget(e){const t=new ga.WebGLRenderTarget(this.rtSize.x,this.rtSize.y,{samples:e});return t.depthTexture=new ga.DepthTexture(this.rtSize.x,this.rtSize.y),t.depthTexture.type=ga.UnsignedIntType,t.depthTexture.format=ga.DepthFormat,t.texture.format=ga.RGBAFormat,t.texture.encoding=ga.sRGBEncoding,t}ppOutline(){this.mtOutline=new In.Q(this)}ppGlow(){this.isChrome?(this.effectComposer.renderToScreen=!0,this.mtuGlow=new xn(this)):this.isSafari&&(this.effectComposer.renderToScreen=!1,this.threeGlow=new Ln(this))}ppAO(){this.mtAO=new Xn(this)}toJSON(){const e={};var{pp:t,glow:r,outline:n,ao:a,vignette:i}=this.params;return e.ppParams=Object.assign({},t),e.bloomParams=Object.assign({},r),e.outlineParams=Object.assign({},n),e.aoParams=Object.assign({},a),e.vignetteParams=Object.assign({},i),JSON.stringify(e)}fromJSON(e){var{ppParams:e,bloomParams:t,outlineParams:r,aoParams:n,vignetteParams:a}=e;e&&(e=e.samples,this.params.pp.samples=e,this.effectComposer&&this.effectComposer.reset(this.getNewRenderTarget(this.params.pp.samples))),t&&(this.params.glow.isBloom=t.isBloom,this.setGlowData("radius",t.radius),this.setGlowData("strength",t.strength),this.setGlowData("threshold",t.threshold),this.runScene.cb.pp.glow.setData.cb(this.params.glow)),r&&this.mtOutline&&(this.params.outline.isOutline=r.isOutline,this.setOutlineData("edgeStrength",r.edgeStrength),this.setOutlineData("edgeGlow",r.edgeGlow),this.setOutlineData("edgeThickness",r.edgeThickness),this.setOutlineData("pulsePeriod",r.pulsePeriod),this.setOutlineData("visibleEdgeColor",r.visibleEdgeColor),this.setOutlineData("hiddenEdgeColor",r.hiddenEdgeColor),this.runScene.cb.pp.outline.setData.cb(this.params.outline)),n&&this.mtAO&&(this.params.ao.isAO=n.isAO,this.setAOData("directionOffset",n.directionOffset),this.setAOData("stepOffset",n.stepOffset),this.setAOData("rotationJitter",n.rotationJitter),this.setAOData("radiusJitter",n.radiusJitter),this.setAOData("numSteps",n.numSteps),this.setAOData("numDirections",n.numDirections),this.setAOData("intensity",n.intensity),this.setAOData("radius",n.radius),this.setAOData("enableFalloff",n.enableFalloff),this.setAOData("falloffStart",n.falloffStart),this.setAOData("falloffEnd",n.falloffEnd),this.setAOData("renderTargetScale",n.renderTargetScale),this.setAOData("blurMode",n.blurMode),this.setAOData("blurIterations",n.blurIterations),this.setAOData("blurStride",n.blurStride),this.setAOData("ambientColor",n.ambientColor),this.setAOData("ambientIntensity",n.ambientIntensity),this.setAOData("lightBounceIntensity",n.lightBounceIntensity),this.runScene.cb.pp.ao.setData.cb(this.params.ao)),a&&this.vignettePass&&(this.params.vignette.isVignette=a.isVignette,this.setVignetteData("offset",a.offset),this.setVignetteData("darkness",a.darkness),this.runScene.cb.pp.vignette.setData.cb(this.params.vignette))}setUpdate(e){this.isUpdate=e}clearAllOutlineObj(){this.mtOutline.clearAllOutlineObj()}update(){this.isUpdate&&this.mainScene&&this.mainCamera&&this.renderer&&(this.params.glow.isBloom||this.params.outline.isOutline||this.params.ao.isAO||this.params.vignette.isVignette?(this.vignettePass.enabled=this.params.vignette.isVignette,this.mtAO&&this.mtAO.enablePass(this.params.ao.isAO),this.mtOutline&&this.mtOutline.enablePass(this.params.outline.isOutline),this.isChrome&&this.mtuGlow?(this.mtuGlow.enablePass(this.params.glow.isBloom),this.effectComposer.render()):this.isSafari&&this.threeGlow&&(this.threeGlow.enablePass(this.params.glow.isBloom),this.threeGlow.render())):this.renderer.render(this.mainScene,this.mainCamera))}setSize(e,t){this.rtSize.x=e,this.rtSize.y=t,this.effectComposer&&this.effectComposer.setSize(e,t),this.isChrome&&this.mtuGlow||this.isSafari&&this.threeGlow&&this.threeGlow.setSize(e,t)}reset(){this.runScene.pp.dispose(),this.runScene.pp.init()}dispose(){this.isChrome&&this.mtuGlow?this.mtuGlow.dispose():this.isSafari&&this.threeGlow&&this.threeGlow.dispose(),this.mtOutline&&this.mtOutline.dispose(),this.renderPass=null,this.effectComposer&&(this.effectComposer.renderTarget1&&(this.effectComposer.renderTarget1.dispose(),this.effectComposer.renderTarget1=null),this.effectComposer.renderTarget2&&(this.effectComposer.renderTarget2.dispose(),this.effectComposer.renderTarget2=null),this.effectComposer=null)}setPPData(e,t){this.params.pp[e]=t,"samples"===e&&this.effectComposer&&this.effectComposer.reset(this.getNewRenderTarget(this.params.pp.samples))}setGlowData(e,t){this.params.glow[e]=t,this.isChrome&&this.mtuGlow?this.mtuGlow.setGlowData(e,t):this.isSafari&&this.threeGlow&&this.threeGlow.setGlowData(e,t)}setOutlineData(e,t){this.params.outline[e]=t,this.mtOutline&&this.mtOutline.setOutlineData(e,t)}addOutlineObj(e,t=!0){this.mtOutline.addSelectedObject(e,t)}setAOData(e,t){this.params.ao[e]=t,this.mtAO&&this.mtAO.setAOData(e,t)}setVignetteData(e,t){this.params.vignette[e]=t,this.vignettePass&&(this.vignettePass.uniforms[e].value=t)}}var oa=r(7738);class la extends o{constructor(e){super(e),this.map=new A.Z,this.playLimit=new I.cM,this.renderName="script-texture-render",this._clock=new s.Clock,this.bindEvent()}parse(e,t){var r=(0,U.Ki)(t);0===Object.keys(e||{}).length?this.map.has(r)&&this.map.delete(r):this.map.set(r,{texture:t,uvScript:e})}bindEvent(){this.runScene.cb.texture.setAnima.add("script-texture-set-anima",(({uvScript:e,texture:t})=>this.parse(e,t))),this.runScene.cb.texture.add.add("script-texture-add-texture",(e=>{var t=e.userData.uvScript;t&&this.parse(t,e)}))}_playAll(){this.map.forEach((e=>{const{texture:t,uvScript:r}=e;var{moveX:e,moveY:n,rotate:a}=r;t.userData.scriptTextre||(t.userData.scriptTextre={offsetX:t.offset.x,offsetY:t.offset.y,rotation:t.rotation}),e&&(t.offset.x+=e),n&&(t.offset.y+=n),a&&(t.rotation+=a)}))}playAll(){const{scriptFrame:e,mode:t}=this.runScene.optionsEx.options.renderConfig;-1===e&&"tick"===t?this.runScene.cb.render.add(this.renderName,(()=>{this._playAll()})):this.runScene.cb.render.add(this.renderName,(()=>{this.playLimit.update({cb:()=>{this._playAll()},cbRate:1/e,now:this._clock.getDelta()})}))}closeAll(){this.map.forEach((e=>{const t=e.texture;let r=0,n=0,a=0;t.userData.scriptTextre&&(r=(e=t.userData.scriptTextre).offsetX,n=e.offsetY,a=e.rotation,delete t.userData.scriptTextre),t.offset.x=r,t.offset.y=n,t.rotation=a})),this.runScene.cb.render.delete(this.renderName)}has(e){return void 0!==e.userData.uvScript}get(e){return e.userData.uvScript}set(e,t){t.userData.uvScript=e}}class ca extends o{constructor(e){super(e),this.runAll=!1,this.inited=()=>{this.runScene.cb.exporter.gltf.before.add("script",(()=>{this.closeAll()}))},this.texture=new la(e),e.cb.inited.add("texture",this.inited)}playAll(){this.runAll||(this.runAll=!0,this.texture.playAll())}closeAll(){this.runAll&&(this.runAll=!1,this.texture.closeAll())}}class ua{constructor(e){this.map=new A.Z,this.clean=()=>{this.clear()},this.runScene=e,this.runScene.cb.clean.add("Tags",this.clean),this.runScene.cb.model.remove.add("Tags",(({model:e})=>{const t=(0,U.Ki)(e);t&&this.map.map(((e,r)=>{r.delete(t)}))}))}get(e){return this.map.get(e)}add(e){this.get(e)||this.map.set(e,new j.Z)}rename(e,t){const r=this.get(e);r&&(this.addId(t,r.toArray()),this.remove(e))}addId(e,t){this.map.has(e)||this.add(e),this.map.get(e).add(t)}addModel(e,t){if(this.map.has(e)||this.add(e),(0,I.lG)(t,"array"))return t.map((t=>{this.addModel(e,t)}));this.map.get(e).add((0,U.Ki)(t))}reflash(e){const t=this.map.get(e);if(t){let e=[];t.forEach((t=>{this.runScene.modelEx.getById(t)||e.push(t)})),e.map((e=>t.remove(e)))}}removeModel(e,t){if(this.map.has(e))return(0,I.lG)(t,"array")?t.map((t=>{this.removeModel(e,t)})):void this.map.get(e).remove((0,U.Ki)(t))}remove(e){this.map.delete(e)}clear(){this.map.clear(),this.runScene.cb.tags.clear.cb()}toJSON(){const e={};return this.map.map(((t,r)=>{e[t]=[...r.filter((e=>this.runScene.modelEx.getById(e)))]})),e}parseJSON(e){let t={};(0,i.mapObj)(e,((e,r)=>{t[e]=new j.Z(r)})),this.map=A.Z.formJSON(t),this.runScene.cb.tags.parseJSON.cb(e)}}class ha{constructor(e,t){this.showTransform=!1,this.data=new Proxy({},{set:(e,t,r)=>(e[t]=r,!0)}),this.uuid="",this.getAnimaByModelData=(()=>{const e=(e,t,r,n)=>{const a={},s={};if(e=ha.isNotNow(e)?this.getAllData():e,(0,i.mapObj)(n,((r,n)=>{void 0!==e[r]&&("number"===(n=n.type)?(a[r]=t[r],s[r]=e[r]):"color"===n&&(0,i.mapObj)(e[r],((e,n)=>{var i=r+e;a[i]=t[r][e],s[i]=n})))})),!(0,i.emptyObj)(a))return{begin:a,end:s}};return(t,r,n,a=!1,s)=>{let o=a?n.time:0;const l=Object.keys(t).sort(((e,t)=>a?Number(t)-Number(e):Number(e)-Number(t)));var c=(0,i.lastArrayEle)(l),h=a?"0.00":String(n.time);return c!==h&&(t[h]=Object.assign({},c),l.push(h)),l.map((l=>{var c=t[String(l)],h=.001*((h=a?o-l:l-o)<=0?.001:h)*n.speed;o=l;{var d=r,p=c,f=h,m=s;const t={color(e){const{animaData:t,defType:r}=e,n={};(0,i.mapObj)(t,(e=>{var a;-1!==e.indexOf(r)&&(a=e.substring(r.length),["r","g","b"].includes(a)&&(n[a]=t[e]))}));var{r:e,g:a,b:s}=n;if(e&&a&&s)return n}};return()=>{let r;return{promise:new Promise((n=>{var a;if(!(a=e(p,d,0,m)))return n(0);var{begin:a,end:s}=a;return r=(0,u.anima)(a,s,f,(e=>{(0,i.mapObj)(m,((r,n)=>{n=n.type;var a,i=e[r];"number"===n?d[r]=i:"color"===n&&(i=t.color({animaData:e,defType:r}))&&(({r:n,g:i,b:a}=i),d[r].setRGB(n,i,a))}))}),n)})),anima:r}}}}))}})(),this.runScene=t,this.target=e,this.target.userData.isTimeLineUsed=!0,this.uuid=this.getId(e)}toJSON(){var{data:e,type:t}=this;return{data:e,type:t}}addData(e,t,r=!1){return 1e3<Number(e)&&(e="1000.00"),r?this.data[e]=this.getAllData():(this.data[e]||(this.data[e]={}),this.data[e][t]=this.getData(t)),this.data[e]}addTriggerNowData(e){return this.data[e]=this.getAllData(!0)}removeData(e){delete this.data[e]}static isNotNow(e){return"notNow"===Object.values(e)[0]}static getAllDefValByType(e,t,r=!1){const n={};return(0,i.mapObj)(e,(a=>{n[a]=r?"notNow":ha.getValByType(t,a,e)})),n}static getValByType(e,t,r){var n,a;return r=r[t].type,e=e[t],"number"===r?e:"color"===r?(({r:t,g:n,b:a}=e),{r:t,g:n,b:a}):"V3"===r?(0,u.v3ToMap)(e):""}static SetTargetByData(e){const{baseType:t,data:r,defType:n,target:a}=e;var i,s;"number"===t?a[n]=r:"color"===t&&(({r:e,g:i,b:s}=r),a[n].setRGB(e,i,s))}getAllData(e=!1){return ha.getAllDefValByType(this.defOptions,this.target,e)}getData(e){return ha.getValByType(this.target,e,this.defOptions)}static getTarget(e,t){}getAnima(e,t){return this.getAnimaByModelData(this.data,this.target,e,t,this.defOptions)}setTargetByBetween(e,t,r){ha.setTargetByBetween(e,t,r,this.defOptions,this.target)}clone(e){var{data:t,type:r}=this;const n=new(0,fa[r])(e);return n.data=t,n}reset(){(0,i.mapObj)(this.defOptions,((e,t)=>{ha.SetTargetByData({baseType:t.type,data:ha.getValByType(this.beginData,e,this.defOptions),target:this.target,defType:e})}))}remove(){delete this.target.userData.isTimeLineUsed}}ha.setTargetByBetween=(()=>{const e=(e,t,r)=>e!==t?(t-e)*r+e:e;return(t,r,n,a,s)=>{(0,i.mapObj)(a,((a,i)=>{var o,l,c,u,h,d;i=i.type,void 0!==t[a]&&void 0!==r[a]&&ha.SetTargetByData({baseType:i,data:(o=t[a],l=r[a],c=n,"number"===i?e(o,l,c):"color"===i?(({r:i,g:o,b:u}=o),({r:l,g:h,b:d}=l),{r:e(i,l,c),g:e(o,h,c),b:e(u,d,c)}):void 0),defType:a,target:s})}))}})();const da=ha;class pa extends o{constructor(){super(...arguments),this.mount=e=>{e.core.module.set("timeline",this)},this.after=e=>{var t,{json:e,config:r}=e;"scene"===(null==(t=null==(t=e.asset)?void 0:t.ex)?void 0:t.type)&&r.module.timeline&&this.runScene.timeLineEx.parseSavedGroupMap((null==(t=e.asset.ex)?void 0:t.timeLine)||{})}}init(){var e={name:"timeline",loadCallBacks:new A.Z({afterParse:this.after,mountModule:this.mount}),exportCallBacks:new A.Z};this.runScene.exporter.gltf.module.bind(e)}}const fa={model:class extends da{constructor(e,t){super(e,t),this.type="model",this.defOptions={position:{type:"V3"},scale:{type:"V3"},rotation:{type:"V3"}},this.setTargetByBetween=(()=>{const e=(e,t,r)=>{var{x:e,y:n,z:a}=e,{x:t,y:i,z:s}=t;return{x:e!==t?(t-e)*r+e:e,y:n!==i?(i-n)*r+n:n,z:a!==s?(s-a)*r+a:a}};return(t,r,n)=>{var a,{position:t,scale:i,rotation:s}=t,{position:r,scale:o,rotation:l}=r;t&&r&&(({x:t,y:r,z:a}=e(t,r,n)),this.target.position.set(t,r,a)),i&&o&&(({x:t,y:r,z:a}=e(i,o,n)),this.target.scale.set(t,r,a)),s&&l&&(({x:i,y:o,z:t}=e(s,l,n)),this.target.rotation.set(i,o,t))}})(),this.getAnimaByModelData=(()=>{const e=(e,t,r)=>{var{position:t,scale:n,rotation:a}=t,{position:e,scale:i,rotation:s}=da.isNotNow(e)?this.getAllData():e;return{begin:Object.assign({},e?{px:t.x,py:t.y,pz:t.z}:{},i?{sx:n.x,sy:n.y,sz:n.z}:{},s?{rx:a.x,ry:a.y,rz:a.z}:{}),end:Object.assign({},r.curve?{ease:"none"}:{},e?{px:e.x,py:e.y,pz:e.z}:{},i?{sx:i.x,sy:i.y,sz:i.z}:{},s?{rx:s.x,ry:s.y,rz:s.z}:{})}};return(t,r,n,a=!1)=>{let s=a?n.time:0;const o=Object.keys(t).sort(((e,t)=>a?Number(t)-Number(e):Number(e)-Number(t)));var l=(0,i.lastArrayEle)(o),c=a?"0.00":String(n.time)+".00";return l!==c&&(t[c]={position:"notNow",rotation:"notNow",scale:"notNow"},o.push(c)),o.map((i=>{var o,l,c,h,d=t[String(i)],p=.001*((p=a?s-i:i-s)<=0?.001:p)*n.speed;return s=i,o=r,l=d,c=p,h=n,()=>{let t;return{promise:new Promise((r=>{var{begin:n,end:a}=e(l,o,h);return t=(0,u.anima)(n,a,c,(e=>{var{px:e,py:t,pz:r,sx:n,sy:a,sz:i,rx:s,ry:c,rz:u}=e;l.position&&o.position.set(e,t,r),l.scale&&o.scale.set(n,a,i),l.rotation&&o.rotation.set(s,c,u)}),r)})),anima:t}}}))}})(),this.beginData=this.getAllData()}static getTarget(e,t){return t.uniqueEx.model.get(e)}isRemoved(){return!(this.target&&this.target.parent)}getAnima(e,t=!1){return this.getAnimaByModelData(this.data,this.target,e,t)}getId(){return this.runScene.uniqueEx.getId(this.target)}reset(){var{position:e,scale:t,rotation:r}=this.beginData;this.target.position.set(e.x,e.y,e.z),this.target.scale.set(t.x,t.y,t.z),this.target.rotation.set(r.x,r.y,r.z)}},camera:class extends da{constructor(e,t){super(e,t),this.type="camera",this.defOptions={position:{type:"V3"},scale:{type:"V3"},rotation:{type:"V3"},target:{type:"V3"}},this.setTargetByBetween=(()=>{const e=(e,t,r)=>{var{x:e,y:n,z:a}=e,{x:t,y:i,z:s}=t;return{x:e!==t?(t-e)*r+e:e,y:n!==i?(i-n)*r+n:n,z:a!==s?(s-a)*r+a:a}};return(t,r,n)=>{var a,{position:t,scale:i,rotation:s,target:o}=t,{position:r,scale:l,rotation:c,target:u}=r;t&&r&&(({x:t,y:r,z:a}=e(t,r,n)),this.target.position.set(t,r,a)),i&&l&&(({x:t,y:r,z:a}=e(i,l,n)),this.target.scale.set(t,r,a)),s&&c&&(({x:i,y:l,z:t}=e(s,c,n)),this.target.rotation.set(i,l,t)),o&&u&&(({x:r,y:a,z:s}=e(o,u,n)),this.controls.target.set(r,a,s))}})(),this.getAnimaByModelData=(()=>{const e=(e,t,r)=>{var{position:t,scale:n,rotation:a}=t,{position:e,scale:i,rotation:s,target:o}=da.isNotNow(e)?this.getAllData():e;return{begin:Object.assign({},e?{px:t.x,py:t.y,pz:t.z}:{},i?{sx:n.x,sy:n.y,sz:n.z}:{},s?{rx:a.x,ry:a.y,rz:a.z}:{},o?{tx:this.controls.target.x,ty:this.controls.target.y,tz:this.controls.target.z}:{}),end:Object.assign({},r.curve?{ease:"none"}:{},e?{px:e.x,py:e.y,pz:e.z}:{},i?{sx:i.x,sy:i.y,sz:i.z}:{},s?{rx:s.x,ry:s.y,rz:s.z}:{},o?{tx:o.x,ty:o.y,tz:o.z}:{})}},t=(t,r,n,a)=>()=>{let i;return{promise:new Promise((s=>{var{begin:o,end:l}=e(r,t,a);return i=(0,u.anima)(o,l,n,(e=>{var{px:e,py:n,pz:a,sx:i,sy:s,sz:o,rx:l,ry:c,rz:u,tx:h,ty:d,tz:p}=e;r.position&&t.position.set(e,n,a),r.scale&&t.scale.set(i,s,o),r.rotation&&t.rotation.set(l,c,u),r.target&&this.controls.target.set(h,d,p)}),s)})),anima:u.anima}};return(e,r,n,a=!1)=>{let s=a?n.time:0;const o=Object.keys(e).sort(((e,t)=>a?Number(t)-Number(e):Number(e)-Number(t)));var l=(0,i.lastArrayEle)(o),c=a?"0.00":String(n.time);return l!==c&&(e[c]=Object.assign({},l),o.push(c)),o.map((i=>{var o=e[String(i)],l=.001*((l=a?s-i:i-s)<=0?.001:l)*n.speed;return s=i,t(r,o,l,n)}))}})(),this.controls=this.runScene.assetsEx.get().controls,this.beginData=this.getAllData()}static getTarget(e,t){return t.uniqueEx.model.get(e)}getBeginData(e){return this.getAllData()}isRemoved(){return!this.target}getAllData(e=!1){var{position:t,scale:r,rotation:n}=this.target;return{position:e?"notNow":(0,u.v3ToMap)(t),scale:e?"notNow":(0,u.v3ToMap)(r),rotation:e?"notNow":(0,u.v3ToMap)(n),target:e?"notNow":(0,u.v3ToMap)(this.controls.target)}}getData(e){var{position:t,scale:r,rotation:n}=this.target;let a;if("position"===e)a=(0,u.v3ToMap)(t);else if("scale"===e)a=(0,u.v3ToMap)(r);else if("rotation"===e)a=(0,u.v3ToMap)(n);else{if("target"!==e)throw TypeError("输入值不存在");a=(0,u.v3ToMap)(this.controls.target)}return a}getAnima(e,t=!1){return this.getAnimaByModelData(this.data,this.target,e,t)}getId(){return this.runScene.uniqueEx.getId(this.target)}reset(){var{position:e,scale:t,rotation:r,target:n}=this.beginData;this.target.position.set(e.x,e.y,e.z),this.target.scale.set(t.x,t.y,t.z),this.target.rotation.set(r.x,r.y,r.z),this.controls.target.set(n.x,n.y,n.z)}},material:class extends da{constructor(e,t){super(e,t),this.type="material",this.defOptions={roughness:{type:"number"},metalness:{type:"number"},opacity:{type:"number"},emissive:{type:"color"},color:{type:"color"}},this.beginData=this.getAllData()}static getTarget(e,t){return t.uniqueEx.material.get(e)}isRemoved(){return!0}getId(){return this.runScene.uniqueEx.getId(this.target)}}};class ma{constructor(){this.list={}}on(e,t){this.list[e]=t}emit(...e){if(void 0===this.list[e[0]])throw Error("请先挂载在使用---"+[e[0]]);return this.list[e[0]](...[...e].filter(((e,t)=>0!==t)))}off(e){this.list[e]&&delete this.list[e]}}const ga=c.Z,va=class{constructor(e){this._clock=new s.Clock,this.cb=new v,this.script=new ca(this),this.uniqueEx=new U.ZP(this),this.fileEx=new Ur(this),this.snapshot=new ia.ZP(this),this.undoEx=new $r.ZP(this),this.textureEx=new it.default(this),this.controlsEx=new P(this),this.assetsEx=new m(this),this.renderEx=new oa.Z(this),this.events=new class{constructor(e){this.key=new R(this),this.mouse=new B(this),this.model=new N(this),this.runScene=e}init(e){this.key.init(e),this.mouse.init(e),this.model.init(),window.addEventListener("resize",(()=>{this.runScene.cb.resize.cb(this.runScene.renderEx.getDomSize())}))}}(this),this.multipSelector=new qr(this),this.helperEx=null,this.materialEx=new ot.default(this),this.cameraEx=new b.Z(this),this.sceneEx=new lt.ZP(this),this.modelEx=new h.default(this),this.loaderer=new l.Z(this),this.exporter=new gt(this),this.lightEx=new Fr.ZP(this),this.timeLineEx=new class{constructor(e){this.timerMap={},this.animaMap={},this.groupMap={},this.clean=()=>{this.reset()},this.setModelLocal=(e,t)=>{Object.values(e.data).map((e=>{var r,n,a=((e,t)=>{let r=-1,n=1e3;const a=Object.keys(e).sort(((e,t)=>Number(e)-Number(t)));if(1!==a.length&&(a.map(((e,a)=>{e=Number(e),0<(e=t-e)&&e<n&&(n=e,r=a)})),-1!==r)){var i=a[r],s=a[r+1],o=e[i];if(e=e[s],o&&e){var l=Object.values(o)[0],c=Object.values(e)[0];if("notNow"!==l&&"notNow"!==c)return{left:o,right:e,progress:(t-Number(i))/(Number(s)-Number(i))}}}})(e.data,t);a&&(({left:a,right:r,progress:n}=a),e.setTargetByBetween(a,r,n))}))},this.runScene=e,this.runScene.cb.clean.add("TimeLine",this.clean),this.exportAndImport=new pa(e)}init(){this.exportAndImport.init()}reset(){this.timerMap={},this.animaMap={},this.groupMap={},this.runScene.cb.timeLine.reset.cb("")}pause(e){var t,r;if(this.groupMap[e]){this.timerMap[e]&&(({setProgressTime:t,awaitRuned:r}=this.timerMap[e]),t&&clearInterval(t),r&&clearInterval(r)),this.groupMap[e].run=!1;const n=this.animaMap[e];n&&n.length&&n.map((e=>{e.controls.run=!1}))}}resume(e){const t=this.groupMap[e];if(t){this.groupMap[e].run=!0;const r=this.animaMap[e];r&&r.length&&r.map((r=>{const{controls:n,promise:a}=r;n.run=!0,a.then((()=>{if(t.run)return t.run=!1,t.loop?this.playGroup(e):void 0}))}))}}closeGroup(e){var t,r;this.timerMap[e]&&(({setProgressTime:t,awaitRuned:r}=this.timerMap[e]),t&&clearInterval(t),r&&clearInterval(r)),this.groupMap[e].run=!1,this.runScene.cb.timeLine.closeGroup.cb(e);const n=this.animaMap[e];n&&n.length&&n.map((e=>{e.controls.clean=!0}))}resetGroup(e){var t=this.groupMap[e];t&&(this.closeGroup(e),this.runScene.cb.timeLine.setProgress.cb(0),Object.values(t.data).map((e=>e.reset())))}getSavedData(){return(0,i.mapObj)(this.groupMap,((e,t)=>{t.run=!1})),this.groupMap}parseSavedGroupMap(e){Object.keys(e).map((t=>{const r=e[t],n={};(0,i.mapObj)(r.data,((e,t)=>{var{type:t,data:r}=t;const a=fa[t];if(t=a.getTarget(e,this.runScene)){const i=new a(t,this.runScene);i.data=r,n[e]=i}})),r.data=n,this.groupMap[t]=r,this.runScene.cb.timeLine.setGroupMap.cb({group:r,groupName:t})}))}playGroup(e,t){const r=(0,I.Gm)({onlyReverse:!1},t).onlyReverse,n=(this.runScene.helperEx.unfocus(),this.groupMap[e]);if(n&&!n.run){n.run=!0;const a=Object.keys(n.data).map((e=>{const t=n.data[e];if(t.data=new Proxy(t.data,{set:(e,t,r)=>(e[t]=r,!0)}),r)return t.getAnima(n,!0);const a=t.getAnima(n);return n.reverse&&(e=t.getAnima(n,!0),a.push(...e)),a}));this.animaMap[e]||(this.animaMap[e]=[]),this.animaMap[e]=a.map((e=>(0,i.eachTriggerArrGetControls)(e)));let s=0;s=r?n.time*n.speed:n.time*n.speed*(n.reverse?2:1);const o=(new Date).valueOf(),l=s;let c;t=setInterval((()=>{var t=((new Date).valueOf()-o)/l;this.runScene.cb.timeLine.playGroup.cb({groupName:e,progress:t})}),16.6);const u=new Promise((e=>c=setTimeout(e,s)));return this.timerMap[e]={setProgressTime:t,awaitRuned:c},u.then((()=>{if(clearInterval(this.timerMap[e].setProgressTime),n.run)return n.run=!1,n.loop?this.playGroup(e):void 0}))}}}(this),this.anima=new d(this),this.tags=new ua(this),this.globalConfig=new Nr(this),this.pp=new sa(this),this.objects=new nn(this),this.inited=!1,this._renderLimit=new I.cM,this._render=()=>{const{render2:e,render3:t}=this.assetsEx,{scene:r,camera:n,controls:a}=this.assetsEx.get();this.cb.render.cb(""),this.pp.update(),null!=t&&t.render(r,n),null!=e&&e.render(r,n),a.update()},this.render=()=>{if(null!=(e=this.optionsEx.options)&&e.run){const r=this._render;var{frame:e,mode:t}=this.optionsEx.options.renderConfig;-1!==e&&"tick"===t?(t=this._clock.getDelta(),this._renderLimit.update({cb(){r()},cbRate:1/e,now:t})):this._render()}},this.optionsEx=new on(this,e)}initLibs(e){if(!this.inited){this.inited=!0,this.snapshot.init(),this.materialEx.init(),this.modelEx.init(),this.sceneEx.init(),this.timeLineEx.init(),this.loaderer.init(),this.assetsEx.init(e),this.events.init(e),this.globalConfig.setRenderMode(this.optionsEx.options.renderConfig.mode),this.helperEx=new Gr(this);const{camera:t,controls:r}=this.assetsEx.get();this.uniqueEx.model.add(t),this.renderEx.setSize(),r.update(),this.pp.init(),this.cameraEx.reset(t),this.cb.inited.cb(0)}}init(e){return this.initLibs(e),this}load(e){var{path:e,dom:t,loadConfig:r}=e;return this.init(t),this.loadScene(e,r).then((e=>{0!==(null==e?void 0:e.length)&&this.modelEx.add(e)})),this}loadScene(e,t){return function(e,t,r,n){return new(r=r||Promise)((function(t,a){function i(e){try{o(n.next(e))}catch(e){a(e)}}function s(e){try{o(n.throw(e))}catch(e){a(e)}}function o(e){var n;e.done?t(e.value):((n=e.value)instanceof r?n:new r((function(e){e(n)}))).then(i,s)}o((n=n.apply(e,[])).next())}))}(this,0,void 0,(function*(){const{getJSON:r,progress:n,complete:i}=this.cb.load;t=t||{};var s=Object.assign(Object.assign({},t),{callBack:Object.assign(Object.assign({},t.callBack),{getJSON:e=>{var n,a;null!=(a=null==(n=null==t?void 0:t.callBack)?void 0:n.getJSON)&&a.call(n,e),r.cb(e)},progress:e=>{var r,a;null!=(a=null==(r=null==t?void 0:t.callBack)?void 0:r.progress)&&a.call(r,e),n.cb(e)},complete:e=>{var r,n;null!=(n=null==(r=null==t?void 0:t.callBack)?void 0:r.complete)&&n.call(r,e),i.cb(e)}}),triggerCb:!1});if(e instanceof ArrayBuffer)return this.optionsEx.log("正在解析二进制文件","base","info"),this.loaderer.gltf.parse(e,s);this.optionsEx.log("正在拉取场景","base","info");var o=yield a().get(e,{responseType:"arraybuffer",onDownloadProgress:e=>{var{total:e,loaded:t}=e;let r=t/e;1<(r=r<0?0:r)&&(r=1),t=Number(r.toFixed(2)),e=Math.floor(100*t),this.optionsEx.log("下载场景进度:"+e,"detail"),this.cb.load.progress.cb(e)}}).then((e=>e.data)).catch((e=>{this.sceneEx.clean(),this.optionsEx.log("下载场景失败:",e)}));return o?(this.optionsEx.log("拉取场景成功、正在解析","base","success"),this.loaderer.gltf.parse(o,s)):void 0}))}dispose(){this.assetsEx.dispose(),this.sceneEx.clean()}on(e,t){return null!=(e=this.cb.load[e])&&e.add("load-callback"+(0,i.getId)(),t),this}setSize(e,t){const{render2:r,render3:n}=this.assetsEx,a=this.assetsEx.get().renderer;this.cameraEx.setSize(),null!=n&&n.setSize(e,t),null!=r&&r.setSize(e,t),a.setSize(e,t,!0),this.pp.setSize(e,t)}clean(){this.cb.clean.cb(0)}}},3736:(e,t,r)=>{r.d(t,{ZP:()=>y,bv:()=>T,is:()=>M,UE:()=>S,M:()=>x});var n=r(6001),a=r(8881),i=r(932),s=r(8715),o=r(7738),l=r(1794),c=r(3625);class u{constructor(e){this.mount=e=>{e.core.module.set("scene",this)},this.parse={before:e=>{var t,r,n,a,i,s,{json:e,config:o,core:l}=e;"scene"===(null==(t=null==(t=e.asset)?void 0:t.ex)?void 0:t.type)&&(({camera:t,lights:e,options:r,controls:n,tags:a,envStrength:i,objects:s}=e.asset.ex),void 0!==i&&this.runScene.sceneEx.setEnvStrength(i),this.parse.camera(t,o),e&&this.parse.light(e,o,l),this.parse.controls(n,o),o.module.tags&&this.runScene.tags.parseJSON(a||{}),this.parse.options(r),s&&this.runScene.objects.parseJSON(s))},after:e=>{const{core:t,json:r,data:n,config:a}=e;if("scene"===(null==(e=null==(e=r.asset)?void 0:e.ex)?void 0:e.type)){var{options:e,json:i}=n;if(e=e.models,!t.loadConfig.module.model)return[];const s=e[0];if(t.module.get("model").data.map.map(((e,t)=>{this.runScene.uniqueEx.model.add(t)})),e=s.children.filter((e=>this.runScene.modelEx.isUnless(e)?void 0:e)),1===e.length){const[t]=e;t.animations=[...t.animations,...i.animations]}t.callback("loaded",""),this.runScene.optionsEx.sceneOptions.loaded=!0,this.parse.scene(r,a,t),t.models.push(...e)}},controls:(e,t)=>{var r;t.module.controls&&e&&(({x:t,y:e,z:r}=e),this.runScene.assetsEx.controls.target.set(t,e,r),this.runScene.assetsEx.controls.update())},camera:(e,t)=>{if(t.module.camera){let o=e;e.temp&&(o=e.camera,this.runScene.cameraEx.temp=l.Z.formJSON(e.temp));var{position:t,far:e,near:r,fov:n,name:a,userData:i,rotation:s}=this.runScene.loaderer.object.parse(o);const c=this.runScene.assetsEx.get().camera;c.position.copy(t),c.far=e,c.near=r,c.fov=n,c.name=a,c.updateProjectionMatrix(),c.userData.id=i.id,this.runScene.uniqueEx.model.add(c),c.rotation.copy(s),this.runScene.assetsEx.get().controls.update()}},light:(e,t,r)=>{if(t.module.light){const t=[];e.map((e=>{var r=e.type;t.push(...this.runScene.lightEx.lightExMap[r].parseJSON(e))})),r.models.push(...t)}},scene:(e,t,r)=>{if(t.module.sceneConfig){const s=this.runScene.sceneEx.get();t=r.module.get("material").data.materialIns;var{materialId:r,backgroundMapping:e,backgroundColor:n,fog:i}=e.asset.ex.sceneEx;if(r&&(r=null==(t=t[r])?void 0:t.material)){const{map:t,envMap:n}=r;t&&(t.mapping=e||300,t.needsUpdate=!0,this.runScene.sceneEx.setBackground(t,!1),t.userData.isBackgroud=!0),n&&(s.environment=(0,c.setTextureMapping)(n))}if(n&&this.runScene.sceneEx.setBackground(new a.Color("#"+n)),i){const{color:e,far:t,near:r,show:n}=i,o=new a.Fog(e.includes("#")?e:"#"+e,r,t);!1===n?this.runScene.sceneEx.oldFog=o:s.fog=o,o.show=n,this.runScene.cb.setScene.cb({scene:s,type:"fog",val:o})}this.runScene.cb.setScene.cb({scene:s,type:"any",val:"any"})}},options:e=>{e.map((e=>{var{type:e,data:t}=e;const r=this.runScene.exporter.gltf.options.getParse(e);null!=r&&r.parse(t)}))}},this.toJSON=()=>{},this.runScene=e}init(){this.bindEvent()}bindEvent(){var e={name:"sceneConfig",loadCallBacks:new l.Z({beforeParse:this.parse.before,afterParse:this.parse.after,mountModule:this.mount}),exportCallBacks:new l.Z};this.runScene.exporter.gltf.module.bind(e)}}var h=r(8089),d=r(7201);class p{constructor(e){this.create=e=>{var t=this.getDiff();0!==(0,d.objLength)(t)&&e.data.set("scene",t)},this.set=e=>{const t=e.snapshot.data.get("scene");if(t){const{fog:u,bgc:d,env:p,bgcm:f,envS:m}=t,g=this.runScene.assetsEx.get().scene,{animas:v,completedCbs:b}=e.data;let y=g.background;if(this.runScene.sceneEx.setEnvStrength(void 0!==m?m:1),d){const{type:t,data:r}=d;if("color"===t)(0,i.isColor)(y)||null===y?(e=null===y?"#000000":(0,h.J6)(y),null===y&&this.runScene.sceneEx.setBackground(new a.Color("#000000")),e!==d.data&&v.push({target:g,label:"background",type:"color",isUpdate:!0,begin:e,end:r})):(0,c.isTexture)(y)&&b.push((()=>{this.runScene.sceneEx.setBackground(new a.Color(r))}));else if("texture"===t){const e=this.runScene.uniqueEx.texture.get(d.data);e&&(0,c.setTextureMapping)(e,303===f?"repeat":"normal"),b.push((()=>{this.runScene.sceneEx.setBackground(e)}))}}else(0,i.isColor)(y)&&(y||(y=new a.Color,this.runScene.sceneEx.setBackground(y)),v.push({target:g,label:"background",type:"color",isUpdate:!0,begin:(0,h.J6)(y),end:"#000000"})),b.push((()=>{this.runScene.sceneEx.setBackground(null)}));var r,n,s,o,l;b.push((()=>{g.environment=this.runScene.uniqueEx.texture.get(null==p?void 0:p.data)})),g.fog&&u?(({color:e,near:r,far:n}=u),({color:l,near:s,far:o}=g.fog),e!==(l=(0,h.J6)(l))&&v.push({target:g,label:["fog","color"],begin:l,end:e,type:"color",isUpdate:!0}),s!==r&&v.push({target:g,label:["fog","near"],begin:s,end:r,type:"number",isUpdate:!0}),o!==n&&v.push({target:g,label:["fog","far"],begin:o,end:n,type:"number",isUpdate:!0})):b.push((()=>{g.fog=u?S(u):null})),b.push((()=>{this.runScene.cb.setScene.cb({scene:this.runScene.assetsEx.get().scene,type:"any",val:"any"})}))}},this.runScene=e,this.runScene.cb.snapshot.create.add("scene",this.create),this.runScene.cb.snapshot.set.add("scene",this.set)}getDiff(){let e={};var t=((t=this.runScene.sceneEx.getJson("fog"))&&(e.fog=t),this.runScene.sceneEx.getJson("background")),r=this.runScene.assetsEx.scene;return void 0!==(t&&"texture"===(e.bgc=t).type&&303===r.background.mapping&&(e.bgcm=303),(t=this.runScene.sceneEx.getJson("environment"))&&(e.env=t),r=this.runScene.sceneEx.getEnvStrength())&&1!==r&&(e.envS=r),e}}var f=r(3735),m=r(2510),g=r(7169),v=r(3729),b=function(e,t,r,n){return new(r=r||Promise)((function(a,i){function s(e){try{l(n.next(e))}catch(e){i(e)}}function o(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?a(e.value):((t=e.value)instanceof r?t:new r((function(e){e(t)}))).then(s,o)}l((n=n.apply(e,t||[])).next())}))};class y{constructor(e){this.oldFog=null,this.removeMap={light:{valid:e=>this.runScene.lightEx.isLight(e),remove:e=>this.runScene.lightEx.remove(e)}},this.clean=()=>{this.cleanSceneInfo(this.get()),this.cleanNormal()},this.envStrength=1,this.runScene=e,this.exportAndImport=new u(e),this.snapshot=new p(e),this.runScene.cb.clean.add("EngineScene",this.clean)}init(){this.exportAndImport.init()}each(e){return this.runScene.assetsEx.get().scene.traverseAncestors(e)}get(){return new Proxy(this.runScene.assetsEx.get().scene,{set:(e,t,r)=>(e[t]=r,!0)})}getNromal(){return this.get().children.filter((e=>!this.runScene.helperEx.isHelper(e)))}getEnvStrength(){return this.envStrength}remove(e){if(e){if(e instanceof Array){const t=[];return e.map((e=>{for(const r in this.removeMap){const{valid:a,remove:i}=this.removeMap[r];if(a(e))return t.push(...(0,n.multiArrToArr)(i(e)))}t.push(new g.Z({model:e,runScene:this.runScene,parent:e.parent}).execute())})),this.runScene.undoEx.addUndo(t),t}for(const t in this.removeMap){const{valid:r,remove:n}=this.removeMap[t];if(r(e))return n(e)}this.runScene.modelEx.remove(e),this.runScene.helperEx.unfocus()}}cleanUnlessLevel(e){return this.runScene.modelEx.isUnlessLevel(e)&&!this.runScene.helperEx.isHelper(e)&&0!==e.children.length&&1===e.children.length?this.cleanUnlessLevel(e.children[0]):e}searchModel(e){return this.runScene.uniqueEx.model.findModelWithName(e)}getClearModels(){return this.get().children.filter((e=>!this.runScene.helperEx.isHelper(e)&&!this.runScene.lightEx.isLight(e)))}getClear(){const e=this.get(),t=new a.Group;return e.children.filter((e=>!this.runScene.helperEx.isHelper(e)&&s.normalModel.is(e))).map((e=>{const r=e.clone();(0,s.withAnima)(e)&&(r.animations=[...e.animations]),t.add(r)})),this.runScene.helperEx.setHelper(t),this.cleanUnlessLevel(t)}cleanNormal(){this.getNromal().map((e=>this.remove(e)))}cleanSceneInfo(e){this.setBackground(null).then(),this.setEnv(null).then(),e.fog=null,this.runScene.cb.setScene.cb({scene:e,type:"any",val:null})}setBackground(e,t=!0){return b(this,void 0,void 0,(function*(){e instanceof String&&(e=yield this.runScene.textureEx.load(e)),(0,c.isTexture)(e)&&(e.userData.isBackgroud=!0);var r=this.get(),n=new m.Z({target:r,info:"background",newVal:e,oldVal:r.background,runScene:this.runScene,cb:e=>{}}).execute();return t&&this.runScene.undoEx.addUndo(n),this.runScene.cb.setScene.cb({scene:r,type:"background",val:r.background}),e}))}isBackground(e){return e.userData.isBackgroud}dispose(){const{renderer:e,controls:t}=this.runScene.assetsEx.get();this.clean(),(0,o.s)(e),t.dispose(),this.runScene.pp.dispose(),a.Cache.clear()}render(){}create(){return new a.Scene}setEnv(e){return b(this,void 0,void 0,(function*(){var t=this.runScene.assetsEx.scene;let r;return e instanceof String&&(r=yield this.runScene.textureEx.load(e)),e instanceof File&&(r=yield this.runScene.textureEx.parse(e)),r=(r=null!=e&&e.isTexture?this.runScene.textureEx.clone(e):r)&&(0,c.setTextureMapping)(r),this.setNormal({model:t,info:"environment",val:r}),this.runScene.cb.setScene.cb({scene:t,type:"environment",val:r}),r}))}setNormal(e,t=!0){var{model:e,info:r,val:n}=e;e=new m.Z({target:e,info:r,oldVal:e[r],newVal:n,runScene:this.runScene}).execute(),t&&this.runScene.undoEx.addUndo(e)}setRealReflection(){const{scene:e,renderer:t}=this.runScene.assetsEx;this.cubeRT||(this.cubeRT=new a.WebGLCubeRenderTarget(1024)),this.realReflectionCamera||(this.realReflectionCamera=new a.CubeCamera(.1,5e3,this.cubeRT),e.add(this.realReflectionCamera),this.runScene.cb.render.add("RealReflection-update",(()=>{this.realReflectionCamera.update(t,e)}))),this.isRealReflection?(this.preEnvMap=e.environment,this.setEnv(null).then(),this.setNormal({model:e,info:"environment",val:this.cubeRT.texture})):this.preEnvMap&&this.setEnv(this.preEnvMap).then(),this.testSphere||(this.testSphere=new a.Mesh(new a.SphereGeometry(15,32,16),new a.MeshStandardMaterial),e.add(this.testSphere),this.testSphere.scale.set(10,10,10),this.testSphere.position.set(0,600,0),this.testSphere.getWorldPosition(this.realReflectionCamera.position),this.testSphere.material.roughness=0,this.testSphere.material.metalness=1)}setFogShow(e){var t=this.runScene.assetsEx.scene,{show:e,color:r}=e;if(e){let e=this.oldFog||new a.Fog(r||"#ffffff");e.show=!0,this.setNormal({model:t,info:"fog",val:e})}else this.oldFog=t.fog,this.setNormal({model:t,info:"fog",val:null}),this.oldFog.show=!1;this.runScene.cb.setScene.cb({scene:t,type:"fog",val:t.fog})}setFog(e){var t=this.runScene.assetsEx.scene,{type:e,val:r,cb:n}=e;t=new f.Z({target:t,typeList:["fog",e],newVal:r,cb:n}).execute(),this.runScene.undoEx.addUndo(t)}sreenShotDefFile(e,t){e=e||Number(prompt("请输入截图的宽"))||1920,t=t||Number(prompt("请输入截图的高"))||1080;var{width:r,height:a}=(this.runScene.helperEx.unfocus(),this.runScene.renderEx.getDomSize());const i=this.runScene.assetsEx.get().renderer.domElement;return this.runScene.pp.setSize(e,t),this.runScene.renderEx.setSize(e,t),this.runScene.pp.update(),e=i.toDataURL("image/png",1),t=(0,n.base64ToFile)(e,"screenShot.png"),this.runScene.pp.setSize(r,a),this.runScene.renderEx.setSize(),this.runScene.pp.update(),t}getJson(e){let t;var r=this.runScene.assetsEx.scene;if("fog"===e){var n=r.fog;n&&(t=w(n,null!==r.fog))}else if("background"===e){if(!r.background)return;t={type:(n=(0,i.isColor)(r.background))?"color":"texture",data:(n?h.J6:v.Ki)(r.background)}}else if("environment"===e){if(!r.environment)return;t={type:"texture",data:(0,v.Ki)(r.environment)}}return t}static toJSON(e,t){const r={};let n=!1,a=e.fog;return a?n=!0:a=t.sceneEx.oldFog,a&&(r.fog=w(a,n)),(0,i.isColor)(e.background)&&(r.backgroundColor=e.background.getHexString()),r}setEnvStrength(e){this.runScene.cb.scene.setEnvStrength.cb({val:e}),this.runScene.uniqueEx.material.each((t=>this.runScene.materialEx.setEnvStrength(t,e))),this.envStrength=e}}const x=(e,t,r)=>{e.userData[t]=r},w=(e,t)=>{var{color:e,far:r,near:n}=e;return{color:(0,h.J6)(e),show:t,far:r,near:n}},S=e=>{var{color:e,far:t,near:r}=e;return new a.Fog(e,r,t)},M=(e,t)=>(null==(e=null==e?void 0:e.userData)?void 0:e[t])||"",T=(e,t)=>{delete e.userData[t]}},1398:(e,t,r)=>{r.d(t,{LV:()=>p,ZP:()=>d});var n=r(6001),a=r(3263),i=r(1794),s=r(7201),o=r(3625),l=r(3729),c=r(4457),u=r(8089);const h=["number","color","color_obj","color_str","v2","v3"];class d{constructor(e){this.map=new i.Z,this.onInited=()=>{this.runScene.cb.events.model.addOptions.cb({name:"snapshot",map:{parse:e=>Promise.all(e.childs.map((e=>new Promise((t=>{this.set(e,{onDone:()=>{t(0)}})})))))}})},this.playing=new i.Z,this.unique={set:()=>{},get:()=>{}},this.toJSON=()=>JSON.stringify(this.map.toJSON()),this.parseJSON=e=>{const t=i.Z.formJSON(JSON.parse(e));t.map(((e,t)=>{t.data=i.Z.formJSON(t.data)})),this.map=t},this.clean=()=>{this.map.clear()},this.trans={set:(e,t)=>{var r,n,a,i,s,o=e.label instanceof Array?e.label.join("."):e.label;const l={begin:[],end:[]};return"color"===e.type||"color_obj"===e.type||"color_str"===e.type?(a=(0,u.sS)(e.begin),r=(0,u.sS)(e.end),i=o+"_"+t+"_r",s=o+"_"+t+"_g",n=o+"_"+t+"_b",l.begin.push({type:i,data:a.r}),l.begin.push({type:s,data:a.g}),l.begin.push({type:n,data:a.b}),l.end.push({type:i,data:r.r}),l.end.push({type:s,data:r.g}),l.end.push({type:n,data:r.b})):"number"===e.type?(l.begin.push({type:o+"_"+t,data:e.begin}),l.end.push({type:o+"_"+t,data:e.end})):"v2"!==e.type&&"v3"!==e.type||(a=o+"_"+t+"_x",i=o+"_"+t+"_y",s=o+"_"+t+"_z",l.begin.push({type:a,data:e.begin.x}),l.begin.push({type:i,data:e.begin.y}),"v3"===e.type&&(l.begin.push({type:s,data:e.begin.z}),l.end.push({type:s,data:e.end.z})),l.end.push({type:a,data:e.end.x}),l.end.push({type:i,data:e.end.y})),l},getKey(e){let t=[];var{unique:r,type:n}=e;return e=e.label instanceof Array?e.label.join("."):e.label,"v2"===n||"v3"===n?(t.push(e+"_"+r+"_x"),t.push(e+"_"+r+"_y"),t.push(e+"_"+r+"_z")):"color"===n||"color_obj"===n||"color_str"===n?(t.push(e+"_"+r+"_r"),t.push(e+"_"+r+"_g"),t.push(e+"_"+r+"_b")):"number"===n&&t.push(e+"_"+r),t},update:(e,t)=>{var r;const a=this.trans.getKey(e);let i=e.target,s=e.label,o=(e.label instanceof Array&&(s=(0,n.lastArrayEle)(e.label),i=(0,n.objLastMap)(e.target,e.label)),t[a[0]]),l=s;"color"===e.type||"color_obj"===e.type?(o={r:0,g:0,b:0},a.map((e=>{var[,,r]=e.split("_");e=t[e]/255,o[r]=e}))):"color_str"===e.type?o="#"+a.map((e=>Number(Number(t[e]).toFixed(0)).toString(16).padStart(2,"0"))).join(""):"v2"!==e.type&&"v3"!==e.type||(o={x:0,y:0,z:0},a.map((e=>{var[,,r]=e.split("_");o[r]=t[e]}))),null!=(r=e.onUpdate)&&r.call(e,{target:i,data:o,type:l,runScene:this.runScene})},exec:(e,t)=>{const r=this.trans.getKey(e);let a=e.target,i=e.label;e.label instanceof Array&&(i=(0,n.lastArrayEle)(e.label),a=(0,n.objLastMap)(e.target,e.label)),"color"===e.type||"color_str"===e.type||"color_obj"===e.type?r.map((e=>{var[,,r]=e.split("_");e=1<t[e]?t[e]/255:t[e],a[i][r]=e})):"number"===e.type?a[i]=t[r[0]]:"v2"!==e.type&&"v3"!==e.type||r.map((e=>{var[,,r]=e.split("_");a[i][r]=t[e]}))}},this.getLengthByName=e=>{var t;if(e=this.map.get(e))return t={},this.runScene.cb.snapshot.getLength.cb({data:e,inputData:t}),t},this.runScene=e}init(){this.runScene.exporter.gltf.options.addOption({type:"snapshot",process:this.toJSON,parse:this.parseJSON}),this.runScene.cb.clean.add("snapshrot",this.clean),this.runScene.cb.inited.add("snapshot",this.onInited)}create(e){var{name:e,time:t}=e;return e={name:e,time:t,data:new i.Z},this.runScene.cb.snapshot.create.cb(e),e}resetItem(e){const{targets:t,names:r,type:n}=e;e=r.map((e=>this.map.get(e))).filter((e=>e)),this.runScene.cb.snapshot.resetItem.cb({targets:t,datas:e,type:n})}add(e){var t=this.create(e);return this.map.set(e.name,t),t}addByType(e){var{name:t,time:r,targets:n,type:a}=e,t={name:t,time:r,data:new i.Z};return this.runScene.cb.snapshot.getByType.cb({type:a,data:t,targets:n}),this.map.set(e.name,t),t}set(e,t){var r=this.map.get(e);const{animaTime:n,isLinear:a,onDone:i}=Object.assign({animaTime:-1},t);if(r){const t={animas:[],completedCbs:[]};if(this.runScene.cb.snapshot.set.cb({snapshot:r,data:t}),0===t.animas.length){if(0===t.completedCbs.length)return null==i?void 0:i();t.completedCbs.map((e=>e())),null!=i&&i()}else this.anima(e,t,{animaTime:-1===n?r.time:n,isLinear:a,onDone:i})}}del(e){var t=this.map.get(e);t&&this.runScene.cb.snapshot.delete.cb({name:e,data:t})}anima(e,t,r){var a;if(this.runScene.modelEx.selectNull(),null==(a=this.playing.get(e))||!a.animaIns){const a=new i.Z,s={},o={},{animaTime:l,isLinear:u,onDone:h}=r,d={data:t,animaIns:null};t.animas.map(((e,t)=>{t=String(t);const{begin:r,end:n}=this.trans.set(e,t);r.map((e=>s[e.type]=e.data)),n.map((e=>o[e.type]=e.data)),a.set(t,Object.assign({unique:t},e))})),d.animaIns=(0,c.anima)(s,Object.assign(Object.assign({},o),{ease:u?"none":"easeOut"}),l,(e=>{(0,n.mapObj)(e,(t=>{var[,t]=t.split("_");(t=a.get(t))&&(t.isUpdate?this.trans.exec(t,e):this.trans.update(t,e))}))}),(()=>{var e;null!=(e=d.animaIns)&&e.kill(),d.animaIns=null,d.data.completedCbs.map((e=>e())),null!=h&&h()})),this.playing.set(e,d)}}close(e){const t=this.playing.get(e);return!(!t||(null!=(e=t.animaIns)&&e.kill(),t.animaIns=null))}closeAll(){this.playing.map(((e,t)=>{var r;t&&null!=(r=t.animaIns)&&r.kill(),t.animaIns=null}))}parseNromal(e,t){const{animas:r,completedCbs:a}=t.data,{target:i,type:s,begin:o,end:l,set:u,label:d,onUpdate:p}=e;if((0,c.isDef)(o,l))if(h.includes(s))r.push({target:i,type:s,begin:o,end:l,label:d,isUpdate:void 0===p,onUpdate:p});else if(u)u({target:i,begin:o,end:l});else{let e=i,t=d;d instanceof Array&&(e=(0,n.objLastMap)(i,d),t=(0,n.lastArrayEle)(d)),"texture"===s?e[t]=l:a.push((()=>{e[t]=l}))}}bind(e){const{name:t,def:r,target:n,create:a,set:i}=e;this.runScene.cb.snapshot.create.add(t,a||(e=>{var a=p.getDiff(r,n);0!==(0,s.objLength)(a)&&e.data.set(t,a)})),this.runScene.cb.snapshot.set.add(t,i||(e=>{var a=e.snapshot.data.get(t);a&&p.set({def:r,runScene:this.runScene,data:a,target:n,map:e})}))}}const p={toNormal(e){var t,{type:e,val:r}=e;let n=r;return"color"===e?n=(0,u.Lv)(r):"color_obj"===e?n=r:"color_str"===e?n=(0,c.MyHextoRgb)(r,!0):"texture"===e?(0,o.isTexture)(r)&&(n=(0,l.Ki)(r)):"v3"!==e&&"v2"!==e||(({x:e,y:r,z:t}=r),n={x:e,y:r,z:t}),n},parse(e){const{type:t,val:r,runScene:n}=e;let i=r;return"color"===t?i=a.YD.is(r)?r:(0,c.HextoRgb)(r,!0):"color_obj"===t?i=r:"color_str"===t&&(i=a.YD.is(r)?r:(0,c.HextoRgb)(r,!0)),"texture"===t&&null!==r?n.uniqueEx.texture.get(r):i},getDiff(e,t){let r={};return(0,n.mapObj)(e,((e,a)=>{const{label:i,get:s}=a;let o=t[e];s?o=s(t):i&&(o=(0,n.objLastMap)(t,i)[(0,n.lastArrayEle)(i)]),r[e]=o})),(0,s.replaceKVForObj)((0,c.getDiff)((0,s.replaceValForObj)(e,((e,t)=>t.val)),r),((t,r)=>{var{shortKey:t,type:n}=e[t];return{k:t,v:p.toNormal({type:n,val:r})}}))},set(e){const{def:t,data:r,target:a,runScene:i,map:s}=e;(0,n.mapObj)(t,((e,t)=>{const{type:o,val:l,shortKey:u,before:h,label:d,onUpdate:f,get:m,set:g}=t;let v=a,b=e;d&&(v=(0,n.objLastMap)(a,d),b=(0,n.lastArrayEle)(d)),t=p.toNormal({type:o,val:m?m(v):v[b]}),e=p.parse({type:o,val:void 0!==r[u]?r[u]:l,runScene:i}),(0,c.isDef)(t,e)&&(null!=h&&h({target:v,begin:t,end:e}),i.snapshot.parseNromal({target:v,label:b,type:o,set:g,begin:t,end:e,onUpdate:f},s))}))}}},3625:(e,t,r)=>{r.r(t),r.d(t,{bindTextureBaseData:()=>_,default:()=>x,disposeTexture:()=>T,getBlobByTexture:()=>E,getCloneIdFromTexture:()=>I,getImageDomByUrl:()=>G,getMimeByTexture:()=>S,getSizeByTexture:()=>C,getTextureGpuMemory:()=>M,getTextureMinFilter:()=>N,getUrlByTexture:()=>P,initTexture:()=>k,isClonedTexture:()=>L,isInvalidTexture:()=>H,isTexture:()=>R,loadTexture:()=>O,parseImageBitMapByBlob:()=>D,setTextureCloneId:()=>B,setTextureMapping:()=>A,setTextureMinFilter:()=>U,textureNameMap:()=>w,unDelAbleTexture:()=>V,updateTexture:()=>j});var n=r(6001),a=r(8881),i=r(6422),s=r(5247),o=r(932),l=r(3736);class c extends r(4616).Z{constructor(e){super(),this.info="函数修改",this.map=e}_execute(e,t){throw new Error("Method not implemented.")}execute(){return this.map.redo(),this}undo(){this.map.undo()}redo(){this.map.redo()}}const u=c;var h=r(8024),d=r(2510),p=r(3729),f=r(4457),m=r(1398),g=r(7201);const v={repeat:{type:"v2",val:{x:1,y:1},shortKey:"re"},offset:{type:"v2",val:{x:0,y:0},shortKey:"of"},rotation:{type:"number",val:0,shortKey:"ro"},center:{type:"v2",val:{x:0,y:0},shortKey:"ce"}};class b{constructor(e){this.onDeleteSnapshot=e=>{const{data:t,name:r}=e;(e=t.data.get("texture"))&&(0,n.mapObj)(e,(e=>{(e=this.runScene.uniqueEx.texture.get(e))&&this.setUnDel(e,!1,r)}))},this.resetItem=e=>{"texture"===e.type&&e.datas.map((t=>{const{data:r,name:n}=t;let a=r.get("texture");a||(a={},r.set("texture",a)),e.targets.map((e=>{var t=(0,p.Ki)(e);t&&(a[t]=this.getItem(e,n))}))}))},this.setUnDel=(e,t,r)=>{if(t){if(V.is(e))return}else if(V.getRef(e)!=="snapshot_"+r)return;V.set(e,t,"snapshot_"+r)},this.getItem=(e,t)=>{this.setUnDel(e,!0,t);const r=m.LV.getDiff(v,e);return(t=this.runScene.script.texture.get(e))&&(r.uvScript=Object.assign({},t)),r},this.getDiff=e=>{let t={};return this.runScene.uniqueEx.texture.getAll().map((({texture:r})=>{var n=(0,p.Ki)(r);n&&(t[n]=this.getItem(r,e))})),t},this.create=e=>{var t=this.getDiff(e.name);0!==(0,g.objLength)(t)&&e.data.set("texture",t)},this.set=e=>{var t=e.snapshot.data.get("texture");t&&(0,n.mapObj)(t,((t,r)=>{(t=this.runScene.uniqueEx.texture.get(t))&&(m.LV.set({def:v,data:r,runScene:this.runScene,map:e,target:t}),this.runScene.script.texture.parse(r.uvScript,t),this.runScene.script.texture.set(r.uvScript,t))}))},this.runScene=e,this.runScene.cb.snapshot.create.add("texture",this.create),this.runScene.cb.snapshot.set.add("texture",this.set),this.runScene.cb.snapshot.getLength.add("texture",(e=>{var t=e.data.data.get("texture");t&&(e.inputData.texture=Object.keys(t).length)})),this.runScene.cb.snapshot.delete.add("texture",this.onDeleteSnapshot),this.runScene.cb.snapshot.resetItem.add("texture",this.resetItem)}}var y=function(e,t,r,n){return new(r=r||Promise)((function(a,i){function s(e){try{l(n.next(e))}catch(e){i(e)}}function o(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?a(e.value):((t=e.value)instanceof r?t:new r((function(e){e(t)}))).then(s,o)}l((n=n.apply(e,t||[])).next())}))};class x{constructor(e){this.allTextures=new Set,this.rgbeLoader=new i.x,this.spcielBack=["hdr","pic"],this.setAnima=e=>{const{texture:t,type:r,val:n}=e,a=t.userData.uvScript||{};t.userData.uvScript||(t.userData.uvScript=a),0===n?delete a[r]:a[r]=n,this.runScene.cb.texture.setAnima.cb({texture:t,uvScript:a})},this.runScene=e,this.snapshot=new b(e)}load(e,t){return y(this,void 0,void 0,(function*(){var r=yield(0,f.urlToBlob)(e);return this.parse(r,t)}))}parse(e,t){return y(this,void 0,void 0,(function*(){let r;return t=(0,f.mergeObject)({flipY:!0},t),(e=e instanceof File?yield(0,f.fileToBlob)(e):e)instanceof File&&this.spcielBack.includes(e.name.substring(e.name.lastIndexOf(".")+1))?(r=yield this.parseHdr(e)).userData.isHdr=!0:r=yield O(e,t),this.afterLoad(r,e)}))}parseHdr(e){return this.rgbeLoader.loadAsync(URL.createObjectURL(e))}clone(e){const t=new a.Texture(e.image);return t.userData=Object.assign(Object.assign({},e.userData),{id:(0,n.getId)(),cloneSourceId:(0,p.Ki)(e)}),(0,l.bv)(t,"minFilter"),_(t,this.runScene),this.getSameAndAddtoAll(t)}getDef(e){return e=new a.Texture(e),_(e,this.runScene),this.getSameAndAddtoAll(e)}getSameAndAddtoAll(e){var t=e.userData.md5;return(t=this.getSameTexture(t,e))?(T(e),t):(this.initTextureAndAddtoAll(e),e)}afterLoad(e,t){return y(this,void 0,void 0,(function*(){return this.getSameAndAddtoAll(yield _(e,this.runScene,t))}))}getSameTexture(e,t){if(!L(t))for(const n in this.runScene.uniqueEx.texture.map){var r=this.runScene.uniqueEx.texture.get(n);if(r.userData.md5===e&&r.mapping===t.mapping)return r}}initTextureAndAddtoAll(e){return y(this,void 0,void 0,(function*(){return k(e),_(e,this.runScene),this.addTextureToAll(e),e}))}addTextureToAll(e){var t=this.runScene.uniqueEx.texture.getLength();this.runScene.uniqueEx.texture.add(e),this.runScene.uniqueEx.texture.getLength()!==t&&this.runScene.cb.texture.add.cb(e)}getBlobAndBase64(e){return e.userData.blob?e.userData:(0,f.imgBitMapToBlobAndBase64)(e)}coverByImage(e,t){return y(this,void 0,void 0,(function*(){let r;r=R(t)?t:t?yield this.parse(t):null;var a=this.runScene.uniqueEx.texture.getMaterials(this.runScene.uniqueEx.getId(e));if(a){const t=[];(0,n.mapObj)(a,((n,a)=>{const i=this.runScene.uniqueEx.material.get(n);i&&a.forEach((n=>{t.push(new h.Z({target:i,info:n,newVal:r,oldVal:e,runScene:this.runScene}).execute())}))})),this.runScene.undoEx.addUndo(t)}}))}remove(e){const t=(0,p.Ki)(e);var r=this.runScene.uniqueEx.texture.map[t];if(r){const a=[];r=r.materialMap,(0,n.mapObj)(r,((e,t)=>{const r=this.runScene.uniqueEx.material.get(e);r&&(t.forEach((e=>{a.push(new d.Z({target:r,info:e,oldVal:r[e],newVal:null,runScene:this.runScene,cb(){(0,o.updateMaterial)(r)}}).execute())})),(0,o.updateMaterial)(r))}));const i=this.runScene.uniqueEx.texture.map[t];a.push(new u({undo:()=>{this.runScene.cb.texture.add.cb(e),this.runScene.uniqueEx.texture.add(e)},redo:()=>{this.runScene.cb.texture.remove.cb(e),this.runScene.uniqueEx.texture.remove(e)}}).execute(),new u({undo:()=>{this.runScene.uniqueEx.texture.map[t]=i},redo:()=>{delete this.runScene.uniqueEx.texture.map[t]}}).execute()),this.runScene.undoEx.addUndo(a)}}delete(e){this.runScene.cb.texture.remove.cb(e),this.runScene.uniqueEx.texture.remove(e),T(e)}reverseImageBitMapTexture(e){return y(this,void 0,void 0,(function*(){var{canvas:t,imageBitMap:r}=yield(0,f.reverseImageBitMap)(e.image);const i=new a.Texture(r);return i.needsUpdate=!0,r=this.runScene.uniqueEx.texture.map[e.userData.id],(0,n.mapObj)(r.materialMap,((e,t)=>{const r=this.runScene.uniqueEx.material.get(e);t.forEach((e=>{r[e]=i,this.runScene.uniqueEx.texture.addMaterial(i,{material:r,type:e})}))})),k(i),yield _(i,this.runScene),this.runScene.cb.texture.add.cb(i),this.delete(e),(0,f.disposeCanvas)(t),i}))}setUnDelAble(e,t,r="custom",n){V.set(e,t,r,n),this.runScene.cb.texture.set.cb({type:"unDelAble",texture:e,data:t})}getUsedModel(e,t=!0){if(e=(0,p.Ki)(e)){const r=[];if((e=this.runScene.uniqueEx.texture.map[e])&&((0,n.mapObj)(e.materialMap,(e=>{const t=this.runScene.uniqueEx.material.map[e];t&&r.push(...t.models.toArray())})),0!==r.length))return t&&this.runScene.multipSelector.add(r,!0),r}}getUsedMaterial(e){if((e=(0,p.Ki)(e))&&(e=this.runScene.uniqueEx.texture.map[e]))return(0,n.mapObj)(e.materialMap,(e=>null==(e=this.runScene.uniqueEx.material.map[e])?void 0:e.material)).filter((e=>e))}}const w={环境遮蔽:"aoMap",法线:"normalMap",金属度:"metalnessMap",粗糙度:"roughnessMap",自发光:"emissiveMap",颜色:"map",置换:"displacementMap",光照贴图:"lightMap",环境:"envMap",透明度:"alphaMap"},S=e=>1023===e.format?"image/png":"image/jpeg",M=e=>{var{width:e,height:t}=e.image||{width:0,height:0};return e*t*4*1.33},T=e=>{var t,r;e&&(t=e.image,r=e.userData.url,t instanceof ImageBitmap?(0,f.disposeImageBitMap)(t):t instanceof HTMLCanvasElement&&(0,f.disposeCanvas)(t),URL.revokeObjectURL(r),e.dispose())},_=(e,t,r)=>y(void 0,void 0,void 0,(function*(){if("editor"===t.optionsEx.options.mode){var n=(0,f.isBlob)(e.userData.blob)?e.userData.blob:null;const t=r||n||(yield E(e));e.userData.blob=t,e.userData.mimeType=t.type;var{md5:n,url:a}=e.userData;return n||(e.userData.md5=(0,f.getMd5)(yield t.arrayBuffer())),a||(e.userData.url=URL.createObjectURL(t)),e.userData.isHdr&&(e.flipY=!0),e.userData.gm=M(e),e.needsUpdate=!0,e}})),E=e=>(0,f.isBlob)(e.userData.blob)?e.userData.blob:(0,f.imgBitMapToBlob)(e.image),k=e=>{if(!e.userData.isHdr)return e.magFilter=1003,e.wrapS=s.Z.RepeatWrapping,e.wrapT=s.Z.RepeatWrapping,e.encoding=3e3,e.version=3,e.userData.flipY?e.flipY=!0:e.flipY=!1,"nearest"!==N(e)&&(e.minFilter=s.Z.LinearMipmapLinearFilter),e.needsUpdate=!0,e},D=(e,t)=>{let r={resizeQuality:"pixelated"};return null!=t&&t.flipY&&(r.imageOrientation="flipY"),createImageBitmap(e,r)},O=(e,t)=>y(void 0,void 0,void 0,(function*(){var r=yield D(yield G(e instanceof Blob?URL.createObjectURL(e):e),t);const n=new a.Texture(r);return n.needsUpdate=!0,n})),P=e=>null==(e=e.userData)?void 0:e.url,A=(e,t="repeat")=>(e.mapping="repeat"===t?s.Z.EquirectangularReflectionMapping:300,e.needsUpdate=!0,e),C=e=>{var{width:e,height:t}=e.image;return{width:e,height:t}},R=e=>null==e?void 0:e.isTexture,L=e=>0<(null==(e=e.userData.cloneSourceId)?void 0:e.length),I=e=>e.userData.cloneSourceId,B=(e,t)=>{e.userData.cloneSourceId=t},j=e=>{e.needsUpdate=!0},U=(e,t)=>{e.minFilter=s.Z["linear"===t?"LinearMipmapLinearFilter":"NearestFilter"],(0,l.M)(e,"minFilter",t),j(e)},N=e=>(0,l.is)(e,"minFilter"),F="unDelAble",z="unDelAbleRef",V={is:e=>(0,l.is)(e,F),getRef:e=>(0,l.is)(e,z),set(e,t,r="custom",n){if(t)(0,l.M)(e,F,t),(0,l.M)(e,z,r);else{let t=!1;(t=!(!n&&(0,l.is)(e,z)!==r)||t)&&(delete e.userData[F],delete e.userData[z])}}},G=e=>{const t=document.createElement("img");return t.src=e,new Promise((e=>{t.addEventListener("load",(()=>{e(t)}))}))},H=e=>{var t;return 0===(null==(t=e.userData.blob)?void 0:t.size)||void 0!==(null==(t=e.source)?void 0:t.data.width)&&(0===(null==(t=e.source)?void 0:t.data.width)||0===e.source.data.height)}},6651:(e,t,r)=>{r.d(t,{ZP:()=>n,d9:()=>a});class n{constructor(e){this.undos=[],this.redos=[],this.dataMap={history:[],index:0},this.clean=()=>{this.reset()},this.runScene=e,this.runScene.cb.clean.add("Undo",this.clean)}undo(){if(0!==this.undos.length){const e=this.removeUndos(-1)[0];e&&(e instanceof Array?e.reverse().map((e=>e.undo())):e.undo(),this.redos.push(e))}}addUndos(e){var t;return this.undos.push(e),t=this.dataMap.history.push(e),this.dataMap.index=this.undos.length-1,this.runScene.cb.undo.addUndos.cb({undoVal:e,undos:this.undos}),t}removeUndos(e){var t;return this.undos.splice(e),t=this.dataMap.history.splice(e),this.dataMap.index=this.undos.length-1,this.runScene.cb.undo.removeUndos.cb({index:e}),t}undoByIndex(e){e>this.dataMap.index?this.undos.slice(this.dataMap.index+1,e+1).map((e=>{e instanceof Array?e.map((e=>e.redo())):e.redo()})):e<this.dataMap.index&&this.undos.slice(e+1,this.dataMap.index+1).reverse().map((e=>{e instanceof Array?e.map((e=>e.undo())):e.undo()})),this.dataMap.index=e,this.runScene.cb.undo.undoByIndex.cb(e)}addUndo(e){this.dataMap.index!==this.undos.length&&this.removeUndos(this.dataMap.index+1),this.addUndos(e)}addRedo(e){this.redos.push(e)}redo(){if(0!==this.redos.length){const e=this.redos.splice(-1)[0];e&&(e instanceof Array?e.reverse().map((e=>e.redo())):e.redo(),this.addUndo(e))}}reset(){this.undos=[],this.redos=[],this.dataMap.history=[],this.dataMap.index=0,this.runScene.cb.undo.reset.cb("")}}var a=function(e){if("object"!=typeof e)return e;if(null===e)return null;if(e){var t,r,n=new e.constructor;for(t in e)e.hasOwnProperty(t)&&(r=a(e[t]),n[t]=r);return n}}},4773:(e,t,r)=>{r.d(t,{Z:()=>a});var n=r(1269);class a{constructor(e){this.addTree=!0,this.isClone=!1,this.cb=(e,t)=>{};var{model:e,parent:t,cb:r,addTree:n,isClone:a,runScene:i}=e;this.runScene=i,this.model=e,this.parent=t,!1===n&&(this.addTree=n),!0===a&&(this.isClone=a),r&&(this.cb=r)}remove(e){const{model:t,parent:r,addTree:n,runScene:a}=e;a.modelEx.select===t&&a.modelEx.selectNull(),r.remove(t),n&&a.uniqueEx.model.remove(t),n&&a.cb.model.remove.cb({model:t,parent:r}),this.cb(t,"remove"),a.uniqueEx.material.addModel(t,void 0,t.material)}add(e){const{model:t,parent:r,addTree:a,isClone:i,runScene:s}=e;r.add(t),a&&s.uniqueEx.model.add(t),a&&s.cb.model.add.cb({model:t,parent:r,isClone:i}),this.cb(t,"add"),s.uniqueEx.material.addModel(t,t.material),(0,n.RQ)(t)&&setTimeout((()=>{this.runScene.lightEx.update(t)}))}}},4616:(e,t,r)=>{r.d(t,{Z:()=>n});class n{}},8024:(e,t,r)=>{r.d(t,{Z:()=>i});var n=r(4330);class a extends r(4616).Z{constructor(e){super(),this.isUndoMaterial=!0,this.type="修改材质";var{target:e,info:t,newVal:r,oldVal:n,runScene:a,cb:i}=e;this.runScene=a,this.target=e,this.info=t,this.newVal=r,this.oldVal=n,this.cb=i}_execute(e,t){if(this.target[this.info]=e,this.target.needsUpdate=!0,n.zX.includes(this.info)){if(!e)return;this.runScene.uniqueEx.texture.addMaterial(e,{material:this.target,type:this.info})}"depthWrite"===this.info&&!0===e&&delete this.target.userData[this.info],null!=(e=this.cb)&&e.call(this,this)}execute(){return this.redo(),this}undo(){this._execute(this.oldVal,this.newVal)}redo(){this._execute(this.newVal,this.oldVal)}}const i=a},3735:(e,t,r)=>{r.d(t,{Z:()=>i});var n=r(6001);class a extends r(4616).Z{constructor(e){super(),this.type="多层级修改",this.isUndoMultipLevel=!0,this.target=e.target,this.typeList=e.typeList,this.new=e.newVal,this.cb=e.cb,this.old=(0,n.objLastMap)(e.target,this.typeList)[(0,n.lastArrayEle)(e.typeList)]}execute(){return this.redo(),this}_execute(e){const t=(0,n.objLastMap)(this.target,this.typeList);t[(0,n.lastArrayEle)(this.typeList)]=e,this.cb&&this.cb(t),"shadow"!==this.typeList[0]&&this.typeList[1]}undo(){this._execute(this.old)}redo(){this._execute(this.new)}}const i=a},2510:(e,t,r)=>{r.d(t,{Z:()=>a});class n extends r(4616).Z{constructor(e){super(),this.type="修改属性",this.isUndoNormal=!0,this.cb=e=>{};var{target:e,info:t,oldVal:r,newVal:n,runScene:a,cb:i,executeCb:s}=e;this.runScene=a,this.target=e,this.info=t,this.newVal=n,this.oldVal=r,i&&(this.cb=i),s&&(this.executeCb=s)}_execute(e){var{target:t,info:r}=this;if(this.executeCb)return this.executeCb({target:t,info:r,val:e});this.target[this.info]=e,"name"===this.info&&this.target.isObject3D?(t=this.runScene.uniqueEx.model.parseName(this.target),r=e,this.runScene.cb.model.changeName.cb({model:this.target,name:e=t||e,oldName:r})):"material"===this.info?this.runScene.uniqueEx.material.addModel(this.target,e,e===this.newVal?this.oldVal:this.newVal):"visible"===this.info&&this.runScene.cb.model.setVisible.cb({model:this.target,visible:e}),this.runScene.cb.model.change.cb({type:this.info,model:this.target,val:e}),this.cb(this.target)}execute(){return this.redo(),this}undo(){this._execute(this.oldVal)}redo(){this._execute(this.newVal)}}const a=n},7169:(e,t,r)=>{r.d(t,{Z:()=>n});class n extends r(4773).Z{constructor(e){super(e),this.type="移除模型",this.isUndoRemove=!0}undo(){this.add({model:this.model,parent:this.parent,addTree:this.addTree,runScene:this.runScene})}redo(){this.remove({model:this.model,parent:this.parent,addTree:this.addTree,runScene:this.runScene})}_execute(e){return Promise.reject()}execute(){return this.redo(),this}}},4380:(e,t,r)=>{r.d(t,{Z:()=>a});class n extends r(4616).Z{constructor(e){super(),this.isUndoV3=!0,this.type="三维矩阵修改";var{target:e,info:t,newV3:r,oldV3:n,runScene:a}=e;this.target=e,this.info=t,this.runScene=a,this.newV3=r,this.oldV3=n,this.target.uuid===(null==(e=this.runScene.modelEx.select)?void 0:e.uuid)&&(this.runScene.cb.model.setSelect.cb(null),this.runScene.cb.model.setSelect.cb(this.target))}_execute(e){this.target[this.info].copy(e),this.target.uuid===(null==(e=this.runScene.modelEx.select)?void 0:e.uuid)&&this.runScene.helperEx.focus(this.target)}execute(e=!0){return e&&this.redo(),this}undo(){this._execute(this.oldV3)}redo(){this._execute(this.newV3)}}const a=n},3729:(e,t,r)=>{r.d(t,{ZP:()=>d,Ki:()=>p,x:()=>f});var n=r(6001),a=r(272),i=r(932);class s{constructor(e){this.map={},this.removes=[],this.unique=e}add(e,t,r){if(null!=e&&e.userData&&!i.materialIgnore.is(e)){let i=e.userData.id;if(i||(i=(0,n.getId)(),e.userData.id=i),this.map[i]){if(this.map[i].material.name!==e.name){const t=(0,n.getId)();e.userData.id=t,this.map[t]={material:e,models:new a.Z},this.unique.runScene.cb.unique.material.add.cb(e)}}else this.map[i]={material:e,models:new a.Z},this.unique.runScene.cb.unique.material.add.cb(e);t&&this.addModel(t,e,r)}}addModel(e,t,r){r&&t&&p(r)===p(t)||(null!=t&&t.userData&&(t=p(t),null!=(t=this.map[t])&&t.models.add(e)),r&&null!=(t=this.map[p(r)])&&t.models.delete(e))}each(e){return this.getAll("values").map((({material:t})=>e(t)))}getAll(e){return Object[e](this.map)}get(e){return null==(e=this.map[e])?void 0:e.material}getModels(e){return null==(e=this.map[e])?void 0:e.models}remove(e){delete this.map[e]}addRemoved(e){this.map[e.uuid]&&this.removes.push(e.uuid)}dispose(){(0,n.mapObj)(this.map,((e,t)=>{t.material.dispose()})),this.map={}}}var o=r(1269),l=r(8715),c=r(158);class u extends class{constructor(e){this.map={},this.unique=e}add(e){if(e instanceof Array)return e.map((e=>this.add(e)));let t=e.userData.id;return t||(t=(0,n.getId)(),e.userData.id=t),this.map[t]?void 0:(this.map[t]=e,t)}get(e){return this.map[e]}remove(e){if(e instanceof Array)return e.map((e=>this.remove(e)));delete this.map[e.userData.id]}}{constructor(){super(...arguments),this.nameMap={},this.parseName=(()=>{const e=e=>{var t=e.lastIndexOf("_");return-1===t?-1:(e=e.slice(t+1),n.type.isNumber(e)?Number.parseInt(e):-1)},t=(r,n)=>{var a=(t=>{if(-1===e(t))return t;var r=t.lastIndexOf("_");return-1===r?t:t.slice(0,r)})(r)+"_"+n++;return this.nameMap[a]?t(r,n):a},r=e=>Object.keys(this.nameMap).find((t=>this.nameMap[t]===e)),a=["PerspectiveCamera"];return n=>{if(a.includes(n.type))return n.name=n.type;let i=n.name;if(i=i||n.type,!this.nameMap[i])return s=this.unique.getId(n),(o=r(s))&&delete this.nameMap[o],void(this.nameMap[i]=s);var s,o=this.nameMap[i];return this.unique.model.get(o)!==n?(s=e(i),s=t(i,o=-1===s?0:s),this.nameMap[s]=this.unique.getId(n),n.name=s):void 0}})()}add(e,t){var{reset:r,hasReset:a}=t||{ignoreMaterial:!1};if(e instanceof Array)return e.map((e=>this.add(e,t)));if(e&&!(0,l.isHelper)(e)){let i=e.userData.id;if(i&&!r||(i=(0,n.getId)(),e.userData.id=i),this.map[i]){if(!(a||(0,c.An)(this.unique.runScene)&&(0,c.FW)(this.unique.runScene).coverSameId))return void(e.name!==this.map[i].name&&this.unique.runScene.optionsEx.log(`解析模型出错,${e.name} 与 ${this.map[i].name} 拥有相同的id,请选择任意一个模型导出并删除,并重新导入。`,"base","error"));i=(0,n.getId)(),e.userData.id=i}return this.unique.runScene.cb.unique.model.add.cb({model:e}),this.map[i]=e,this.parseName(e),e.material&&(this.unique.runScene.materialEx.parse(e.material),this.unique.material.add(e.material,e)),!e.children.length||(0,o.RQ)(e)||(0,l.isHelper)(e)?i:this.add(e.children,t)}}get(e){return this.map[e]}getModelsWithIds(e){return e.map((e=>this.get(e))).filter((e=>e))}getByName(e){return this.nameMap[e]}getIdByNames(e){return e.map((e=>this.getByName(e))).filter((e=>e))}remove(e){if(e instanceof Array)return e.map((e=>this.remove(e)));e.traverse((e=>{delete this.nameMap[e.name]})),delete this.map[e.userData.id]}dispose(){this.map={},this.nameMap={}}findModelWithName(e){var t=Object.keys(this.nameMap).filter((t=>{const r=t.toLowerCase();return r===(t=e.toLowerCase())||-1!==r.indexOf(t)}));return t=this.getIdByNames(t),this.getModelsWithIds(t)}}class h{constructor(e){this.map={},this.unique=e}add(e){if(e&&e.userData){if(e instanceof Array)return e.map((e=>this.add(e)));let t=e.userData.id;return t||(t=(0,n.getId)(),e.userData.id=t),this.map[t]?void 0:(this.map[t]={texture:e,materialMap:{}},t)}}getLength(){return Object.keys(this.map).length}addMaterial(e,t,r){var n,a=e.userData.id||this.add(e);t&&(({material:t,type:n}=t),this.map[a]||(this.map[a]={materialMap:{},texture:e}),this.map[a].materialMap[t.userData.id]||(this.map[a].materialMap[t.userData.id]=new Set),this.map[a].materialMap[t.userData.id].add(n)),r&&(({material:e,type:t}=r),this.map[a].materialMap[e.userData.id]&&this.map[a].materialMap[e.userData.id].delete(t))}get(e){return null==(e=this.map[e])?void 0:e.texture}getMaterials(e){return null==(e=this.map[e])?void 0:e.materialMap}remove(e){if(e instanceof Array)return e.map((e=>this.remove(e)));var t=this.map[e.userData.id];t&&((0,n.mapObj)(t.materialMap,((e,t)=>{const r=this.unique.runScene.uniqueEx.material.get(e);r&&t.forEach((e=>{r[e]=null}))})),delete this.map[e.userData.id])}dispose(){(0,n.mapObj)(this.map,((e,t)=>{t.texture.dispose()})),this.map={}}getAll(){return Object.values(this.map)}}class d{constructor(e){this.clean=()=>{this.dispose()},this.runScene=e,this.model=new u(this),this.material=new s(this),this.texture=new h(this),this.runScene.cb.clean.add("EngineModel",this.clean)}getId(e){return e.userData.id}dispose(){this.material.dispose(),this.model.dispose(),this.texture.dispose()}}const p=e=>(null==(e=null==e?void 0:e.userData)?void 0:e.id)||"",f=(e,t)=>{e.userData&&(e.userData.id=t)}},4457:(e,t,r)=>{r.r(t),r.d(t,{HextoRgb:()=>a.I8,LimitCb:()=>a.cM,MyHextoRgb:()=>a.Dn,addElesFromIndexToArr:()=>a.Rn,angleToNum:()=>i.Zv,anima:()=>a.gY,arrayBufferToBase64:()=>a.sM,arrayBufferToBlobUr:()=>a.oo,arrayToVector3:()=>i.F,base64ToArrayBuffer:()=>a.RG,base64ToBlob:()=>a.Jr,bitMapToCanvas:()=>n.Rd,blobToFile:()=>a.hl,bufferToArrayBuffer:()=>a.cO,canvasToBlob:()=>a._c,changeModelOpc:()=>i.Hg,changeModelOpcs:()=>i.Z7,clone:()=>a.d9,closeNum:()=>a.nx,colorToRgb:()=>i.sS,compressImgToUrl:()=>n.jH,deepFindParentByUuid:()=>i.Q3,deepMergeObject:()=>a.U,disposeCanvas:()=>n.eZ,disposeImageBitMap:()=>n.oZ,domTo2Dui:()=>i.UZ,domTo3DSprite:()=>i.YG,domTo3Dui:()=>i.ol,fileAndBlobToCanvas:()=>a.OE,fileToBlob:()=>a.a_,filterFiles:()=>a.Rz,fromCode:()=>a.Ne,getArrIndexByItem:()=>a.B1,getBetweenByV3:()=>i.A2,getBetweenDomByIdx:()=>l,getCamAnimaData:()=>i.Gm,getCenter:()=>i.qg,getClock:()=>i.aM,getColorByHex:()=>i.e9,getColorByHexStr:()=>i.ZD,getCurve:()=>i.kG,getDate:()=>a._3,getDiff:()=>a.ad,getDistance:()=>i.Sp,getEmptyImageData:()=>n.mH,getFilesByDataTransfer:()=>a.xl,getFilesFromFileList:()=>a.kk,getHexByColor:()=>i.J6,getIdxInParent:()=>o,getImg:()=>n.Pk,getImgByHdrTexture:()=>i.p1,getImgPixels:()=>n.BW,getImgPixels1:()=>n.Cm,getLine2:()=>i.SI,getMacro:()=>a.Ls,getMapByRgb:()=>a.fh,getMd5:()=>a.ZM,getModelByType:()=>i.Py,getModelMap:()=>i.yT,getNamesByNum:()=>a.nR,getOptions:()=>s.FW,getProgress:()=>a.xC,getRGBByHex:()=>i.OR,getRandomColor:()=>a.mr,getRes:()=>a.sR,getResultFromCanvas:()=>n.xK,getTime:()=>a.hK,getTruthBase64:()=>a.Mh,getType:()=>a.oL,getTypeByBase64:()=>a.Op,getTypeFromGlb:()=>s.te,getVideoTexture:()=>i.hX,getWorldLocal:()=>i.VU,hslToRgb:()=>n.ve,imgArrayBufferToBlobUrl:()=>n.lU,imgBitMapToBase64:()=>n.s4,imgBitMapToBlob:()=>n.gW,imgBitMapToBlobAndBase64:()=>n.v1,isBlob:()=>a.Lj,isDef:()=>a.Xq,isEditor:()=>s.hz,isEmpty:()=>a.xb,isRunning:()=>s.An,isVisible:()=>i.pn,longestCommonPrefix:()=>a.GG,mergeObject:()=>a.Gm,percentageStrToNum:()=>a.zz,removeUnLess:()=>i.hs,resetCenter:()=>i.cm,reverseImageBitMap:()=>n.Fs,reverseImg:()=>n.rx,rgbToHex:()=>i.vq,rgbToHsl:()=>n.lC,rgbToStr:()=>i.$W,rgbaToRgb:()=>i.Di,rmArrEle:()=>a.J9,rmPartOfString:()=>a.h3,sameArr:()=>a.F1,sameV3:()=>i.x$,setParentVisible:()=>i.FT,strToNum:()=>a.LC,tColorToRgb:()=>i.Lv,textureToThreeD:()=>i.vp,toCode:()=>a.Ni,toInt:()=>a.Hq,toTimeString:()=>a.U9,transByte:()=>a.iM,typeAnima:()=>u,urlToBlob:()=>a.pX,urlToCanvas:()=>a.o4,v3ToMap:()=>i.ln,validType:()=>a.lG,vector:()=>i.xr});var n=r(5137),a=r(6272),i=r(8089),s=r(158);const o=e=>[...e.parentElement.children].findIndex((t=>t===e)),l=e=>{var{dom:e,beginIdx:t,endIdx:r}=e;return[...e.children].slice(t,r+1)};var c=r(8881);const u=(e,t,r)=>{const{}=r||{},n={},i={};e.map(((e,t)=>{const{begin:r,end:s,type:o,label:l}=e,u="_"+o+"_"+l+"_"+String(t);if("color"===o&&r instanceof c.Color&&s instanceof c.Color){const e=(0,a.I8)("#"+r.getHexString(),!0),t=(0,a.I8)("#"+s.getHexString(),!0);["r","g","b"].map((r=>{var a=r+u;n[a]=e[r],i[a]=t[r]}))}"number"===o&&(n[e=l+u]=r,i[e]=s),"vector3"===o&&["x","y","z"].map((e=>{var t=e+u;n[t]=r[e],i[t]=s[e]})),"vector2"===o&&["x","y"].map((e=>{var t=e+u;n[t]=r[e],i[t]=s[e]}))}))};u([{begin:new c.Color(.5,.5,.5),end:new c.Color(0,0,0),label:"color",type:"color"},{begin:1,end:2,label:"a",type:"number"},{begin:new c.Vector3(1,1,1),end:new c.Vector3(2,2,2),label:"b",type:"vector3"},{begin:new c.Vector2(1,1),end:new c.Vector2(2,2),label:"c",type:"vector2"}],1)},5137:(e,t,r)=>{r.d(t,{BW:()=>f,Cm:()=>p,Fs:()=>x,Pk:()=>b,Rd:()=>m,eZ:()=>w,gW:()=>l,jH:()=>d,lC:()=>g,lU:()=>h,mH:()=>M,oZ:()=>S,rx:()=>c,s4:()=>o,v1:()=>u,ve:()=>v,xK:()=>y});var n=r(5247),a=r(3625),i=r(6272),s=function(e,t,r,n){return new(r=r||Promise)((function(a,i){function s(e){try{l(n.next(e))}catch(e){i(e)}}function o(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?a(e.value):((t=e.value)instanceof r?t:new r((function(e){e(t)}))).then(s,o)}l((n=n.apply(e,t||[])).next())}))};const o=e=>{const t=document.createElement("canvas");return(t.width=e.width,t.height=e.height,t.getContext("2d")).drawImage(e,0,0,t.width,t.height),t.toDataURL()},l=e=>s(void 0,void 0,void 0,(function*(){const t=document.createElement("canvas");return(t.width=e.width,t.height=e.height,t.getContext("2d")).drawImage(e,0,0,t.width,t.height),new Promise((e=>{t.toBlob((t=>{e(t)}))}))})),c=e=>{const t=document.createElement("canvas"),r=(t.width=e.width,t.height=e.height,t.getContext("2d"));r.translate(0,t.height),r.scale(1,-1),r.drawImage(e,0,0,t.width,t.height)},u=e=>s(void 0,void 0,void 0,(function*(){var t=e.image;const r=document.createElement("canvas"),n=(r.width=t.width,r.height=t.height,r.getContext("2d")),i=(0,a.getMimeByTexture)(e);return n.drawImage(t,0,0,r.width,r.height),new Promise((e=>{r.toBlob((t=>{e({blob:t,base64:r.toDataURL(i)})}),i)}))})),h=(e,t)=>URL.createObjectURL(new Blob([e],t)),d=(e,t)=>{const r=document.createElement("canvas"),n=r.getContext("2d");return r.width=e.width,r.height=e.height,n.drawImage(e,0,0,e.width,e.height),new Promise((e=>{r.toBlob((t=>{t&&e(URL.createObjectURL(t))}),"image/webp",t)}))},p=e=>s(void 0,void 0,void 0,(function*(){var{bitmap:t,texture:r}=e;const{ctx:a,canvas:s}=yield(0,i.OE)(URL.createObjectURL(r.userData.blob),{width:t.width,height:t.height});for(var o=a.getImageData(0,0,t.width,t.height,{colorSpace:"srgb"}),l=0,c=o.data.length;l<c;l+=4){var u=(d=g(o.data[l],o.data[l+1],o.data[l+2]))[0]/100,h=d[1]/100,d=d[2]/100;u=v(u,h,d),o.data[l]=u[0],o.data[l+1]=u[1],o.data[l+2]=u[2]}return a.putImageData(o,0,0),new n.Z.Texture(s)})),f=e=>{for(var t=(e=e.bitmap).width,r=e.height,n=m(e).ctx.getImageData(0,0,t,r).data,a=[],i=0;i<n/4;i+=1)a.push(n.slice(4*i,4*(i+1)))},m=e=>{const t=document.createElement("canvas"),r=t.getContext("2d");return r.drawImage(e,0,0,e.width,e.height),{ctx:r,canvas:t}},g=(e,t,r)=>{e/=255,t/=255,r/=255;var n,a=Math.max(e,t,r),i=Math.min(e,t,r),s=(a+i)/2;if(a==i)n=l=0;else{var o=a-i,l=.5<s?o/(2-a-i):o/(a+i);switch(a){case e:n=(t-r)/o+(t<r?6:0);break;case t:n=(r-e)/o+2;break;case r:n=(e-t)/o+4}n/=6}return[100*n,100*l,100*s]},v=(e,t,r)=>{var n,a,i,s;return 0==t?a=i=s=r:(a=(n=function(e,t,r){return r<0&&(r+=1),1<r&&--r,r<1/6?e+6*(t-e)*r:r<.5?t:r<2/3?e+(t-e)*(2/3-r)*6:e})(t=2*r-(r=r<.5?r*(1+t):r+t-r*t),r,e+1/3),i=n(t,r,e),s=n(t,r,e-1/3)),[255*a,255*i,255*s]},b=e=>{const t=new Image;return t.src=e,new Promise((e=>{t.onload=()=>{e(t)}}))},y=(e,t,r)=>{const n=(0,i.Gm)({base64Type:"webp"},r).base64Type;return new Promise(((r,a)=>{"blob"===t?e.toBlob((e=>{(e?r:a)(e)})):"base64"===t&&r(e.toDataURL("image/"+n))}))},x=e=>s(void 0,void 0,void 0,(function*(){var{width:t,height:r}=e;const n=document.createElement("canvas"),a=(n.width=t,n.height=r,n.getContext("2d"));if(a)return a.translate(0,r),a.scale(1,-1),a.drawImage(e,0,0,t,r),{imageBitMap:yield createImageBitmap(a.getImageData(0,0,t,r)),canvas:n}})),w=e=>{e.remove()},S=e=>{e.close()},M=e=>{var{width:e,height:t}=e;const r=document.createElement("canvas");return(r.width=e,r.height=t,r.getContext("2d")).drawImage(new Image,0,0),r}},6272:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{B1:()=>getArrIndexByItem,Dn:()=>MyHextoRgb,F1:()=>sameArr,GG:()=>longestCommonPrefix,Gm:()=>mergeObject,Hq:()=>toInt,I8:()=>HextoRgb,J9:()=>rmArrEle,Jr:()=>base64ToBlob,LC:()=>strToNum,Lj:()=>isBlob,Ls:()=>getMacro,Mh:()=>getTruthBase64,Ne:()=>fromCode,Ni:()=>toCode,OE:()=>fileAndBlobToCanvas,Op:()=>getTypeByBase64,RG:()=>base64ToArrayBuffer,Rn:()=>addElesFromIndexToArr,Rz:()=>filterFiles,U:()=>deepMergeObject,U9:()=>toTimeString,Xq:()=>isDef,ZM:()=>getMd5,_3:()=>getDate,_c:()=>canvasToBlob,a_:()=>fileToBlob,ad:()=>getDiff,cM:()=>LimitCb,cO:()=>bufferToArrayBuffer,d9:()=>clone,fh:()=>getMapByRgb,gY:()=>anima,h3:()=>rmPartOfString,hK:()=>getTime,hl:()=>blobToFile,iM:()=>transByte,kk:()=>getFilesFromFileList,lG:()=>validType,mr:()=>getRandomColor,nR:()=>getNamesByNum,nx:()=>closeNum,o4:()=>urlToCanvas,oL:()=>getType,oo:()=>arrayBufferToBlobUr,pX:()=>urlToBlob,sM:()=>arrayBufferToBase64,sR:()=>getRes,xC:()=>getProgress,xb:()=>isEmpty,xl:()=>getFilesByDataTransfer,zz:()=>percentageStrToNum});var _allex_md5__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(1129),_allex_md5__WEBPACK_IMPORTED_MODULE_0___default=__webpack_require__.n(_allex_md5__WEBPACK_IMPORTED_MODULE_0__),axios__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(3300),axios__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(axios__WEBPACK_IMPORTED_MODULE_1__),js_funcs__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(6001),js_funcs__WEBPACK_IMPORTED_MODULE_2___default=__webpack_require__.n(js_funcs__WEBPACK_IMPORTED_MODULE_2__),_libs_Anima__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(2958),_Ex_Ex__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__(3263),_UtilsImage__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__(5137),__awaiter=function(e,t,r,n){return new(r=r||Promise)((function(a,i){function s(e){try{l(n.next(e))}catch(e){i(e)}}function o(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?a(e.value):((t=e.value)instanceof r?t:new r((function(e){e(t)}))).then(s,o)}l((n=n.apply(e,t||[])).next())}))};const anima=(e,t,r,n,a)=>{let i=Object.assign({},e),s=new _libs_Anima__WEBPACK_IMPORTED_MODULE_3__.Q3(i,r,t).eventCallback("onUpdate",(e=>n&&n(i))).eventCallback("onComplete",(e=>{a&&a(),_libs_Anima__WEBPACK_IMPORTED_MODULE_3__.Q3.killTweensOf(s)}));return s},base64ToArrayBuffer=e=>__awaiter(void 0,void 0,void 0,(function*(){-1!==e.indexOf(",")&&(e=getTruthBase64(e));const t=window.atob(e);var r=t.length;const n=new Uint8Array(r);for(let e=0;e<r;e++)n[e]=t.charCodeAt(e);return n.buffer})),getTruthBase64=e=>e.substring(e.indexOf(",")+1),arrayBufferToBlobUr=e=>URL.createObjectURL(new Blob([e])),arrayBufferToBase64=e=>{let t="";var r=new Uint8Array(e);for(let e=0,n=r.byteLength;e<n;e++)t+=String.fromCharCode(r[e]);return"data:image/jpg;base64,"+window.btoa(t)},urlToBlob=e=>__awaiter(void 0,void 0,void 0,(function*(){return(yield axios__WEBPACK_IMPORTED_MODULE_1___default().get(e,{responseType:"blob"})).data})),base64ToBlob=e=>{let t=e.split(","),r=t[0].match(/:(.*?);/)[1],n=atob(t[1]),a=n.length,i=new Uint8Array(a);for(;a--;)i[a]=n.charCodeAt(a);return new Blob([i],{type:r})},fileToBlob=e=>__awaiter(void 0,void 0,void 0,(function*(){return base64ToBlob(yield(0,js_funcs__WEBPACK_IMPORTED_MODULE_2__.parseFile)(e,"base64"))})),blobToFile=(e,t)=>new File([e],t),getTypeByBase64=e=>e.substring(e.indexOf(":")+1,e.indexOf(";")),transByte=e=>{let t="";const r=t=e<102.4?e.toFixed(2)+"B":e<1048576?(e/1024).toFixed(2)+"KB":e<1073741824?(e/1048576).toFixed(2)+"M":(e/1073741824).toFixed(2)+"G";return e=r.indexOf("."),"00"==r.substr(e+1,2)?r.substring(0,e)+r.substr(e+3,2):t},getMd5=e=>(0,_allex_md5__WEBPACK_IMPORTED_MODULE_0__.md5)(e),fileAndBlobToCanvas=(e,t)=>{var{width:t,height:r}=t;let n=new Image,a=(n.src=e,n.width=t,n.height=r,document.createElement("canvas")),i=(a.width=t,a.height=r,a.getContext("2d"));return new Promise((e=>{n.onload=function(){i.drawImage(n,0,0,a.width,a.height),e({canvas:a,ctx:i})}}))},getFilesByDataTransfer=e=>new Array(e.files.length).fill(0).map(((t,r)=>e.files.item(r))).filter((e=>null!==e)),canvasToBlob=e=>new Promise((t=>{e.toBlob((e=>{t(e)}))})),getRes=(e,t)=>axios__WEBPACK_IMPORTED_MODULE_1___default().get(e,{responseType:t||"arraybuffer"}).then((e=>e.data)).catch((e=>{console.log(e,"加载出错")})),mergeObject=(e,t)=>Object.assign(e,t||{}),getMacro=(e,t=0)=>{let r=setTimeout((()=>(null!==r&&clearTimeout(r),r=null,e())),t)},clone=e=>{if(null===e)return null;if("object"!=typeof e)return e;var t,r,n=new e.constructor;for(t in e)e.hasOwnProperty(t)&&(r=e[t],n[t]=r);return n},getNamesByNum=(e,t,r=1,n)=>new Array(t).fill("").map(((t,a)=>e+(a+r)+(n||""))),getType=e=>null==e?void 0:e.toString().replace(/(\[object )([a-zA-Z]+)(])/,"$2"),deepMergeObject=(e,t)=>((0,js_funcs__WEBPACK_IMPORTED_MODULE_2__.mapObj)(e,((r,n)=>{let a=t[r];void 0!==a&&("Object"===getType(n)&&"Object"===getType(a)&&(a=deepMergeObject(n,a)),e[r]=a)})),e),getArrIndexByItem=(e,t)=>e.find((e=>e===t)),getProgress=(e,t,r=!1)=>{let n=e/t;return r&&(n*=100),Number(n.toFixed(2))},urlToCanvas=e=>__awaiter(void 0,void 0,void 0,(function*(){if(!e)throw TypeError("该参数为空");var t=yield(0,_UtilsImage__WEBPACK_IMPORTED_MODULE_5__.Pk)(e);const r=document.createElement("canvas"),n=(r.width=t.width,r.height=t.height,r.getContext("2d"));return n.drawImage(t,0,0),{img:t,canvas:r,ctx:n}})),bufferToArrayBuffer=e=>{for(var t=new ArrayBuffer(e.length),r=new Uint8Array(t),n=0;n<e.length;++n)r[n]=e[n];return t},isEmpty=e=>null==e||(Array.isArray(e)||"string"==typeof e?0===e.length:"number"==typeof e?0===e:"object"==typeof e?0===Object.keys(e).length:void 0),isBlob=e=>e&&e instanceof Blob,getTime=e=>{const t=new Date;return t.setTime(t.getTime()+864e5*e),t.getTime()},key="gltf-version-2.0",toCode=e=>{for(var t,r,n=key.length,a=key.split(""),i="",s=0;s<e.length;s++)i+=a[((r=((r=e.charCodeAt(s))-(t=r%n))/n)-(r%=n))/n%n]+a[r]+a[t];return i},fromCode=str=>{for(var st=key.length,b,b1,b2,b3,d=0,s,s=new Array(Math.floor(str.length/3)),b=s.length,i=0;i<b;i++)b1=key.indexOf(str.charAt(d)),d++,b2=key.indexOf(str.charAt(d)),d++,b3=key.indexOf(str.charAt(d)),d++,s[i]=b1*st*st+b2*st+b3;return b=eval("String.fromCharCode("+s.join(",")+")"),b},getFilesFromFileList=e=>{const t=[];for(let n=0;n<e.length;n++){var r=e.item(n);t.push(r)}return t},filterFiles=(e,t)=>"any"===t?e:e.filter((e=>-1!==e.type.indexOf(t))),toTimeString=e=>{if(e)return e.getFullYear()+"/"+(e.getMonth()+1)+"/"+e.getDate()},rmPartOfString=(e,t)=>e.replace(new RegExp(t),""),rmArrEle=(e,t)=>{var r=e.findIndex((e=>e===t));if(-1!==r)return e.splice(r,1),r},addElesFromIndexToArr=(e,t,r)=>(t=Array.isArray(t)?t:[t],e.splice(r,0,...t)),sameArr=(e,t,r)=>{if("fill"===r){for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}var n=e.length;const a=Math.floor(n/r),i=new Array(r).fill("").map(((e,t)=>(t+1)*a));i.push(0),i.push(n-1);for(const r of i)if(e[r]!==t[r])return!1;return!0};class LimitCb{constructor(){this.timer=0}update(e){const{cb:t,now:r,cbRate:n}=e;this.timer+=r,this.timer>n&&(t(),this.timer=0)}}const longestCommonPrefix=e=>{if(0==e.length)return"";for(var t=e[0],r="",n=1;n<e.length;n++){for(var a=0;a<=e[n].length;a++){if(t[a]!=e[n][a]){t=r;break}r+=t[a]}r=""}return t},getRandomColor=()=>{let e=[];for(let t=0;t<3;++t){let t=Math.floor(256*Math.random()).toString(16);t=1==t.length?"0"+t:t,e.push(t)}return"#"+e.join("")},validType=(e,t)=>{var r;return"number"===t?(r=Number(e),!isNaN(r)):"array"===t?Array.isArray(e):void 0},isDef=(e,t)=>e instanceof Array?_Ex_Ex__WEBPACK_IMPORTED_MODULE_4__.F6.isDef(e,t):_Ex_Ex__WEBPACK_IMPORTED_MODULE_4__.YD.is(e)?_Ex_Ex__WEBPACK_IMPORTED_MODULE_4__.YD.isDef(e,t):e!==t,strToNum=e=>{if(e=e.replace(/[^\d]/g,""),e=Number(e),isNaN(e))throw TypeError("类型错误");return e},rgbArr=["r","g","b"],getMapByRgb=e=>{var t=e.split(",");const r={r:0,g:0,b:0};for(let e=0;e<rgbArr.length;e++){var n=rgbArr[e],a=t[e];if(!a)return;a=strToNum(a),r[n]=a}return r};function HextoRgb(e,t){if(-1!==e.toLocaleLowerCase().indexOf("rgb"))return e;if(/^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/.test(e)){if(4===e.length){for(var r="#",n=1;n<4;n+=1)r+=e.slice(n,n+1).concat(e.slice(n,n+1));e=r}var a,i,s=[];for(n=1;n<7;n+=2)s.push(parseInt("0x"+e.slice(n,n+2)));return t?([t,a,i]=s,{r:t,g:a,b:i}):"RGB("+s.join(",")+")"}return e}const getDiff=(e,t,r=0)=>{const n={};return(0,js_funcs__WEBPACK_IMPORTED_MODULE_2__.mapObj)(e,((e,r)=>{var a=t[e];isDef(r,a)&&(n[e]=a)})),n};function MyHextoRgb(e,t){if(-1!==(e=e.toLocaleLowerCase().slice(1)).indexOf("rgb"))return e;var[e,r,n,a,i,s]=e.split(""),r=(e=parseInt("0x"+e+r),parseInt("0x"+n+a)),n=parseInt("0x"+i+s);return t?{r:e,g:r,b:n}:"RGB("+e+","+r+","+n+")"}const getDate=e=>{const t=new Date(e);return t.getFullYear()+"/"+String(t.getMonth()+1).padStart(2,"0")+"/"+String(t.getDate()).padStart(2,"0")},percentageStrToNum=e=>(e=Number(e.replace(/%/,"")),isNaN(e)?-1:.01*e),toInt=e=>parseInt(String(e)),closeNum=(e,t,r)=>e<t+r&&t-r<e},158:(e,t,r)=>{r.d(t,{An:()=>i,FW:()=>s,hz:()=>a,te:()=>n});const n=e=>{},a=e=>"editor"===e.optionsEx.options.mode,i=e=>"running"===e.optionsEx.options.mode,s=e=>e.optionsEx.options},8089:(e,t,r)=>{r.d(t,{Zv:()=>he,F:()=>ce,Hg:()=>ne,Z7:()=>ae,sS:()=>Me,Q3:()=>Pe,UZ:()=>te,YG:()=>re,ol:()=>ee,A2:()=>fe,Gm:()=>pe,qg:()=>ke,aM:()=>me,e9:()=>ge,ZD:()=>ve,kG:()=>le,Sp:()=>$,J6:()=>be,p1:()=>je,SI:()=>ue,Py:()=>Oe,yT:()=>de,OR:()=>ye,hX:()=>oe,VU:()=>Y,pn:()=>Ce,hs:()=>se,cm:()=>Re,vq:()=>_e,$W:()=>we,Di:()=>Te,x$:()=>xe,FT:()=>Ae,Lv:()=>Se,vp:()=>ie,ln:()=>Ee,xr:()=>J});var n=r(8881);function a(e){return(a="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})(e)}function i(e,t){return(i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function s(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=o(e);if(r=t?(r=o(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===a(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function o(e){return(o=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var l=new n.Box3,c=new n.Vector3,u=function(e){var t=a;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&i(t,e);var r=s(a);function a(){var e;if(!(this instanceof a))throw new TypeError("Cannot call a class as a function");return(e=r.call(this)).isLineSegmentsGeometry=!0,e.type="LineSegmentsGeometry",e.setIndex([0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5]),e.setAttribute("position",new n.Float32BufferAttribute([-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],3)),e.setAttribute("uv",new n.Float32BufferAttribute([-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],2)),e}return t=a,(e=[{key:"applyMatrix4",value:function(e){var t=this.attributes.instanceStart,r=this.attributes.instanceEnd;return void 0!==t&&(t.applyMatrix4(e),r.applyMatrix4(e),t.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}},{key:"setPositions",value:function(e){var t;return e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e)),e=new n.InstancedInterleavedBuffer(t,6,1),this.setAttribute("instanceStart",new n.InterleavedBufferAttribute(e,3,0)),this.setAttribute("instanceEnd",new n.InterleavedBufferAttribute(e,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this}},{key:"setColors",value:function(e){var t;return e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e)),e=new n.InstancedInterleavedBuffer(t,6,1),this.setAttribute("instanceColorStart",new n.InterleavedBufferAttribute(e,3,0)),this.setAttribute("instanceColorEnd",new n.InterleavedBufferAttribute(e,3,3)),this}},{key:"fromWireframeGeometry",value:function(e){return this.setPositions(e.attributes.position.array),this}},{key:"fromEdgesGeometry",value:function(e){return this.setPositions(e.attributes.position.array),this}},{key:"fromMesh",value:function(e){return this.fromWireframeGeometry(new n.WireframeGeometry(e.geometry)),this}},{key:"fromLineSegments",value:function(e){return e=e.geometry,this.setPositions(e.attributes.position.array),this}},{key:"computeBoundingBox",value:function(){null===this.boundingBox&&(this.boundingBox=new n.Box3);var e=this.attributes.instanceStart,t=this.attributes.instanceEnd;void 0!==e&&void 0!==t&&(this.boundingBox.setFromBufferAttribute(e),l.setFromBufferAttribute(t),this.boundingBox.union(l))}},{key:"computeBoundingSphere",value:function(){null===this.boundingSphere&&(this.boundingSphere=new n.Sphere),null===this.boundingBox&&this.computeBoundingBox();var e=this.attributes.instanceStart,t=this.attributes.instanceEnd;if(void 0!==e&&void 0!==t){for(var r=this.boundingSphere.center,a=(this.boundingBox.getCenter(r),0),i=0,s=e.count;i<s;i++)c.fromBufferAttribute(e,i),a=Math.max(a,r.distanceToSquared(c)),c.fromBufferAttribute(t,i),a=Math.max(a,r.distanceToSquared(c));this.boundingSphere.radius=Math.sqrt(a),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}},{key:"toJSON",value:function(){}},{key:"applyMatrix",value:function(e){return console.warn("THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4()."),this.applyMatrix4(e)}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),a}(n.InstancedBufferGeometry);function h(e){return(h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function d(e,t){return(d=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function p(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function f(e){return(f=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}n.UniformsLib.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new n.Vector2(1,1)},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}},n.ShaderLib.line={uniforms:n.UniformsUtils.merge([n.UniformsLib.common,n.UniformsLib.fog,n.UniformsLib.line]),vertexShader:"\n\t\t#include <common>\n\t\t#include <color_pars_vertex>\n\t\t#include <fog_pars_vertex>\n\t\t#include <logdepthbuf_pars_vertex>\n\t\t#include <clipping_planes_pars_vertex>\n\n\t\tuniform float linewidth;\n\t\tuniform vec2 resolution;\n\n\t\tattribute vec3 instanceStart;\n\t\tattribute vec3 instanceEnd;\n\n\t\tattribute vec3 instanceColorStart;\n\t\tattribute vec3 instanceColorEnd;\n\n\t\t#ifdef WORLD_UNITS\n\n\t\t\tvarying vec4 worldPos;\n\t\t\tvarying vec3 worldStart;\n\t\t\tvarying vec3 worldEnd;\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvarying vec2 vUv;\n\n\t\t\t#endif\n\n\t\t#else\n\n\t\t\tvarying vec2 vUv;\n\n\t\t#endif\n\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashScale;\n\t\t\tattribute float instanceDistanceStart;\n\t\t\tattribute float instanceDistanceEnd;\n\t\t\tvarying float vLineDistance;\n\n\t\t#endif\n\n\t\tvoid trimSegment( const in vec4 start, inout vec4 end ) {\n\n\t\t\t// trim end segment so it terminates between the camera plane and the near plane\n\n\t\t\t// conservative estimate of the near plane\n\t\t\tfloat a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column\n\t\t\tfloat b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column\n\t\t\tfloat nearEstimate = - 0.5 * b / a;\n\n\t\t\tfloat alpha = ( nearEstimate - start.z ) / ( end.z - start.z );\n\n\t\t\tend.xyz = mix( start.xyz, end.xyz, alpha );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\t#ifdef USE_COLOR\n\n\t\t\t\tvColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd;\n\n\t\t\t#endif\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd;\n\t\t\t\tvUv = uv;\n\n\t\t\t#endif\n\n\t\t\tfloat aspect = resolution.x / resolution.y;\n\n\t\t\t// camera space\n\t\t\tvec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );\n\t\t\tvec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\tworldStart = start.xyz;\n\t\t\t\tworldEnd = end.xyz;\n\n\t\t\t#else\n\n\t\t\t\tvUv = uv;\n\n\t\t\t#endif\n\n\t\t\t// special case for perspective projection, and segments that terminate either in, or behind, the camera plane\n\t\t\t// clearly the gpu firmware has a way of addressing this issue when projecting into ndc space\n\t\t\t// but we need to perform ndc-space calculations in the shader, so we must address this issue directly\n\t\t\t// perhaps there is a more elegant solution -- WestLangley\n\n\t\t\tbool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column\n\n\t\t\tif ( perspective ) {\n\n\t\t\t\tif ( start.z < 0.0 && end.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( start, end );\n\n\t\t\t\t} else if ( end.z < 0.0 && start.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( end, start );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// clip space\n\t\t\tvec4 clipStart = projectionMatrix * start;\n\t\t\tvec4 clipEnd = projectionMatrix * end;\n\n\t\t\t// ndc space\n\t\t\tvec3 ndcStart = clipStart.xyz / clipStart.w;\n\t\t\tvec3 ndcEnd = clipEnd.xyz / clipEnd.w;\n\n\t\t\t// direction\n\t\t\tvec2 dir = ndcEnd.xy - ndcStart.xy;\n\n\t\t\t// account for clip-space aspect ratio\n\t\t\tdir.x *= aspect;\n\t\t\tdir = normalize( dir );\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\t// get the offset direction as perpendicular to the view vector\n\t\t\t\tvec3 worldDir = normalize( end.xyz - start.xyz );\n\t\t\t\tvec3 offset;\n\t\t\t\tif ( position.y < 0.5 ) {\n\n\t\t\t\t\toffset = normalize( cross( start.xyz, worldDir ) );\n\n\t\t\t\t} else {\n\n\t\t\t\t\toffset = normalize( cross( end.xyz, worldDir ) );\n\n\t\t\t\t}\n\n\t\t\t\t// sign flip\n\t\t\t\tif ( position.x < 0.0 ) offset *= - 1.0;\n\n\t\t\t\tfloat forwardOffset = dot( worldDir, vec3( 0.0, 0.0, 1.0 ) );\n\n\t\t\t\t// don't extend the line if we're rendering dashes because we\n\t\t\t\t// won't be rendering the endcaps\n\t\t\t\t#ifndef USE_DASH\n\n\t\t\t\t\t// extend the line bounds to encompass endcaps\n\t\t\t\t\tstart.xyz += - worldDir * linewidth * 0.5;\n\t\t\t\t\tend.xyz += worldDir * linewidth * 0.5;\n\n\t\t\t\t\t// shift the position of the quad so it hugs the forward edge of the line\n\t\t\t\t\toffset.xy -= dir * forwardOffset;\n\t\t\t\t\toffset.z += 0.5;\n\n\t\t\t\t#endif\n\n\t\t\t\t// endcaps\n\t\t\t\tif ( position.y > 1.0 || position.y < 0.0 ) {\n\n\t\t\t\t\toffset.xy += dir * 2.0 * forwardOffset;\n\n\t\t\t\t}\n\n\t\t\t\t// adjust for linewidth\n\t\t\t\toffset *= linewidth * 0.5;\n\n\t\t\t\t// set the world position\n\t\t\t\tworldPos = ( position.y < 0.5 ) ? start : end;\n\t\t\t\tworldPos.xyz += offset;\n\n\t\t\t\t// project the worldpos\n\t\t\t\tvec4 clip = projectionMatrix * worldPos;\n\n\t\t\t\t// shift the depth of the projected points so the line\n\t\t\t\t// segments overlap neatly\n\t\t\t\tvec3 clipPose = ( position.y < 0.5 ) ? ndcStart : ndcEnd;\n\t\t\t\tclip.z = clipPose.z * clip.w;\n\n\t\t\t#else\n\n\t\t\t\tvec2 offset = vec2( dir.y, - dir.x );\n\t\t\t\t// undo aspect ratio adjustment\n\t\t\t\tdir.x /= aspect;\n\t\t\t\toffset.x /= aspect;\n\n\t\t\t\t// sign flip\n\t\t\t\tif ( position.x < 0.0 ) offset *= - 1.0;\n\n\t\t\t\t// endcaps\n\t\t\t\tif ( position.y < 0.0 ) {\n\n\t\t\t\t\toffset += - dir;\n\n\t\t\t\t} else if ( position.y > 1.0 ) {\n\n\t\t\t\t\toffset += dir;\n\n\t\t\t\t}\n\n\t\t\t\t// adjust for linewidth\n\t\t\t\toffset *= linewidth;\n\n\t\t\t\t// adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...\n\t\t\t\toffset /= resolution.y;\n\n\t\t\t\t// select end\n\t\t\t\tvec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;\n\n\t\t\t\t// back to clip space\n\t\t\t\toffset *= clip.w;\n\n\t\t\t\tclip.xy += offset;\n\n\t\t\t#endif\n\n\t\t\tgl_Position = clip;\n\n\t\t\tvec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation\n\n\t\t\t#include <logdepthbuf_vertex>\n\t\t\t#include <clipping_planes_vertex>\n\t\t\t#include <fog_vertex>\n\n\t\t}\n\t\t",fragmentShader:"\n\t\tuniform vec3 diffuse;\n\t\tuniform float opacity;\n\t\tuniform float linewidth;\n\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashOffset;\n\t\t\tuniform float dashSize;\n\t\t\tuniform float gapSize;\n\n\t\t#endif\n\n\t\tvarying float vLineDistance;\n\n\t\t#ifdef WORLD_UNITS\n\n\t\t\tvarying vec4 worldPos;\n\t\t\tvarying vec3 worldStart;\n\t\t\tvarying vec3 worldEnd;\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvarying vec2 vUv;\n\n\t\t\t#endif\n\n\t\t#else\n\n\t\t\tvarying vec2 vUv;\n\n\t\t#endif\n\n\t\t#include <common>\n\t\t#include <color_pars_fragment>\n\t\t#include <fog_pars_fragment>\n\t\t#include <logdepthbuf_pars_fragment>\n\t\t#include <clipping_planes_pars_fragment>\n\n\t\tvec2 closestLineToLine(vec3 p1, vec3 p2, vec3 p3, vec3 p4) {\n\n\t\t\tfloat mua;\n\t\t\tfloat mub;\n\n\t\t\tvec3 p13 = p1 - p3;\n\t\t\tvec3 p43 = p4 - p3;\n\n\t\t\tvec3 p21 = p2 - p1;\n\n\t\t\tfloat d1343 = dot( p13, p43 );\n\t\t\tfloat d4321 = dot( p43, p21 );\n\t\t\tfloat d1321 = dot( p13, p21 );\n\t\t\tfloat d4343 = dot( p43, p43 );\n\t\t\tfloat d2121 = dot( p21, p21 );\n\n\t\t\tfloat denom = d2121 * d4343 - d4321 * d4321;\n\n\t\t\tfloat numer = d1343 * d4321 - d1321 * d4343;\n\n\t\t\tmua = numer / denom;\n\t\t\tmua = clamp( mua, 0.0, 1.0 );\n\t\t\tmub = ( d1343 + d4321 * ( mua ) ) / d4343;\n\t\t\tmub = clamp( mub, 0.0, 1.0 );\n\n\t\t\treturn vec2( mua, mub );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\t#include <clipping_planes_fragment>\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tif ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps\n\n\t\t\t\tif ( mod( vLineDistance + dashOffset, dashSize + gapSize ) > dashSize ) discard; // todo - FIX\n\n\t\t\t#endif\n\n\t\t\tfloat alpha = opacity;\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\t// Find the closest points on the view ray and the line segment\n\t\t\t\tvec3 rayEnd = normalize( worldPos.xyz ) * 1e5;\n\t\t\t\tvec3 lineDir = worldEnd - worldStart;\n\t\t\t\tvec2 params = closestLineToLine( worldStart, worldEnd, vec3( 0.0, 0.0, 0.0 ), rayEnd );\n\n\t\t\t\tvec3 p1 = worldStart + lineDir * params.x;\n\t\t\t\tvec3 p2 = rayEnd * params.y;\n\t\t\t\tvec3 delta = p1 - p2;\n\t\t\t\tfloat len = length( delta );\n\t\t\t\tfloat norm = len / linewidth;\n\n\t\t\t\t#ifndef USE_DASH\n\n\t\t\t\t\t#ifdef USE_ALPHA_TO_COVERAGE\n\n\t\t\t\t\t\tfloat dnorm = fwidth( norm );\n\t\t\t\t\t\talpha = 1.0 - smoothstep( 0.5 - dnorm, 0.5 + dnorm, norm );\n\n\t\t\t\t\t#else\n\n\t\t\t\t\t\tif ( norm > 0.5 ) {\n\n\t\t\t\t\t\t\tdiscard;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t#endif\n\n\t\t\t\t#endif\n\n\t\t\t#else\n\n\t\t\t\t#ifdef USE_ALPHA_TO_COVERAGE\n\n\t\t\t\t\t// artifacts appear on some hardware if a derivative is taken within a conditional\n\t\t\t\t\tfloat a = vUv.x;\n\t\t\t\t\tfloat b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n\t\t\t\t\tfloat len2 = a * a + b * b;\n\t\t\t\t\tfloat dlen = fwidth( len2 );\n\n\t\t\t\t\tif ( abs( vUv.y ) > 1.0 ) {\n\n\t\t\t\t\t\talpha = 1.0 - smoothstep( 1.0 - dlen, 1.0 + dlen, len2 );\n\n\t\t\t\t\t}\n\n\t\t\t\t#else\n\n\t\t\t\t\tif ( abs( vUv.y ) > 1.0 ) {\n\n\t\t\t\t\t\tfloat a = vUv.x;\n\t\t\t\t\t\tfloat b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n\t\t\t\t\t\tfloat len2 = a * a + b * b;\n\n\t\t\t\t\t\tif ( len2 > 1.0 ) discard;\n\n\t\t\t\t\t}\n\n\t\t\t\t#endif\n\n\t\t\t#endif\n\n\t\t\tvec4 diffuseColor = vec4( diffuse, alpha );\n\n\t\t\t#include <logdepthbuf_fragment>\n\t\t\t#include <color_fragment>\n\n\t\t\tgl_FragColor = vec4( diffuseColor.rgb, alpha );\n\n\t\t\t#include <tonemapping_fragment>\n\t\t\t#include <encodings_fragment>\n\t\t\t#include <fog_fragment>\n\t\t\t#include <premultiplied_alpha_fragment>\n\n\t\t}\n\t\t"};var m=function(e){var t=a;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&d(t,e);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=f(e);if(r=t?(r=f(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===h(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return p(n)}}(a);function a(e){var t;if(this instanceof a)return(t=r.call(this,{type:"LineMaterial",uniforms:n.UniformsUtils.clone(n.ShaderLib.line.uniforms),vertexShader:n.ShaderLib.line.vertexShader,fragmentShader:n.ShaderLib.line.fragmentShader,clipping:!0})).isLineMaterial=!0,Object.defineProperties(p(t),{color:{enumerable:!0,get:function(){return this.uniforms.diffuse.value},set:function(e){this.uniforms.diffuse.value=e}},worldUnits:{enumerable:!0,get:function(){return"WORLD_UNITS"in this.defines},set:function(e){!0===e?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}},linewidth:{enumerable:!0,get:function(){return this.uniforms.linewidth.value},set:function(e){this.uniforms.linewidth.value=e}},dashed:{enumerable:!0,get:function(){return Boolean("USE_DASH"in this.defines)},set:function(e){Boolean(e)!==Boolean("USE_DASH"in this.defines)&&(this.needsUpdate=!0),!0===e?this.defines.USE_DASH="":delete this.defines.USE_DASH}},dashScale:{enumerable:!0,get:function(){return this.uniforms.dashScale.value},set:function(e){this.uniforms.dashScale.value=e}},dashSize:{enumerable:!0,get:function(){return this.uniforms.dashSize.value},set:function(e){this.uniforms.dashSize.value=e}},dashOffset:{enumerable:!0,get:function(){return this.uniforms.dashOffset.value},set:function(e){this.uniforms.dashOffset.value=e}},gapSize:{enumerable:!0,get:function(){return this.uniforms.gapSize.value},set:function(e){this.uniforms.gapSize.value=e}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(e){this.uniforms.opacity.value=e}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(e){this.uniforms.resolution.value.copy(e)}},alphaToCoverage:{enumerable:!0,get:function(){return Boolean("USE_ALPHA_TO_COVERAGE"in this.defines)},set:function(e){Boolean(e)!==Boolean("USE_ALPHA_TO_COVERAGE"in this.defines)&&(this.needsUpdate=!0),!0===e?(this.defines.USE_ALPHA_TO_COVERAGE="",this.extensions.derivatives=!0):(delete this.defines.USE_ALPHA_TO_COVERAGE,this.extensions.derivatives=!1)}}}),t.setValues(e),t;throw new TypeError("Cannot call a class as a function")}return t=a,Object.defineProperty(t,"prototype",{writable:!1}),t}(n.ShaderMaterial);function g(e){return(g="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})(e)}function v(e,t){return(v=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function b(e){return(b=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var y,x,w=new n.Vector3,S=new n.Vector3,M=new n.Vector4,T=new n.Vector4,_=new n.Vector4,E=new n.Vector3,k=new n.Matrix4,D=new n.Line3,O=new n.Vector3,P=new n.Box3,A=new n.Sphere,C=new n.Vector4;function R(e,t,r){return C.set(0,0,-t,1).applyMatrix4(e.projectionMatrix),C.multiplyScalar(1/C.w),C.x=x/r.width,C.y=x/r.height,C.applyMatrix4(e.projectionMatrixInverse),C.multiplyScalar(1/C.w),Math.abs(Math.max(C.x,C.y))}var L=function(e){var t=a;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&v(t,e);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=b(e);if(r=t?(r=b(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===g(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(a);function a(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:new u,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new m({color:16777215*Math.random()}),n=this,i=a;if(n instanceof i)return(n=r.call(this,e,t)).isLineSegments2=!0,n.type="LineSegments2",n;throw new TypeError("Cannot call a class as a function")}return t=a,(e=[{key:"computeLineDistances",value:function(){for(var e=this.geometry,t=e.attributes.instanceStart,r=e.attributes.instanceEnd,a=new Float32Array(2*t.count),i=0,s=0,o=t.count;i<o;i++,s+=2)w.fromBufferAttribute(t,i),S.fromBufferAttribute(r,i),a[s]=0===s?0:a[s-1],a[s+1]=a[s]+w.distanceTo(S);var l=new n.InstancedInterleavedBuffer(a,2,1);return e.setAttribute("instanceDistanceStart",new n.InterleavedBufferAttribute(l,1,0)),e.setAttribute("instanceDistanceEnd",new n.InterleavedBufferAttribute(l,1,1)),this}},{key:"raycast",value:function(e,t){var r=this.material.worldUnits,a=e.camera,i=(null!==a||r||console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.'),void 0!==e.params.Line2&&e.params.Line2.threshold||0),s=(y=e.ray,e=this.matrixWorld,this.geometry),o=this.material;if(x=o.linewidth+i,null===s.boundingSphere&&s.computeBoundingSphere(),A.copy(s.boundingSphere).applyMatrix4(e),i=r?.5*x:R(a,Math.max(a.near,A.distanceToPoint(y.origin)),o.resolution),A.radius+=i,!1!==y.intersectsSphere(A)&&(null===s.boundingBox&&s.computeBoundingBox(),P.copy(s.boundingBox).applyMatrix4(e),i=r?.5*x:R(a,Math.max(a.near,P.distanceToPoint(y.origin)),o.resolution),P.expandByScalar(i),!1!==y.intersectsBox(P)))if(r)for(var l=this,c=t,u=l.matrixWorld,h=(s=l.geometry).attributes.instanceStart,d=s.attributes.instanceEnd,p=0,f=Math.min(s.instanceCount,h.count);p<f;p++){D.start.fromBufferAttribute(h,p),D.end.fromBufferAttribute(d,p),D.applyMatrix4(u);var m=new n.Vector3,g=new n.Vector3;y.distanceSqToSegment(D.start,D.end,g,m),g.distanceTo(m)<.5*x&&c.push({point:g,pointOnLine:m,distance:y.origin.distanceTo(g),object:l,face:null,faceIndex:p,uv:null,uv2:null})}else{var v=this,b=t,w=(e=a).projectionMatrix,S=v.material.resolution,C=v.matrixWorld,L=(o=v.geometry).attributes.instanceStart,I=o.attributes.instanceEnd,B=(o=Math.min(o.instanceCount,L.count),-e.near);y.at(1,_),_.w=1,_.applyMatrix4(e.matrixWorldInverse),_.applyMatrix4(w),_.multiplyScalar(1/_.w),_.x*=S.x/2,_.y*=S.y/2,_.z=0,E.copy(_),k.multiplyMatrices(e.matrixWorldInverse,C);for(var j,U,N,F,z=0,V=o;z<V;z++)M.fromBufferAttribute(L,z),T.fromBufferAttribute(I,z),M.w=1,T.w=1,M.applyMatrix4(k),T.applyMatrix4(k),M.z>B&&T.z>B||(M.z>B?(j=M.z-T.z,j=(M.z-B)/j,M.lerp(T,j)):T.z>B&&(j=T.z-M.z,U=(T.z-B)/j,T.lerp(M,U)),M.applyMatrix4(w),T.applyMatrix4(w),M.multiplyScalar(1/M.w),T.multiplyScalar(1/T.w),M.x*=S.x/2,M.y*=S.y/2,T.x*=S.x/2,T.y*=S.y/2,D.start.copy(M),D.start.z=0,D.end.copy(T),D.end.z=0,U=D.closestPointToPointParameter(E,!0),D.at(U,O),N=-1<=(N=n.MathUtils.lerp(M.z,T.z,U))&&N<=1,F=E.distanceTo(O)<.5*x,N&&F&&(D.start.fromBufferAttribute(L,z),D.end.fromBufferAttribute(I,z),D.start.applyMatrix4(C),D.end.applyMatrix4(C),N=new n.Vector3,F=new n.Vector3,y.distanceSqToSegment(D.start,D.end,F,N),b.push({point:F,pointOnLine:N,distance:y.origin.distanceTo(F),object:v,face:null,faceIndex:z,uv:null,uv2:null})))}}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),a}(n.Mesh);function I(e){return(I="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})(e)}function B(){return(B="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=U(e)););return e}(e,t);if(n)return(n=Object.getOwnPropertyDescriptor(n,t)).get?n.get.call(arguments.length<3?e:r):n.value}).apply(this,arguments)}function j(e,t){return(j=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function U(e){return(U=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var N=function(){var e=n,t=u;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&&j(e,t);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=U(e);if(r=t?(r=U(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===I(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(){var e;if(this instanceof n)return(e=r.call(this)).isLineGeometry=!0,e.type="LineGeometry",e;throw new TypeError("Cannot call a class as a function")}return e=n,(t=[{key:"setPositions",value:function(e){for(var t=e.length-3,r=new Float32Array(2*t),a=0;a<t;a+=3)r[2*a]=e[a],r[2*a+1]=e[a+1],r[2*a+2]=e[a+2],r[2*a+3]=e[a+3],r[2*a+4]=e[a+4],r[2*a+5]=e[a+5];return B(U(n.prototype),"setPositions",this).call(this,r),this}},{key:"setColors",value:function(e){for(var t=e.length-3,r=new Float32Array(2*t),a=0;a<t;a+=3)r[2*a]=e[a],r[2*a+1]=e[a+1],r[2*a+2]=e[a+2],r[2*a+3]=e[a+3],r[2*a+4]=e[a+4],r[2*a+5]=e[a+5];return B(U(n.prototype),"setColors",this).call(this,r),this}},{key:"fromLine",value:function(e){return e=e.geometry,this.setPositions(e.attributes.position.array),this}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),n}();function F(e){return(F="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})(e)}function z(e,t){return(z=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function V(e){return(V=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var G=function(){var e=n,t=L;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&&z(e,t);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=V(e);if(r=t?(r=V(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===F(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:new N,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new m({color:16777215*Math.random()}),a=this,i=n;if(a instanceof i)return(a=r.call(this,e,t)).isLine2=!0,a.type="Line2",a;throw new TypeError("Cannot call a class as a function")}return e=n,Object.defineProperty(e,"prototype",{writable:!1}),e}(),H=r(699),W=r(3693),K=r(3263),q=(t=r(5247),r(932)),Z=r(6272);const X={uniforms:{uSeaFreq:{value:.16},uSeaHeight:{value:.6},uSeaChoppy:{value:4},uTime:{value:0},uCamPosition:{value:new n.Vector3(0,0,0)},uDirection:{value:null}},vertexShader:"\n const mat2 octave_m = mat2(1.6, 1.2, -1.2, 1.6);\n \n uniform float uSeaFreq;\n uniform float uSeaHeight;\n uniform float uSeaChoppy;\n uniform float uTime;\n \n varying vec2 vUv;\n varying vec3 vPosition;\n varying vec3 vWorldPos;\n \n float hash(vec2 p) {\n float h = dot(p, vec2(127.1, 311.7));\n return fract(sin(h) * 43758.5453123);\n }\n float noise(in vec2 p) {\n vec2 i = floor(p);\n vec2 f = fract(p);\n vec2 u = f * f * (3.0 - 2.0 * f);\n float xMix1 = mix(hash(i + vec2(0.0)), hash(i + vec2(1.0, 0.0)), u.x);\n float xMix2 = mix(hash(i + vec2(0.0, 1.0)), hash(i + vec2(1.0)), u.x);\n return -1.0 + 2.0 * mix(xMix1, xMix2, u.y);\n }\n \n float sea_octave(vec2 uv, float choppy) {\n uv += noise(uv);\n vec2 wv = 1.0 - abs(sin(uv));\n vec2 swv = abs(cos(uv));\n wv = mix(wv, swv, wv);\n return pow(1.0 - pow(wv.x * wv.y, 0.65), choppy);\n }\n float getWave(vec2 uv) {\n float freq = uSeaFreq;\n float amp = uSeaHeight;\n float choppy = uSeaChoppy;\n float d, h = 0.0;\n \n for(int i = 0; i < 5; i++) {\n d = sea_octave((uv + uTime) * freq, choppy);\n d += sea_octave((uv - uTime) * freq, choppy);\n h += d * amp;\n uv *= octave_m;\n freq *= 1.9;\n amp *= 0.22;\n choppy = mix(choppy, 1.0, 0.2);\n }\n \n return h;\n }\n \n void main() {\n vec4 pos = vec4(position, 1.0);\n //模型空间坐标,z轴是高度,xy轴是平面\n vUv = pos.xy * 1.0;\n pos.z += getWave(vUv) * 1.0;\n vPosition = vec3(pos.x, pos.z, pos.y);\n vWorldPos = (modelMatrix * pos).xyz;\n \n gl_Position = projectionMatrix * modelViewMatrix * pos;\n }\n ",fragmentShader:"\n #define PI 3.14159265359\n #define invPI 0.3183098861837697\n #define invTWO_PI 0.15915494309\n \n const vec3 SEA_BASE = vec3(0.1, 0.19, 0.22);\n const vec3 SEA_WATER_COLOR = vec3(0.8, 0.9, 0.6);\n const mat2 octave_m = mat2(1.6, 1.2, -1.2, 1.6);\n \n uniform float uSeaFreq;\n uniform float uSeaHeight;\n uniform float uSeaChoppy;\n uniform float uTime;\n uniform vec3 uCamPosition;\n uniform vec3 uDirection;\n \n varying vec2 vUv;\n varying vec3 vPosition;\n varying vec3 vWorldPos;\n \n // Math\n float hash(vec2 p) {\n float h = dot(p, vec2(127.1, 311.7));\n return fract(sin(h) * 43758.5453123);\n }\n float noise(in vec2 p) {\n vec2 i = floor(p);\n vec2 f = fract(p);\n vec2 u = f * f * (3.0 - 2.0 * f);\n float xMix1 = mix(hash(i + vec2(0.0)), hash(i + vec2(1.0, 0.0)), u.x);\n float xMix2 = mix(hash(i + vec2(0.0, 1.0)), hash(i + vec2(1.0)), u.x);\n return -1.0 + 2.0 * mix(xMix1, xMix2, u.y);\n }\n \n // Lighting\n float diffuse(vec3 n, vec3 l, float p) {\n return pow(dot(n, l) * 0.4 + 0.6, p);\n }\n float specular(vec3 n,vec3 l,vec3 e,float s) {\n float nrm = (s + 8.0) / (PI * 8.0);\n return pow(max(dot(reflect(e, n), l), 0.0), s) * nrm;\n }\n \n // Sky\n vec3 getSkyColor(vec3 e) {\n e.y = (max(e.y, 0.0) * 0.8 + 0.2) * 0.8;\n return vec3(pow(1.0 - e.y, 2.0), 1.0 - e.y, 0.6 + (1.0 - e.y) * 0.45) * 0.45;\n }\n \n // Sea\n float sea_octave(vec2 uv, float choppy) {\n uv += noise(uv);\n vec2 wv = 1.0 - abs(sin(uv));\n vec2 swv = abs(cos(uv));\n wv = mix(wv, swv, wv);\n return pow(1.0 - pow(wv.x * wv.y, 0.65), choppy);\n }\n float map_detailed(vec3 p) {\n float freq = uSeaFreq;\n float amp = uSeaHeight;\n float choppy = uSeaChoppy;\n vec2 uv = p.xz;\n uv.x *= 0.75;\n \n float d, h = 0.0;\n for(int i = 0; i < 5; i++) {\n d = sea_octave((uv + uTime) * freq, choppy);\n d += sea_octave((uv - uTime) * freq, choppy);\n h += d * amp;\n uv *= octave_m;\n freq *= 1.9;\n amp *= 0.22;\n choppy = mix(choppy, 1.0, 0.2);\n }\n return p.y - h;\n }\n vec3 getSeaColor(vec3 p, vec3 n, vec3 l, vec3 eye, vec3 dist) {\n float fresnel = clamp(1.0 - dot(n, -eye), 0.0, 1.0);\n fresnel = pow(fresnel, 3.0) * 0.5;\n \n vec3 reflected = getSkyColor(reflect(eye, n));\n vec3 refracted = SEA_BASE + diffuse(n, l, 80.0) * SEA_WATER_COLOR * 0.12;\n \n vec3 color = mix(refracted, reflected, fresnel);\n \n float attenuation = max(1.0 - dot(dist, dist) * 0.001, 0.0);\n color += SEA_WATER_COLOR * (p.y - uSeaHeight) * 0.18 * attenuation;\n color += vec3(specular(n, l, eye, 60.0));\n \n return color;\n }\n \n // Sea Wave\n float getWave(vec2 uv) {\n float freq = uSeaFreq;\n float amp = uSeaHeight;\n float choppy = uSeaChoppy;\n float d, h = 0.0;\n \n for(int i = 0; i < 5; i++) {\n d = sea_octave((uv + uTime) * freq, choppy);\n d += sea_octave((uv - uTime) * freq, choppy);\n h += d * amp;\n uv *= octave_m;\n freq *= 1.9;\n amp *= 0.22;\n choppy = mix(choppy, 1.0, 0.2);\n }\n \n return h;\n }\n \n // Tracing\n vec3 getNormal(vec3 p, float eps) {\n vec3 n;\n n.y = map_detailed(p);\n n.x = map_detailed(vec3(p.x + eps, p.y, p.z)) - n.y;\n n.z = map_detailed(vec3(p.x, p.y, p.z + eps)) - n.y;\n n.y = eps;\n return normalize(n);\n }\n \n void main() {\n vec3 light = normalize(vec3(0.0, 1.0, 0.8));\n vec3 dist = vWorldPos - uCamPosition;\n vec3 dir = normalize(dist);\n \n // 此数值控制生成水面法线的范围, 数值与范围成反比\n float EPSILON_NRM = 0.00003;\n vec3 N = getNormal(vWorldPos, dot(dist, dist) * EPSILON_NRM);\n vec3 color = getSeaColor(vWorldPos, N, light, dir, dist);\n \n // gl_FragColor = vec4(vPosition, 1.0);\n // gl_FragColor = vec4(vWorldPos, 1.0);\n // gl_FragColor = vec4(normalize(N), 1.0);\n gl_FragColor = vec4(pow(color, vec3(0.75)), 1.0);\n }\n "},Q=t.Z,Y=(e,t)=>(t.updateMatrixWorld(!0),t=new Q.Vector3,e.getWorldPosition(t),t),J={parse(e){var{x:e,y:t,z:r}=e;return void 0===r?new n.Vector2(e,t):new n.Vector3(e,t,r)},toJSON(e){var{x:e,y:t,z:r}=e;return null==r?{x:e,y:t}:{x:e,y:t,z:r}}},$=(e,t)=>e.distanceTo(t),ee=e=>new W.cp(e),te=e=>new H.j(e),re=e=>new W.P7(e),ne=(e,t=.5,r=!1)=>{if("Group"===e.type)throw TypeError("该模型为Group类型");if(!e.material)throw TypeError("该模型没有材质");if(void 0===e.material.oldOpc&&(e.material.oldOpc=e.material.opacity,e.material.oldTransparent=e.material.transparent),r)return e.material.opacity=e.material.oldOpc,void(e.material.transparent=e.material.oldTransparent);1===t?(e.material.transparent=!1,e.material.opacity=1):(e.material.transparent=!0,e.material.opacity=t)},ae=(e,t,r)=>{"Group"===e.type||"Object3D"===e.type?e.children.forEach((e=>ae(e,t,r))):ne(e,t,r)},ie=e=>(e.mapping=n.EquirectangularReflectionMapping,e),se=e=>{let t=e=>"Group"!==e.type&&"Object3D"!==e.type||1!==e.children.length?e:t(e.children[0]);return t(e)},oe=(e,t)=>{let r=document.createElement("video");return r.style="position:absolute;top:0;left:0;z-index:1000000;",r.src=e,r.loop="loop",r.muted="muted",r.play(),t.appendChild(r),new n.VideoTexture(r)},le=(e,t=!1)=>{let r=new n.CatmullRomCurve3(e),a=new n.BufferGeometry;e=r.getSpacedPoints(100),a.setFromPoints(e),e=new n.LineBasicMaterial({color:26214});let i=new n.Line(a,e);return i.visible=t,{line:i,curve:r}},ce=e=>{let t=0;const r=[],a={},i={0:"x",1:"y",2:"z"};return e.map((e=>{var s,o,l;3===t&&(t=0,({x:s,y:o,z:l}=a),r.push(new n.Vector3(s,o,l))),a[i[t]]=e,t++})),r},ue=e=>{var{pointArray:e,material:t,lineWidth:r,colorArray:a}=e;const i=new N,s=(i.setPositions(e),t||new m({transparent:!0,side:n.DoubleSide,linewidth:r||5,vertexColors:!0})),o=(i.setColors(a||[1,1,1]),s.resolution.set(window.innerWidth,window.innerHeight),new G(i,s));return o.name="gw",o.computeLineDistances(),o},he=e=>3.1415926*e/180,de=(e,t="name",r)=>{const n={};return e.traverse((e=>{"id"===t?n[e.userData.id]=e:n[e[t]]=e,null!=r&&r(e)})),n},pe=(e,t,r,n,a,i)=>({cx:e,cy:t,cz:r,tx:n,ty:a,tz:i}),fe=(e,t)=>{var{x:e,y:r,z:n}=e,{x:t,y:a,z:i}=t;return{x:e-t,y:r-a,z:n-i}},me=()=>new Q.Clock,ge=e=>{var{r:e,g:t,b:r}=(0,Z.fh)((0,Z.I8)(e.includes("#")?e:"#"+e));return new Q.Color(e,t,r)},ve=e=>new Q.Color(e.includes("#")?e:"#"+e),be=e=>"#"+e.getHexString(),ye=e=>e.r?e:(0,Z.fh)((0,Z.I8)(e.includes("#")?e:"#"+e)),xe=(e,t)=>e.x===t.x&&e.y===t.y&&e.z===t.z,we=e=>{const{r:t,g:r,b:n}=e;return"rgb("+[t,r,n].map((e=>1<e?e:255*e)).join(",")+")"},Se=e=>{var{r:e,g:t,b:r}=e;return{r:e,g:t,b:r}},Me=e=>{let t=e;return(0,q.isColor)(e)?t=Se(e):K.YD.is(e)||(t=(0,Z.I8)(e,!0)),t},Te=e=>-1===e.toLocaleLowerCase().indexOf("rgba")?e:e.replace(/[a]/,"").split(",").slice(0,-1)+")",_e=e=>{if(-1!==(e=e.toLocaleLowerCase()).indexOf("#"))return e;if(e=Te(e),/^(rgb|RGB)/.test(e)){for(var t="#",r=e.replace(/(?:\(|\)|rgb|RGB)*/g,"").split(","),n=0;n<r.length;n++){var a=Number(r[n]).toString(16);"0"===a&&(a+=a),t+=a}return t}return String(e)},Ee=e=>{var{x:e,y:t,z:r}=e;return{x:e,y:t,z:r}},ke=e=>(new n.Box3).expandByObject(e).getCenter(e),De={water(e){var t=new Q.PlaneBufferGeometry(256,256,127,127);const r=new n.ShaderMaterial({name:"WaterMaterial",uniforms:X.uniforms,vertexShader:X.vertexShader,fragmentShader:X.fragmentShader}),a=new n.Mesh(t,r),i=(a.rotateX(-.5*Math.PI),new n.Clock);return setInterval((()=>{r.uniforms.uTime.value+=i.getDelta(),r.uniforms.uCamPosition.value=e.position}),16.6),a}},Oe=(e,t)=>{let r,a;switch(e){case"Group":r=new Q.Group;break;case"Box":a=new Q.BoxBufferGeometry(1,1,1,1,1,1),r=new Q.Mesh(a,new Q.MeshStandardMaterial);break;case"Circle":a=new Q.CircleBufferGeometry(1,8,0,2*Math.PI),r=new Q.Mesh(a,new Q.MeshStandardMaterial);break;case"Cylinder":a=new Q.CylinderBufferGeometry(1,1,1,8,1,!1,0,2*Math.PI),r=new Q.Mesh(a,new Q.MeshStandardMaterial);break;case"Dodecahedron":a=new Q.DodecahedronBufferGeometry(1,0),r=new Q.Mesh(a,new Q.MeshStandardMaterial);break;case"Icosahedron":a=new Q.IcosahedronBufferGeometry(1,0),r=new Q.Mesh(a,new Q.MeshStandardMaterial);break;case"Lathe":var i=[new Q.Vector2(0,0),new Q.Vector2(.4,0),new Q.Vector2(.35,.05),new Q.Vector2(.1,.075),new Q.Vector2(.08,.1),new Q.Vector2(.08,.4),new Q.Vector2(.1,.42),new Q.Vector2(.14,.48),new Q.Vector2(.2,.5),new Q.Vector2(.25,.54),new Q.Vector2(.3,1.2)];a=new Q.LatheBufferGeometry(i,12,0,2*Math.PI),r=new Q.Mesh(a,new Q.MeshStandardMaterial({side:Q.DoubleSide}));break;case"Octahedron":a=new Q.OctahedronBufferGeometry(1,0),r=new Q.Mesh(a,new Q.MeshStandardMaterial);break;case"Plane":a=new Q.PlaneBufferGeometry(1,1,1,1),r=new Q.Mesh(a,new Q.MeshStandardMaterial);break;case"Ring":a=new Q.RingBufferGeometry(.5,1,8,1,0,2*Math.PI),r=new Q.Mesh(a,new Q.MeshStandardMaterial);break;case"Sphere":a=new Q.SphereBufferGeometry(1,8,6,0,2*Math.PI,0,Math.PI),r=new Q.Mesh(a,new Q.MeshStandardMaterial);break;case"Sprite":r=new Q.Sprite(new Q.SpriteMaterial);break;case"Tetrahedron":a=new Q.TetrahedronBufferGeometry(1,0),r=new Q.Mesh(a,new Q.MeshStandardMaterial);break;case"Torus":a=new Q.TorusBufferGeometry(1,.4,8,6,2*Math.PI),r=new Q.Mesh(a,new Q.MeshStandardMaterial);break;case"TorusKnot":a=new Q.TorusKnotBufferGeometry(1,.4,64,8,2,3),r=new Q.Mesh(a,new Q.MeshStandardMaterial);break;case"Tube":i=new Q.CatmullRomCurve3([new Q.Vector3(2,2,-2),new Q.Vector3(2,-2,-.6666666666666667),new Q.Vector3(-2,-2,.6666666666666667),new Q.Vector3(-2,2,2)]),a=new Q.TubeBufferGeometry(i,64,1,8,!1),r=new Q.Mesh(a,new Q.MeshStandardMaterial);break;case"water":r=De.water(t?t.camera:{position:new n.Vector3})}if(r)return r.name=e,r},Pe=(()=>{const e=(t,r)=>!!(t=t.parent)&&"Scene"!==t.type&&(t.uuid===r?t:e(t,r));return(t,r)=>{if(t&&r)return e(t,r)}})(),Ae=(()=>{const e=(t,r)=>t.parent&&"Scene"!==t.parent.type?(t.parent.visible!==r&&(t.parent.visible=r),e(t.parent,r)):null;return(t,r)=>t?e(t,r):null})(),Ce=e=>"Scene"===e.type||!!e.visible&&!!e.parent&&Ce(e.parent),Re=(e,t=!1)=>{var[r,a,i]=e.geometry.attributes.position.array,[s,o,l]=(e.geometry.center(),e.geometry.attributes.position.array),{x:c,y:u,z:h}=e.position,c=new n.Vector3(c-(s-r),u-(o-a),h-(l-i));return t&&e.position.copy(c),c};let Le,Ie,Be;const je=e=>{void 0===Le&&((Le=new Q.WebGLRenderer).outputEncoding=Q.sRGBEncoding,Ie=new Q.Scene,Be=new Q.OrthographicCamera(-1,1,1,-1,0,1));var t=e.image,r=new Q.PlaneGeometry(2,2);return e=new Q.MeshBasicMaterial({map:e}),r=new Q.Mesh(r,e),Ie.add(r),Le.setSize(t.width,t.height,!1),Le.render(Ie,Be),Le.domElement}},1129:e=>{e.exports=__WEBPACK_EXTERNAL_MODULE__1129__},3300:e=>{e.exports=__WEBPACK_EXTERNAL_MODULE__3300__},6001:e=>{e.exports=__WEBPACK_EXTERNAL_MODULE__6001__},8881:e=>{e.exports=__WEBPACK_EXTERNAL_MODULE__8881__},8624:(e,t,r)=>{r.d(t,{Ys:()=>M});var n=r(8881);function a(e){return(a="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})(e)}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function o(e,t,r){t&&s(e.prototype,t),r&&s(e,r),Object.defineProperty(e,"prototype",{writable:!1})}function l(){return(l="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=p(e)););return e}(e,t);if(n)return(n=Object.getOwnPropertyDescriptor(n,t)).get?n.get.call(arguments.length<3?e:r):n.value}).apply(this,arguments)}function c(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&&u(e,t)}function u(e,t){return(u=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function h(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=p(e);if(r=t?(r=p(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===a(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return d(n)}}function d(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function p(e){return(p=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var f=new n.Raycaster,m=new n.Vector3,g=new n.Vector3,v=new n.Quaternion,b={X:new n.Vector3(1,0,0),Y:new n.Vector3(0,1,0),Z:new n.Vector3(0,0,1)},y={type:"change"},x={type:"mouseDown"},w={type:"mouseUp",mode:null},S={type:"objectChange"},M=function(){c(t,n.Object3D);var e=h(t);function t(r,a){i(this,t),s=e.call(this),void 0===a&&(console.warn('THREE.TransformControls: The second parameter "domElement" is now mandatory.'),a=document),s.isTransformControls=!0,s.visible=!1,s.domElement=a,s.domElement.style.touchAction="none";var s,o=new N,l=(s._gizmo=o,s.add(o),new F),c=(s._plane=l,s.add(l),d(s));function u(e,t){var r=t;Object.defineProperty(c,e,{get:function(){return void 0!==r?r:t},set:function(t){r!==t&&(r=t,l[e]=t,o[e]=t,c.dispatchEvent({type:e+"-changed",value:t}),c.dispatchEvent(y))}}),c[e]=t,l[e]=t,o[e]=t}u("camera",r),u("object",void 0),u("enabled",!0),u("axis",null),u("mode","translate"),u("translationSnap",null),u("rotationSnap",null),u("scaleSnap",null),u("space","world"),u("size",1),u("dragging",!1),u("showX",!0),u("showY",!0),u("showZ",!0),a=new n.Vector3,r=new n.Vector3;var h=new n.Quaternion,p=new n.Quaternion,f=new n.Vector3,m=new n.Quaternion,g=new n.Vector3,v=new n.Vector3,b=new n.Vector3,x=new n.Vector3;return u("worldPosition",a),u("worldPositionStart",r),u("worldQuaternion",h),u("worldQuaternionStart",p),u("cameraPosition",f),u("cameraQuaternion",m),u("pointStart",g),u("pointEnd",v),u("rotationAxis",b),u("rotationAngle",0),u("eye",x),s._offset=new n.Vector3,s._startNorm=new n.Vector3,s._endNorm=new n.Vector3,s._cameraScale=new n.Vector3,s._parentPosition=new n.Vector3,s._parentQuaternion=new n.Quaternion,s._parentQuaternionInv=new n.Quaternion,s._parentScale=new n.Vector3,s._worldScaleStart=new n.Vector3,s._worldQuaternionInv=new n.Quaternion,s._worldScale=new n.Vector3,s._positionStart=new n.Vector3,s._quaternionStart=new n.Quaternion,s._scaleStart=new n.Vector3,s._getPointer=function(e){var t;return this.domElement.ownerDocument.pointerLockElement?{x:0,y:0,button:e.button}:(t=this.domElement.getBoundingClientRect(),{x:(e.clientX-t.left)/t.width*2-1,y:-(e.clientY-t.top)/t.height*2+1,button:e.button})}.bind(d(s)),s._onPointerDown=function(e){this.enabled&&(document.pointerLockElement||this.domElement.setPointerCapture(e.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.pointerHover(this._getPointer(e)),this.pointerDown(this._getPointer(e)))}.bind(d(s)),s._onPointerHover=function(e){if(this.enabled)switch(e.pointerType){case"mouse":case"pen":this.pointerHover(this._getPointer(e))}}.bind(d(s)),s._onPointerMove=function(e){this.enabled&&this.pointerMove(this._getPointer(e))}.bind(d(s)),s._onPointerUp=function(e){this.enabled&&(this.domElement.releasePointerCapture(e.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.pointerUp(this._getPointer(e)))}.bind(d(s)),s.domElement.addEventListener("pointerdown",s._onPointerDown),s.domElement.addEventListener("pointermove",s._onPointerHover),s.domElement.addEventListener("pointerup",s._onPointerUp),s}return o(t,[{key:"updateMatrixWorld",value:function(){void 0!==this.object&&(this.object.updateMatrixWorld(),null===this.object.parent?console.error("TransformControls: The attached 3D object must be a part of the scene graph."):this.object.parent.matrixWorld.decompose(this._parentPosition,this._parentQuaternion,this._parentScale),this.object.matrixWorld.decompose(this.worldPosition,this.worldQuaternion,this._worldScale),this._parentQuaternionInv.copy(this._parentQuaternion).invert(),this._worldQuaternionInv.copy(this.worldQuaternion).invert()),this.camera.updateMatrixWorld(),this.camera.matrixWorld.decompose(this.cameraPosition,this.cameraQuaternion,this._cameraScale),this.camera.isOrthographicCamera?this.camera.getWorldDirection(this.eye).negate():this.eye.copy(this.cameraPosition).sub(this.worldPosition).normalize(),l(p(t.prototype),"updateMatrixWorld",this).call(this,this)}},{key:"pointerHover",value:function(e){void 0!==this.object&&!0!==this.dragging&&(f.setFromCamera(e,this.camera),e=T(this._gizmo.picker[this.mode],f),this.axis=e?e.object.name:null)}},{key:"pointerDown",value:function(e){void 0!==this.object&&!0!==this.dragging&&0===e.button&&null!==this.axis&&(f.setFromCamera(e,this.camera),(e=T(this._plane,f,!0))&&(this.object.updateMatrixWorld(),this.object.parent.updateMatrixWorld(),this._positionStart.copy(this.object.position),this._quaternionStart.copy(this.object.quaternion),this._scaleStart.copy(this.object.scale),this.object.matrixWorld.decompose(this.worldPositionStart,this.worldQuaternionStart,this._worldScaleStart),this.pointStart.copy(e.point).sub(this.worldPositionStart)),this.dragging=!0,x.mode=this.mode,this.dispatchEvent(x))}},{key:"pointerMove",value:function(e){var t=this.axis,r=this.mode,n=this.object,a=this.space;"scale"===r?a="local":"E"!==t&&"XYZE"!==t&&"XYZ"!==t||(a="world"),void 0!==n&&null!==t&&!1!==this.dragging&&-1===e.button&&(f.setFromCamera(e,this.camera),(e=T(this._plane,f,!0))&&(this.pointEnd.copy(e.point).sub(this.worldPositionStart),"translate"===r?(this._offset.copy(this.pointEnd).sub(this.pointStart),"local"===a&&"XYZ"!==t&&this._offset.applyQuaternion(this._worldQuaternionInv),-1===t.indexOf("X")&&(this._offset.x=0),-1===t.indexOf("Y")&&(this._offset.y=0),-1===t.indexOf("Z")&&(this._offset.z=0),("local"===a&&"XYZ"!==t?this._offset.applyQuaternion(this._quaternionStart):this._offset.applyQuaternion(this._parentQuaternionInv)).divide(this._parentScale),n.position.copy(this._offset).add(this._positionStart),this.translationSnap&&("local"===a&&(n.position.applyQuaternion(v.copy(this._quaternionStart).invert()),-1!==t.search("X")&&(n.position.x=Math.round(n.position.x/this.translationSnap)*this.translationSnap),-1!==t.search("Y")&&(n.position.y=Math.round(n.position.y/this.translationSnap)*this.translationSnap),-1!==t.search("Z")&&(n.position.z=Math.round(n.position.z/this.translationSnap)*this.translationSnap),n.position.applyQuaternion(this._quaternionStart)),"world"===a&&(n.parent&&n.position.add(m.setFromMatrixPosition(n.parent.matrixWorld)),-1!==t.search("X")&&(n.position.x=Math.round(n.position.x/this.translationSnap)*this.translationSnap),-1!==t.search("Y")&&(n.position.y=Math.round(n.position.y/this.translationSnap)*this.translationSnap),-1!==t.search("Z")&&(n.position.z=Math.round(n.position.z/this.translationSnap)*this.translationSnap),n.parent&&n.position.sub(m.setFromMatrixPosition(n.parent.matrixWorld))))):"scale"===r?(-1!==t.search("XYZ")?(e=this.pointEnd.length()/this.pointStart.length(),this.pointEnd.dot(this.pointStart)<0&&(e*=-1),g.set(e,e,e)):(m.copy(this.pointStart),g.copy(this.pointEnd),m.applyQuaternion(this._worldQuaternionInv),g.applyQuaternion(this._worldQuaternionInv),g.divide(m),-1===t.search("X")&&(g.x=1),-1===t.search("Y")&&(g.y=1),-1===t.search("Z")&&(g.z=1)),n.scale.copy(this._scaleStart).multiply(g),this.scaleSnap&&(-1!==t.search("X")&&(n.scale.x=Math.round(n.scale.x/this.scaleSnap)*this.scaleSnap||this.scaleSnap),-1!==t.search("Y")&&(n.scale.y=Math.round(n.scale.y/this.scaleSnap)*this.scaleSnap||this.scaleSnap),-1!==t.search("Z")&&(n.scale.z=Math.round(n.scale.z/this.scaleSnap)*this.scaleSnap||this.scaleSnap))):"rotate"===r&&(this._offset.copy(this.pointEnd).sub(this.pointStart),e=20/this.worldPosition.distanceTo(m.setFromMatrixPosition(this.camera.matrixWorld)),"E"===t?(this.rotationAxis.copy(this.eye),this.rotationAngle=this.pointEnd.angleTo(this.pointStart),this._startNorm.copy(this.pointStart).normalize(),this._endNorm.copy(this.pointEnd).normalize(),this.rotationAngle*=this._endNorm.cross(this._startNorm).dot(this.eye)<0?1:-1):"XYZE"===t?(this.rotationAxis.copy(this._offset).cross(this.eye).normalize(),this.rotationAngle=this._offset.dot(m.copy(this.rotationAxis).cross(this.eye))*e):"X"!==t&&"Y"!==t&&"Z"!==t||(this.rotationAxis.copy(b[t]),m.copy(b[t]),"local"===a&&m.applyQuaternion(this.worldQuaternion),this.rotationAngle=this._offset.dot(m.cross(this.eye).normalize())*e),this.rotationSnap&&(this.rotationAngle=Math.round(this.rotationAngle/this.rotationSnap)*this.rotationSnap),"local"===a&&"E"!==t&&"XYZE"!==t?(n.quaternion.copy(this._quaternionStart),n.quaternion.multiply(v.setFromAxisAngle(this.rotationAxis,this.rotationAngle)).normalize()):(this.rotationAxis.applyQuaternion(this._parentQuaternionInv),n.quaternion.copy(v.setFromAxisAngle(this.rotationAxis,this.rotationAngle)),n.quaternion.multiply(this._quaternionStart).normalize())),this.dispatchEvent(y),this.dispatchEvent(S)))}},{key:"pointerUp",value:function(e){0===e.button&&(this.dragging&&null!==this.axis&&(w.mode=this.mode,this.dispatchEvent(w)),this.dragging=!1,this.axis=null)}},{key:"dispose",value:function(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointermove",this._onPointerHover),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.traverse((function(e){e.geometry&&e.geometry.dispose(),e.material&&e.material.dispose()}))}},{key:"attach",value:function(e){return this.object=e,this.visible=!0,this}},{key:"detach",value:function(){return this.object=void 0,this.visible=!1,this.axis=null,this}},{key:"reset",value:function(){this.enabled&&this.dragging&&(this.object.position.copy(this._positionStart),this.object.quaternion.copy(this._quaternionStart),this.object.scale.copy(this._scaleStart),this.dispatchEvent(y),this.dispatchEvent(S),this.pointStart.copy(this.pointEnd))}},{key:"getRaycaster",value:function(){return f}},{key:"getMode",value:function(){return this.mode}},{key:"setMode",value:function(e){this.mode=e}},{key:"setTranslationSnap",value:function(e){this.translationSnap=e}},{key:"setRotationSnap",value:function(e){this.rotationSnap=e}},{key:"setScaleSnap",value:function(e){this.scaleSnap=e}},{key:"setSize",value:function(e){this.size=e}},{key:"setSpace",value:function(e){this.space=e}}]),t}();function T(e,t,r){for(var n=t.intersectObject(e,!0),a=0;a<n.length;a++)if(n[a].object.visible||r)return n[a];return!1}var _=new n.Euler,E=new n.Vector3(0,1,0),k=new n.Vector3(0,0,0),D=new n.Matrix4,O=new n.Quaternion,P=new n.Quaternion,A=new n.Vector3,C=new n.Matrix4,R=new n.Vector3(1,0,0),L=new n.Vector3(0,1,0),I=new n.Vector3(0,0,1),B=new n.Vector3,j=new n.Vector3,U=new n.Vector3,N=function(){c(t,n.Object3D);var e=h(t);function t(){i(this,t),(r=e.call(this)).isTransformControlsGizmo=!0,r.type="TransformControlsGizmo";var r,a=new n.MeshBasicMaterial({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),s=new n.LineBasicMaterial({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),o=a.clone(),l=((((o.opacity=.15,s=s.clone()).opacity=.5,w=a.clone()).color.setHex(16711680),S=a.clone()).color.setHex(65280),a.clone()),c=(l.color.setHex(255),a.clone()),u=(c.color.setHex(16711680),c.opacity=.5,a.clone()),h=(u.color.setHex(65280),u.opacity=.5,a.clone()),d=(h.color.setHex(255),h.opacity=.5,a.clone());(d.opacity=.25,y=a.clone()).color.setHex(16776960),y.opacity=.25,a.clone().color.setHex(16776960);var p=(((a=a.clone()).color.setHex(7895160),g=new n.CylinderGeometry(0,.04,.1,12)).translate(0,.05,0),new n.BoxGeometry(.08,.08,.08)),f=(p.translate(0,.04,0),new n.BufferGeometry);function m(e,t){return(e=new n.TorusGeometry(e,.0075,3,64,t*Math.PI*2)).rotateY(Math.PI/2),e.rotateX(Math.PI/2),e}(f.setAttribute("position",new n.Float32BufferAttribute([0,0,0,1,0,0],3)),M=new n.CylinderGeometry(.0075,.0075,.5,3)).translate(0,.25,0);var g={X:[[new n.Mesh(g,w),[.5,0,0],[0,0,-Math.PI/2]],[new n.Mesh(g,w),[-.5,0,0],[0,0,Math.PI/2]],[new n.Mesh(M,w),[0,0,0],[0,0,-Math.PI/2]]],Y:[[new n.Mesh(g,S),[0,.5,0]],[new n.Mesh(g,S),[0,-.5,0],[Math.PI,0,0]],[new n.Mesh(M,S)]],Z:[[new n.Mesh(g,l),[0,0,.5],[Math.PI/2,0,0]],[new n.Mesh(g,l),[0,0,-.5],[-Math.PI/2,0,0]],[new n.Mesh(M,l),null,[Math.PI/2,0,0]]],XYZ:[[new n.Mesh(new n.OctahedronGeometry(.1,0),d.clone()),[0,0,0]]],XY:[[new n.Mesh(new n.BoxGeometry(.15,.15,.01),h.clone()),[.15,.15,0]]],YZ:[[new n.Mesh(new n.BoxGeometry(.15,.15,.01),c.clone()),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new n.Mesh(new n.BoxGeometry(.15,.15,.01),u.clone()),[.15,0,.15],[-Math.PI/2,0,0]]]},v={X:[[new n.Mesh(new n.CylinderGeometry(.2,0,.6,4),o),[.3,0,0],[0,0,-Math.PI/2]],[new n.Mesh(new n.CylinderGeometry(.2,0,.6,4),o),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new n.Mesh(new n.CylinderGeometry(.2,0,.6,4),o),[0,.3,0]],[new n.Mesh(new n.CylinderGeometry(.2,0,.6,4),o),[0,-.3,0],[0,0,Math.PI]]],Z:[[new n.Mesh(new n.CylinderGeometry(.2,0,.6,4),o),[0,0,.3],[Math.PI/2,0,0]],[new n.Mesh(new n.CylinderGeometry(.2,0,.6,4),o),[0,0,-.3],[-Math.PI/2,0,0]]],XYZ:[[new n.Mesh(new n.OctahedronGeometry(.2,0),o)]],XY:[[new n.Mesh(new n.BoxGeometry(.2,.2,.01),o),[.15,.15,0]]],YZ:[[new n.Mesh(new n.BoxGeometry(.2,.2,.01),o),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new n.Mesh(new n.BoxGeometry(.2,.2,.01),o),[.15,0,.15],[-Math.PI/2,0,0]]]},b={START:[[new n.Mesh(new n.OctahedronGeometry(.01,2),s),null,null,null,"helper"]],END:[[new n.Mesh(new n.OctahedronGeometry(.01,2),s),null,null,null,"helper"]],DELTA:[[new n.Line(((b=new n.BufferGeometry).setAttribute("position",new n.Float32BufferAttribute([0,0,0,1,1,1],3)),b),s),null,null,null,"helper"]],X:[[new n.Line(f,s.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new n.Line(f,s.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new n.Line(f,s.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]},y=(a={XYZE:[[new n.Mesh(m(.5,1),a),null,[0,Math.PI/2,0]]],X:[[new n.Mesh(m(.5,.5),w)]],Y:[[new n.Mesh(m(.5,.5),S),null,[0,0,-Math.PI/2]]],Z:[[new n.Mesh(m(.5,.5),l),null,[0,Math.PI/2,0]]],E:[[new n.Mesh(m(.75,1),y),null,[0,Math.PI/2,0]]]},{AXIS:[[new n.Line(f,s.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]]}),x={XYZE:[[new n.Mesh(new n.SphereGeometry(.25,10,8),o)]],X:[[new n.Mesh(new n.TorusGeometry(.5,.1,4,24),o),[0,0,0],[0,-Math.PI/2,-Math.PI/2]]],Y:[[new n.Mesh(new n.TorusGeometry(.5,.1,4,24),o),[0,0,0],[Math.PI/2,0,0]]],Z:[[new n.Mesh(new n.TorusGeometry(.5,.1,4,24),o),[0,0,0],[0,0,-Math.PI/2]]],E:[[new n.Mesh(new n.TorusGeometry(.75,.1,2,24),o)]]},w={X:[[new n.Mesh(p,w),[.5,0,0],[0,0,-Math.PI/2]],[new n.Mesh(M,w),[0,0,0],[0,0,-Math.PI/2]],[new n.Mesh(p,w),[-.5,0,0],[0,0,Math.PI/2]]],Y:[[new n.Mesh(p,S),[0,.5,0]],[new n.Mesh(M,S)],[new n.Mesh(p,S),[0,-.5,0],[0,0,Math.PI]]],Z:[[new n.Mesh(p,l),[0,0,.5],[Math.PI/2,0,0]],[new n.Mesh(M,l),[0,0,0],[Math.PI/2,0,0]],[new n.Mesh(p,l),[0,0,-.5],[-Math.PI/2,0,0]]],XY:[[new n.Mesh(new n.BoxGeometry(.15,.15,.01),h),[.15,.15,0]]],YZ:[[new n.Mesh(new n.BoxGeometry(.15,.15,.01),c),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new n.Mesh(new n.BoxGeometry(.15,.15,.01),u),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new n.Mesh(new n.BoxGeometry(.1,.1,.1),d.clone())]]},S={X:[[new n.Mesh(new n.CylinderGeometry(.2,0,.6,4),o),[.3,0,0],[0,0,-Math.PI/2]],[new n.Mesh(new n.CylinderGeometry(.2,0,.6,4),o),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new n.Mesh(new n.CylinderGeometry(.2,0,.6,4),o),[0,.3,0]],[new n.Mesh(new n.CylinderGeometry(.2,0,.6,4),o),[0,-.3,0],[0,0,Math.PI]]],Z:[[new n.Mesh(new n.CylinderGeometry(.2,0,.6,4),o),[0,0,.3],[Math.PI/2,0,0]],[new n.Mesh(new n.CylinderGeometry(.2,0,.6,4),o),[0,0,-.3],[-Math.PI/2,0,0]]],XY:[[new n.Mesh(new n.BoxGeometry(.2,.2,.01),o),[.15,.15,0]]],YZ:[[new n.Mesh(new n.BoxGeometry(.2,.2,.01),o),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new n.Mesh(new n.BoxGeometry(.2,.2,.01),o),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new n.Mesh(new n.BoxGeometry(.2,.2,.2),o),[0,0,0]]]},M={X:[[new n.Line(f,s.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new n.Line(f,s.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new n.Line(f,s.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]};function T(e){var t,r=new n.Object3D;for(t in e)for(var a=e[t].length;a--;){var i=e[t][a][0].clone(),s=e[t][a][1],o=e[t][a][2],l=e[t][a][3],c=e[t][a][4];(i.name=t,i.tag=c,s&&i.position.set(s[0],s[1],s[2]),o&&i.rotation.set(o[0],o[1],o[2]),l&&i.scale.set(l[0],l[1],l[2]),i.updateMatrix(),c=i.geometry.clone()).applyMatrix4(i.matrix),i.geometry=c,i.renderOrder=1/0,i.position.set(0,0,0),i.rotation.set(0,0,0),i.scale.set(1,1,1),r.add(i)}return r}return r.gizmo={},r.picker={},r.helper={},r.add(r.gizmo.translate=T(g)),r.add(r.gizmo.rotate=T(a)),r.add(r.gizmo.scale=T(w)),r.add(r.picker.translate=T(v)),r.add(r.picker.rotate=T(x)),r.add(r.picker.scale=T(S)),r.add(r.helper.translate=T(b)),r.add(r.helper.rotate=T(y)),r.add(r.helper.scale=T(M)),r.picker.translate.visible=!1,r.picker.rotate.visible=!1,r.picker.scale.visible=!1,r}return o(t,[{key:"updateMatrixWorld",value:function(e){var r=this,n="local"===("scale"===this.mode?"local":this.space)?this.worldQuaternion:P,a=(this.gizmo.translate.visible="translate"===this.mode,this.gizmo.rotate.visible="rotate"===this.mode,this.gizmo.scale.visible="scale"===this.mode,this.helper.translate.visible="translate"===this.mode,this.helper.rotate.visible="rotate"===this.mode,this.helper.scale.visible="scale"===this.mode,[]);a=(a=(a=a.concat(this.picker[this.mode].children)).concat(this.gizmo[this.mode].children)).concat(this.helper[this.mode].children);for(var i=0;i<a.length;i++)!function(e){var t=a[e];if(t.visible=!0,t.rotation.set(0,0,0),e=void t.position.copy(r.worldPosition),e=r.camera.isOrthographicCamera?(r.camera.top-r.camera.bottom)/r.camera.zoom:r.worldPosition.distanceTo(r.cameraPosition)*Math.min(1.9*Math.tan(Math.PI*r.camera.fov/360)/r.camera.zoom,7),t.scale.set(1,1,1).multiplyScalar(e*r.size/4),"helper"===t.tag)return t.visible=!1,"AXIS"===t.name?(t.visible=!!r.axis,"X"===r.axis&&(v.setFromEuler(_.set(0,0,0)),t.quaternion.copy(n).multiply(v),.9<Math.abs(E.copy(R).applyQuaternion(n).dot(r.eye))&&(t.visible=!1)),"Y"===r.axis&&(v.setFromEuler(_.set(0,0,Math.PI/2)),t.quaternion.copy(n).multiply(v),.9<Math.abs(E.copy(L).applyQuaternion(n).dot(r.eye))&&(t.visible=!1)),"Z"===r.axis&&(v.setFromEuler(_.set(0,Math.PI/2,0)),t.quaternion.copy(n).multiply(v),.9<Math.abs(E.copy(I).applyQuaternion(n).dot(r.eye))&&(t.visible=!1)),"XYZE"===r.axis&&(v.setFromEuler(_.set(0,Math.PI/2,0)),E.copy(r.rotationAxis),t.quaternion.setFromRotationMatrix(D.lookAt(k,E,L)),t.quaternion.multiply(v),t.visible=r.dragging),"E"===r.axis&&(t.visible=!1)):"START"===t.name?(t.position.copy(r.worldPositionStart),t.visible=r.dragging):"END"===t.name?(t.position.copy(r.worldPosition),t.visible=r.dragging):"DELTA"===t.name?(t.position.copy(r.worldPositionStart),t.quaternion.copy(r.worldQuaternionStart),m.set(1e-10,1e-10,1e-10).add(r.worldPositionStart).sub(r.worldPosition).multiplyScalar(-1),m.applyQuaternion(r.worldQuaternionStart.clone().invert()),t.scale.copy(m),t.visible=r.dragging):(t.quaternion.copy(n),r.dragging?t.position.copy(r.worldPositionStart):t.position.copy(r.worldPosition),r.axis&&(t.visible=-1!==r.axis.search(t.name)));t.quaternion.copy(n),"translate"===r.mode||"scale"===r.mode?("X"===t.name&&.99<Math.abs(E.copy(R).applyQuaternion(n).dot(r.eye))&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1),"Y"===t.name&&.99<Math.abs(E.copy(L).applyQuaternion(n).dot(r.eye))&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1),"Z"===t.name&&.99<Math.abs(E.copy(I).applyQuaternion(n).dot(r.eye))&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1),"XY"===t.name&&Math.abs(E.copy(I).applyQuaternion(n).dot(r.eye))<.2&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1),"YZ"===t.name&&Math.abs(E.copy(R).applyQuaternion(n).dot(r.eye))<.2&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1),"XZ"===t.name&&Math.abs(E.copy(L).applyQuaternion(n).dot(r.eye))<.2&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1)):"rotate"===r.mode&&(O.copy(n),E.copy(r.eye).applyQuaternion(v.copy(n).invert()),-1!==t.name.search("E")&&t.quaternion.setFromRotationMatrix(D.lookAt(r.eye,k,L)),"X"===t.name&&(v.setFromAxisAngle(R,Math.atan2(-E.y,E.z)),v.multiplyQuaternions(O,v),t.quaternion.copy(v)),"Y"===t.name&&(v.setFromAxisAngle(L,Math.atan2(E.x,E.z)),v.multiplyQuaternions(O,v),t.quaternion.copy(v)),"Z"===t.name&&(v.setFromAxisAngle(I,Math.atan2(E.y,E.x)),v.multiplyQuaternions(O,v),t.quaternion.copy(v))),t.visible=t.visible&&(-1===t.name.indexOf("X")||r.showX),t.visible=t.visible&&(-1===t.name.indexOf("Y")||r.showY),t.visible=t.visible&&(-1===t.name.indexOf("Z")||r.showZ),t.visible=t.visible&&(-1===t.name.indexOf("E")||r.showX&&r.showY&&r.showZ),t.material._color=t.material._color||t.material.color.clone(),t.material._opacity=t.material._opacity||t.material.opacity,t.material.color.copy(t.material._color),t.material.opacity=t.material._opacity,r.enabled&&r.axis&&(t.name===r.axis||r.axis.split("").some((function(e){return t.name===e})))&&(t.material.color.setHex(16776960),t.material.opacity=1)}(i);l(p(t.prototype),"updateMatrixWorld",this).call(this,e)}}]),t}(),F=function(){c(t,n.Mesh);var e=h(t);function t(){var r;return i(this,t),(r=e.call(this,new n.PlaneGeometry(1e5,1e5,2,2),new n.MeshBasicMaterial({visible:!1,wireframe:!0,side:n.DoubleSide,transparent:!0,opacity:.1,toneMapped:!1}))).isTransformControlsPlane=!0,r.type="TransformControlsPlane",r}return o(t,[{key:"updateMatrixWorld",value:function(e){var r=this.space;switch(this.position.copy(this.worldPosition),"scale"===this.mode&&(r="local"),B.copy(R).applyQuaternion("local"===r?this.worldQuaternion:P),j.copy(L).applyQuaternion("local"===r?this.worldQuaternion:P),U.copy(I).applyQuaternion("local"===r?this.worldQuaternion:P),E.copy(j),this.mode){case"translate":case"scale":switch(this.axis){case"X":E.copy(this.eye).cross(B),A.copy(B).cross(E);break;case"Y":E.copy(this.eye).cross(j),A.copy(j).cross(E);break;case"Z":E.copy(this.eye).cross(U),A.copy(U).cross(E);break;case"XY":A.copy(U);break;case"YZ":A.copy(B);break;case"XZ":E.copy(U),A.copy(j);break;case"XYZ":case"E":A.set(0,0,0)}break;default:A.set(0,0,0)}0===A.length()?this.quaternion.copy(this.cameraQuaternion):(C.lookAt(m.set(0,0,0),A,E),this.quaternion.setFromRotationMatrix(C)),l(p(t.prototype),"updateMatrixWorld",this).call(this,e)}}]),t}()},6422:(e,t,r)=>{r.d(t,{x:()=>c});var n=r(8881);function a(e){return(a="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})(e)}function i(){return(i="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=l(e)););return e}(e,t);if(n)return(n=Object.getOwnPropertyDescriptor(n,t)).get?n.get.call(arguments.length<3?e:r):n.value}).apply(this,arguments)}function s(e,t){return(s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function o(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=l(e);if(r=t?(r=l(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===a(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function l(e){return(l=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var c=function(e){var t=a;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&s(t,e);var r=o(a);function a(e){if(this instanceof a)return(e=r.call(this,e)).type=n.HalfFloatType,e;throw new TypeError("Cannot call a class as a function")}return t=a,(e=[{key:"parse",value:function(e){var t,r,a,i,s,o,l,c,u,h,d=function(e,t){switch(e){case 1:console.error("THREE.RGBELoader Read Error: "+(t||""));break;case 2:console.error("THREE.RGBELoader Write Error: "+(t||""));break;case 3:console.error("THREE.RGBELoader Bad File Format: "+(t||""));break;default:console.error("THREE.RGBELoader: Error: "+(t||""))}return-1},p=function(e,t,r){t=t||1024;for(var n=e.pos,a=-1,i=0,s="",o=String.fromCharCode.apply(null,new Uint16Array(e.subarray(n,n+128)));(a=o.indexOf("\n"))<0&&i<t&&n<e.byteLength;)s+=o,i+=o.length,n+=128,o+=String.fromCharCode.apply(null,new Uint16Array(e.subarray(n,n+128)));return-1<a&&(!1!==r&&(e.pos+=i+a+1),s+o.slice(0,a))},f=((e=new Uint8Array(e)).pos=0,function(e){var t,r,n=/^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,a=/^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/,i=/^\s*FORMAT=(\S+)\s*$/,s=/^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/,o={valid:0,string:"",comments:"",programtype:"RGBE",format:"",gamma:1,exposure:1,width:0,height:0};if(e.pos>=e.byteLength||!(t=p(e)))return d(1,"no header found");if(!(r=t.match(/^#\?(\S+)/)))return d(3,"bad initial token");for(o.valid|=1,o.programtype=r[1],o.string+=t+"\n";!1!==(t=p(e));)if(o.string+=t+"\n","#"===t.charAt(0))o.comments+=t+"\n";else if((r=t.match(n))&&(o.gamma=parseFloat(r[1])),(r=t.match(a))&&(o.exposure=parseFloat(r[1])),(r=t.match(i))&&(o.valid|=2,o.format=r[1]),(r=t.match(s))&&(o.valid|=4,o.height=parseInt(r[1],10),o.width=parseInt(r[2],10)),2&o.valid&&4&o.valid)break;return 2&o.valid?4&o.valid?o:d(3,"missing image size specifier"):d(3,"missing format specifier")}(e));if(-1!==f){var m,g,v=f.width,b=f.height,y=function(e,t,r){var n=t;if(n<8||32767<n||2!==e[0]||2!==e[1]||128&e[2])return new Uint8Array(e);if(n!==(e[2]<<8|e[3]))return d(3,"wrong scanline width");var a=new Uint8Array(4*t*r);if(!a.length)return d(4,"unable to allocate buffer space");for(var i=0,s=0,o=4*n,l=new Uint8Array(4),c=new Uint8Array(o),u=r;0<u&&s<e.byteLength;){if(s+4>e.byteLength)return d(1);if(l[0]=e[s++],l[1]=e[s++],l[2]=e[s++],l[3]=e[s++],2!=l[0]||2!=l[1]||(l[2]<<8|l[3])!=n)return d(3,"bad rgbe scanline format");for(var h=0,p=void 0;h<o&&s<e.byteLength;){var f=128<(p=e[s++]);if(f&&(p-=128),0===p||o<h+p)return d(3,"bad scanline data");if(f)for(var m=e[s++],g=0;g<p;g++)c[h++]=m;else c.set(e.subarray(s,s+p),h),h+=p,s+=p}for(var v=n,b=0;b<v;b++){var y=0;a[i]=c[b+0],y+=n,a[i+1]=c[b+y],y+=n,a[i+2]=c[b+y],y+=n,a[i+3]=c[b+y],i+=4}u--}return a}(e.subarray(e.pos),v,b);if(-1!==y){switch(this.type){case n.FloatType:for(var x=y.length/4,w=new Float32Array(4*x),S=0;S<x;S++)c=w,u=l=4*S,h=void 0,h=(o=y)[l+3],h=Math.pow(2,h-128)/255,c[u+0]=o[l+0]*h,c[u+1]=o[l+1]*h,c[u+2]=o[l+2]*h,c[u+3]=1;m=w,g=n.FloatType;break;case n.HalfFloatType:x=y.length/4;for(var M=new Uint16Array(4*x),T=0;T<x;T++)a=M,i=r=4*T,s=void 0,s=(t=y)[r+3],s=Math.pow(2,s-128)/255,a[i+0]=n.DataUtils.toHalfFloat(Math.min(t[r+0]*s,65504)),a[i+1]=n.DataUtils.toHalfFloat(Math.min(t[r+1]*s,65504)),a[i+2]=n.DataUtils.toHalfFloat(Math.min(t[r+2]*s,65504)),a[i+3]=n.DataUtils.toHalfFloat(1);m=M,g=n.HalfFloatType;break;default:console.error("THREE.RGBELoader: unsupported type: ",this.type)}return{width:v,height:b,data:m,header:f.string,gamma:f.gamma,exposure:f.exposure,type:g}}}return null}},{key:"setDataType",value:function(e){return this.type=e,this}},{key:"load",value:function(e,t,r,s){return i(l(a.prototype),"load",this).call(this,e,(function(e,r){switch(e.type){case n.FloatType:case n.HalfFloatType:e.encoding=n.LinearEncoding,e.minFilter=n.LinearFilter,e.magFilter=n.LinearFilter,e.generateMipmaps=!1,e.flipY=!0}t&&t(e,r)}),r,s)}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),a}(n.DataTextureLoader)},4819:(e,t,r)=>{r.d(t,{T:()=>u,w:()=>o});var n=r(8881);function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function s(e,t,r){t&&i(e.prototype,t),r&&i(e,r),Object.defineProperty(e,"prototype",{writable:!1})}var o=function(){function e(){a(this,e),this.enabled=!0,this.needsSwap=!0,this.clear=!1,this.renderToScreen=!1}return s(e,[{key:"setSize",value:function(){}},{key:"render",value:function(){console.error("THREE.Pass: .render() must be implemented in derived pass.")}},{key:"dispose",value:function(){}}]),e}(),l=new n.OrthographicCamera(-1,1,1,-1,0,1),c=new n.BufferGeometry,u=(c.setAttribute("position",new n.Float32BufferAttribute([-1,3,0,-1,-1,0,3,-1,0],3)),c.setAttribute("uv",new n.Float32BufferAttribute([0,2,0,0,2,0],2)),function(){function e(t){a(this,e),this._mesh=new n.Mesh(c,t)}return s(e,[{key:"dispose",value:function(){this._mesh.geometry.dispose()}},{key:"render",value:function(e){e.render(this._mesh,l)}},{key:"material",get:function(){return this._mesh.material},set:function(e){this._mesh.material=e}}]),e}())},5180:(e,t,r)=>{r.d(t,{T:()=>c});var n=r(8881),a=r(4819);function i(e){return(i="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})(e)}function s(e,t){return(s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function o(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=l(e);if(r=t?(r=l(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===i(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function l(e){return(l=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var c=function(e){var t=i;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&s(t,e);var r=o(i);function i(e,t){var s;if(this instanceof i)return(s=r.call(this)).textureID=void 0!==t?t:"tDiffuse",e instanceof n.ShaderMaterial?(s.uniforms=e.uniforms,s.material=e):e&&(s.uniforms=n.UniformsUtils.clone(e.uniforms),s.material=new n.ShaderMaterial({defines:Object.assign({},e.defines),uniforms:s.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader})),s.fsQuad=new a.T(s.material),s;throw new TypeError("Cannot call a class as a function")}return t=i,(e=[{key:"render",value:function(e,t,r){this.uniforms[this.textureID]&&(this.uniforms[this.textureID].value=r.texture),this.fsQuad.material=this.material,this.renderToScreen?e.setRenderTarget(null):(e.setRenderTarget(t),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil)),this.fsQuad.render(e)}},{key:"dispose",value:function(){this.material.dispose(),this.fsQuad.dispose()}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),i}(a.w)},699:(e,t,r)=>{function n(e){return(n="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})(e)}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function s(e,t,r){return t&&i(e.prototype,t),r&&i(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function o(){return(o="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=c(e)););return e}(e,t);if(n)return(n=Object.getOwnPropertyDescriptor(n,t)).get?n.get.call(arguments.length<3?e:r):n.value}).apply(this,arguments)}function l(e,t){return(l=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function c(e){return(c=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}r.d(t,{M:()=>g,j:()=>u});var u=function(e){var t=i;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&l(t,e);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,a=c(e);if(r=t?(r=c(this).constructor,Reflect.construct(a,arguments,r)):a.apply(this,arguments),a=this,r&&("object"===n(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==a)return a;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(i);function i(){var e,t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:document.createElement("div");return a(this,i),(e=r.call(this)).isCSS2DObject=!0,e.element=t,e.element.style.position="absolute",e.element.style.userSelect="none",e.element.setAttribute("draggable",!1),e.addEventListener("removed",(function(){this.traverse((function(e){e.element instanceof Element&&null!==e.element.parentNode&&e.element.parentNode.removeChild(e.element)}))})),e}return s(i,[{key:"copy",value:function(e,t){return o(c(i.prototype),"copy",this).call(this,e,t),this.element=e.element.cloneNode(!0),this}}]),i}((t=r(8881)).Object3D),h=new t.Vector3,d=new t.Matrix4,p=new t.Matrix4,f=new t.Vector3,m=new t.Vector3,g=s((function e(){var t,r,n,i,s=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},o=(a(this,e),this),l={objects:new WeakMap},c=void 0!==s.element?s.element:document.createElement("div");function u(e,t){return f.setFromMatrixPosition(e.matrixWorld),m.setFromMatrixPosition(t.matrixWorld),f.distanceToSquared(m)}c.style.overflow="hidden",this.domElement=c,this.getSize=function(){return{width:t,height:r}},this.render=function(e,t){!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),null===t.parent&&!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),d.copy(t.matrixWorldInverse),p.multiplyMatrices(t.projectionMatrix,d),function e(t,r,a){var s;t.isCSS2DObject&&(h.setFromMatrixPosition(t.matrixWorld),h.applyMatrix4(p),s=!0===t.visible&&-1<=h.z&&h.z<=1&&!0===t.layers.test(a.layers),t.element.style.display=1==s?"":"none",1==s&&(t.onBeforeRender(o,r,a),(s=t.element).style.transform="translate(-50%,-50%) translate("+(h.x*n+n)+"px,"+(-h.y*i+i)+"px)",s.parentNode!==c&&c.appendChild(s),t.onAfterRender(o,r,a)),s={distanceToCameraSquared:u(a,t)},l.objects.set(t,s));for(var d=0,f=t.children.length;d<f;d++)e(t.children[d],r,a)}(e,e,t);for(var r=function(e){var t=[];return e.traverse((function(e){e.isCSS2DObject&&t.push(e)})),t}(e).sort((function(e,t){return e.renderOrder!==t.renderOrder?t.renderOrder-e.renderOrder:l.objects.get(e).distanceToCameraSquared-l.objects.get(t).distanceToCameraSquared})),a=r.length,s=0,f=r.length;s<f;s++)r[s].element.style.zIndex=a-s},this.setSize=function(e,a){n=(t=e)/2,i=(r=a)/2,c.style.width=e+"px",c.style.height=a+"px"}}))},3693:(e,t,r)=>{r.d(t,{P7:()=>v,cp:()=>g,lX:()=>x});var n=r(8881);function a(e){return(a="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})(e)}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function o(e,t,r){return t&&s(e.prototype,t),r&&s(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function l(){return(l="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=d(e)););return e}(e,t);if(n)return(n=Object.getOwnPropertyDescriptor(n,t)).get?n.get.call(arguments.length<3?e:r):n.value}).apply(this,arguments)}function c(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&&u(e,t)}function u(e,t){return(u=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function h(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=d(e);if(r=t?(r=d(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===a(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function d(e){return(d=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var p=new n.Vector3,f=new n.Quaternion,m=new n.Vector3,g=function(){c(t,n.Object3D);var e=h(t);function t(){var r,n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:document.createElement("div");return i(this,t),(r=e.call(this)).isCSS3DObject=!0,r.element=n,r.element.style.position="absolute",r.element.style.pointerEvents="auto",r.element.style.userSelect="none",r.element.setAttribute("draggable",!1),r.addEventListener("removed",(function(){this.traverse((function(e){e.element instanceof Element&&null!==e.element.parentNode&&e.element.parentNode.removeChild(e.element)}))})),r}return o(t,[{key:"copy",value:function(e,r){return l(d(t.prototype),"copy",this).call(this,e,r),this.element=e.element.cloneNode(!0),this}}]),t}(),v=function(){c(t,g);var e=h(t);function t(r){return i(this,t),(r=e.call(this,r)).isCSS3DSprite=!0,r.rotation2D=0,r}return o(t,[{key:"copy",value:function(e,r){return l(d(t.prototype),"copy",this).call(this,e,r),this.rotation2D=e.rotation2D,this}}]),t}(),b=new n.Matrix4,y=new n.Matrix4,x=o((function e(){var t,r,n,a,s=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},o=(i(this,e),this),l={camera:{fov:0,style:""},objects:new WeakMap},c=void 0!==s.element?s.element:document.createElement("div"),u=(c.style.overflow="hidden",this.domElement=c,document.createElement("div"));function h(e){return Math.abs(e)<1e-10?0:e}function d(e){return"matrix3d("+h((e=e.elements)[0])+","+h(-e[1])+","+h(e[2])+","+h(e[3])+","+h(e[4])+","+h(-e[5])+","+h(e[6])+","+h(e[7])+","+h(e[8])+","+h(-e[9])+","+h(e[10])+","+h(e[11])+","+h(e[12])+","+h(-e[13])+","+h(e[14])+","+h(e[15])+")"}function g(e){return"translate(-50%,-50%)matrix3d("+h((e=e.elements)[0])+","+h(e[1])+","+h(e[2])+","+h(e[3])+","+h(-e[4])+","+h(-e[5])+","+h(-e[6])+","+h(-e[7])+","+h(e[8])+","+h(e[9])+","+h(e[10])+","+h(e[11])+","+h(e[12])+","+h(e[13])+","+h(e[14])+","+h(e[15])+")"}u.style.transformStyle="preserve-3d",u.style.pointerEvents="none",c.appendChild(u),this.getSize=function(){return{width:t,height:r}},this.render=function(e,t){var r=t.projectionMatrix.elements[5]*a,i=(l.camera.fov!==r&&(c.style.perspective=t.isPerspectiveCamera?r+"px":"",l.camera.fov=r),!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),null===t.parent&&!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),t.isOrthographicCamera&&(i=-(t.right+t.left)/2,s=(t.top+t.bottom)/2),t.isOrthographicCamera?"scale("+r+")translate("+h(i)+"px,"+h(s)+"px)"+d(t.matrixWorldInverse):"translateZ("+r+"px)"+d(t.matrixWorldInverse)),s=i+"translate("+n+"px,"+a+"px)";l.camera.style!==s&&(u.style.transform=s,l.camera.style=s),function e(t,r,n,a){var i,s,c;t.isCSS3DObject&&(i=!0===t.visible&&!0===t.layers.test(n.layers),t.element.style.display=1==i?"":"none",1==i&&(t.onBeforeRender(o,r,n),i=t.isCSS3DSprite?(b.copy(n.matrixWorldInverse),b.transpose(),0!==t.rotation2D&&b.multiply(y.makeRotationZ(t.rotation2D)),t.matrixWorld.decompose(p,f,m),b.setPosition(p),b.scale(m),b.elements[3]=0,b.elements[7]=0,b.elements[11]=0,b.elements[15]=1,g(b)):g(t.matrixWorld),s=t.element,void 0!==(c=l.objects.get(t))&&c.style===i||(c={style:s.style.transform=i},l.objects.set(t,c)),s.parentNode!==u&&u.appendChild(s),t.onAfterRender(o,r,n)));for(var h=0,d=t.children.length;h<d;h++)e(t.children[h],r,n,a)}(e,e,t,i)},this.setSize=function(e,i){n=(t=e)/2,a=(r=i)/2,c.style.width=e+"px",c.style.height=i+"px",u.style.width=e+"px",u.style.height=i+"px"}}))},6608:(e,t,r)=>{r.d(t,{C:()=>n});var n={uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:"\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",fragmentShader:"\n\n\t\tuniform float opacity;\n\n\t\tuniform sampler2D tDiffuse;\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tgl_FragColor = texture2D( tDiffuse, vUv );\n\t\t\tgl_FragColor.a *= opacity;\n\n\n\t\t}"}},4091:(e,t,r)=>{r.d(t,{Vs:()=>function(e,t){if(t===n.TrianglesDrawMode)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),e;if(t!==n.TriangleFanDrawMode&&t!==n.TriangleStripDrawMode)return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",t),e;var r=e.getIndex();if(null===r){var a=[],i=e.getAttribute("position");if(void 0===i)return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),e;for(var s=0;s<i.count;s++)a.push(s);e.setIndex(a),r=e.getIndex()}var o=r.count-2,l=[];if(t===n.TriangleFanDrawMode)for(var c=1;c<=o;c++)l.push(r.getX(0)),l.push(r.getX(c)),l.push(r.getX(c+1));else for(var u=0;u<o;u++)u%2==0?(l.push(r.getX(u)),l.push(r.getX(u+1)),l.push(r.getX(u+2))):(l.push(r.getX(u+2)),l.push(r.getX(u+1)),l.push(r.getX(u)));return l.length/3!=o&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles."),(t=e.clone()).setIndex(l),t.clearGroups(),t},qf:()=>function(e){for(var t,r,i=1<arguments.length&&void 0!==arguments[1]&&arguments[1],s=null!==e[0].index,o=new Set(Object.keys(e[0].attributes)),l=new Set(Object.keys(e[0].morphAttributes)),c={},u={},h=e[0].morphTargetsRelative,d=new n.BufferGeometry,p=0,f=0;f<e.length;++f){var m,g,v=e[f],b=0;if(s!=(null!==v.index))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+f+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(m in v.attributes){if(!o.has(m))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+f+'. All geometries must have compatible attributes; make sure "'+m+'" attribute exists among all geometries, or in none of them.'),null;void 0===c[m]&&(c[m]=[]),c[m].push(v.attributes[m]),b++}if(b!==o.size)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+f+". Make sure all geometries have the same number of attributes."),null;if(h!==v.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+f+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(g in v.morphAttributes){if(!l.has(g))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+f+". .morphAttributes must be consistent throughout all geometries."),null;void 0===u[g]&&(u[g]=[]),u[g].push(v.morphAttributes[g])}if(i){var y=void 0;if(s)y=v.index.count;else{if(void 0===v.attributes.position)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+f+". The geometry must have either an index or a position attribute"),null;y=v.attributes.position.count}d.addGroup(p,y,f),p+=y}}if(s){for(var x=0,w=[],S=0;S<e.length;++S){for(var M=e[S].index,T=0;T<M.count;++T)w.push(M.getX(T)+x);x+=e[S].attributes.position.count}d.setIndex(w)}for(t in c){var _=a(c[t]);if(!_)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the "+t+" attribute."),null;d.setAttribute(t,_)}for(r in u){var E=u[r][0].length;if(0===E)break;d.morphAttributes=d.morphAttributes||{},d.morphAttributes[r]=[];for(var k=0;k<E;++k){for(var D=[],O=0;O<u[r].length;++O)D.push(u[r][O][k]);var P=a(D);if(!P)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the "+r+" morphAttribute."),null;d.morphAttributes[r].push(P)}}return d}});var n=r(8881);function a(e){for(var t,r,a,i=0,s=0;s<e.length;++s){var o=e[s];if(o.isInterleavedBufferAttribute)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. InterleavedBufferAttributes are not supported."),null;if((t=void 0===t?o.array.constructor:t)!==o.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if((r=void 0===r?o.itemSize:r)!==o.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if((a=void 0===a?o.normalized:a)!==o.normalized)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;i+=o.array.length}for(var l=new t(i),c=0,u=0;u<e.length;++u)l.set(e[u].array,c),c+=e[u].array.length;return new n.BufferAttribute(l,r,a)}}},__webpack_module_cache__={};function __webpack_require__(e){var t=__webpack_module_cache__[e];return void 0!==t||(t=__webpack_module_cache__[e]={exports:{}},__webpack_modules__[e](t,t.exports,__webpack_require__)),t.exports}__webpack_require__.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return __webpack_require__.d(t,{a:t}),t},__webpack_require__.d=(e,t)=>{for(var r in t)__webpack_require__.o(t,r)&&!__webpack_require__.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},__webpack_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),__webpack_require__.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var __webpack_exports__={};return(()=>{__webpack_require__.d(__webpack_exports__,{default:()=>r});var e=__webpack_require__(8624),t=__webpack_require__(4670);const r={RunScene:t.ZP,Utils:t.cQ,ModelEx:t.ch,MaterialEx:t.al,TextureEx:t.Az,Three:t.Sf,ThreeEx:{TransformControls:e.Ys},Bus:t.Gc}})(),__webpack_exports__=__webpack_exports__.default,__webpack_exports__})()));
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("axios"),require("js-funcs"),require("three"),require("@allex/md5")):"function"==typeof define&&define.amd?define(["axios","js-funcs","three","@allex/md5"],t):"object"==typeof exports?exports.RunScene=t(require("axios"),require("js-funcs"),require("three"),require("@allex/md5")):e.RunScene=t(e.axios,e["js-funcs"],e.three,e["@allex/md5"])}(self,((__WEBPACK_EXTERNAL_MODULE__3300__,__WEBPACK_EXTERNAL_MODULE__6001__,__WEBPACK_EXTERNAL_MODULE__8881__,__WEBPACK_EXTERNAL_MODULE__1129__)=>(()=>{"use strict";var __webpack_modules__={2958:(e,t,r)=>{function n(){return(n="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=l(e)););return e}(e,t);if(n)return(n=Object.getOwnPropertyDescriptor(n,t)).get?n.get.call(arguments.length<3?e:r):n.value}).apply(this,arguments)}function a(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&&i(e,t)}function i(e,t){return(i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function s(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=l(e);if(r=t?(r=l(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===f(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return o(n)}}function o(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function l(e){return(l=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function c(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function u(e,t,r){return t&&c(e.prototype,t),r&&c(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function h(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function d(e){return function(e){if(Array.isArray(e))return p(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return p(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Map"===(r="Object"===r&&e.constructor?e.constructor.name:r)||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?p(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function p(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function f(e){return(f="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})(e)}function m(e){return void 0===e}function g(){return"undefined"!=typeof window}function v(e){return Ge(e)||Ve(e)}function b(e){return(nt=D(e,rt))&&Sr}function y(e,t){return!t&&console.warn(e)}function x(e,t){return e&&(rt[e]=t)&&nt&&(nt[e]=t)||rt}function w(){return 0}function S(e,t,r){return(r=e[t])&&Ge(r)?e[t]():m(r)&&e.getAttribute&&e.getAttribute(t)||r}function M(e,t){(e=e.split(",")).forEach(t)}function T(e,t,r,n){st.length&>(),e.render(t,r,n),st.length&>()}function _(e){var t=parseFloat(e);return(t||0===t)&&(e+"").match(et).length<2?t:Ve(e)?e.trim():e}function E(e){return e}function D(e,t){for(var r in t)e[r]=t[r];return e}function k(e,t){for(var r in t)"__proto__"!==r&&"constructor"!==r&&"prototype"!==r&&(e[r]=We(t[r])?k(e[r]||(e[r]={}),t[r]):t[r]);return e}function O(e){var t,r=e.parent||le,n=e.keyframes?(t=Ze(e.keyframes),function(e,r){for(var n in r)n in e||"duration"===n&&t||"ease"===n||(e[n]=r[n])}):vt;if(Ke(e.inherit))for(;r;)n(e,r.vars.defaults),r=r.parent||r._dp;return e}function P(e){return!e||e._ts&&P(e.parent)}function A(e){return e._repeat?C(e._tTime,e=e.duration()+e._rDelay)*e:0}function C(e,t){return t=Math.floor(e/=t),e&&t===e?t-1:t}function R(e,t){return(e-t._start)*t._ts+(0<=t._ts?0:t._dirty?t.totalDuration():t._tDur)}function L(e,t){var r;if((t._time||t._initted&&!t._dur)&&(r=R(e.rawTime(),t),(!t._dur||H(0,t.totalDuration(),r)-t._tTime>Ie)&&t.render(r,!0)),wt(e,t)._dp&&e._initted&&e._time>=e._dur&&e._ts){if(e._dur<e.duration())for(r=e;r._dp;)0<=r.rawTime()&&r.totalTime(r._tTime),r=r._dp;e._zTime=-Ie}}function I(e,t,r,n){return t.parent&&xt(t),t._start=mt((He(r)?r:r||e!==le?V(e,r,t):e._time)+t._delay),t._end=mt(t._start+(t.totalDuration()/Math.abs(t.timeScale())||0)),function(e,t){var r,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:"_first",a=3<arguments.length&&void 0!==arguments[3]?arguments[3]:"_last",i=4<arguments.length?arguments[4]:void 0,s=e[a];if(i)for(r=t[i];s&&s[i]>r;)s=s._prev;s?(t._next=s._next,s._next=t):(t._next=e[n],e[n]=t),t._next?t._next._prev=t:e[a]=t,t._prev=s,t.parent=t._dp=e}(e,t,"_first","_last",e._sort?"_start":0),N(t)||(e._recent=t),n||L(e,t),e}function B(e,t){(rt.ScrollTrigger||at("scrollTrigger",t))&&rt.ScrollTrigger.create(t,e)}function j(e,t,r,n){return qt(e,t),e._initted?!r&&e._pt&&(e._dur&&!1!==e.vars.lazy||!e._dur&&e.vars.lazy)&&pe!==Ut.frame?(st.push(e),e._lazy=[t,n]):void 0:1}function U(e){return(e=e.parent)&&e._ts&&e._initted&&!e._lock&&(e.rawTime()<0||U(e))}function N(e){return"isFromStart"===(e=e.data)||"isStart"===e}function z(e,t,r,n){var a=e._repeat,i=mt(t)||0;return(t=e._tTime/e._tDur)&&!n&&(e._time*=i/e._dur),e._dur=i,e._tDur=a?a<0?1e10:mt(i*(a+1)+e._rDelay*a):i,0<t&&!n?Mt(e,e._tTime=e._tDur*t):e.parent&&St(e),r||wt(e.parent,e),e}function F(e){return e instanceof ir?wt(e):z(e,e._dur)}function V(e,t,r){var n,a,i,s=e.labels,o=e._recent||Tt,l=e.duration()>=Le?o.endTime(!1):e._dur;return Ve(t)&&(isNaN(t)||t in s)?(a=t.charAt(0),i="%"===t.substr(-1),n=t.indexOf("="),"<"===a||">"===a?(0<=n&&(t=t.replace(/=/,"")),("<"===a?o._start:o.endTime(0<=o._repeat))+(parseFloat(t.substr(1))||0)*(i?(n<0?o:r).totalDuration()/100:1)):n<0?(t in s||(s[t]=l),s[t]):(a=parseFloat(t.charAt(n-1)+t.substr(n+1)),i&&r&&(a=a/100*(Ze(r)?r[0]:r).totalDuration()),1<n?V(e,t.substr(0,n-1),r)+a:l+a)):null==t?l:+t}function G(e,t,r){var n,a,i=He(t[1]),s=(i?2:1)+(e<2?0:1),o=t[s];if(i&&(o.duration=t[1]),o.parent=r,e){for(n=o,a=r;a&&!("immediateRender"in n);)n=a.vars.defaults||{},a=Ke(a.vars.inherit)&&a.parent;o.immediateRender=Ke(n.immediateRender),e<2?o.runBackwards=1:o.startAt=t[s-1]}return new hr(t[0],o,t[1+s])}function H(e,t,r){return r<e?e:t<r?t:r}function W(e){if(Ge(e))return e;var t=We(e)?e:{each:e},r=Ht(t.ease),n=t.from||0,a=parseFloat(t.base)||0,i={},s=(e=0<n&&n<1,isNaN(n)||e),o=t.axis,l=n,c=n;return Ve(n)?l=c={center:.5,edges:.5,end:1}[n]||0:!e&&s&&(l=n[0],c=n[1]),function(e,u,h){var d,p,f,m,g,v,b,y,x=(h||t).length,w=i[x];if(!w){if(!(y="auto"===t.grid?0:(t.grid||[1,Le])[1])){for(v=-Le;v<(v=h[y++].getBoundingClientRect().left)&&y<x;);y--}for(w=i[x]=[],d=s?Math.min(y,x)*l-.5:n%y,p=y===Le?0:s?x*c/y-.5:n/y|0,b=Le,g=v=0;g<x;g++)m=g%y-d,f=p-(g/y|0),w[g]=m=o?Math.abs("y"===o?f:m):Ne(m*m+f*f),v<m&&(v=m),m<b&&(b=m);"random"===n&&Pt(w),w.max=v-b,w.min=b,w.v=x=(parseFloat(t.amount)||parseFloat(t.each)*(x<y?x-1:o?"y"===o?x/y:y:Math.max(y,x/y))||0)*("edges"===n?-1:1),w.b=x<0?a-x:a,w.u=Et(t.amount||t.each)||0,r=r&&x<0?Gt(r):r}return x=(w[e]-w.min)/w.max||0,mt(w.b+(r?r(x):x)*w.v)+w.u}}function K(e){var t=Math.pow(10,((e+"").split(".")[1]||"").length);return function(r){var n=Math.round(parseFloat(r)/e)*e*t;return(n-n%1)/t+(He(r)?0:Et(r))}}function q(e,t){var r,n,a=Ze(e);return!a&&We(e)&&(r=a=e.radius||Le,e.values?(e=Ot(e.values),(n=!He(e[0]))&&(r*=r)):e=K(e.increment)),_t(t,a?Ge(e)?function(t){return n=e(t),Math.abs(n-t)<=r?n:t}:function(t){for(var a,i,s=parseFloat(n?t.x:t),o=parseFloat(n?t.y:0),l=Le,c=0,u=e.length;u--;)(a=n?(a=e[u].x-s)*a+(i=e[u].y-o)*i:Math.abs(e[u]-s))<l&&(l=a,c=u);return c=!r||l<=r?e[c]:t,n||c===t||He(t)?c:c+Et(t)}:K(e))}function Z(e,t,r,n){return _t(Ze(e)?!t:!0===r?!!(r=0):!n,(function(){return Ze(e)?e[~~(Math.random()*e.length)]:(r=r||1e-5)&&(n=r<1?Math.pow(10,(r+"").length-2):1)&&Math.floor(Math.round((e-r/2+Math.random()*(t-e+.99*r))/r)*r*n)/n}))}function X(e,t,r){return _t(r,(function(r){return e[~~t(r)]}))}function Q(e,t,r,n,a){var i=t-e,s=n-r;return _t(a,(function(t){return r+((t-e)/i*s||0)}))}function Y(e,t,r){var n,a,i,s=e.labels,o=Le;for(n in s)(a=s[n]-t)<0==!!r&&a&&o>(a=Math.abs(a))&&(i=n,o=a);return i}function J(e,t,r){var n=e.vars,a=n[t];a&&(t=n[t+"Params"],n=n.callbackScope||e,r&&st.length&>(),t?a.apply(n,t):a.call(n))}function $(e){return xt(e),e.scrollTrigger&&e.scrollTrigger.kill(!1),e.progress()<1&&J(e,"onInterrupt"),e}function ee(e,t,r){return(6*(e+=e<0?1:1<e?-1:0)<1?t+(r-t)*e*6:e<.5?r:3*e<2?t+(r-t)*(2/3-e)*6:t)*Ct+.5|0}function te(e,t,r){var n,a,i,s,o="",l=(e+o).match(Bt),c=t?"hsla(":"rgba(",u=0;if(!l)return e;if(l=l.map((function(e){return(e=Lt(e,t,1))&&c+(t?e[0]+","+e[1]+"%,"+e[2]+"%,"+e[3]:e.join(","))+")"})),r&&(i=It(e),(n=r.c).join(o)!==i.c.join(o)))for(s=(a=e.replace(Bt,"1").split(Ye)).length-1;u<s;u++)o+=a[u]+(~n.indexOf(u)?l.shift()||c+"0,0,0,0)":(i.length?i:l.length?l:r).shift());if(!a)for(s=(a=e.split(Bt)).length-1;u<s;u++)o+=a[u]+l[u];return o+a[s]}function re(e,t){for(var r,n=e._first;n;)n instanceof ir?re(n,t):!n.vars.yoyoEase||n._yoyo&&n._repeat||n._yoyo===t||(n.timeline?re(n.timeline,t):(r=n._ease,n._ease=n._yEase,n._yEase=r,n._yoyo=t)),n=n._next}function ne(e,t){var r,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:function(e){return 1-t(1-e)},a={easeIn:t,easeOut:n,easeInOut:3<arguments.length&&void 0!==arguments[3]?arguments[3]:function(e){return e<.5?t(2*e)/2:1-t(2*(1-e))/2}};M(e,(function(e){for(var t in zt[e]=rt[e]=a,zt[r=e.toLowerCase()]=n,a)zt[r+("easeIn"===t?".in":"easeOut"===t?".out":".inOut")]=zt[e+"."+t]=a[t]}))}function ae(e){return function(t){return t<.5?(1-e(1-2*t))/2:.5+e(2*(t-.5))/2}}function ie(e,t,r){function n(e){return 1===e?1:a*Math.pow(2,-10*e)*Fe((e-i)*s)+1}var a=1<=t?t:1,i=(s=(r||(e?.3:.45))/(t<1?t:1))/Be*(Math.asin(1/a)||0),s=(r="out"===e?n:"in"===e?function(e){return 1-n(1-e)}:ae(n),Be/s);return r.config=function(t,r){return ie(e,t,r)},r}function se(e){function t(e){return e?--e*e*((r+1)*e+r)+1:0}var r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1.70158,n="out"===e?t:"in"===e?function(e){return 1-t(1-e)}:ae(t);return n.config=function(t){return se(e,t)},n}r.d(t,{Q3:()=>hr});var oe,le,ce,ue,he,de,pe,fe,me,ge,ve,be,ye,xe,we,Se,Me,Te,_e,Ee,De,ke,Oe,Pe,Ae,Ce={autoSleep:120,force3D:"auto",nullTargetWarn:1,units:{lineHeight:""}},Re={duration:.5,overwrite:!1,delay:0},Le=1e8,Ie=1/Le,Be=2*Math.PI,je=Be/4,Ue=0,Ne=Math.sqrt,ze=Math.cos,Fe=Math.sin,Ve=function(e){return"string"==typeof e},Ge=function(e){return"function"==typeof e},He=function(e){return"number"==typeof e},We=function(e){return"object"==f(e)},Ke=function(e){return!1!==e},qe="function"==typeof ArrayBuffer&&ArrayBuffer.isView||function(){},Ze=Array.isArray,Xe=/(?:-?\.?\d|\.)+/gi,Qe=/[-+=.]*\d+[.e\-+]*\d*[e\-+]*\d*/g,Ye=/[-+=.]*\d+[.e-]*\d*[a-z%]*/g,Je=/[-+=.]*\d+\.?\d*(?:e-|e\+)?\d*/gi,$e=/[+-]=-?[.\d]+/,et=/[^,'"\[\]\s]+/gi,tt=/[\d.+\-=]+(?:e[-+]\d*)*/i,rt={},nt={},at=function(e,t){return console.warn("Invalid property",e,"set to",t,"Missing plugin? gsap.registerPlugin()")},it={},st=[],ot={},lt={},ct={},ut=30,ht=[],dt="",pt=function(e){var t,r,n=e[0];if(We(n)||Ge(n)||(e=[e]),!(t=(n._gsap||{}).harness)){for(r=ht.length;r--&&!ht[r].targetTest(n););t=ht[r]}for(r=e.length;r--;)e[r]&&(e[r]._gsap||(e[r]._gsap=new nr(e[r],t)))||e.splice(r,1);return e},ft=function(e){return e._gsap||pt(Ot(e))[0]._gsap},mt=function(e){return Math.round(1e7*e)/1e7||0},gt=function(){var e,t,r=st.length,n=st.slice(0);for(ot={},e=st.length=0;e<r;e++)(t=n[e])&&t._lazy&&(t.render(t._lazy[0],t._lazy[1],!0)._lazy=0)},vt=function(e,t){for(var r in t)r in e||(e[r]=t[r]);return e},bt=function(e,t){var r,n={};for(r in e)r in t||(n[r]=e[r]);return n},yt=function(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:"_first",n=3<arguments.length&&void 0!==arguments[3]?arguments[3]:"_last",a=t._prev,i=t._next;a?a._next=i:e[r]===t&&(e[r]=i),i?i._prev=a:e[n]===t&&(e[n]=a),t._next=t._prev=t.parent=null},xt=function(e,t){!e.parent||t&&!e.parent.autoRemoveChildren||e.parent.remove(e),e._act=0},wt=function(e,t){if(e&&(!t||t._end>e._dur||t._start<0))for(var r=e;r;)r._dirty=1,r=r.parent;return e},St=function(e){return e._end=mt(e._start+(e._tDur/Math.abs(e._ts||e._rts||Ie)||0))},Mt=function(e,t){var r=e._dp;return r&&r.smoothChildTiming&&e._ts&&(e._start=mt(r._time-(0<e._ts?t/e._ts:((e._dirty?e.totalDuration():e._tDur)-t)/-e._ts)),St(e),r._dirty||wt(r,e)),e},Tt={_start:0,endTime:w,totalDuration:w},_t=function(e,t){return e||0===e?t(e):t},Et=function(e,t){return Ve(e)&&(t=tt.exec(e))?e.substr(t.index+t[0].length):""},Dt=[].slice,kt=function(e,t){return e&&We(e)&&"length"in e&&(!t&&!e.length||e.length-1 in e&&We(e[0]))&&!e.nodeType&&e!==ce},Ot=function(e,t,r){return!Ve(e)||r||!ue&&Nt()?Ze(e)?function(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:[];return e.forEach((function(e){return Ve(e)&&!t||kt(e,1)?r.push.apply(r,d(Ot(e))):r.push(e)}))||r}(e,r):kt(e)?Dt.call(e,0):e?[e]:[]:Dt.call((t||he).querySelectorAll(e),0)},Pt=function(e){return e.sort((function(){return.5-Math.random()}))},At=function(e){for(var t,r,n,a,i=0,s="";~(t=e.indexOf("random(",i));)n=e.indexOf(")",t),a="["===e.charAt(t+7),r=e.substr(t+7,n-t-7).match(a?et:Xe),s+=e.substr(i,t-i)+Z(a?r:+r[0],a?0:+r[1],+r[2]||1e-5),i=n+1;return s+e.substr(i,e.length-i)},Ct=255,Rt={aqua:[0,Ct,Ct],lime:[0,Ct,0],silver:[192,192,192],black:[0,0,0],maroon:[128,0,0],teal:[0,128,128],blue:[0,0,Ct],navy:[0,0,128],white:[Ct,Ct,Ct],olive:[128,128,0],yellow:[Ct,Ct,0],orange:[Ct,165,0],gray:[128,128,128],purple:[128,0,128],green:[0,128,0],red:[Ct,0,0],pink:[Ct,192,203],cyan:[0,Ct,Ct],transparent:[Ct,Ct,Ct,0]},Lt=function(e,t,r){var n,a,i,s,o,l,c,u=e?He(e)?[e>>16,e>>8&Ct,e&Ct]:0:Rt.black;if(!u){if(","===e.substr(-1)&&(e=e.substr(0,e.length-1)),Rt[e])u=Rt[e];else if("#"===e.charAt(0)){if(9===(e=e.length<6?"#"+(n=e.charAt(1))+n+(a=e.charAt(2))+a+(i=e.charAt(3))+i+(5===e.length?e.charAt(4)+e.charAt(4):""):e).length)return[(u=parseInt(e.substr(1,6),16))>>16,u>>8&Ct,u&Ct,parseInt(e.substr(7),16)/255];u=[(e=parseInt(e.substr(1),16))>>16,e>>8&Ct,e&Ct]}else if("hsl"===e.substr(0,3))if(u=c=e.match(Xe),t){if(~e.indexOf("="))return u=e.match(Qe),r&&u.length<4&&(u[3]=1),u}else s=+u[0]%360/360,o=+u[1]/100,n=2*(l=+u[2]/100)-(a=l<=.5?l*(o+1):l+o-l*o),3<u.length&&(u[3]*=1),u[0]=ee(s+1/3,n,a),u[1]=ee(s,n,a),u[2]=ee(s-1/3,n,a);else u=e.match(Xe)||Rt.transparent;u=u.map(Number)}return t&&!c&&(n=u[0]/Ct,a=u[1]/Ct,i=u[2]/Ct,l=((e=Math.max(n,a,i))+(t=Math.min(n,a,i)))/2,e===t?s=o=0:(c=e-t,o=.5<l?c/(2-e-t):c/(e+t),s=e===n?(a-i)/c+(a<i?6:0):e===a?(i-n)/c+2:(n-a)/c+4,s*=60),u[0]=~~(s+.5),u[1]=~~(100*o+.5),u[2]=~~(100*l+.5)),r&&u.length<4&&(u[3]=1),u},It=function(e){var t=[],r=[],n=-1;return e.split(Bt).forEach((function(e){e=e.match(Ye)||[],t.push.apply(t,d(e)),r.push(n+=e.length+1)})),t.c=r,t},Bt=function(){var e,t="(?:\\b(?:(?:rgb|rgba|hsl|hsla)\\(.+?\\))|\\B#(?:[0-9a-f]{3,4}){1,2}\\b";for(e in Rt)t+="|"+e+"\\b";return new RegExp(t+")","gi")}(),jt=/hsl[a]?\(/,Ut=(we=Date.now,Se=500,Me=33,Te=we(),_e=Te,De=Ee=1e3/240,Oe={time:0,frame:0,tick:function(){Wt(!0)},deltaRatio:function(e){return ye/(1e3/(e||60))},wake:function(){de&&(!ue&&g()&&(ce=ue=window,he=ce.document||{},rt.gsap=Sr,(ce.gsapVersions||(ce.gsapVersions=[])).push(Sr.version),b(nt||ce.GreenSockGlobals||!ce.gsap&&ce||{}),be=ce.requestAnimationFrame),ge&&Oe.sleep(),ve=be||function(e){return setTimeout(e,De-1e3*Oe.time+1|0)},me=1,Wt(2))},sleep:function(){(be?ce.cancelAnimationFrame:clearTimeout)(ge),me=0,ve=w},lagSmoothing:function(e,t){Se=e||1/Ie,Me=Math.min(t,Se,0)},fps:function(e){Ee=1e3/(e||240),De=1e3*Oe.time+Ee},add:function(e){ke.indexOf(e)<0&&ke.push(e),Nt()},remove:function(e,t){~(t=ke.indexOf(e))&&ke.splice(t,1)&&t<=xe&&xe--},_listeners:ke=[]}),Nt=function(){return!me&&Ut.wake()},zt={},Ft=/^[\d.\-M][\d.\-,\s]/,Vt=/["']/g,Gt=function(e){return function(t){return 1-e(1-t)}},Ht=function(e,t){return e&&(Ge(e)?e:zt[e]||function(e){var t,r,n,a=(e+"").split("("),i=zt[a[0]];return i&&1<a.length&&i.config?i.config.apply(null,~e.indexOf("{")?[function(e){for(var t,r,n,a={},i=e.substr(1,e.length-3).split(":"),s=i[0],o=1,l=i.length;o<l;o++)r=i[o],t=o!==l-1?r.lastIndexOf(","):r.length,n=r.substr(0,t),a[s]=isNaN(n)?n.replace(Vt,"").trim():+n,s=r.substr(t+1).trim();return a}(a[1])]:(t=(a=e).indexOf("(")+1,r=a.indexOf(")"),n=a.indexOf("(",t),a.substring(t,~n&&n<r?a.indexOf(")",r+1):r).split(",").map(_))):zt._CE&&Ft.test(e)?zt._CE("",e):i}(e))||t};function Wt(e){var t,r,n,a=we()-_e,i=!0===e;if(Se<a&&(Te+=a-Me),(0<(a=(r=(_e+=a)-Te)-De)||i)&&(n=++Oe.frame,ye=r-1e3*Oe.time,Oe.time=r/=1e3,De+=a+(Ee<=a?4:Ee-a),t=1),i||(ge=ve(Wt)),t)for(xe=0;xe<ke.length;xe++)ke[xe](r,ye,n,e)}function Kt(e){return e<Ae?Pe*e*e:e<.7272727272727273?Pe*Math.pow(e-1.5/2.75,2)+.75:e<.9090909090909092?Pe*(e-=2.25/2.75)*e+.9375:Pe*Math.pow(e-2.625/2.75,2)+.984375}function qt(e,t){var r,n,a,i,s,o,l,c,u,h,d,p,f,m=e.vars,g=m.ease,v=m.startAt,b=m.immediateRender,y=m.lazy,x=m.onUpdate,w=m.onUpdateParams,S=m.callbackScope,M=m.runBackwards,T=m.yoyoEase,_=m.keyframes,E=m.autoRevert,D=e._dur,k=e._startAt,O=e._targets,P=e.parent,A=P&&"nested"===P.data?P.parent._targets:O,C="auto"===e._overwrite&&!oe,R=e.timeline;if(e._ease=Ht(g=!R||_&&g?g:"none",Re.ease),e._yEase=T?Gt(Ht(!0===T?g:T,Re.ease)):0,T&&e._yoyo&&!e._repeat&&(T=e._yEase,e._yEase=e._ease,e._ease=T),e._from=!R&&!!m.runBackwards,!R||_&&!m.stagger){if(p=(c=O[0]?ft(O[0]).harness:0)&&m[c.prop],r=bt(m,it),k&&xt(k.render(-1,!0)),v)if(xt(e._startAt=hr.set(O,vt({data:"isStart",overwrite:!1,parent:P,immediateRender:!0,lazy:Ke(y),startAt:null,delay:0,onUpdate:x,onUpdateParams:w,callbackScope:S,stagger:0},v))),t<0&&!b&&!E&&e._startAt.render(-1,!0),b){if(0<t&&!E&&(e._startAt=0),D&&t<=0)return void(t&&(e._zTime=t))}else!1===E&&(e._startAt=0);else if(M&&D)if(k)E||(e._startAt=0);else if(a=vt({overwrite:!1,data:"isFromStart",lazy:(b=!t&&b)&&Ke(y),immediateRender:b,stagger:0,parent:P},r),p&&(a[c.prop]=p),xt(e._startAt=hr.set(O,a)),t<0&&e._startAt.render(-1,!0),e._zTime=t,b){if(!t)return}else qt(e._startAt,Ie);for(e._pt=0,y=D&&Ke(y)||y&&!D,n=0;n<O.length;n++){if(l=(s=O[n])._gsap||pt(O)[n]._gsap,e._ptLookup[n]=h={},ot[l.id]&&st.length&>(),d=A===O?n:A.indexOf(s),c&&!1!==(u=new c).init(s,p||r,e,d,A)&&(e._pt=i=new yr(e._pt,s,u.name,0,1,u.render,u,0,u.priority),u._props.forEach((function(e){h[e]=i})),u.priority&&(o=1)),!c||p)for(a in r)lt[a]&&(u=lr(a,r,e,d,s,A))?u.priority&&(o=1):h[a]=i=or.call(e,s,a,"get",r[a],d,A,0,m.stringFilter);e._op&&e._op[n]&&e.kill(s,e._op[n]),C&&e._pt&&(rr=e,le.killTweensOf(s,h,e.globalTime(t)),f=!e.parent,rr=0),e._pt&&y&&(ot[l.id]=1)}o&&br(e),e._onInit&&e._onInit(e)}e._onUpdate=x,e._initted=(!e._op||e._pt)&&!f,_&&t<=0&&R.render(Le,!0,!0)}function Zt(e,t,r,n,a){return Ge(e)?e.call(t,r,n,a):Ve(e)&&~e.indexOf("random(")?At(e):e}function Xt(e,t,r){return e.setAttribute(t,r)}function Qt(e,t){var r=t._pt,n="";if(!e&&t.b)n=t.b;else if(1===e&&t.e)n=t.e;else{for(;r;)n=r.p+(r.m?r.m(r.s+r.c*e):Math.round(1e4*(r.s+r.c*e))/1e4)+n,r=r._next;n+=t.c}t.set(t.t,t.p,n,t)}function Yt(e,t){for(var r=t._pt;r;)r.r(e,r.d),r=r._next}function Jt(e,t,r,n){for(var a,i=this._pt;i;)a=i._next,i.p===n&&i.modifier(e,t,r),i=a}function $t(e){for(var t,r,n=this._pt;n;)r=n._next,n.p===e&&!n.op||n.op===e?yt(this,n,"_pt"):n.dep||(t=1),n=r;return!t}function er(e,t,r,n){n.mSet(e,t,n.m.call(n.tween,r,n.mt),n)}function tr(e,t){return{name:e,rawVars:1,init:function(e,r,n){n._onInit=function(e){var n,a;if(Ve(r)&&(n={},M(r,(function(e){return n[e]=1})),r=n),t){for(a in n={},r)n[a]=t(r[a]);r=n}var i,s,o,l=e,c=r,u=l._targets;for(i in c)for(s=u.length;s--;)(o=(o=l._ptLookup[s][i])&&o.d)&&(o=o._pt?wr(o,i):o)&&o.modifier&&o.modifier(c[i],l,u[s],i)}}}}M("Linear,Quad,Cubic,Quart,Quint,Strong",(function(e,t){var r=t<5?t+1:t;ne(e+",Power"+(r-1),t?function(e){return Math.pow(e,r)}:function(e){return e},(function(e){return 1-Math.pow(1-e,r)}),(function(e){return e<.5?Math.pow(2*e,r)/2:1-Math.pow(2*(1-e),r)/2}))})),zt.Linear.easeNone=zt.none=zt.Linear.easeIn,ne("Elastic",ie("in"),ie("out"),ie()),Pe=7.5625,Ae=1/2.75,ne("Bounce",(function(e){return 1-Kt(1-e)}),Kt),ne("Expo",(function(e){return e?Math.pow(2,10*(e-1)):0})),ne("Circ",(function(e){return-(Ne(1-e*e)-1)})),ne("Sine",(function(e){return 1===e?1:1-ze(e*je)})),ne("Back",se("in"),se("out"),se()),zt.SteppedEase=zt.steps=rt.SteppedEase={config:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:1,t=1<arguments.length?arguments[1]:void 0,r=1/e,n=e+(t?0:1),a=t?1:0,i=1-Ie;return function(e){return((n*H(0,i,e)|0)+a)*r}}},Re.ease=zt["quad.out"],M("onComplete,onUpdate,onStart,onRepeat,onReverseComplete,onInterrupt",(function(e){return dt+=e+","+e+"Params,"}));var rr,nr=u((function e(t,r){h(this,e),this.id=Ue++,(t._gsap=this).target=t,this.harness=r,this.get=r?r.get:S,this.set=r?r.getSetter:mr})),ar=function(){function e(t){h(this,e),this.vars=t,this._delay=+t.delay||0,(this._repeat=t.repeat===1/0?-2:t.repeat||0)&&(this._rDelay=t.repeatDelay||0,this._yoyo=!!t.yoyo||!!t.yoyoEase),this._ts=1,z(this,+t.duration,1,1),this.data=t.data,me||Ut.wake()}return u(e,[{key:"delay",value:function(e){return e||0===e?(this.parent&&this.parent.smoothChildTiming&&this.startTime(this._start+e-this._delay),this._delay=e,this):this._delay}},{key:"duration",value:function(e){return arguments.length?this.totalDuration(0<this._repeat?e+(e+this._rDelay)*this._repeat:e):this.totalDuration()&&this._dur}},{key:"totalDuration",value:function(e){return arguments.length?(this._dirty=0,z(this,this._repeat<0?e:(e-this._repeat*this._rDelay)/(this._repeat+1))):this._tDur}},{key:"totalTime",value:function(e,t){if(Nt(),!arguments.length)return this._tTime;var r=this._dp;if(r&&r.smoothChildTiming&&this._ts){for(Mt(this,e),r._dp&&!r.parent&&L(r,this);r&&r.parent;)r.parent._time!==r._start+(0<=r._ts?r._tTime/r._ts:(r.totalDuration()-r._tTime)/-r._ts)&&r.totalTime(r._tTime,!0),r=r.parent;!this.parent&&this._dp.autoRemoveChildren&&(0<this._ts&&e<this._tDur||this._ts<0&&0<e||!this._tDur&&!e)&&I(this._dp,this,this._start-this._delay)}return(this._tTime!==e||!this._dur&&!t||this._initted&&Math.abs(this._zTime)===Ie||!e&&!this._initted&&(this.add||this._ptLookup))&&(this._ts||(this._pTime=e),T(this,e,t)),this}},{key:"time",value:function(e,t){return arguments.length?this.totalTime(Math.min(this.totalDuration(),e+A(this))%(this._dur+this._rDelay)||(e?this._dur:0),t):this._time}},{key:"totalProgress",value:function(e,t){return arguments.length?this.totalTime(this.totalDuration()*e,t):this.totalDuration()?Math.min(1,this._tTime/this._tDur):this.ratio}},{key:"progress",value:function(e,t){return arguments.length?this.totalTime(this.duration()*(!this._yoyo||1&this.iteration()?e:1-e)+A(this),t):this.duration()?Math.min(1,this._time/this._dur):this.ratio}},{key:"iteration",value:function(e,t){var r=this.duration()+this._rDelay;return arguments.length?this.totalTime(this._time+(e-1)*r,t):this._repeat?C(this._tTime,r)+1:1}},{key:"timeScale",value:function(e){if(!arguments.length)return this._rts===-Ie?0:this._rts;if(this._rts===e)return this;for(var t=this.parent&&this._ts?R(this.parent._time,this):this._tTime,r=(this._rts=+e||0,this._ts=this._ps||e===-Ie?0:this._rts,e=this.totalTime(H(-this._delay,this._tDur,t),!0)).parent;r&&r.parent;)r._dirty=1,r.totalDuration(),r=r.parent;return St(this),this}},{key:"paused",value:function(e){return arguments.length?(this._ps!==e&&((this._ps=e)?(this._pTime=this._tTime||Math.max(-this._delay,this.rawTime()),this._ts=this._act=0):(Nt(),this._ts=this._rts,this.totalTime(this.parent&&!this.parent.smoothChildTiming?this.rawTime():this._tTime||this._pTime,1===this.progress()&&Math.abs(this._zTime)!==Ie&&(this._tTime-=Ie)))),this):this._ps}},{key:"startTime",value:function(e){var t;return arguments.length?(this._start=e,!(t=this.parent||this._dp)||!t._sort&&this.parent||I(t,this,e-this._delay),this):this._start}},{key:"endTime",value:function(e){return this._start+(Ke(e)?this.totalDuration():this.duration())/Math.abs(this._ts||1)}},{key:"rawTime",value:function(e){var t=this.parent||this._dp;return t?e&&(!this._ts||this._repeat&&this._time&&this.totalProgress()<1)?this._tTime%(this._dur+this._rDelay):this._ts?R(t.rawTime(e),this):this._tTime:this._tTime}},{key:"globalTime",value:function(e){for(var t=this,r=arguments.length?e:t.rawTime();t;)r=t._start+r/(t._ts||1),t=t._dp;return r}},{key:"repeat",value:function(e){return arguments.length?(this._repeat=e===1/0?-2:e,F(this)):-2===this._repeat?1/0:this._repeat}},{key:"repeatDelay",value:function(e){var t;return arguments.length?(t=this._time,this._rDelay=e,F(this),t?this.time(t):this):this._rDelay}},{key:"yoyo",value:function(e){return arguments.length?(this._yoyo=e,this):this._yoyo}},{key:"seek",value:function(e,t){return this.totalTime(V(this,e),Ke(t))}},{key:"restart",value:function(e,t){return this.play().totalTime(e?-this._delay:0,Ke(t))}},{key:"play",value:function(e,t){return null!=e&&this.seek(e,t),this.reversed(!1).paused(!1)}},{key:"reverse",value:function(e,t){return null!=e&&this.seek(e||this.totalDuration(),t),this.reversed(!0).paused(!1)}},{key:"pause",value:function(e,t){return null!=e&&this.seek(e,t),this.paused(!0)}},{key:"resume",value:function(){return this.paused(!1)}},{key:"reversed",value:function(e){return arguments.length?(!!e!==this.reversed()&&this.timeScale(-this._rts||(e?-Ie:0)),this):this._rts<0}},{key:"invalidate",value:function(){return this._initted=this._act=0,this._zTime=-Ie,this}},{key:"isActive",value:function(){var e=this.parent||this._dp,t=this._start;return!(e&&!(this._ts&&this._initted&&e.isActive()&&(e=e.rawTime(!0))>=t&&e<this.endTime(!0)-Ie))}},{key:"eventCallback",value:function(e,t,r){var n=this.vars;return 1<arguments.length?(t?(n[e]=t,r&&(n[e+"Params"]=r),"onUpdate"===e&&(this._onUpdate=t)):delete n[e],this):n[e]}},{key:"then",value:function(e){var t=this;return new Promise((function(r){function n(){var e=t.then;t.then=null,Ge(a)&&(a=a(t))&&(a.then||a===t)&&(t.then=e),r(a),t.then=e}var a=Ge(e)?e:E;t._initted&&1===t.totalProgress()&&0<=t._ts||!t._tTime&&t._ts<0?n():t._prom=n}))}},{key:"kill",value:function(){$(this)}}]),e}(),ir=(vt(ar.prototype,{_time:0,_start:0,_end:0,_tTime:0,_tDur:0,_dirty:0,_repeat:0,_yoyo:!1,parent:null,_initted:!1,_rDelay:0,_ts:1,_dp:0,ratio:0,_zTime:-Ie,_prom:0,_ps:!1,_rts:1}),function(){a(t,ar);var e=s(t);function t(){var r,n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},a=1<arguments.length?arguments[1]:void 0;return h(this,t),(r=e.call(this,n)).labels={},r.smoothChildTiming=!!n.smoothChildTiming,r.autoRemoveChildren=!!n.autoRemoveChildren,r._sort=Ke(n.sortChildren),le&&I(n.parent||le,o(r),a),n.reversed&&r.reverse(),n.paused&&r.paused(!0),n.scrollTrigger&&B(o(r),n.scrollTrigger),r}return u(t,[{key:"to",value:function(e,t,r){return G(0,arguments,this),this}},{key:"from",value:function(e,t,r){return G(1,arguments,this),this}},{key:"fromTo",value:function(e,t,r,n){return G(2,arguments,this),this}},{key:"set",value:function(e,t,r){return t.duration=0,t.parent=this,O(t).repeatDelay||(t.repeat=0),t.immediateRender=!!t.immediateRender,new hr(e,t,V(this,r),1),this}},{key:"call",value:function(e,t,r){return I(this,hr.delayedCall(0,e,t),r)}},{key:"staggerTo",value:function(e,t,r,n,a,i,s){return r.duration=t,r.stagger=r.stagger||n,r.onComplete=i,r.onCompleteParams=s,r.parent=this,new hr(e,r,V(this,a)),this}},{key:"staggerFrom",value:function(e,t,r,n,a,i,s){return r.runBackwards=1,O(r).immediateRender=Ke(r.immediateRender),this.staggerTo(e,t,r,n,a,i,s)}},{key:"staggerFromTo",value:function(e,t,r,n,a,i,s,o){return n.startAt=r,O(n).immediateRender=Ke(n.immediateRender),this.staggerTo(e,t,n,a,i,s,o)}},{key:"render",value:function(e,t,r){var n,a,i,s,o,l,c,u,h,d,p=this._time,f=this._dirty?this.totalDuration():this._tDur,m=this._dur,g=e<=0?0:mt(e),v=this._zTime<0!=e<0&&(this._initted||!m);if((g=this!==le&&f<g&&0<=e?f:g)!==this._tTime||r||v){if(p!==this._time&&m&&(g+=this._time-p,e+=this._time-p),n=g,u=this._start,o=!(c=this._ts),v&&(m||(p=this._zTime),!e&&t||(this._zTime=e)),this._repeat){if(v=this._yoyo,s=m+this._rDelay,this._repeat<-1&&e<0)return this.totalTime(100*s+e,t,r);if(n=mt(g%s),g===f?(i=this._repeat,n=m):((i=~~(g/s))&&i===g/s&&(n=m,i--),m<n&&(n=m)),h=C(this._tTime,s),v&&1&i&&(n=m-n,d=1),i!==(h=!p&&this._tTime&&h!==i?i:h)&&!this._lock){var b=v&&1&h;if(v=b===(v&&1&i),p=(b=i<h?!b:b)?0:m,this._lock=1,this.render(p||(d?0:mt(i*s)),t,!m)._lock=0,this._tTime=g,!t&&this.parent&&J(this,"onRepeat"),this.vars.repeatRefresh&&!d&&(this.invalidate()._lock=1),p&&p!==this._time||o!=!this._ts||this.vars.onRepeat&&!this.parent&&!this._act)return this;if(m=this._dur,f=this._tDur,v&&(this._lock=2,this.render(p=b?m:-1e-4,!0),this.vars.repeatRefresh&&!d&&this.invalidate()),this._lock=0,!this._ts&&!o)return this;re(this,d)}}if(this._hasPause&&!this._forcing&&this._lock<2&&(l=function(e,t,r){var n;if(t<r)for(n=e._first;n&&n._start<=r;){if("isPause"===n.data&&n._start>t)return n;n=n._next}else for(n=e._last;n&&n._start>=r;){if("isPause"===n.data&&n._start<t)return n;n=n._prev}}(this,mt(p),mt(n)))&&(g-=n-(n=l._start)),this._tTime=g,this._time=n,this._act=!c,this._initted||(this._onUpdate=this.vars.onUpdate,this._initted=1,this._zTime=e,p=0),!p&&n&&!t&&(J(this,"onStart"),this._tTime!==g))return this;if(p<=n&&0<=e)for(y=this._first;y;){if(a=y._next,(y._act||n>=y._start)&&y._ts&&l!==y){if(y.parent!==this)return this.render(e,t,r);if(y.render(0<y._ts?(n-y._start)*y._ts:(y._dirty?y.totalDuration():y._tDur)+(n-y._start)*y._ts,t,r),n!==this._time||!this._ts&&!o){l=0,a&&(g+=this._zTime=-Ie);break}}y=a}else for(var y=this._last,x=e<0?e:n;y;){if(a=y._prev,(y._act||x<=y._end)&&y._ts&&l!==y){if(y.parent!==this)return this.render(e,t,r);if(y.render(0<y._ts?(x-y._start)*y._ts:(y._dirty?y.totalDuration():y._tDur)+(x-y._start)*y._ts,t,r),n!==this._time||!this._ts&&!o){l=0,a&&(g+=this._zTime=x?-Ie:Ie);break}}y=a}if(l&&!t&&(this.pause(),l.render(p<=n?0:-Ie)._zTime=p<=n?1:-1,this._ts))return this._start=u,St(this),this.render(e,t,r);this._onUpdate&&!t&&J(this,"onUpdate",!0),!(g===f&&f>=this.totalDuration()||!g&&p)||u!==this._start&&Math.abs(c)===Math.abs(this._ts)||this._lock||(!e&&m||!(g===f&&0<this._ts||!g&&this._ts<0)||xt(this,1),t||e<0&&!p||!g&&!p&&f||(J(this,g===f&&0<=e?"onComplete":"onReverseComplete",!0),!this._prom||g<f&&0<this.timeScale()||this._prom()))}return this}},{key:"add",value:function(e,t){var r=this;if(He(t)||(t=V(this,t,e)),!(e instanceof ar)){if(Ze(e))return e.forEach((function(e){return r.add(e,t)})),this;if(Ve(e))return this.addLabel(e,t);if(!Ge(e))return this;e=hr.delayedCall(0,e)}return this!==e?I(this,e,t):this}},{key:"getChildren",value:function(){for(var e=!(0<arguments.length&&void 0!==arguments[0])||arguments[0],t=!(1<arguments.length&&void 0!==arguments[1])||arguments[1],r=!(2<arguments.length&&void 0!==arguments[2])||arguments[2],n=3<arguments.length&&void 0!==arguments[3]?arguments[3]:-Le,a=[],i=this._first;i;)i._start>=n&&(i instanceof hr?t&&a.push(i):(r&&a.push(i),e&&a.push.apply(a,d(i.getChildren(!0,t,r))))),i=i._next;return a}},{key:"getById",value:function(e){for(var t=this.getChildren(1,1,1),r=t.length;r--;)if(t[r].vars.id===e)return t[r]}},{key:"remove",value:function(e){return Ve(e)?this.removeLabel(e):Ge(e)?this.killTweensOf(e):(yt(this,e),e===this._recent&&(this._recent=this._last),wt(this))}},{key:"totalTime",value:function(e,r){return arguments.length?(this._forcing=1,!this._dp&&this._ts&&(this._start=mt(Ut.time-(0<this._ts?e/this._ts:(this.totalDuration()-e)/-this._ts))),n(l(t.prototype),"totalTime",this).call(this,e,r),this._forcing=0,this):this._tTime}},{key:"addLabel",value:function(e,t){return this.labels[e]=V(this,t),this}},{key:"removeLabel",value:function(e){return delete this.labels[e],this}},{key:"addPause",value:function(e,t,r){return(t=hr.delayedCall(0,t||w,r)).data="isPause",this._hasPause=1,I(this,t,V(this,e))}},{key:"removePause",value:function(e){var t=this._first;for(e=V(this,e);t;)t._start===e&&"isPause"===t.data&&xt(t),t=t._next}},{key:"killTweensOf",value:function(e,t,r){for(var n=this.getTweensOf(e,r),a=n.length;a--;)rr!==n[a]&&n[a].kill(e,t);return this}},{key:"getTweensOf",value:function(e,t){for(var r,n=[],a=Ot(e),i=this._first,s=He(t);i;)i instanceof hr?function(e,t){for(var r=t.length,n=0;e.indexOf(t[n])<0&&++n<r;);return n<r}(i._targets,a)&&(s?(!rr||i._initted&&i._ts)&&i.globalTime(0)<=t&&i.globalTime(i.totalDuration())>t:!t||i.isActive())&&n.push(i):(r=i.getTweensOf(a,t)).length&&n.push.apply(n,d(r)),i=i._next;return n}},{key:"tweenTo",value:function(e,t){t=t||{};var r,n=this,a=V(n,e),i=(e=t).startAt,s=e.onStart,o=e.onStartParams,l=(e=e.immediateRender,hr.to(n,vt({ease:t.ease||"none",lazy:!1,immediateRender:!1,time:a,overwrite:"auto",duration:t.duration||Math.abs((a-(i&&"time"in i?i.time:n._time))/n.timeScale())||Ie,onStart:function(){var e;n.pause(),r||(e=t.duration||Math.abs((a-(i&&"time"in i?i.time:n._time))/n.timeScale()),l._dur!==e&&z(l,e,0,1).render(l._time,!0,!0),r=1),s&&s.apply(l,o||[])}},t)));return e?l.render(0):l}},{key:"tweenFromTo",value:function(e,t,r){return this.tweenTo(t,vt({startAt:{time:V(this,e)}},r))}},{key:"recent",value:function(){return this._recent}},{key:"nextLabel",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:this._time;return Y(this,V(this,e))}},{key:"previousLabel",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:this._time;return Y(this,V(this,e),1)}},{key:"currentLabel",value:function(e){return arguments.length?this.seek(e,!0):this.previousLabel(this._time+Ie)}},{key:"shiftChildren",value:function(e,t){for(var r,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0,a=this._first,i=this.labels;a;)a._start>=n&&(a._start+=e,a._end+=e),a=a._next;if(t)for(r in i)i[r]>=n&&(i[r]+=e);return wt(this)}},{key:"invalidate",value:function(){var e=this._first;for(this._lock=0;e;)e.invalidate(),e=e._next;return n(l(t.prototype),"invalidate",this).call(this)}},{key:"clear",value:function(){for(var e,t=!(0<arguments.length&&void 0!==arguments[0])||arguments[0],r=this._first;r;)e=r._next,this.remove(r),r=e;return this._dp&&(this._time=this._tTime=this._pTime=0),t&&(this.labels={}),wt(this)}},{key:"totalDuration",value:function(e){var t,r,n,a=0,i=this,s=i._last,o=Le;if(arguments.length)return i.timeScale((i._repeat<0?i.duration():i.totalDuration())/(i.reversed()?-e:e));if(i._dirty){for(n=i.parent;s;)t=s._prev,s._dirty&&s.totalDuration(),(r=s._start)>o&&i._sort&&s._ts&&!i._lock?(i._lock=1,I(i,s,r-s._delay,1)._lock=0):o=r,r<0&&s._ts&&(a-=r,(!n&&!i._dp||n&&n.smoothChildTiming)&&(i._start+=r/i._ts,i._time-=r,i._tTime-=r),i.shiftChildren(-r,!1,-1/0),o=0),s._end>a&&s._ts&&(a=s._end),s=t;z(i,i===le&&i._time>a?i._time:a,1,1),i._dirty=0}return i._tDur}}],[{key:"updateRoot",value:function(e){if(le._ts&&(T(le,R(e,le)),pe=Ut.frame),Ut.frame>=ut){ut+=Ce.autoSleep||120;var t=le._first;if((!t||!t._ts)&&Ce.autoSleep&&Ut._listeners.length<2){for(;t&&!t._ts;)t=t._next;t||Ut.sleep()}}}}]),t}()),sr=(vt(ir.prototype,{_lock:0,_hasPause:0,_forcing:0}),function(e,t,r,n,a,i,s){var o,l,c,u,h,d=new yr(this._pt,e,t,0,1,Qt,null,a),p=0,f=0;for(d.b=r,d.e=n,r+="",(a=~(n+="").indexOf("random("))&&(n=At(n)),i&&(i(i=[r,n],e,t),r=i[0],n=i[1]),o=r.match(Je)||[];u=Je.exec(n);)c=u[0],u=n.substring(p,u.index),l?l=(l+1)%5:"rgba("===u.substr(-5)&&(l=1),c!==o[f++]&&(h=parseFloat(o[f-1])||0,d._pt={_next:d._pt,p:u||1===f?u:",",s:h,c:"="===c.charAt(1)?parseFloat(c.substr(2))*("-"===c.charAt(0)?-1:1):parseFloat(c)-h,m:l&&l<4?Math.round:0},p=Je.lastIndex);return d.c=p<n.length?n.substring(p,n.length):"",d.fp=s,($e.test(n)||a)&&(d.e=0),this._pt=d}),or=function(e,t,r,n,a,i,s,o,l){var c;if(Ge(n)&&(n=n(a||0,e,i)),a=e[t],i="get"!==r?r:Ge(a)?l?e[t.indexOf("set")||!Ge(e["get"+t.substr(3)])?t:"get"+t.substr(3)](l):e[t]():a,r=Ge(a)?l?fr:pr:dr,Ve(n)&&"="===(n=~n.indexOf("random(")?At(n):n).charAt(1)&&(!(c=parseFloat(i)+parseFloat(n.substr(2))*("-"===n.charAt(0)?-1:1)+(Et(i)||0))&&0!==c||(n=c)),i!==n)return isNaN(i*n)||""===n?(a||t in e||at(t,n),sr.call(this,e,t,i,n,r,o||Ce.stringFilter,l)):(c=new yr(this._pt,e,t,+i||0,n-(i||0),"boolean"==typeof a?vr:gr,0,r),l&&(c.fp=l),s&&c.modifier(s,this,e),this._pt=c)},lr=function(e,t,r,n,a,i){var s,o,l,c;if(lt[e]&&!1!==(s=new lt[e]).init(a,s.rawVars?t[e]:function(e,t,r,n,a){if(Ge(e)&&(e=Zt(e,a,t,r,n)),!We(e)||e.style&&e.nodeType||Ze(e)||qe(e))return Ve(e)?Zt(e,a,t,r,n):e;var i,s={};for(i in e)s[i]=Zt(e[i],a,t,r,n);return s}(t[e],n,a,i,r),r,n,i)&&(r._pt=o=new yr(r._pt,a,e,0,1,s.render,s,0,s.priority),r!==fe))for(l=r._ptLookup[r._targets.indexOf(a)],c=s._props.length;c--;)l[s._props[c]]=o;return s},cr=dt+"repeat,repeatDelay,yoyo,repeatRefresh,yoyoEase",ur={},hr=(M(cr+",id,stagger,delay,duration,paused,scrollTrigger",(function(e){return ur[e]=1})),function(){a(t,ar);var e=s(t);function t(r,n,a,i){h(this,t),"number"==typeof n&&(a.duration=n,n=a,a=null);var s,l,c,u,d,p,f,m,g,b=(i=(s=e.call(this,i?n:O(n))).vars).duration,x=i.delay,w=i.immediateRender,S=i.stagger,M=i.overwrite,T=i.keyframes,_=i.defaults,E=i.scrollTrigger,k=i.yoyoEase,A=(i=n.parent||le,(Ze(r)||qe(r)?He(r[0]):"length"in n)?[r]:Ot(r));if(s._targets=A.length?pt(A):y("GSAP target "+r+" not found. https://greensock.com",!Ce.nullTargetWarn)||[],s._ptLookup=[],s._overwrite=M,T||S||v(b)||v(x)){if(n=s.vars,(l=s.timeline=new ir({data:"nested",defaults:_||{}})).kill(),l.parent=l._dp=o(s),l._start=0,S||v(b)||v(x)){if(d=A.length,m=S&&W(S),We(S))for(p in S)~cr.indexOf(p)&&((g=g||{})[p]=S[p]);for(c=0;c<d;c++)(u=bt(n,ur)).stagger=0,k&&(u.yoyoEase=k),g&&D(u,g),f=A[c],u.duration=+Zt(b,o(s),c,f,A),u.delay=(+Zt(x,o(s),c,f,A)||0)-s._delay,!S&&1===d&&u.delay&&(s._delay=x=u.delay,s._start+=x,u.delay=0),l.to(f,u,m?m(c,f,A):0),l._ease=zt.none;l.duration()?b=x=0:s.timeline=0}else if(T){O(vt(l.vars.defaults,{ease:"none"})),l._ease=Ht(T.ease||n.ease||"none");var C,R,L,j=0;if(Ze(T))T.forEach((function(e){return l.to(A,e,">")}));else{for(p in u={},T)"ease"!==p&&"easeEach"!==p&&function(e,t,r,n){var a,i,s=t.ease||n||"power1.inOut";if(Ze(t))i=r[e]||(r[e]=[]),t.forEach((function(e,r){return i.push({t:r/(t.length-1)*100,v:e,e:s})}));else for(a in t)i=r[a]||(r[a]=[]),"ease"!==a&&i.push({t:parseFloat(e),v:t[a],e:s})}(p,T[p],u,T.easeEach);for(p in u)for(C=u[p].sort((function(e,t){return e.t-t.t})),c=j=0;c<C.length;c++)(L={ease:(R=C[c]).e,duration:(R.t-(c?C[c-1].t:0))/100*b})[p]=R.v,l.to(A,L,j),j+=L.duration;l.duration()<b&&l.to({},{duration:b-l.duration()})}}b||s.duration(b=l.duration())}else s.timeline=0;return!0!==M||oe||(rr=o(s),le.killTweensOf(A),rr=0),I(i,o(s),a),n.reversed&&s.reverse(),n.paused&&s.paused(!0),(w||!b&&!T&&s._start===mt(i._time)&&Ke(w)&&P(o(s))&&"nested"!==i.data)&&(s._tTime=-Ie,s.render(Math.max(0,-x))),E&&B(o(s),E),s}return u(t,[{key:"render",value:function(e,t,r){var n,a,i=this._time,s=this._tDur,o=this._dur,l=s-Ie<e&&0<=e?s:e<Ie?0:e;if(o){if(l!==this._tTime||!e||r||!this._initted&&this._tTime||this._startAt&&this._zTime<0!=e<0){if(m=l,f=this.timeline,this._repeat){if(h=o+this._rDelay,this._repeat<-1&&e<0)return this.totalTime(100*h+e,t,r);if(m=mt(l%h),l===s?(v=this._repeat,m=o):((v=~~(l/h))&&v===l/h&&(m=o,v--),o<m&&(m=o)),(p=this._yoyo&&1&v)&&(d=this._yEase,m=o-m),b=C(this._tTime,h),m===i&&!r&&this._initted)return this;v!==b&&(f&&this._yEase&&re(f,p),!this.vars.repeatRefresh||p||this._lock||(this._lock=r=1,this.render(mt(h*v),!0).invalidate()._lock=0))}if(!this._initted){if(j(this,e<0?e:m,r,t))return this._tTime=0,this;if(o!==this._dur)return this.render(e,t,r)}if(this._tTime=l,this._time=m,!this._act&&this._ts&&(this._act=1,this._lazy=0),this.ratio=a=(d||this._ease)(m/o),this._from&&(this.ratio=a=1-a),m&&!i&&!t&&(J(this,"onStart"),this._tTime!==l))return this;for(n=this._pt;n;)n.r(a,n.d),n=n._next;f&&f.render(e<0?e:!m&&p?-Ie:f._dur*f._ease(m/this._dur),t,r)||this._startAt&&(this._zTime=e),this._onUpdate&&!t&&(e<0&&this._startAt&&this._startAt.render(e,!0,r),J(this,"onUpdate")),this._repeat&&v!==b&&this.vars.onRepeat&&!t&&this.parent&&J(this,"onRepeat"),l!==this._tDur&&l||this._tTime!==l||(e<0&&this._startAt&&!this._onUpdate&&this._startAt.render(e,!0,!0),!e&&o||!(l===this._tDur&&0<this._ts||!l&&this._ts<0)||xt(this,1),t||e<0&&!i||!l&&!i||(J(this,l===s?"onComplete":"onReverseComplete",!0),!this._prom||l<s&&0<this.timeScale()||this._prom()))}}else{var c,u,h=this,d=e,p=t,f=r,m=h.ratio,g=d<0||!d&&(!h._start&&U(h)&&(h._initted||!N(h))||(h._ts<0||h._dp._ts<0)&&!N(h))?0:1,v=h._rDelay,b=0;if(v&&h._repeat&&(u=C(b=H(0,h._tDur,d),v),h._yoyo&&1&u&&(g=1-g),u!==C(h._tTime,v)&&(m=1-g,h.vars.repeatRefresh&&h._initted&&h.invalidate())),g!==m||f||h._zTime===Ie||!d&&h._zTime){if(h._initted||!j(h,d,f,p)){for(u=h._zTime,h._zTime=d||(p?Ie:0),p=p||d&&!u,h.ratio=g,h._from&&(g=1-g),h._time=0,h._tTime=b,c=h._pt;c;)c.r(g,c.d),c=c._next;h._startAt&&d<0&&h._startAt.render(d,!0,!0),h._onUpdate&&!p&&J(h,"onUpdate"),b&&h._repeat&&!p&&h.parent&&J(h,"onRepeat"),(d>=h._tDur||d<0)&&h.ratio===g&&(g&&xt(h,1),p||(J(h,g?"onComplete":"onReverseComplete",!0),h._prom&&h._prom()))}}else h._zTime||(h._zTime=d)}return this}},{key:"targets",value:function(){return this._targets}},{key:"invalidate",value:function(){return this._pt=this._op=this._startAt=this._onUpdate=this._lazy=this.ratio=0,this._ptLookup=[],this.timeline&&this.timeline.invalidate(),n(l(t.prototype),"invalidate",this).call(this)}},{key:"kill",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"all";if(!(e||t&&"all"!==t))return this._lazy=this._pt=0,this.parent?$(this):this;if(this.timeline)return d=this.timeline.totalDuration(),this.timeline.killTweensOf(e,t,rr&&!0!==rr.vars.overwrite)._first||$(this),this.parent&&d!==this.timeline.totalDuration()&&z(this,this._dur*this.timeline._tDur/d,0,1),this;var r,n,a,i,s,o,l,c=this._targets,u=e?Ot(e):c,h=this._ptLookup,d=this._pt;if((!t||"all"===t)&&function(e,t){for(var r=e.length,n=r===t.length;n&&r--&&e[r]===t[r];);return r<0}(c,u))return"all"===t&&(this._pt=0),$(this);for(r=this._op=this._op||[],"all"!==t&&(Ve(t)&&(s={},M(t,(function(e){return s[e]=1})),t=s),t=function(e,t){var r,n,a,i,s=(e=e[0]?ft(e[0]).harness:0)&&e.aliases;if(!s)return t;for(n in r=D({},t),s)if(n in r)for(a=(i=s[n].split(",")).length;a--;)r[i[a]]=r[n];return r}(c,t)),l=c.length;l--;)if(~u.indexOf(c[l]))for(s in n=h[l],"all"===t?(r[l]=t,i=n,a={}):(a=r[l]=r[l]||{},i=t),i)(o=n&&n[s])&&("kill"in o.d&&!0!==o.d.kill(s)||yt(this,o,"_pt"),delete n[s]),"all"!==a&&(a[s]=1);return this._initted&&!this._pt&&d&&$(this),this}}],[{key:"to",value:function(e,r){return new t(e,r,arguments[2])}},{key:"from",value:function(e,t){return G(1,arguments)}},{key:"delayedCall",value:function(e,r,n,a){return new t(r,0,{immediateRender:!1,lazy:!1,overwrite:!1,delay:e,onComplete:r,onReverseComplete:r,onCompleteParams:n,onReverseCompleteParams:n,callbackScope:a})}},{key:"fromTo",value:function(e,t,r){return G(2,arguments)}},{key:"set",value:function(e,r){return r.duration=0,r.repeatDelay||(r.repeat=0),new t(e,r)}},{key:"killTweensOf",value:function(e,t,r){return le.killTweensOf(e,t,r)}}]),t}()),dr=(vt(hr.prototype,{_targets:[],_lazy:0,_startAt:0,_op:0,_onInit:0}),M("staggerTo,staggerFrom,staggerFromTo",(function(e){hr[e]=function(){var t=new ir,r=Dt.call(arguments,0);return r.splice("staggerFromTo"===e?5:4,0,0),t[e].apply(t,r)}})),function(e,t,r){return e[t]=r}),pr=function(e,t,r){return e[t](r)},fr=function(e,t,r,n){return e[t](n.fp,r)},mr=function(e,t){return Ge(e[t])?pr:m(e[t])&&e.setAttribute?Xt:dr},gr=function(e,t){return t.set(t.t,t.p,Math.round(1e6*(t.s+t.c*e))/1e6,t)},vr=function(e,t){return t.set(t.t,t.p,!!(t.s+t.c*e),t)},br=function(e){for(var t,r,n,a,i=e._pt;i;){for(t=i._next,r=n;r&&r.pr>i.pr;)r=r._next;(i._prev=r?r._prev:a)?i._prev._next=i:n=i,(i._next=r)?r._prev=i:a=i,i=t}e._pt=n},yr=function(){function e(t,r,n,a,i,s,o,l,c){h(this,e),this.t=r,this.s=a,this.c=i,this.p=n,this.r=s||gr,this.d=o||this,this.set=l||dr,this.pr=c||0,(this._next=t)&&(t._prev=this)}return u(e,[{key:"modifier",value:function(e,t,r){this.mSet=this.mSet||this.set,this.set=er,this.m=e,this.mt=r,this.tween=t}}]),e}(),xr=(M(dt+"parent,duration,ease,delay,overwrite,runBackwards,startAt,yoyo,immediateRender,repeat,repeatDelay,data,paused,reversed,lazy,callbackScope,stringFilter,id,yoyoEase,stagger,inherit,repeatRefresh,keyframes,autoRevert,scrollTrigger",(function(e){return it[e]=1})),rt.TweenMax=rt.TweenLite=hr,rt.TimelineLite=rt.TimelineMax=ir,le=new ir({sortChildren:!1,defaults:Re,autoRemoveChildren:!0,id:"root",smoothChildTiming:!0}),Ce.stringFilter=function(e){var t=e.join(" ");if(Bt.lastIndex=0,Bt.test(t))return t=jt.test(t),e[1]=te(e[1],t),e[0]=te(e[0],t,It(e[1])),!0},{registerPlugin:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];t.forEach((function(e){var t=(e=!e.name&&e.default||e).name,r=Ge(e),n=(r=t&&!r&&e.init?function(){this._props=[]}:e,{init:w,render:Yt,add:or,kill:$t,modifier:Jt,rawVars:0}),a={targetTest:0,get:0,getSetter:mr,aliases:{},register:0};if(Nt(),e!==r){if(lt[t])return;vt(r,vt(bt(e,n),a)),D(r.prototype,D(n,bt(e,a))),lt[r.prop=t]=r,e.targetTest&&(ht.push(r),it[t]=1),t=("css"===t?"CSS":t.charAt(0).toUpperCase()+t.substr(1))+"Plugin"}x(t,r),e.register&&e.register(Sr,r,yr)}))},timeline:function(e){return new ir(e)},getTweensOf:function(e,t){return le.getTweensOf(e,t)},getProperty:function(e,t,r,n){Ve(e)&&(e=Ot(e)[0]);var a=ft(e||{}).get,i=r?E:_;return"native"===r&&(r=""),e&&(t?i((lt[t]&<[t].get||a)(e,t,r,n)):function(t,r,n){return i((lt[t]&<[t].get||a)(e,t,r,n))})},quickSetter:function(e,t,r){var n,a;if(1<(e=Ot(e)).length)return n=e.map((function(e){return Sr.quickSetter(e,t,r)})),a=n.length,function(e){for(var t=a;t--;)n[t](e)};e=e[0]||{};var i=lt[t],s=ft(e),o=s.harness&&(s.harness.aliases||{})[t]||t,l=i?function(t){var n=new i;fe._pt=0,n.init(e,r?t+r:t,fe,0,[e]),n.render(1,n),fe._pt&&Yt(1,fe)}:s.set(e,o);return i?l:function(t){return l(e,o,r?t+r:t,s,1)}},isTweening:function(e){return 0<le.getTweensOf(e,!0).length},defaults:function(e){return e&&e.ease&&(e.ease=Ht(e.ease,Re.ease)),k(Re,e||{})},config:function(e){return k(Ce,e||{})},registerEffect:function(e){var t=e.name,r=e.effect,n=e.plugins,a=e.defaults;e=e.extendTimeline,(n||"").split(",").forEach((function(e){return e&&!lt[e]&&!rt[e]&&y(t+" effect requires "+e+" plugin.")})),ct[t]=function(e,t,n){return r(Ot(e),vt(t||{},a),n)},e&&(ir.prototype[t]=function(e,r,n){return this.add(ct[t](e,We(r)?r:(n=r)&&{},this),n)})},registerEase:function(e,t){zt[e]=Ht(t)},parseEase:function(e,t){return arguments.length?Ht(e,t):zt},getById:function(e){return le.getById(e)},exportRoot:function(){var e,t,r=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},n=1<arguments.length?arguments[1]:void 0,a=new ir(r);for(a.smoothChildTiming=Ke(r.smoothChildTiming),le.remove(a),a._dp=0,a._time=a._tTime=le._time,e=le._first;e;)t=e._next,!n&&!e._dur&&e instanceof hr&&e.vars.onComplete===e._targets[0]||I(a,e,e._start-e._delay),e=t;return I(le,a,0),a},utils:{wrap:function e(t,r,n){var a=r-t;return Ze(t)?X(t,e(0,t.length),r):_t(n,(function(e){return(a+(e-t)%a)%a+t}))},wrapYoyo:function e(t,r,n){var a=r-t,i=2*a;return Ze(t)?X(t,e(0,t.length-1),r):_t(n,(function(e){return t+(a<(e=(i+(e-t)%i)%i||0)?i-e:e)}))},distribute:W,random:Z,snap:q,normalize:function(e,t,r){return Q(e,t,0,1,r)},getUnit:Et,clamp:function(e,t,r){return _t(r,(function(r){return H(e,t,r)}))},splitColor:Lt,toArray:Ot,selector:function(e){return e=Ot(e)[0]||y("Invalid scope")||{},function(t){var r=e.current||e.nativeElement||e;return Ot(t,r.querySelectorAll?r:r===e?y("Invalid scope")||he.createElement("div"):e)}},mapRange:Q,pipe:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return function(e){return t.reduce((function(e,t){return t(e)}),e)}},unitize:function(e,t){return function(r){return e(parseFloat(r))+(t||Et(r))}},interpolate:function e(t,r,n,a){var i=isNaN(t+r)?0:function(e){return(1-e)*t+e*r};if(!i){var s,o,l,c,u,h=Ve(t),d={};if(!0===n&&(a=1)&&(n=null),h)t={p:t},r={p:r};else if(Ze(t)&&!Ze(r)){for(l=[],c=t.length,u=c-2,o=1;o<c;o++)l.push(e(t[o-1],t[o]));c--,i=function(e){e*=c;var t=Math.min(u,~~e);return l[t](e-t)},n=r}else a||(t=D(Ze(t)?[]:{},t));if(!l){for(s in r)or.call(d,t,s,"get",r[s]);i=function(e){return Yt(e,d),h?t.p:t}}}return _t(n,i)},shuffle:Pt},install:b,effects:ct,ticker:Ut,updateRoot:ir.updateRoot,plugins:lt,globalTimeline:le,core:{PropTween:yr,globals:x,Tween:hr,Timeline:ir,Animation:ar,getCache:ft,_removeLinkedListItem:yt,suppressOverwrites:function(e){return oe=e}}}),wr=(M("to,from,fromTo,delayedCall,set,killTweensOf",(function(e){return xr[e]=hr[e]})),Ut.add(ir.updateRoot),fe=xr.to({},{duration:0}),function(e,t){for(var r=e._pt;r&&r.p!==t&&r.op!==t&&r.fp!==t;)r=r._next;return r}),Sr=xr.registerPlugin({name:"attr",init:function(e,t,r,n,a){var i,s;for(i in t)(s=this.add(e,"setAttribute",(e.getAttribute(i)||0)+"",t[i],n,a,0,0,i))&&(s.op=i),this._props.push(i)}},{name:"endArray",init:function(e,t){for(var r=t.length;r--;)this.add(e,r,e[r]||0,t[r])}},tr("roundProps",K),tr("modifiers"),tr("snap",q))||xr;hr.version=ir.version=Sr.version="3.9.1",de=1,g()&&Nt(),zt.Power0,zt.Power1,zt.Power2,zt.Power3,zt.Power4,zt.Linear,zt.Quad,zt.Cubic,zt.Quart,zt.Quint,zt.Strong,zt.Elastic,zt.Back,zt.SteppedEase,zt.Bounce,zt.Sine,zt.Expo,zt.Circ},4230:(e,t,r)=>{r.d(t,{N:()=>o,Z:()=>s});var n=r(8881),a=r(1794),i=r(6272);class s{constructor(e){this.mode="PerspectiveCamera",this.oCam=this.createOrthographic(),this.pCam=this.create(),this.onInited=()=>{this.runScene.cb.events.model.addOptions.cb({name:"camera",map:{parse:e=>Promise.all(e.childs.map((e=>new Promise((t=>{this.setTemp(e,{time:.5,onComplete:()=>{t(0)}})})))))}})},this.clean=()=>{this.temp.clear()},this.backgroudDom=null,this.temp=new a.Z,this.pointerDown=()=>{this.closeAnima()},this.animaData={animaIns:null,onComplete:null},this.runScene=e,this.runScene.cb.resize.add("camera-background",(()=>{var e,t;this.backgroudDom&&(({width:e,height:t}=this.runScene.renderEx.getDomSize()),this.backgroudDom.style.width=e+"px",this.backgroudDom.style.height=t+"px")})),this.runScene.cb.events.pointer.down.add("camera",this.pointerDown),this.runScene.cb.clean.add("camera",this.clean),this.runScene.cb.inited.add("camera",this.onInited)}setBackground(e){const t=this.runScene.assetsEx.engineDom;var r,n;this.backgroudDom||(this.backgroudDom=document.createElement("div"),({width:r,height:n}=this.runScene.assetsEx.renderer.domElement.getBoundingClientRect()),this.backgroudDom.style.position="absolute",this.backgroudDom.style.left="50%",this.backgroudDom.style.top="50%",this.backgroudDom.style.transform="translate(-50%,-50%)",this.backgroudDom.style.width=r+"px",this.backgroudDom.style.height=n+"px",t.appendChild(this.backgroudDom)),e?(this.backgroudDom.style.display="block",this.backgroudDom.style.backgroundImage="url("+e+")",this.backgroudDom.style.backgroundRepeat="no-repeat",this.backgroudDom.style.backgroundSize="100% 100%"):this.backgroudDom.style.display="none"}create(){return new n.PerspectiveCamera}createOrthographic(){return new n.OrthographicCamera}setMode(e){if(e!==this.mode){this.runScene.helperEx.transContro.reset(),this.mode=e,this.runScene.assetsEx.reset(),this.reset(this.getCamera()),this.setSize();const t=this.runScene.assetsEx.get().controls;"OrthographicCamera"===e&&(t.enableRotate=!1,t.enablePan=!1)}}getCamera(){return"OrthographicCamera"===this.mode?this.oCam:this.pCam}reset(e){e.position.set(0,20,20),e.near=.1,e.far=1e3,e.fov=50,e.updateProjectionMatrix()}get(){return this.runScene.assetsEx.get().camera}setSize(){var{width:e,height:t}=this.runScene.renderEx.getDomSize();const r=this.getCamera();r.aspect=e/t,r.updateProjectionMatrix()}addTemp(e){var{name:e,data:t}=e;this.temp.set(e,{name:e,data:t})}delTemp(e){this.temp.delete(e)}getLocal(){var{camera:e,controls:t}=this.runScene.assetsEx,{x:e,y:r,z:n}=e.position,{x:t,y:a,z:i}=t.target;return{x:e,y:r,z:n,tx:t,ty:a,tz:i}}closeAnima(){var e,t;null!=(e=this.animaData.animaIns)&&e.kill(),(this.animaData.animaIns=null)!=(t=(e=this.animaData).onComplete)&&t.call(e),this.animaData.onComplete=null}setTemp(e,t){return(e=this.temp.get(e))?this.anima(e.data,t):Promise.resolve()}anima(e,t){return new Promise((r=>{const{time:n,onComplete:a,onUpdate:s}=t||{},{camera:o,controls:l}=this.runScene.assetsEx;this.closeAnima(),this.animaData.onComplete=a,this.animaData.animaIns=(0,i.gY)(this.getLocal(),e,n||.5,(e=>{var{x:t,y:r,z:n,tx:a,ty:i,tz:c}=e;o.position.set(t,r,n),l.target.set(a,i,c),l.update(),null!=s&&s(e)}),(()=>{null!=a&&a(),r(0)}))}))}static toJSON(e){const t=e.assetsEx.camera;return{temp:e.cameraEx.temp.toJSON(),camera:t.toJSON()}}}const o=e=>null==e?void 0:e.isCamera},4330:(e,t,r)=>{r.d(t,{sG:()=>n,zX:()=>a});const n=["map","normalMap","aoMap"],a=["map","metalnessMap","roughnessMap","normalMap","aoMap","emissiveMap","alphaMap","lightMap","envMap","displacementMap"]},3263:(e,t,r)=>{r.d(t,{F6:()=>n,YD:()=>c});var n={};r.r(n),r.d(n,{filter:()=>a,isDef:()=>l,isEmpty:()=>i,notEmpty:()=>s,random:()=>o});const a=e=>e.filter((e=>e)),i=e=>0===e.length,s=e=>0!==e.length,o=e=>{var t=Math.random()*e.length;return e[Math.floor(t)]},l=(e,t)=>{for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!0;return!1};r(1794),r(272);var c=r(7201)},1794:(e,t,r)=>{r.d(t,{Z:()=>a});var n=r(6001);class a extends Map{constructor(e){e?super((0,n.mapObj)(e,((e,t)=>[e,t]))):super()}toArray(e){let t=[];for(const r of this.entries())"key"==e?t.push(r[0]):t.push(r[1]);return t}map(e){return[...this.entries()].map((t=>{var[t,r]=t;return e(t,r)}))}toJSON(){const e={};return this.forEach(((t,r)=>{e[r]=t})),e}toString(){return JSON.stringify(this.map)}filterData(e){let t=[];for(var[r,n]of this.entries())e(r,n)&&t.push({key:r,val:n});return t}find(e){for(var[t,r]of this.entries())if(e(t,r))return r}static formJSON(e){return new a(e)}copy(e){e.map(((e,t)=>this.set(e,t)))}}},7201:(e,t,r)=>{r.r(t),r.d(t,{is:()=>i,isDef:()=>a,logObj:()=>u,objLength:()=>h,objToStr:()=>c,replaceKVForObj:()=>o,replaceKeyForObj:()=>l,replaceValForObj:()=>s});var n=r(6001);const a=(e,t)=>{if(!i(e))return!0;var r=Object.keys(e);for(let o=0;o<r.length;o++){var n=r[o],s=e[n];if(n=t[n],i(s))return!i(n)||a(s,n);if(s!==n)return!0}return!1},i=e=>(null==e?void 0:e.constructor)===Object,s=(e,t)=>{let r={};return Object.keys(e).map(((n,a)=>{var i=e[n];r[n]=t(n,i,a)})),r},o=(e,t)=>{let r={};return Object.keys(e).map(((n,a)=>{var i=e[n],{k:n,v:i}=t(n,i,a);r[n]=i})),r},l=(e,t)=>{let r={};return Object.keys(e).map(((n,a)=>{var i=e[n];r[t(n,i,a)]=i})),r},c=e=>{let t="";return(0,n.mapObj)(e,((e,r)=>{t=(t+=e+":")+(i(r)?c(r):r)})),t},u=e=>{console.log(c(e))},h=e=>Object.keys(e).length},272:(e,t,r)=>{r.d(t,{Z:()=>n});class n extends Set{constructor(e){super(),this.isSet=!0,null!=e&&e.map((e=>this.add(e)))}add(e){return Array.isArray(e)?e.map((e=>this.add(e))):super.add(e),this}remove(e){if(Array.isArray(e))e.map((e=>this.remove(e)));else{if(!super.has(e))return;super.delete(e)}return this}toArray(){return[...this]}map(e,t=!1){const r=[];return this.forEach((n=>{if(n=e(n),!t)return r.push(n);n&&r.push(n)})),r}find(e){for(const t of this)if(e(t))return t}filter(e){const t=[];for(const r of this)e(r)&&t.push(r);return t}toJSON(){return this.toArray()}}},5247:(e,t,r)=>{r.d(t,{Z:()=>a,z:()=>n.z}),t=r(8881);var n=r(3151);const a=t},7625:(e,t,r)=>{r.d(t,{Z:()=>n});class n{constructor(e){this.snapshot={create:e=>({}),set(e){}},this.runScene=e}}},7585:(e,t,r)=>{r.d(t,{Z:()=>u});var n=r(6756),a=r(3736),i=r(1398),s=r(3729),o=r(5317);t=r(7625);const l={far:1e5,near:.5,mapSizeX:512,scaleX:1,targetPosition:{x:0,y:-10,z:0}},c={position:{type:"v3",val:{x:0,y:10,z:0},shortKey:"p"},intensity:{type:"number",val:1,shortKey:"i"},visible:{type:"other",val:!0,shortKey:"v"},color:{type:"color",val:{r:1,g:1,b:1},shortKey:"c"}};class u extends t.Z{constructor(){super(...arguments),this.type="DirectionalLight",this.parseNromalLight=e=>(e=this.parseJSON(e.normal),this.runScene.lightEx.update(e[0]),e),this.toNormalLight=e=>{var{type:e,model:t}=e;if(e===this.type){const e=(0,n.createDefModel)("Box");return e.userData.normal=Object.assign({type:this.type},u.toJSON(t)),e}}}static toJSON(e){const{intensity:t,name:r,type:n,position:a,visible:i,color:o,castShadow:l,shadow:c,rotation:u,target:h}=e;var{mapSize:d,camera:p}=c,{scale:p,near:f,far:m}=p;return{type:n,intensity:t,name:r,visible:i,color:o.getHexString(),castShadow:l,shadow:{mapSize:d.x,camera:{near:f,far:m,scale:p.x}},id:(0,s.Ki)(e),position:{x:a.x,y:a.y,z:a.z},rotation:{x:u.x,y:u.y,z:u.z},targetPosition:{x:h.position.x,y:h.position.y,z:h.position.z}}}parseJSON(e,t){t=this.runScene.lightEx.get("DirectionalLight",t);var[r]=t;return u.setConfig(r,e),(0,a.M)(r,"id",e.id),t}get(e){return this.runScene.lightEx.get("DirectionalLight",e)}static setConfig(e,t){var{intensity:t,position:r,rotation:n,targetPosition:a,name:i,visible:s,color:l,castShadow:c,shadow:u}=t,{mapSize:u,camera:h}=u,{scale:h,near:d,far:p}=h;e.intensity=t,e.name=i,e.visible=s,e.castShadow=c,e.color=(0,o.getColorByHexStr)(l),r&&e.position.set(r.x,r.y,r.z),n&&e.rotation.set(n.x,n.y,n.z),a&&e.target.position.set(a.x,a.y,a.z),e.add(e.target),e.shadow.mapSize.x=u,e.shadow.mapSize.y=u,e.shadow.camera.scale.x=h,e.shadow.camera.scale.y=h,e.shadow.camera.scale.z=h,e.shadow.camera.near=d,e.shadow.camera.far=p,e.shadow.camera.updateProjectionMatrix(),null!=(t=e.cameraHelper)&&t.update()}setConfig(e,t){return u.setConfig(e,t)}}u.snapshot={create:e=>{const t=i.LV.getDiff(c,e);var r=e.shadow,{mapSize:r,camera:n}=r,{scale:n,near:a,far:s}=n,{x:e,y:u,z:h}=e.target.position;return(0,o.isDef)(r.x,l.mapSizeX)&&(t.m=r.x),(0,o.isDef)({x:e,y:u,z:h},l.targetPosition)&&(t.tp={x:e,y:u,z:h}),(0,o.isDef)(n.x,l.scaleX)&&(t.s=n.x),(0,o.isDef)(a,l.near)&&(t.n=a),(0,o.isDef)(s,l.far)&&(t.f=s),t},set:e=>{const{map:t,light:r,runScene:n,data:a}=e,{m:s,tp:o,s:u,n:h,f:d}=(i.LV.set({def:c,data:a,runScene:n,map:t,target:r}),a);t.data.completedCbs.push((()=>{var{far:e,near:t,mapSizeX:n,scaleX:a,targetPosition:i}=l,{x:i,y:c,z:p}=o||i,i=(r.target.position.set(i,c,p),s||n),c=(r.shadow.mapSize.x=i,r.shadow.mapSize.y=i,u||a);r.shadow.camera.scale.x=c,r.shadow.camera.scale.y=c,r.shadow.camera.scale.z=c,r.shadow.camera.near=h||t,r.shadow.camera.far=d||e,r.shadow.camera.updateProjectionMatrix(),null!=(p=r.cameraHelper)&&p.update()}))}}},1269:(e,t,r)=>{r.d(t,{ZP:()=>k,RQ:()=>O});var n=r(6001),a=r(8881);function i(e){return(i="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})(e)}function s(e,t){return(s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function o(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=l(e);if(r=t?(r=l(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===i(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function l(e){return(l=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var c=function(e){var t=n;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&s(t,e);var r=o(n);function n(e,t){if(!(this instanceof n))throw new TypeError("Cannot call a class as a function");var i=new a.BufferGeometry,s=(i.setAttribute("position",new a.Float32BufferAttribute([1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],3)),i.computeBoundingSphere(),new a.LineBasicMaterial({fog:!1}));return((i=r.call(this,i,s)).light=e,i.color=t,i.type="RectAreaLightHelper",s=new a.BufferGeometry).setAttribute("position",new a.Float32BufferAttribute([1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],3)),s.computeBoundingSphere(),i.add(new a.Mesh(s,new a.MeshBasicMaterial({side:a.BackSide,fog:!1}))),i}return t=n,(e=[{key:"updateMatrixWorld",value:function(){var e,t;this.scale.set(.5*this.light.width,.5*this.light.height,1),void 0!==this.color?(this.material.color.set(this.color),this.children[0].material.color.set(this.color)):(this.material.color.copy(this.light.color).multiplyScalar(this.light.intensity),e=this.material.color,1<(t=Math.max(e.r,e.g,e.b))&&e.multiplyScalar(1/t),this.children[0].material.color.copy(this.material.color)),this.matrixWorld.extractRotation(this.light.matrixWorld).scale(this.scale).copyPosition(this.light.matrixWorld),this.children[0].matrixWorld.copy(this.matrixWorld)}},{key:"dispose",value:function(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),n}(a.Line),u=r(5247),h=r(3736),d=r(1398),p=r(3729),f=(t=r(7625),r(6756));const m={intensity:{type:"number",val:1,shortKey:"i"},visible:{type:"other",val:!0,shortKey:"v"},color:{type:"color",val:{r:1,g:1,b:1},shortKey:"c"}};class g extends t.Z{constructor(){super(...arguments),this.parseNromalLight=e=>(e=this.parseJSON(e.normal),this.runScene.lightEx.update(e[0]),e),this.toNormalLight=e=>{var{type:e,model:t}=e;if(e===this.type){const e=(0,f.createDefModel)("Box");return e.userData.normal=Object.assign({type:this.type},g.toJSON(t)),e}},this.type="AmbientLight"}get(){}static toJSON(e){const{type:t,intensity:r,name:n,visible:a,color:i}=e;return{type:t,intensity:r,name:n,visible:a,id:(0,p.Ki)(e),color:i.getHexString()}}setConfig(e,t){var{type:t,intensity:r,name:n,visible:a,color:i}=t;return e.intensity=r,e.type=t,e.name=n,e.visible=a,e.color=new u.Z.Color("#"+i),e}parseJSON(e){var t=this.runScene.lightEx.get("AmbientLight"),[r]=t,n=e.id;return this.setConfig(r,e),(0,h.M)(r,"id",n),t}}g.snapshot={create:e=>d.LV.getDiff(m,e),set:e=>{var{map:e,light:t,runScene:r,data:n}=e;d.LV.set({def:m,data:n,runScene:r,map:e,target:t})}};var v=r(7585);class b extends t.Z{constructor(){super(...arguments),this.parseNromalLight=e=>(e=this.parseJSON(e.normal),this.runScene.lightEx.update(e[0]),e),this.toNormalLight=e=>{var{type:e,model:t}=e;if(e===this.type){const e=(0,f.createDefModel)("Box");return e.userData.normal=Object.assign({type:this.type},b.toJSON(t)),e}},this.type="HemisphereLight"}get(){throw new Error("Method not implemented.")}static toJSON(e){const{type:t,intensity:r,name:n,visible:a,color:i,groundColor:s,position:o}=e;return{name:n,id:(0,p.Ki)(e),type:t,intensity:r,visible:a,position:{x:o.x,y:o.y,z:o.z},groundColor:s.getHexString(),color:i.getHexString()}}setConfig(e,t){var{type:t,intensity:r,name:n,visible:a,color:i,groundColor:s,position:o}=t;e.type=t,e.intensity=r,e.name=n,e.visible=a,e.color=new u.Z.Color("#"+i),e.groundColor=new u.Z.Color("#"+s),e.position.set(o.x,o.y,o.z)}parseJSON(e){var t=this.runScene.lightEx.get("HemisphereLight"),[r]=t,n=e.id;return this.setConfig(r,e),(0,h.M)(r,"id",n),t}}class y extends t.Z{constructor(){super(...arguments),this.parseNromalLight=e=>(e=this.parseJSON(e.normal),this.runScene.lightEx.update(e[0]),e),this.toNormalLight=e=>{var{type:e,model:t}=e;if(e===this.type){const e=(0,f.createDefModel)("Box");return e.userData.normal=Object.assign({type:this.type},y.toJSON(t)),e}},this.type="PointLight"}get(){throw new Error("Method not implemented.")}static toJSON(e){const{name:t,type:r,intensity:n,distance:a,decay:i,renderOrder:s,color:o,visible:l,castShadow:c,shadow:u,position:h}=e;var{mapSize:d,camera:f,bias:m,radius:g}=u,{scale:f,near:v,far:b}=f;return{name:t,type:r,intensity:n,visible:l,color:o.getHexString(),castShadow:c,id:(0,p.Ki)(e),distance:a,decay:i,renderOrder:s,shadow:{mapSize:d.x,camera:{near:v,far:b,scale:f.x},radius:g,bias:m},position:{x:h.x,y:h.y,z:h.z}}}setConfig(e,t){var{name:t,type:r,intensity:n,distance:a,decay:i,renderOrder:s,color:o,visible:l,castShadow:c,shadow:h,position:d}=t,{mapSize:h,camera:p,bias:f,radius:m}=h,{scale:p,near:g,far:v}=p;e.intensity=n,e.type=r,e.name=t,e.visible=l,e.castShadow=c,e.distance=a,e.renderOrder=s,e.color=new u.Z.Color("#"+o),e.position.set(d.x,d.y,d.z),e.shadow.mapSize.x=h,e.shadow.mapSize.y=h,e.shadow.bias=f,e.decay=i,e.shadow.radius=m,e.shadow.camera.scale.x=p,e.shadow.camera.scale.y=p,e.shadow.camera.scale.z=p,e.shadow.camera.near=g,e.shadow.camera.far=v,e.shadow.camera.updateProjectionMatrix()}parseJSON(e){var t=this.runScene.lightEx.get("PointLight"),[r]=t,n=e.id;return this.setConfig(r,e),(0,h.M)(r,"id",n),t}}class x extends t.Z{constructor(){super(...arguments),this.parseNromalLight=e=>(e=this.parseJSON(e.normal),this.runScene.lightEx.update(e[0]),e),this.toNormalLight=e=>{var{type:e,model:t}=e;if(e===this.type){const e=(0,f.createDefModel)("Box");return e.userData.normal=Object.assign({type:this.type},x.toJSON(t)),e}},this.type="RectAreaLight"}get(){throw new Error("Method not implemented.")}static toJSON(e){const{type:t,intensity:r,name:n,visible:a,color:i,position:s}=e;return{name:n,type:t,intensity:r,id:(0,p.Ki)(e),visible:a,position:{x:s.x,y:s.y,z:s.z},color:i.getHexString()}}setConfig(e,t){var{type:t,intensity:r,name:n,visible:a,color:i,position:s}=t;e.type=t,e.intensity=r,e.name=n,e.visible=a,e.color=new u.Z.Color("#"+i),e.position.set(s.x,s.y,s.z)}parseJSON(e){var t=this.runScene.lightEx.get("RectAreaLight"),[r]=t,n=e.id;return this.setConfig(r,e),(0,h.M)(r,"id",n),t}}class w extends t.Z{constructor(){super(...arguments),this.parseNromalLight=e=>(e=this.parseJSON(e.normal),this.runScene.lightEx.update(e[0]),e),this.toNormalLight=e=>{var{type:e,model:t}=e;if(e===this.type){const e=(0,f.createDefModel)("Box");return e.userData.normal=Object.assign({type:this.type},w.toJSON(t)),e}},this.type="SpotLight"}get(){throw new Error("Method not implemented.")}static toJSON(e){const{name:t,type:r,color:n,distance:a,decay:i,intensity:s,angle:o,penumbra:l,visible:c,castShadow:u,shadow:h,renderOrder:d,position:f,target:m}=e;var{bias:g,camera:v,normalBias:b,mapSize:y,radius:x}=h,v=v.near;return{type:r,intensity:s,name:t,visible:c,distance:a,angle:o,id:(0,p.Ki)(e),decay:i,penumbra:l,renderOrder:d,color:n.getHexString(),castShadow:u,shadow:{bias:g,normalBias:b,mapSize:y.x,camera:{near:v},radius:x},position:{x:f.x,y:f.y,z:f.z},targetPosition:{x:m.position.x,y:m.position.y,z:m.position.z}}}setConfig(e,t){var{name:t,type:r,color:n,distance:a,decay:i,intensity:s,angle:o,penumbra:l,visible:c,castShadow:h,shadow:d,renderOrder:p,position:f,targetPosition:m}=t,{bias:d,camera:g,normalBias:v,mapSize:b,radius:y}=d,g=g.near;return e.intensity=s,e.type=r,e.name=t,e.visible=c,e.distance=a,e.decay=i,e.angle=o,e.penumbra=l,e.renderOrder=p,e.castShadow=h,e.color=new u.Z.Color("#"+n),e.position.set(f.x,f.y,f.z),e.shadow.mapSize.x=b,e.shadow.mapSize.y=b,e.shadow.camera.near=g,e.target.position.set(m.x,m.y,m.z),e.shadow.bias=d,e.shadow.normalBias=v,e.shadow.radius=y,e.shadow.camera.updateProjectionMatrix(),e}parseJSON(e){var t=this.runScene.lightEx.get("SpotLight"),[r]=t,n=e.id;return this.setConfig(r,e),(0,h.M)(r,"id",n),t}}var S=r(3735),M=r(2510),T=r(7169),_=r(5317),E=r(7201);const D={DirectionalLight:v.Z,PointLight:y,SpotLight:w,RectAreaLight:x,HemisphereLight:b,AmbientLight:g};class k{constructor(e){this.inited=()=>{(0,n.mapObj)(this.lightExMap,((e,t)=>{this.runScene.modelEx.importAndExport.addParses(t.type,{parse:t.parseNromalLight,toNormal:t.toNormalLight})}))},this.shadowList=["DirectionalLight","PointLight","SpotLight"],this.helperList=["DirectionalLight","PointLight","SpotLight","RectAreaLight","HemisphereLight"],this.helperUpdateList=["DirectionalLight","PointLight","SpotLight","HemisphereLight"],this.snapshot={create:e=>{const t=this.runScene.assetsEx.scene.children.filter((e=>this.isLight(e)&&!(0,f.isHelper)(e))),r={};t.map((e=>{var t=e.type,n=(0,p.Ki)(e),a=null==(a=null==(t=this.lightExMap[t].snapshot)?void 0:t.create)?void 0:a.call(t,e);a&&n&&(r[n]=a)})),0!==(0,E.objLength)(r)&&e.data.set("light",r)},set:e=>{var t=e.snapshot.data.get("light");t&&(0,n.mapObj)(t,((t,r)=>{var n,a=((t=this.runScene.modelEx.getById(t))||{}).type;a&&null!=(n=null==(a=this.lightExMap[a].snapshot)?void 0:a.set)&&n.call(a,{data:r,runScene:this.runScene,light:t,map:e})}))}},this.runScene=e,this.lightExMap={DirectionalLight:new v.Z(e),PointLight:new y(e),SpotLight:new w(e),RectAreaLight:new x(e),HemisphereLight:new b(e),AmbientLight:new g(e)},e.cb.snapshot.create.add("light",this.snapshot.create),e.cb.snapshot.set.add("light",this.snapshot.set),e.cb.snapshot.getLength.add("light",(e=>{var t=e.data.data.get("light");t&&(e.inputData.light=Object.keys(t).length)})),e.cb.inited.add("light",this.inited)}getLightsByScene(e=this.runScene.sceneEx.get()){return e.children.filter((e=>e.isLight))}add(e,t){e=e.map((e=>this.runScene.modelEx.add(e,void 0,Object.assign(Object.assign({},t),{select:!!O(e)&&t.select,addUndo:!1})))),t.addUndo&&this.runScene.undoEx.addUndo(e)}get(e,t){t=(0,_.mergeObject)({id:(0,n.getId)()},t).id;let r=new u.Z[e],a=[r];return r.position.y=10,r.name=e,r.userData.id=t,this.shadowList.includes(e)&&(r.castShadow=!0),this.setLight(r),a.push(...this.setLightHelper(r)),null!=(t=null==r?void 0:r.lightHelper)&&t.update(),a}setNull(e){e.lightTarget&&this.setNull(e.lightTarget),this.isLight(e)&&("DirectionalLight"===e.type?e.cameraHelper&&(e.cameraHelper.visible=!1):"SpotLight"===e.type&&(e.cameraHelper&&(e.cameraHelper.visible=!1),e.helper&&(e.helper.visible=!0)))}setSelect(e){e.lightTarget&&this.setSelect(e.lightTarget),this.isLight(e)&&("DirectionalLight"===e.type?e.cameraHelper&&(e.cameraHelper.visible=!0):"SpotLight"===e.type&&(e.cameraHelper&&(e.cameraHelper.visible=!0),e.helper&&(e.helper.visible=!0)))}update(e){var t;e.userData.isLightTarget&&e.lightTarget&&(e=e.lightTarget),this.isLight(e)&&("DirectionalLight"===e.type||"SpotLight"===e.type?(null!=(t=e.helper)&&t.update(),null!=(t=e.cameraHelper)&&t.update()):null!=(e=null==(t=e.helper)?void 0:t.update)&&e.call(t))}remove(e,t=!0){let r;return this.runScene.helperEx.unfocus(),r="DirectionalLight"===e.type||"SpotLight"===e.type?[e,e.cameraHelper,e.helper].map((t=>{if(t)return new T.Z({addTree:t===e,runScene:this.runScene,model:t,parent:t.parent||this.runScene.sceneEx.get()}).execute()})).filter((e=>e)):[e,e.helper].map((t=>{if(t)return new T.Z({addTree:t===e,runScene:this.runScene,model:t,parent:t.parent||this.runScene.sceneEx.get()}).execute()})).filter((e=>e)),t&&r&&this.runScene.undoEx.addUndo(r),r}getLightHelper(e,t){this.runScene.uniqueEx.model.add(t);const r=(0,p.Ki)(t);let n,a=[];switch(e){case"RectAreaLight":n=new c(t,16773120);break;case"DirectionalLight":if(n=new u.Z.DirectionalLightHelper(t,1,16711680),t.children[0])t.target=t.children[0];else{let e=new u.Z.Object3D;(t.target=e).name="helperModel",e.position.y=-10,t.shadow.autoUpdate=!0,e.userData.isLightTarget=!0,(e.lightTarget=t).add(e)}t.shadow.camera.layers.set(1),t.shadow.camera.far=1e5,t.shadowCameraLeft=-5,t.shadowCameraRight=5,t.shadowCameraTop=5,t.shadowCameraBottom=-5,t.shadow.camera.updateProjectionMatrix();const e=new u.Z.CameraHelper(t.shadow.camera);t.shadow.camera.matrixWorldNeedsUpdate=!0,this.runScene.helperEx.setHelper(e,!0,(e=>{e.userData.id=r,e.userData.unClick=!0})),e.userData.id=r,e.userData.unClick=!0,e.visible=!1,t.cameraHelper=e,a.push(e);break;case"PointLight":n=new u.Z.PointLightHelper(t,1,16711935);break;case"SpotLight":n=new u.Z.SpotLightHelper(t);let i=new u.Z.Object3D;(t.target=i).name="helperModel",i.userData.isLightTarget=!0,i.lightTarget=t,i.position.y=-10,t.shadow.autoUpdate=!0,t.add(i);const s=new u.Z.CameraHelper(t.shadow.camera);t.shadow.camera.matrixWorldNeedsUpdate=!0,this.runScene.helperEx.setHelper(s,!0,(e=>{e.userData.id=r})),s.userData.id=r,s.visible=!1,t.cameraHelper=s,a.push(s);break;case"HemisphereLight":n=new u.Z.HemisphereLightHelper(t,1,16773135)}return n.name="helperModel",this.runScene.helperEx.setHelper(n,!0,(e=>{e.userData.id=r})),n.userData.id=r,(n.light=t).helper=n,this.update(t),a.push(n),a}setLightHelper(e){return"editor"===this.runScene.optionsEx.options.mode&&this.helperList.includes(e.type)?this.getLightHelper(e.type,e):[]}isUpdateHelper(e){return this.helperUpdateList.includes(e)}initLight(e){e.forEach((e=>this.setLightHelper(e)))}setNormal(e,t=0){var{model:e,info:r,val:n,cb:a}=e;return new M.Z({target:e,runScene:this.runScene,info:r,oldVal:e[r],newVal:n,cb:a}).execute()}setMultip(e,t,r=!0,n=!0){if(e instanceof Array)return a=e.map((e=>{var{model:e,typeList:n,newVal:a}=e;const i=new S.Z({target:e,typeList:n,newVal:a,cb:t});return r?i.execute():i})),n&&this.runScene.undoEx.addUndo(a),a;{var{model:a,typeList:e,newVal:i}=e;const s=new S.Z({target:a,typeList:e,newVal:i,cb:t});return n&&this.runScene.undoEx.addUndo(s),r?s.execute():s}}isLight(e){return null==(e=null==e?void 0:e.userData)?void 0:e.isLight}setLight(e){e.userData.isLight=!0}isHelperTarget(e){return e.userData.isLightTarget}clone(e){var t=D[e.type].toJSON(e),r=this.get(e.type),[n]=r;return this.lightExMap[e.type].setConfig(n,t),r}toJSON(e){return e.filter((e=>!(0,f.isHelper)(e))).map((e=>D[e.type].toJSON(e)))}}const O=e=>null==(e=null==e?void 0:e.userData)?void 0:e.isLight},2353:(e,t,r)=>{r.d(t,{B:()=>Ie,Z:()=>Le});var n=r(8881),a=(t=r(3300),r.n(t));function i(e){return(i="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})(e)}r(6001);var s=function(){var e=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]),t=new Uint8Array([32,0,65,2,1,106,34,33,3,128,11,4,13,64,6,253,10,7,15,116,127,5,8,12,40,16,19,54,20,9,27,255,113,17,42,67,24,23,146,148,18,14,22,45,70,69,56,114,101,21,25,63,75,136,108,28,118,29,73,115]);if("object"!==("undefined"==typeof WebAssembly?"undefined":i(WebAssembly)))return{supported:!1};var r,n=WebAssembly.validate(e)?"b9H79TebbbeKl9Gbb9Gvuuuuueu9Giuuub9Geueuikqbbebeedddilve9Weeeviebeoweuec:q;Aekr;leDo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbdY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVblE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtboK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbrL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949Wbwl79IV9RbDq;t9tqlbzik9:evu8Jjjjjbcz9Rhbcbheincbhdcbhiinabcwfadfaicjuaead4ceGglE86bbaialfhiadcefgdcw9hmbkaec:q:yjjbfai86bbaecitc:q1jjbfab8Piw83ibaecefgecjd9hmbkk;h8JlHud97euo978Jjjjjbcj;kb9Rgv8Kjjjjbc9:hodnadcefal0mbcuhoaiRbbc:Ge9hmbavaialfgrad9Rad;8qbbcj;abad9UhoaicefhldnadTmbaoc;WFbGgocjdaocjd6EhwcbhDinaDae9pmeawaeaD9RaDawfae6Egqcsfgoc9WGgkci2hxakcethmaocl4cifcd4hPabaDad2fhscbhzdnincehHalhOcbhAdninaraO9RaP6miavcj;cbfaAak2fhCaOaPfhlcbhidnakc;ab6mbaral9Rc;Gb6mbcbhoinaCaofhidndndndndnaOaoco4fRbbgXciGPlbedibkaipxbbbbbbbbbbbbbbbbpklbxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklbalczfhlkdndndndndnaXcd4ciGPlbedibkaipxbbbbbbbbbbbbbbbbpklzxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklzalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklzalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklzalczfhlkdndndndndnaXcl4ciGPlbedibkaipxbbbbbbbbbbbbbbbbpklaxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklaalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklaalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklaalczfhlkdndndndndnaXco4Plbedibkaipxbbbbbbbbbbbbbbbbpkl8WxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibaXc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spkl8WalclfaYpQbfaXc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibaXc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spkl8WalcwfaYpQbfaXc:q:yjjbfRbbfhlxekaialpbbbpkl8Walczfhlkaoc;abfhiaocjefak0meaihoaral9Rc;Fb0mbkkdndnaiak9pmbaici4hoinaral9RcK6mdaCaifhXdndndndndnaOaico4fRbbaocoG4ciGPlbedibkaXpxbbbbbbbbbbbbbbbbpklbxikaXalpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaXalpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaXalpbbbpklbalczfhlkaocdfhoaiczfgiak6mbkkalTmbaAci6hHalhOaAcefgohAaoclSmdxekkcbhlaHceGmdkdnakTmbavcjdfazfhiavazfpbdbhYcbhXinaiavcj;cbfaXfgopblbgLcep9TaLpxeeeeeeeeeeeeeeeegQp9op9Hp9rgLaoakfpblbg8Acep9Ta8AaQp9op9Hp9rg8ApmbzeHdOiAlCvXoQrLgEaoamfpblbg3cep9Ta3aQp9op9Hp9rg3aoaxfpblbg5cep9Ta5aQp9op9Hp9rg5pmbzeHdOiAlCvXoQrLg8EpmbezHdiOAlvCXorQLgQaQpmbedibedibedibediaYp9UgYp9AdbbaiadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaEa8EpmwDKYqk8AExm35Ps8E8FgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaLa8ApmwKDYq8AkEx3m5P8Es8FgLa3a5pmwKDYq8AkEx3m5P8Es8Fg8ApmbezHdiOAlvCXorQLgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaLa8ApmwDKYqk8AExm35Ps8E8FgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfhiaXczfgXak6mbkkazclfgzad6mbkasavcjdfaqad2;8qbbavavcjdfaqcufad2fad;8qbbaqaDfhDc9:hoalmexikkc9:hoxekcbc99aral9Radcaadca0ESEhokavcj;kbf8Kjjjjbaokwbz:bjjjbk;uzeHu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnaeci9UgrcHfal0mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecje;8kbavcUf9cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhodnaeTmbcmcsaDceSEhkcbhxcbhmcbhDcbhicbhlindnaoaq9nmbc9:hoxikdndnawRbbgrc;Ve0mbavc;abfalarcl4cu7fcsGcitfgPydlhsaPydbhzdnarcsGgPak9pmbavaiarcu7fcsGcdtfydbaxaPEhraPThPdndnadcd9hmbabaDcetfgHaz87ebaHcdfas87ebaHclfar87ebxekabaDcdtfgHazBdbaHclfasBdbaHcwfarBdbkaxaPfhxavc;abfalcitfgHarBdbaHasBdlavaicdtfarBdbavc;abfalcefcsGglcitfgHazBdbaHarBdlaiaPfhialcefhlxdkdndnaPcsSmbamaPfaPc987fcefhmxekaocefhrao8SbbgPcFeGhHdndnaPcu9mmbarhoxekaocvfhoaHcFbGhHcrhPdninar8SbbgOcFbGaPtaHVhHaOcu9kmearcefhraPcrfgPc8J9hmbxdkkarcefhokaHce4cbaHceG9R7amfhmkdndnadcd9hmbabaDcetfgraz87ebarcdfas87ebarclfam87ebxekabaDcdtfgrazBdbarclfasBdbarcwfamBdbkavc;abfalcitfgramBdbarasBdlavaicdtfamBdbavc;abfalcefcsGglcitfgrazBdbaramBdlaicefhialcefhlxekdnarcpe0mbaxcefgOavaiaqarcsGfRbbgPcl49RcsGcdtfydbaPcz6gHEhravaiaP9RcsGcdtfydbaOaHfgsaPcsGgOEhPaOThOdndnadcd9hmbabaDcetfgzax87ebazcdfar87ebazclfaP87ebxekabaDcdtfgzaxBdbazclfarBdbazcwfaPBdbkavaicdtfaxBdbavc;abfalcitfgzarBdbazaxBdlavaicefgicsGcdtfarBdbavc;abfalcefcsGcitfgzaPBdbazarBdlavaiaHfcsGgicdtfaPBdbavc;abfalcdfcsGglcitfgraxBdbaraPBdlalcefhlaiaOfhiasaOfhxxekaxcbaoRbbgzEgAarc;:eSgrfhsazcsGhCazcl4hXdndnazcs0mbascefhOxekashOavaiaX9RcsGcdtfydbhskdndnaCmbaOcefhxxekaOhxavaiaz9RcsGcdtfydbhOkdndnarTmbaocefhrxekaocdfhrao8SbegHcFeGhPdnaHcu9kmbaocofhAaPcFbGhPcrhodninar8SbbgHcFbGaotaPVhPaHcu9kmearcefhraocrfgoc8J9hmbkaAhrxekarcefhrkaPce4cbaPceG9R7amfgmhAkdndnaXcsSmbarhPxekarcefhPar8SbbgocFeGhHdnaocu9kmbarcvfhsaHcFbGhHcrhodninaP8SbbgrcFbGaotaHVhHarcu9kmeaPcefhPaocrfgoc8J9hmbkashPxekaPcefhPkaHce4cbaHceG9R7amfgmhskdndnaCcsSmbaPhoxekaPcefhoaP8SbbgrcFeGhHdnarcu9kmbaPcvfhOaHcFbGhHcrhrdninao8SbbgPcFbGartaHVhHaPcu9kmeaocefhoarcrfgrc8J9hmbkaOhoxekaocefhokaHce4cbaHceG9R7amfgmhOkdndnadcd9hmbabaDcetfgraA87ebarcdfas87ebarclfaO87ebxekabaDcdtfgraABdbarclfasBdbarcwfaOBdbkavc;abfalcitfgrasBdbaraABdlavaicdtfaABdbavc;abfalcefcsGcitfgraOBdbarasBdlavaicefgicsGcdtfasBdbavc;abfalcdfcsGcitfgraABdbaraOBdlavaiazcz6aXcsSVfgicsGcdtfaOBdbaiaCTaCcsSVfhialcifhlkawcefhwalcsGhlaicsGhiaDcifgDae6mbkkcbc99aoaqSEhokavc;aef8Kjjjjbaok:llevu8Jjjjjbcz9Rhvc9:hodnaecvfal0mbcuhoaiRbbc;:eGc;qe9hmbav9cb83iwaicefhraialfc98fhwdnaeTmbdnadcdSmbcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcdtfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfglBdbaoalBdbaDcefgDae9hmbxdkkcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcetfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfgl87ebaoalBdbaDcefgDae9hmbkkcbc99arawSEhokaok:EPliuo97eue978Jjjjjbca9Rhidndnadcl9hmbdnaec98GglTmbcbhvabhdinadadpbbbgocKp:RecKp:Sep;6egraocwp:RecKp:Sep;6earp;Geaoczp:RecKp:Sep;6egwp;Gep;Kep;LegDpxbbbbbbbbbbbbbbbbp:2egqarpxbbbjbbbjbbbjbbbjgkp9op9rp;Kegrpxbb;:9cbb;:9cbb;:9cbb;:9cararp;MeaDaDp;Meawaqawakp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFbbbFbbbFbbbFbbbp9oaopxbbbFbbbFbbbFbbbFp9op9qarawp;Meaqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaDawp;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpkbbadczfhdavclfgval6mbkkalae9pmeaiaeciGgvcdtgdVcbczad9R;8kbaiabalcdtfglad;8qbbdnavTmbaiaipblbgocKp:RecKp:Sep;6egraocwp:RecKp:Sep;6earp;Geaoczp:RecKp:Sep;6egwp;Gep;Kep;LegDpxbbbbbbbbbbbbbbbbp:2egqarpxbbbjbbbjbbbjbbbjgkp9op9rp;Kegrpxbb;:9cbb;:9cbb;:9cbb;:9cararp;MeaDaDp;Meawaqawakp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFbbbFbbbFbbbFbbbp9oaopxbbbFbbbFbbbFbbbFp9op9qarawp;Meaqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaDawp;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpklbkalaiad;8qbbskdnaec98GgxTmbcbhvabhdinadczfglalpbbbgopxbbbbbbFFbbbbbbFFgkp9oadpbbbgDaopmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;6eaDaopmbediwDqkzHOAKY8AEgoczp:Sep;6egrp;Geaoczp:Reczp:Sep;6egwp;Gep;Kep;Legopxb;:FSb;:FSb;:FSb;:FSawaopxbbbbbbbbbbbbbbbbp:2egqawpxbbbjbbbjbbbjbbbjgmp9op9rp;Kegwawp;Meaoaop;Mearaqaramp9op9rp;Kegoaop;Mep;Kep;Kep;Jep;Negrp;Mepxbbn0bbn0bbn0bbn0gqp;Keczp:Reawarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9op9qgwaoarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9ogopmwDKYqk8AExm35Ps8E8Fp9qpkbbadaDakp9oawaopmbezHdiOAlvCXorQLp9qpkbbadcafhdavclfgvax6mbkkaxae9pmbaiaeciGgvcitgdfcbcaad9R;8kbaiabaxcitfglad;8qbbdnavTmbaiaipblzgopxbbbbbbFFbbbbbbFFgkp9oaipblbgDaopmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;6eaDaopmbediwDqkzHOAKY8AEgoczp:Sep;6egrp;Geaoczp:Reczp:Sep;6egwp;Gep;Kep;Legopxb;:FSb;:FSb;:FSb;:FSawaopxbbbbbbbbbbbbbbbbp:2egqawpxbbbjbbbjbbbjbbbjgmp9op9rp;Kegwawp;Meaoaop;Mearaqaramp9op9rp;Kegoaop;Mep;Kep;Kep;Jep;Negrp;Mepxbbn0bbn0bbn0bbn0gqp;Keczp:Reawarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9op9qgwaoarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9ogopmwDKYqk8AExm35Ps8E8Fp9qpklzaiaDakp9oawaopmbezHdiOAlvCXorQLp9qpklbkalaiad;8qbbkk;4wllue97euv978Jjjjjbc8W9Rhidnaec98GglTmbcbhvabhoinaiaopbbbgraoczfgwpbbbgDpmlvorxmPsCXQL358E8Fgqczp:Segkclp:RepklbaopxbbjZbbjZbbjZbbjZpx;Zl81Z;Zl81Z;Zl81Z;Zl81Zakpxibbbibbbibbbibbbp9qp;6ep;NegkaraDpmbediwDqkzHOAKY8AEgrczp:Reczp:Sep;6ep;MegDaDp;Meakarczp:Sep;6ep;Megxaxp;Meakaqczp:Reczp:Sep;6ep;Megqaqp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jepxb;:FSb;:FSb;:FSb;:FSgkp;Mepxbbn0bbn0bbn0bbn0grp;KepxFFbbFFbbFFbbFFbbgmp9oaxakp;Mearp;Keczp:Rep9qgxaqakp;Mearp;Keczp:ReaDakp;Mearp;Keamp9op9qgkpmbezHdiOAlvCXorQLgrp5baipblbpEb:T:j83ibaocwfarp5eaipblbpEe:T:j83ibawaxakpmwDKYqk8AExm35Ps8E8Fgkp5baipblbpEd:T:j83ibaocKfakp5eaipblbpEi:T:j83ibaocafhoavclfgval6mbkkdnalae9pmbaiaeciGgvcitgofcbcaao9R;8kbaiabalcitfgwao;8qbbdnavTmbaiaipblbgraipblzgDpmlvorxmPsCXQL358E8Fgqczp:Segkclp:RepklaaipxbbjZbbjZbbjZbbjZpx;Zl81Z;Zl81Z;Zl81Z;Zl81Zakpxibbbibbbibbbibbbp9qp;6ep;NegkaraDpmbediwDqkzHOAKY8AEgrczp:Reczp:Sep;6ep;MegDaDp;Meakarczp:Sep;6ep;Megxaxp;Meakaqczp:Reczp:Sep;6ep;Megqaqp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jepxb;:FSb;:FSb;:FSb;:FSgkp;Mepxbbn0bbn0bbn0bbn0grp;KepxFFbbFFbbFFbbFFbbgmp9oaxakp;Mearp;Keczp:Rep9qgxaqakp;Mearp;Keczp:ReaDakp;Mearp;Keamp9op9qgkpmbezHdiOAlvCXorQLgrp5baipblapEb:T:j83ibaiarp5eaipblapEe:T:j83iwaiaxakpmwDKYqk8AExm35Ps8E8Fgkp5baipblapEd:T:j83izaiakp5eaipblapEi:T:j83iKkawaiao;8qbbkk:Pddiue978Jjjjjbc;ab9Rhidnadcd4ae2glc98GgvTmbcbhdabheinaeaepbbbgocwp:Recwp:Sep;6eaocep:SepxbbjZbbjZbbjZbbjZp:UepxbbjFbbjFbbjFbbjFp9op;Mepkbbaeczfheadclfgdav6mbkkdnaval9pmbaialciGgdcdtgeVcbc;abae9R;8kbaiabavcdtfgvae;8qbbdnadTmbaiaipblbgocwp:Recwp:Sep;6eaocep:SepxbbjZbbjZbbjZbbjZp:UepxbbjFbbjFbbjFbbjFp9op;Mepklbkavaiae;8qbbkk9teiucbcbydj1jjbgeabcifc98GfgbBdj1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaikkkebcjwklz9Tbb":"b9H79Tebbbe8Fv9Gbb9Gvuuuuueu9Giuuub9Geueu9Giuuueuikqbeeedddillviebeoweuec:q;iekr;leDo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbeY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVbdE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbiL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtblK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949Wbol79IV9Rbrq:P8Yqdbk;3sezu8Jjjjjbcj;eb9Rgv8Kjjjjbc9:hodnadcefal0mbcuhoaiRbbc:Ge9hmbavaialfgrad9Radz1jjjbhwcj;abad9UhoaicefhldnadTmbaoc;WFbGgocjdaocjd6EhDcbhqinaqae9pmeaDaeaq9RaqaDfae6Egkcsfgocl4cifcd4hxdndndndnaoc9WGgmTmbcbhPcehsawcjdfhzalhHinaraH9Rax6midnaraHaxfgl9RcK6mbczhoinawcj;cbfaogifgoc9WfhOdndndndndnaHaic9WfgAco4fRbbaAci4coG4ciGPlbedibkaO9cb83ibaOcwf9cb83ibxikaOalRblalRbbgAco4gCaCciSgCE86bbaocGfalclfaCfgORbbaAcl4ciGgCaCciSgCE86bbaocVfaOaCfgORbbaAcd4ciGgCaCciSgCE86bbaoc7faOaCfgORbbaAciGgAaAciSgAE86bbaoctfaOaAfgARbbalRbegOco4gCaCciSgCE86bbaoc91faAaCfgARbbaOcl4ciGgCaCciSgCE86bbaoc4faAaCfgARbbaOcd4ciGgCaCciSgCE86bbaoc93faAaCfgARbbaOciGgOaOciSgOE86bbaoc94faAaOfgARbbalRbdgOco4gCaCciSgCE86bbaoc95faAaCfgARbbaOcl4ciGgCaCciSgCE86bbaoc96faAaCfgARbbaOcd4ciGgCaCciSgCE86bbaoc97faAaCfgARbbaOciGgOaOciSgOE86bbaoc98faAaOfgORbbalRbiglco4gAaAciSgAE86bbaoc99faOaAfgORbbalcl4ciGgAaAciSgAE86bbaoc9:faOaAfgORbbalcd4ciGgAaAciSgAE86bbaocufaOaAfgoRbbalciGglalciSglE86bbaoalfhlxdkaOalRbwalRbbgAcl4gCaCcsSgCE86bbaocGfalcwfaCfgORbbaAcsGgAaAcsSgAE86bbaocVfaOaAfgORbbalRbegAcl4gCaCcsSgCE86bbaoc7faOaCfgORbbaAcsGgAaAcsSgAE86bbaoctfaOaAfgORbbalRbdgAcl4gCaCcsSgCE86bbaoc91faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc4faOaAfgORbbalRbigAcl4gCaCcsSgCE86bbaoc93faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc94faOaAfgORbbalRblgAcl4gCaCcsSgCE86bbaoc95faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc96faOaAfgORbbalRbvgAcl4gCaCcsSgCE86bbaoc97faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc98faOaAfgORbbalRbogAcl4gCaCcsSgCE86bbaoc99faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc9:faOaAfgORbbalRbrglcl4gAaAcsSgAE86bbaocufaOaAfgoRbbalcsGglalcsSglE86bbaoalfhlxekaOal8Pbb83bbaOcwfalcwf8Pbb83bbalczfhlkdnaiam9pmbaiczfhoaral9RcL0mekkaiam6mialTmidnakTmbawaPfRbbhOcbhoazhiinaiawcj;cbfaofRbbgAce4cbaAceG9R7aOfgO86bbaiadfhiaocefgoak9hmbkkazcefhzaPcefgPad6hsalhHaPad9hmexvkkcbhlasceGmdxikalaxad2fhCdnakTmbcbhHcehsawcjdfhminaral9Rax6mialTmdalaxfhlawaHfRbbhOcbhoamhiinaiawcj;cbfaofRbbgAce4cbaAceG9R7aOfgO86bbaiadfhiaocefgoak9hmbkamcefhmaHcefgHad6hsaHad9hmbkaChlxikcbhocehsinaral9Rax6mdalTmealaxfhlaocefgoad6hsadao9hmbkaChlxdkcbhlasceGTmekc9:hoxikabaqad2fawcjdfakad2z1jjjb8Aawawcjdfakcufad2fadz1jjjb8Aakaqfhqalmbkc9:hoxekcbc99aral9Radcaadca0ESEhokavcj;ebf8Kjjjjbaok;yzeHu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnaeci9UgrcHfal0mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecjez:jjjjb8AavcUf9cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhodnaeTmbcmcsaDceSEhkcbhxcbhmcbhDcbhicbhlindnaoaq9nmbc9:hoxikdndnawRbbgrc;Ve0mbavc;abfalarcl4cu7fcsGcitfgPydlhsaPydbhzdnarcsGgPak9pmbavaiarcu7fcsGcdtfydbaxaPEhraPThPdndnadcd9hmbabaDcetfgHaz87ebaHcdfas87ebaHclfar87ebxekabaDcdtfgHazBdbaHclfasBdbaHcwfarBdbkaxaPfhxavc;abfalcitfgHarBdbaHasBdlavaicdtfarBdbavc;abfalcefcsGglcitfgHazBdbaHarBdlaiaPfhialcefhlxdkdndnaPcsSmbamaPfaPc987fcefhmxekaocefhrao8SbbgPcFeGhHdndnaPcu9mmbarhoxekaocvfhoaHcFbGhHcrhPdninar8SbbgOcFbGaPtaHVhHaOcu9kmearcefhraPcrfgPc8J9hmbxdkkarcefhokaHce4cbaHceG9R7amfhmkdndnadcd9hmbabaDcetfgraz87ebarcdfas87ebarclfam87ebxekabaDcdtfgrazBdbarclfasBdbarcwfamBdbkavc;abfalcitfgramBdbarasBdlavaicdtfamBdbavc;abfalcefcsGglcitfgrazBdbaramBdlaicefhialcefhlxekdnarcpe0mbaxcefgOavaiaqarcsGfRbbgPcl49RcsGcdtfydbaPcz6gHEhravaiaP9RcsGcdtfydbaOaHfgsaPcsGgOEhPaOThOdndnadcd9hmbabaDcetfgzax87ebazcdfar87ebazclfaP87ebxekabaDcdtfgzaxBdbazclfarBdbazcwfaPBdbkavaicdtfaxBdbavc;abfalcitfgzarBdbazaxBdlavaicefgicsGcdtfarBdbavc;abfalcefcsGcitfgzaPBdbazarBdlavaiaHfcsGgicdtfaPBdbavc;abfalcdfcsGglcitfgraxBdbaraPBdlalcefhlaiaOfhiasaOfhxxekaxcbaoRbbgzEgAarc;:eSgrfhsazcsGhCazcl4hXdndnazcs0mbascefhOxekashOavaiaX9RcsGcdtfydbhskdndnaCmbaOcefhxxekaOhxavaiaz9RcsGcdtfydbhOkdndnarTmbaocefhrxekaocdfhrao8SbegHcFeGhPdnaHcu9kmbaocofhAaPcFbGhPcrhodninar8SbbgHcFbGaotaPVhPaHcu9kmearcefhraocrfgoc8J9hmbkaAhrxekarcefhrkaPce4cbaPceG9R7amfgmhAkdndnaXcsSmbarhPxekarcefhPar8SbbgocFeGhHdnaocu9kmbarcvfhsaHcFbGhHcrhodninaP8SbbgrcFbGaotaHVhHarcu9kmeaPcefhPaocrfgoc8J9hmbkashPxekaPcefhPkaHce4cbaHceG9R7amfgmhskdndnaCcsSmbaPhoxekaPcefhoaP8SbbgrcFeGhHdnarcu9kmbaPcvfhOaHcFbGhHcrhrdninao8SbbgPcFbGartaHVhHaPcu9kmeaocefhoarcrfgrc8J9hmbkaOhoxekaocefhokaHce4cbaHceG9R7amfgmhOkdndnadcd9hmbabaDcetfgraA87ebarcdfas87ebarclfaO87ebxekabaDcdtfgraABdbarclfasBdbarcwfaOBdbkavc;abfalcitfgrasBdbaraABdlavaicdtfaABdbavc;abfalcefcsGcitfgraOBdbarasBdlavaicefgicsGcdtfasBdbavc;abfalcdfcsGcitfgraABdbaraOBdlavaiazcz6aXcsSVfgicsGcdtfaOBdbaiaCTaCcsSVfhialcifhlkawcefhwalcsGhlaicsGhiaDcifgDae6mbkkcbc99aoaqSEhokavc;aef8Kjjjjbaok:llevu8Jjjjjbcz9Rhvc9:hodnaecvfal0mbcuhoaiRbbc;:eGc;qe9hmbav9cb83iwaicefhraialfc98fhwdnaeTmbdnadcdSmbcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcdtfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfglBdbaoalBdbaDcefgDae9hmbxdkkcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcetfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfgl87ebaoalBdbaDcefgDae9hmbkkcbc99arawSEhokaok:Lvoeue99dud99eud99dndnadcl9hmbaeTmeindndnabcdfgd8Sbb:Yab8Sbbgi:Ygl:l:tabcefgv8Sbbgo:Ygr:l:tgwJbb;:9cawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai86bbdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad86bbdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad86bbabclfhbaecufgembxdkkaeTmbindndnabclfgd8Ueb:Yab8Uebgi:Ygl:l:tabcdfgv8Uebgo:Ygr:l:tgwJb;:FSawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai87ebdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad87ebdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad87ebabcwfhbaecufgembkkk;siliui99iue99dnaeTmbcbhiabhlindndnJ;Zl81Zalcof8UebgvciV:Y:vgoal8Ueb:YNgrJb;:FSNJbbbZJbbb:;arJbbbb9GEMgw:lJbbb9p9DTmbaw:OhDxekcjjjj94hDkalclf8Uebhqalcdf8UebhkabavcefciGaiVcetfaD87ebdndnaoak:YNgwJb;:FSNJbbbZJbbb:;awJbbbb9GEMgx:lJbbb9p9DTmbax:Ohkxekcjjjj94hkkabavcdfciGaiVcetfak87ebdndnaoaq:YNgoJb;:FSNJbbbZJbbb:;aoJbbbb9GEMgx:lJbbb9p9DTmbax:Ohqxekcjjjj94hqkabavcufciGaiVcetfaq87ebdndnJbbjZararN:tawawN:taoaoN:tgrJbbbbarJbbbb9GE:rJb;:FSNJbbbZMgr:lJbbb9p9DTmbar:Ohqxekcjjjj94hqkabavciGaiVcetfaq87ebalcwfhlaiclfhiaecufgembkkk9mbdnadcd4ae2geTmbinababydbgdcwtcw91:Yadce91cjjj;8ifcjjj98G::NUdbabclfhbaecufgembkkk9teiucbcbydj1jjbgeabcifc98GfgbBdj1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaik;LeeeudndnaeabVciGTmbabhixekdndnadcz9pmbabhixekabhiinaiaeydbBdbaiclfaeclfydbBdbaicwfaecwfydbBdbaicxfaecxfydbBdbaiczfhiaeczfheadc9Wfgdcs0mbkkadcl6mbinaiaeydbBdbaeclfheaiclfhiadc98fgdci0mbkkdnadTmbinaiaeRbb86bbaicefhiaecefheadcufgdmbkkabk;aeedudndnabciGTmbabhixekaecFeGc:b:c:ew2hldndnadcz9pmbabhixekabhiinaialBdbaicxfalBdbaicwfalBdbaiclfalBdbaiczfhiadc9Wfgdcs0mbkkadcl6mbinaialBdbaiclfhiadc98fgdci0mbkkdnadTmbinaiae86bbaicefhiadcufgdmbkkabkkkebcjwklz9Kbb",a=WebAssembly.instantiate(s(n),{}).then((function(e){(r=e.instance).exports.__wasm_call_ctors()}));function s(e){for(var r=new Uint8Array(e.length),n=0;n<e.length;++n){var a=e.charCodeAt(n);r[n]=96<a?a-97:64<a?a-39:a+4}var i=0;for(n=0;n<e.length;++n)r[i++]=r[n]<60?t[r[n]]:64*(r[n]-60)+r[++n];return r.buffer.slice(0,i)}function o(e,t,n,a,i,s){var o=r.exports.sbrk,l=n+3&-4,c=o(l*a),u=o(i.length),h=new Uint8Array(r.exports.memory.buffer);if(0==(h.set(i,u),e=e(c,n,a,u,i.length))&&s&&s(c,l,a),t.set(h.subarray(c,c+n*a)),o(c-o(0)),0!=e)throw new Error("Malformed buffer data: "+e)}var l={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},c={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"},u=[],h=0;return{ready:a,supported:!0,useWorkers:function(e){!function(e){for(var t="var instance; var ready = WebAssembly.instantiate(new Uint8Array(["+new Uint8Array(s(n))+"]), {}).then(function(result) { instance = result.instance; instance.exports.__wasm_call_ctors(); });self.onmessage = workerProcess;"+o.toString()+function(e){a.then((function(){var t=e.data;try{var n=new Uint8Array(t.count*t.size);o(r.exports[t.mode],n,t.count,t.size,t.source,r.exports[t.filter]),self.postMessage({id:t.id,count:t.count,action:"resolve",value:n},[n.buffer])}catch(n){self.postMessage({id:t.id,count:t.count,action:"reject",value:n})}}))}.toString(),i=(t=new Blob([t],{type:"text/javascript"}),URL.createObjectURL(t)),l=0;l<e;++l)u[l]=function(e){var t={object:new Worker(e),pending:0,requests:{}};return t.object.onmessage=function(e){e=e.data,t.pending-=e.count,t.requests[e.id][e.action](e.value),delete t.requests[e.id]},t}(i);URL.revokeObjectURL(i)}(e)},decodeVertexBuffer:function(e,t,n,a,i){o(r.exports.meshopt_decodeVertexBuffer,e,t,n,a,r.exports[l[i]])},decodeIndexBuffer:function(e,t,n,a){o(r.exports.meshopt_decodeIndexBuffer,e,t,n,a)},decodeIndexSequence:function(e,t,n,a){o(r.exports.meshopt_decodeIndexSequence,e,t,n,a)},decodeGltfBuffer:function(e,t,n,a,i,s){o(r.exports[c[i]],e,t,n,a,r.exports[l[s]])},decodeGltfBufferAsync:function(e,t,n,i,s){if(0<u.length){for(var d=e,p=t,f=n,m=c[i],g=l[s],v=u[0],b=1;b<u.length;++b)u[b].pending<v.pending&&(v=u[b]);return new Promise((function(e,t){var r=new Uint8Array(f),n=h++;v.pending+=d,v.requests[n]={resolve:e,reject:t},v.object.postMessage({id:n,count:d,size:p,source:r,mode:m,filter:g},[r.buffer])}))}return a.then((function(){var a=new Uint8Array(e*t);return o(r.exports[c[i]],a,e,t,n,r.exports[l[s]]),a}))}}}();function o(e){return(o="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})(e)}function l(e,t){return(l=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function c(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=u(e);if(r=t?(r=u(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===o(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function u(e){return(u=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var h=new WeakMap,d=function(e){var t=a;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&l(t,e);var r=c(a);function a(e){if(this instanceof a)return(e=r.call(this,e)).decoderPath="",e.decoderConfig={},e.decoderBinary=null,e.decoderPending=null,e.workerLimit=4,e.workerPool=[],e.workerNextTaskID=1,e.workerSourceURL="",e.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},e.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"},e;throw new TypeError("Cannot call a class as a function")}return t=a,(e=[{key:"setDecoderPath",value:function(e){return this.decoderPath=e,this}},{key:"setDecoderConfig",value:function(e){return this.decoderConfig=e,this}},{key:"setWorkerLimit",value:function(e){return this.workerLimit=e,this}},{key:"load",value:function(e,t,r,a){var i=this,s=new n.FileLoader(this.manager);s.setPath(this.path),s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(e,(function(e){i.decodeDracoFile(e,t).catch(a)}),r,a)}},{key:"decodeDracoFile",value:function(e,t,r,n){return n={attributeIDs:r||this.defaultAttributeIDs,attributeTypes:n||this.defaultAttributeTypes,useUniqueIDs:!!r},this.decodeGeometry(e,n).then(t)}},{key:"decodeGeometry",value:function(e,t){var r,n=this,a=JSON.stringify(t);if(h.has(e)){if((s=h.get(e)).key===a)return s.promise;if(0===e.byteLength)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}var i=this.workerNextTaskID++,s=e.byteLength;return s=this._getWorker(i,s).then((function(n){return r=n,new Promise((function(n,a){r._callbacks[i]={resolve:n,reject:a},r.postMessage({type:"decode",id:i,taskConfig:t,buffer:e},[e])}))})).then((function(e){return n._createGeometry(e.geometry)})),s.catch((function(){return!0})).then((function(){r&&i&&n._releaseTask(r,i)})),h.set(e,{key:a,promise:s}),s}},{key:"_createGeometry",value:function(e){var t=new n.BufferGeometry;e.index&&t.setIndex(new n.BufferAttribute(e.index.array,1));for(var r=0;r<e.attributes.length;r++){var a=(s=e.attributes[r]).name,i=s.array,s=s.itemSize;t.setAttribute(a,new n.BufferAttribute(i,s))}return t}},{key:"_loadLibrary",value:function(e,t){var r=new n.FileLoader(this.manager);return r.setPath(this.decoderPath),r.setResponseType(t),r.setWithCredentials(this.withCredentials),new Promise((function(t,n){r.load(e,t,void 0,n)}))}},{key:"preload",value:function(){return this._initDecoder(),this}},{key:"_initDecoder",value:function(){var e=this;if(this.decoderPending)return this.decoderPending;var t="object"!==("undefined"==typeof WebAssembly?"undefined":o(WebAssembly))||"js"===this.decoderConfig.type,r=[];return t?r.push(this._loadLibrary("draco_decoder.js","text")):(r.push(this._loadLibrary("draco_wasm_wrapper.js","text")),r.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(r).then((function(r){var n=r[0];t||(e.decoderConfig.wasmBinary=r[1]),r=function(){var e,t;onmessage=function(r){var n=r.data;switch(n.type){case"init":e=n.decoderConfig,t=new Promise((function(t){e.onModuleLoaded=function(e){t({draco:e})},DracoDecoderModule(e)}));break;case"decode":var a=n.buffer,i=n.taskConfig;t.then((function(e){var t=new(e=e.draco).Decoder,r=new e.DecoderBuffer;r.Init(new Int8Array(a),a.byteLength);try{var s=function(e,t,r,n){var a,i=n.attributeIDs,s=n.attributeTypes,o=t.GetEncodedGeometryType(r);if(o===e.TRIANGULAR_MESH)a=new e.Mesh,v=t.DecodeBufferToMesh(r,a);else{if(o!==e.POINT_CLOUD)throw new Error("THREE.DRACOLoader: Unexpected geometry type.");a=new e.PointCloud,v=t.DecodeBufferToPointCloud(r,a)}if(!v.ok()||0===a.ptr)throw new Error("THREE.DRACOLoader: Decoding failed: "+v.error_msg());var l,c,u,h,d,p,f,m,g,v,b,y,x,w={index:null,attributes:[]};for(l in i){var S=self[s[l]],M=void 0,T=void 0;if(n.useUniqueIDs)T=i[l],M=t.GetAttributeByUniqueId(a,T);else{if(-1===(T=t.GetAttributeId(a,e[i[l]])))continue;M=t.GetAttribute(a,T)}w.attributes.push((T=e,c=t,u=a,h=l,d=M.num_components(),f=(p=u.num_points()*d)*S.BYTES_PER_ELEMENT,m=function(e,t){switch(t){case Float32Array:return e.DT_FLOAT32;case Int8Array:return e.DT_INT8;case Int16Array:return e.DT_INT16;case Int32Array:return e.DT_INT32;case Uint8Array:return e.DT_UINT8;case Uint16Array:return e.DT_UINT16;case Uint32Array:return e.DT_UINT32}}(T,S),g=T._malloc(f),c.GetAttributeDataArrayForAllPoints(u,M,m,f,g),c=new S(T.HEAPF32.buffer,g,p).slice(),T._free(g),{name:h,array:c,itemSize:d}))}return o===e.TRIANGULAR_MESH&&(w.index=(r=e,v=t,y=4*(b=3*(o=a).num_faces()),x=r._malloc(y),v.GetTrianglesUInt32Array(o,y,x),v=new Uint32Array(r.HEAPF32.buffer,x,b).slice(),r._free(x),{array:v,itemSize:1})),e.destroy(a),w}(e,t,r,i),o=s.attributes.map((function(e){return e.array.buffer}));s.index&&o.push(s.index.array.buffer),self.postMessage({type:"decode",id:n.id,geometry:s},o)}catch(e){console.error(e),self.postMessage({type:"error",id:n.id,error:e.message})}finally{e.destroy(r),e.destroy(t)}}))}}}.toString(),n=["/* draco decoder */",n,"","/* worker */",r.substring(r.indexOf("{")+1,r.lastIndexOf("}"))].join("\n"),e.workerSourceURL=URL.createObjectURL(new Blob([n]))})),this.decoderPending}},{key:"_getWorker",value:function(e,t){var r=this;return this._initDecoder().then((function(){r.workerPool.length<r.workerLimit?((n=new Worker(r.workerSourceURL))._callbacks={},n._taskCosts={},n._taskLoad=0,n.postMessage({type:"init",decoderConfig:r.decoderConfig}),n.onmessage=function(e){var t=e.data;switch(t.type){case"decode":n._callbacks[t.id].resolve(t);break;case"error":n._callbacks[t.id].reject(t);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+t.type+'"')}},r.workerPool.push(n)):r.workerPool.sort((function(e,t){return e._taskLoad>t._taskLoad?-1:1}));var n,a=r.workerPool[r.workerPool.length-1];return a._taskCosts[e]=t,a._taskLoad+=t,a}))}},{key:"_releaseTask",value:function(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}},{key:"debug",value:function(){console.log("Task load: ",this.workerPool.map((function(e){return e._taskLoad})))}},{key:"dispose",value:function(){for(var e=0;e<this.workerPool.length;++e)this.workerPool[e].terminate();return this.workerPool.length=0,""!==this.workerSourceURL&&URL.revokeObjectURL(this.workerSourceURL),this}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),a}(n.Loader),p=r(4091),f={enabled:!1,files:{},add:function(e,t){!1!==this.enabled&&(this.files[e]=t)},get:function(e){if(!1!==this.enabled)return this.files[e]},remove:function(e){delete this.files[e]},clear:function(){this.files={}}};var m=new(function(e,t,r){return Object.defineProperty(e,"prototype",{writable:!1}),e}((function e(t,r,n){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");var a=this,i=!1,s=0,o=0,l=void 0,c=[];this.onStart=void 0,this.onLoad=t,this.onProgress=r,this.onError=n,this.itemStart=function(e){o++,!1===i&&void 0!==a.onStart&&a.onStart(e,s,o),i=!0},this.itemEnd=function(e){s++,void 0!==a.onProgress&&a.onProgress(e,s,o),s===o&&(i=!1,void 0!==a.onLoad&&a.onLoad())},this.itemError=function(e){void 0!==a.onError&&a.onError(e)},this.resolveURL=function(e){return l?l(e):e},this.setURLModifier=function(e){return l=e,this},this.addHandler=function(e,t){return c.push(e,t),this},this.removeHandler=function(e){return-1!==(e=c.indexOf(e))&&c.splice(e,2),this},this.getHandler=function(e){for(var t=0,r=c.length;t<r;t+=2){var n=c[t],a=c[t+1];if(n.global&&(n.lastIndex=0),n.test(e))return a}return null}})));var g=function(){function e(t){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");this.manager=void 0!==t?t:m,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}var t,r;return t=e,(r=[{key:"load",value:function(){}},{key:"loadAsync",value:function(e,t){var r=this;return new Promise((function(n,a){r.load(e,n,t,a)}))}},{key:"parse",value:function(){}},{key:"setCrossOrigin",value:function(e){return this.crossOrigin=e,this}},{key:"setWithCredentials",value:function(e){return this.withCredentials=e,this}},{key:"setPath",value:function(e){return this.path=e,this}},{key:"setResourcePath",value:function(e){return this.resourcePath=e,this}},{key:"setRequestHeader",value:function(e){return this.requestHeader=e,this}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,r),Object.defineProperty(t,"prototype",{writable:!1}),e}();function v(e){return(v="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})(e)}function b(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function y(e,t){return(y=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function x(e){return(x=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var w=function(){var e=n,t=g;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&&y(e,t);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=x(e);if(r=t?(r=x(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===v(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(e){if(this instanceof n)return(e=r.call(this,e)).isImageBitmapLoader=!0,"undefined"==typeof createImageBitmap&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),"undefined"==typeof fetch&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),e.options={premultiplyAlpha:"none"},e;throw new TypeError("Cannot call a class as a function")}return e=n,(t=[{key:"setOptions",value:function(e){return this.options=e,this}},{key:"load",value:function(e,t,r,n,a){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);var i=this,s=f.get(e);if(void 0!==s)return i.manager.itemStart(e),setTimeout((function(){t&&t(s),i.manager.itemEnd(e)}),0),s;var o={};o.credentials="anonymous"===this.crossOrigin?"same-origin":"include",o.headers=this.requestHeader,fetch(e,o).then((function(e){return e.blob()})).then((function(e){return Promise.all([new Promise((function(t){var r=(n=i.options).textureQuality,n=n.reverseTexture,s=a.notCompress,o=a.size,l=0===e.size?new ImageData(1,1):e;t(o&&1!==r?(o=(t=a.size).w,t=t.h,s=s?1:r,createImageBitmap(l,Object.assign(i.options,{imageOrientation:n?"none":"flipY",resizeHeight:t*s,resizeWidth:o*s}))):createImageBitmap(l,Object.assign(i.options,{imageOrientation:n?"none":"flipY"})))})),Promise.resolve(e)])})).then((function(r){r=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,a,i=[],s=!0,o=!1;try{for(r=r.call(e);!(s=(n=r.next()).done)&&(i.push(n.value),2!==i.length);s=!0);}catch(e){o=!0,a=e}finally{try{s||null==r.return||r.return()}finally{if(o)throw a}}return i}}(e)||function(e,t){if(e){if("string"==typeof e)return b(e,2);var r=Object.prototype.toString.call(e).slice(8,-1);return"Map"===(r="Object"===r&&e.constructor?e.constructor.name:r)||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?b(e,2):void 0}}(e)||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.")}()}(r);var n=r[0];r=r[1],f.add(e,n),t&&t(n,r),i.manager.itemEnd(e)})).catch((function(t){n&&n(t),i.manager.itemError(e),i.manager.itemEnd(e)})),i.manager.itemStart(e)}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),n}(),S=r(5317),M=r(6422);function T(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,a,i=[],s=!0,o=!1;try{for(r=r.call(e);!(s=(n=r.next()).done)&&(i.push(n.value),!t||i.length!==t);s=!0);}catch(e){o=!0,a=e}finally{try{s||null==r.return||r.return()}finally{if(o)throw a}}return i}}(e,t)||k(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 _(e){return(_="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})(e)}function E(){return(E="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=B(e)););return e}(e,t);if(n)return(n=Object.getOwnPropertyDescriptor(n,t)).get?n.get.call(arguments.length<3?e:r):n.value}).apply(this,arguments)}function D(e,t){var r,n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=k(e))||t&&e&&"number"==typeof e.length)return n&&(e=n),r=0,{s:t=function(){},n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:t};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,i=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return i=e.done,e},e:function(e){s=!0,a=e},f:function(){try{i||null==n.return||n.return()}finally{if(s)throw a}}}}function k(e,t){if(e){if("string"==typeof e)return O(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Map"===(r="Object"===r&&e.constructor?e.constructor.name:r)||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?O(e,t):void 0}}function O(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function P(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function A(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function C(e,t,r){return t&&A(e.prototype,t),r&&A(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function R(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&&L(e,t)}function L(e,t){return(L=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function I(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=B(e);if(r=t?(r=B(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===_(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function B(e){return(B=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var j=function(){R(t,n.Loader);var e=I(t);function t(r){return P(this,t),(r=e.call(this,r)).dracoLoader=null,r.ktx2Loader=null,r.meshoptDecoder=null,r.pluginCallbacks=[],r.register((function(e){return new G(e)})),r.register((function(e){return new Q(e)})),r.register((function(e){return new Y(e)})),r.register((function(e){return new W(e)})),r.register((function(e){return new K(e)})),r.register((function(e){return new q(e)})),r.register((function(e){return new Z(e)})),r.register((function(e){return new V(e)})),r.register((function(e){return new X(e)})),r.register((function(e){return new H(e)})),r.register((function(e){return new z(e)})),r.register((function(e){return new J(e)})),r.register((function(e){return new $(e)})),r}return C(t,[{key:"load",value:function(e,t,r,a){function i(t){a?a(t):console.error(t),s.manager.itemError(e),s.manager.itemEnd(e)}var s=this,o=""!==this.resourcePath?this.resourcePath:""!==this.path?this.path:n.LoaderUtils.extractUrlBase(e),l=(this.manager.itemStart(e),new n.FileLoader(this.manager));l.setPath(this.path),l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),l.setWithCredentials(this.withCredentials),l.load(e,(function(r){try{s.parse(r,o,(function(r){t(r),s.manager.itemEnd(e)}),i)}catch(r){i(r)}}),r,i)}},{key:"setDRACOLoader",value:function(e){return this.dracoLoader=e,this}},{key:"setDDSLoader",value:function(){throw new Error('THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".')}},{key:"setKTX2Loader",value:function(e){return this.ktx2Loader=e,this}},{key:"setMeshoptDecoder",value:function(e){return this.meshoptDecoder=e,this}},{key:"register",value:function(e){return-1===this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.push(e),this}},{key:"unregister",value:function(e){return-1!==this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}},{key:"parse",value:function(e,t,r,n,a){var i,s={},o={},l=new TextDecoder;if("string"==typeof e)i=JSON.parse(e);else if(e instanceof ArrayBuffer)if(l.decode(new Uint8Array(e,0,4))===ee){try{s[N.KHR_BINARY_GLTF]=new te(e)}catch(e){return void(n&&n(e))}i=JSON.parse(s[N.KHR_BINARY_GLTF].content)}else i=JSON.parse(l.decode(e));else i=e;if(void 0===i.asset||i.asset.version[0]<2)n&&n(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));else if(a.valid(i)){var c=new we(i,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder,ex:a});c.fileLoader.setRequestHeader(this.requestHeader);for(var u=0;u<this.pluginCallbacks.length;u++){var h=this.pluginCallbacks[u](c);s[(o[h.name]=h).name]=!0}if(i.extensionsUsed)for(var d=0;d<i.extensionsUsed.length;++d){var p=i.extensionsUsed[d],f=i.extensionsRequired||[];switch(p){case N.KHR_MATERIALS_UNLIT:s[p]=new F;break;case N.KHR_DRACO_MESH_COMPRESSION:s[p]=new re(i,this.dracoLoader);break;case N.KHR_TEXTURE_TRANSFORM:s[p]=new ne;break;case N.KHR_MESH_QUANTIZATION:s[p]=new ae;break;default:0<=f.indexOf(p)&&void 0===o[p]&&console.warn('THREE.GLTFLoader: Unknown extension "'+p+'".')}}c.setExtensions(s),c.setPlugins(o),c.parse(r,n)}}},{key:"parseAsync",value:function(e,t){var r=this;return new Promise((function(n,a){r.parse(e,t,n,a)}))}}]),t}();function U(){var e={};return{get:function(t){return e[t]},add:function(t,r){e[t]=r},remove:function(t){delete e[t]},removeAll:function(){e={}}}}var N={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",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_TEXTURE_WEBP:"EXT_texture_webp",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"},z=function(){function e(t){P(this,e),this.parser=t,this.name=N.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}return C(e,[{key:"_markDefs",value:function(){for(var e=this.parser,t=this.parser.json.nodes||[],r=0,n=t.length;r<n;r++){var a=t[r];a.extensions&&a.extensions[this.name]&&void 0!==a.extensions[this.name].light&&e._addNodeRef(this.cache,a.extensions[this.name].light)}}},{key:"_loadLight",value:function(e){var t=this.parser,r="light:"+e,a=t.cache.get(r);if(a)return a;var i,s=t.json,o=((s.extensions&&s.extensions[this.name]||{}).lights||[])[e],l=new n.Color(16777215),c=(void 0!==o.color&&l.fromArray(o.color),void 0!==o.range?o.range:0);switch(o.type){case"directional":(i=new n.DirectionalLight(l)).target.position.set(0,0,-1),i.add(i.target);break;case"point":(i=new n.PointLight(l)).distance=c;break;case"spot":(i=new n.SpotLight(l)).distance=c,o.spot=o.spot||{},o.spot.innerConeAngle=void 0!==o.spot.innerConeAngle?o.spot.innerConeAngle:0,o.spot.outerConeAngle=void 0!==o.spot.outerConeAngle?o.spot.outerConeAngle:Math.PI/4,i.angle=o.spot.outerConeAngle,i.penumbra=1-o.spot.innerConeAngle/o.spot.outerConeAngle,i.target.position.set(0,0,-1),i.add(i.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+o.type)}return i.position.set(0,0,0),i.decay=2,ve(i,o),void 0!==o.intensity&&(i.intensity=o.intensity),i.name=t.createUniqueName(o.name||"light_"+e),a=Promise.resolve(i),t.cache.add(r,a),a}},{key:"getDependency",value:function(e,t){if("light"===e)return this._loadLight(t)}},{key:"createNodeAttachment",value:function(e){var t=this,r=this.parser,n=((e=r.json.nodes[e]).extensions&&e.extensions[this.name]||{}).light;return void 0===n?null:this._loadLight(n).then((function(e){return r._getNodeRef(t.cache,n,e)}))}}]),e}(),F=function(){function e(){P(this,e),this.name=N.KHR_MATERIALS_UNLIT}return C(e,[{key:"getMaterialType",value:function(){return n.MeshBasicMaterial}},{key:"extendParams",value:function(e,t,r){var a,i=[];return e.color=new n.Color(1,1,1),e.opacity=1,(t=t.pbrMetallicRoughness)&&(Array.isArray(t.baseColorFactor)&&(a=t.baseColorFactor,e.color.fromArray(a),e.opacity=a[3]),void 0!==t.baseColorTexture&&i.push(r.assignTexture(e,"map",t.baseColorTexture,n.sRGBEncoding))),Promise.all(i)}}]),e}(),V=function(){function e(t){P(this,e),this.parser=t,this.name=N.KHR_MATERIALS_EMISSIVE_STRENGTH}return C(e,[{key:"extendMaterialParams",value:function(e,t){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?(void 0!==(e=e.extensions[this.name].emissiveStrength)&&(t.emissiveIntensity=e),Promise.resolve()):Promise.resolve()}}]),e}(),G=function(){function e(t){P(this,e),this.parser=t,this.name=N.KHR_MATERIALS_CLEARCOAT}return C(e,[{key:"getMaterialType",value:function(e){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?n.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(e,t){var r=this.parser;if(!(e=r.json.materials[e]).extensions||!e.extensions[this.name])return Promise.resolve();var a=[];return void 0!==(e=e.extensions[this.name]).clearcoatFactor&&(t.clearcoat=e.clearcoatFactor),void 0!==e.clearcoatTexture&&a.push(r.assignTexture(t,"clearcoatMap",e.clearcoatTexture)),void 0!==e.clearcoatRoughnessFactor&&(t.clearcoatRoughness=e.clearcoatRoughnessFactor),void 0!==e.clearcoatRoughnessTexture&&a.push(r.assignTexture(t,"clearcoatRoughnessMap",e.clearcoatRoughnessTexture)),void 0!==e.clearcoatNormalTexture&&(a.push(r.assignTexture(t,"clearcoatNormalMap",e.clearcoatNormalTexture)),void 0!==e.clearcoatNormalTexture.scale&&(r=e.clearcoatNormalTexture.scale,t.clearcoatNormalScale=new n.Vector2(r,r))),Promise.all(a)}}]),e}(),H=function(){function e(t){P(this,e),this.parser=t,this.name=N.KHR_MATERIALS_IRIDESCENCE}return C(e,[{key:"getMaterialType",value:function(e){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?n.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(e,t){var r=this.parser;if(!(e=r.json.materials[e]).extensions||!e.extensions[this.name])return Promise.resolve();var n=[];return void 0!==(e=e.extensions[this.name]).iridescenceFactor&&(t.iridescence=e.iridescenceFactor),void 0!==e.iridescenceTexture&&n.push(r.assignTexture(t,"iridescenceMap",e.iridescenceTexture)),void 0!==e.iridescenceIor&&(t.iridescenceIOR=e.iridescenceIor),void 0===t.iridescenceThicknessRange&&(t.iridescenceThicknessRange=[100,400]),void 0!==e.iridescenceThicknessMinimum&&(t.iridescenceThicknessRange[0]=e.iridescenceThicknessMinimum),void 0!==e.iridescenceThicknessMaximum&&(t.iridescenceThicknessRange[1]=e.iridescenceThicknessMaximum),void 0!==e.iridescenceThicknessTexture&&n.push(r.assignTexture(t,"iridescenceThicknessMap",e.iridescenceThicknessTexture)),Promise.all(n)}}]),e}(),W=function(){function e(t){P(this,e),this.parser=t,this.name=N.KHR_MATERIALS_SHEEN}return C(e,[{key:"getMaterialType",value:function(e){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?n.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(e,t){var r=this.parser;if(!(e=r.json.materials[e]).extensions||!e.extensions[this.name])return Promise.resolve();var a=[];return void 0!==(t.sheenColor=new n.Color(0,0,0),t.sheenRoughness=0,t.sheen=1,e=e.extensions[this.name]).sheenColorFactor&&t.sheenColor.fromArray(e.sheenColorFactor),void 0!==e.sheenRoughnessFactor&&(t.sheenRoughness=e.sheenRoughnessFactor),void 0!==e.sheenColorTexture&&a.push(r.assignTexture(t,"sheenColorMap",e.sheenColorTexture,n.sRGBEncoding)),void 0!==e.sheenRoughnessTexture&&a.push(r.assignTexture(t,"sheenRoughnessMap",e.sheenRoughnessTexture)),Promise.all(a)}}]),e}(),K=function(){function e(t){P(this,e),this.parser=t,this.name=N.KHR_MATERIALS_TRANSMISSION}return C(e,[{key:"getMaterialType",value:function(e){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?n.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(e,t){var r=this.parser;if(!(e=r.json.materials[e]).extensions||!e.extensions[this.name])return Promise.resolve();var n=[];return void 0!==(e=e.extensions[this.name]).transmissionFactor&&(t.transmission=e.transmissionFactor),void 0!==e.transmissionTexture&&n.push(r.assignTexture(t,"transmissionMap",e.transmissionTexture)),Promise.all(n)}}]),e}(),q=function(){function e(t){P(this,e),this.parser=t,this.name=N.KHR_MATERIALS_VOLUME}return C(e,[{key:"getMaterialType",value:function(e){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?n.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(e,t){if(!(e=(a=this.parser).json.materials[e]).extensions||!e.extensions[this.name])return Promise.resolve();var r=[],a=(e=e.extensions[this.name],t.thickness=void 0!==e.thicknessFactor?e.thicknessFactor:0,void 0!==e.thicknessTexture&&r.push(a.assignTexture(t,"thicknessMap",e.thicknessTexture)),t.attenuationDistance=e.attenuationDistance||1/0,e.attenuationColor||[1,1,1]);return t.attenuationColor=new n.Color(a[0],a[1],a[2]),Promise.all(r)}}]),e}(),Z=function(){function e(t){P(this,e),this.parser=t,this.name=N.KHR_MATERIALS_IOR}return C(e,[{key:"getMaterialType",value:function(e){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?n.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(e,t){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?(e=e.extensions[this.name],t.ior=void 0!==e.ior?e.ior:1.5,Promise.resolve()):Promise.resolve()}}]),e}(),X=function(){function e(t){P(this,e),this.parser=t,this.name=N.KHR_MATERIALS_SPECULAR}return C(e,[{key:"getMaterialType",value:function(e){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?n.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(e,t){var r=this.parser;if(!(e=r.json.materials[e]).extensions||!e.extensions[this.name])return Promise.resolve();var a=[],i=(e=e.extensions[this.name],t.specularIntensity=void 0!==e.specularFactor?e.specularFactor:1,void 0!==e.specularTexture&&a.push(r.assignTexture(t,"specularIntensityMap",e.specularTexture)),e.specularColorFactor||[1,1,1]);return t.specularColor=new n.Color(i[0],i[1],i[2]),void 0!==e.specularColorTexture&&a.push(r.assignTexture(t,"specularColorMap",e.specularColorTexture,n.sRGBEncoding)),Promise.all(a)}}]),e}(),Q=function(){function e(t){P(this,e),this.parser=t,this.name=N.KHR_TEXTURE_BASISU}return C(e,[{key:"loadTexture",value:function(e){var t=this.parser,r=t.json;if(!(n=r.textures[e]).extensions||!n.extensions[this.name])return null;var n=n.extensions[this.name],a=t.options.ktx2Loader;if(a)return t.loadTextureImage(e,n.source,a);if(r.extensionsRequired&&0<=r.extensionsRequired.indexOf(this.name))throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}}]),e}(),Y=function(){function e(t){P(this,e),this.parser=t,this.name=N.EXT_TEXTURE_WEBP,this.isSupported=null}return C(e,[{key:"loadTexture",value:function(e){var t=this.name,r=this.parser,n=r.json;if(!(i=n.textures[e]).extensions||!i.extensions[t])return null;var a=i.extensions[t],i=n.images[a.source],s=r.textureLoader;return i.uri&&null!==(i=r.options.manager.getHandler(i.uri))&&(s=i),this.detectSupport().then((function(i){if(i)return r.loadTextureImage(e,a.source,s);if(n.extensionsRequired&&0<=n.extensionsRequired.indexOf(t))throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return r.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}}]),e}(),J=function(){function e(t){P(this,e),this.name=N.EXT_MESHOPT_COMPRESSION,this.parser=t}return C(e,[{key:"loadBufferView",value:function(e){var t=this.parser.json;if((e=t.bufferViews[e]).extensions&&e.extensions[this.name]){var r=e.extensions[this.name],n=(e=this.parser.getDependency("buffer",r.buffer),this.parser.options.meshoptDecoder);if(n&&n.supported)return e.then((function(e){var t=r.byteOffset||0,a=r.byteLength||0,i=r.count,s=r.byteStride,o=new Uint8Array(e,t,a);return n.decodeGltfBufferAsync?n.decodeGltfBufferAsync(i,s,o,r.mode,r.filter).then((function(e){return e.buffer})):n.ready.then((function(){var e=new ArrayBuffer(i*s);return n.decodeGltfBuffer(new Uint8Array(e),i,s,o,r.mode,r.filter),e}))}));if(t.extensionsRequired&&0<=t.extensionsRequired.indexOf(this.name))throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return null}}]),e}(),$=function(){function e(t){P(this,e),this.name=N.EXT_MESH_GPU_INSTANCING,this.parser=t}return C(e,[{key:"createNodeMesh",value:function(e){var t=this,r=this.parser.json,a=r.nodes[e];if(!a.extensions||!a.extensions[this.name]||void 0===a.mesh)return null;var i,s=D(r.meshes[a.mesh].primitives);try{for(s.s();!(i=s.n()).done;){var o=i.value;if(o.mode!==le.TRIANGLES&&o.mode!==le.TRIANGLE_STRIP&&o.mode!==le.TRIANGLE_FAN&&void 0!==o.mode)return null}}catch(e){s.e(e)}finally{s.f()}var l,c=a.extensions[this.name].attributes,u=[],h={};for(l in c)!function(e){u.push(t.parser.getDependency("accessor",c[e]).then((function(t){return h[e]=t,h[e]})))}(l);return u.length<1?null:(u.push(this.parser.createNodeMesh(e)),Promise.all(u).then((function(e){var r,a=e.pop(),i=a.isGroup?a.children:[a],s=e[0].count,o=[],l=D(i);try{for(l.s();!(r=l.n()).done;){for(var c,u=r.value,d=new n.Matrix4,p=new n.Vector3,f=new n.Quaternion,m=new n.Vector3(1,1,1),g=new n.InstancedMesh(u.geometry,u.material,s),v=0;v<s;v++)h.TRANSLATION&&p.fromBufferAttribute(h.TRANSLATION,v),h.ROTATION&&f.fromBufferAttribute(h.ROTATION,v),h.SCALE&&m.fromBufferAttribute(h.SCALE,v),g.setMatrixAt(v,d.compose(p,f,m));for(c in h)"TRANSLATION"!==c&&"ROTATION"!==c&&"SCALE"!==c&&u.geometry.setAttribute(c,h[c]);n.Object3D.prototype.copy.call(g,u),g.frustumCulled=!1,t.parser.assignFinalMaterial(g),o.push(g)}}catch(e){l.e(e)}finally{l.f()}return a.isGroup?(a.clear(),a.add.apply(a,o),a):o[0]})))}}]),e}(),ee="glTF",te=C((function e(t){P(this,e),this.name=N.KHR_BINARY_GLTF,this.content=null,this.body=null;var r=new DataView(t,0,12),n=new TextDecoder;if(this.header={magic:n.decode(new Uint8Array(t.slice(0,4))),version:r.getUint32(4,!0),length:r.getUint32(8,!0)},this.header.magic!==ee)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");for(var a=this.header.length-12,i=new DataView(t,12),s=0;s<a;){var o,l=i.getUint32(s,!0),c=(s+=4,i.getUint32(s,!0));s+=4,1313821514===c?(o=new Uint8Array(t,12+s,l),this.content=n.decode(o)):5130562===c&&(this.body=t.slice(o=12+s,o+l)),s+=l}if(null===this.content)throw new Error("THREE.GLTFLoader: JSON content not found.")})),re=function(){function e(t,r){if(P(this,e),!r)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=N.KHR_DRACO_MESH_COMPRESSION,this.json=t,this.dracoLoader=r,this.dracoLoader.preload()}return C(e,[{key:"decodePrimitive",value:function(e,t){var r,n,a=this.json,i=this.dracoLoader,s=e.extensions[this.name].bufferView,o=e.extensions[this.name].attributes,l={},c={},u={};for(r in o){var h=pe[r]||r.toLowerCase();l[h]=o[r]}for(n in e.attributes){var d,p,f=pe[n]||n.toLowerCase();void 0!==o[n]&&(d=a.accessors[e.attributes[n]],p=ce[d.componentType],u[f]=p.name,c[f]=!0===d.normalized)}return t.getDependency("bufferView",s).then((function(e){return new Promise((function(t){i.decodeDracoFile(e,(function(e){for(var r in e.attributes){var n=e.attributes[r];void 0!==(r=c[r])&&(n.normalized=r)}t(e)}),l,u)}))}))}}]),e}(),ne=function(){function e(){P(this,e),this.name=N.KHR_TEXTURE_TRANSFORM}return C(e,[{key:"extendTexture",value:function(e,t){return void 0!==t.texCoord&&console.warn('THREE.GLTFLoader: Custom UV sets in "'+this.name+'" extension not yet supported.'),void 0===t.offset&&void 0===t.rotation&&void 0===t.scale||(e=e.clone(),void 0!==t.offset&&e.offset.fromArray(t.offset),void 0!==t.rotation&&(e.rotation=t.rotation),void 0!==t.scale&&e.repeat.fromArray(t.scale),e.needsUpdate=!0),e}}]),e}(),ae=C((function e(){P(this,e),this.name=N.KHR_MESH_QUANTIZATION})),ie=function(){R(t,n.Interpolant);var e=I(t);function t(r,n,a,i){return P(this,t),e.call(this,r,n,a,i)}return C(t,[{key:"copySampleValue_",value:function(e){for(var t=this.resultBuffer,r=this.sampleValues,n=this.valueSize,a=e*n*3+n,i=0;i!==n;i++)t[i]=r[a+i];return t}},{key:"interpolate_",value:function(e,t,r,n){for(var a=this.resultBuffer,i=this.sampleValues,s=this.valueSize,o=2*s,l=3*s,c=n-t,u=e*l,h=u-l,d=-2*(t=(r=(n=(r-t)/c)*n)*n)+3*r,p=t-r,f=1-d,m=p-r+n,g=0;g!==s;g++){var v=i[h+g+s],b=i[h+g+o]*c,y=i[u+g+s],x=i[u+g]*c;a[g]=f*v+m*b+d*y+p*x}return a}}]),t}(),se=new n.Quaternion,oe=function(){R(t,ie);var e=I(t);function t(){return P(this,t),e.apply(this,arguments)}return C(t,[{key:"interpolate_",value:function(e,r,n,a){return e=E(B(t.prototype),"interpolate_",this).call(this,e,r,n,a),se.fromArray(e).normalize().toArray(e),e}}]),t}(),le={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},ce={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},ue={9728:n.NearestFilter,9729:n.LinearFilter,9984:n.NearestMipmapNearestFilter,9985:n.LinearMipmapNearestFilter,9986:n.NearestMipmapLinearFilter,9987:n.LinearMipmapLinearFilter},he={33071:n.ClampToEdgeWrapping,33648:n.MirroredRepeatWrapping,10497:n.RepeatWrapping},de={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},pe={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv2",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},fe={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},me={CUBICSPLINE:void 0,LINEAR:n.InterpolateLinear,STEP:n.InterpolateDiscrete};function ge(e,t,r){for(var n in r.extensions)void 0===e[n]&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[n]=r.extensions[n])}function ve(e,t){void 0!==t.extras&&("object"===_(t.extras)?Object.assign(e.userData,t.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras))}function be(e){for(var t="",r=Object.keys(e).sort(),n=0,a=r.length;n<a;n++)t+=r[n]+":"+e[r[n]]+";";return t}function ye(e){switch(e){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}var xe=new n.Matrix4,we=function(){function e(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},a=(P(this,e),this.json=t,this.extensions={},this.plugins={},this.options=r,this.cache=new U,this.associations=new Map,this.primitiveCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},t=!(this.nodeNamesUsed={}),r=!1,-1);"undefined"!=typeof navigator&&(t=!0===/^((?!chrome|android).)*safari/i.test(navigator.userAgent),a=(r=-1<navigator.userAgent.indexOf("Firefox"))?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),"undefined"==typeof createImageBitmap||t||r&&a<98?this.textureLoader=new n.TextureLoader(this.options.manager):this.textureLoader=new w(this.options.manager),this.options.ex.setTextureLoader(this.textureLoader),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new n.FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.rgbeLoader=new M.x(this.options.manager),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}return C(e,[{key:"setExtensions",value:function(e){this.extensions=e}},{key:"setPlugins",value:function(e){this.plugins=e}},{key:"parse",value:function(e,t){var r=this,n=this.json,a=this.extensions;this.cache.removeAll(),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([r.getDependencies("scene"),r.getDependencies("animation"),r.getDependencies("camera")])})).then((function(t){var i={scene:t[0][n.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:n.asset,parser:r,userData:{}};ge(a,i,n),ve(i,n),Promise.all(r._invokeAll((function(e){return e.afterRoot&&e.afterRoot(i)}))).then((function(){e(i)}))})).catch(t)}},{key:"_markDefs",value:function(){for(var e=this.json.nodes||[],t=this.json.skins||[],r=this.json.meshes||[],n=0,a=t.length;n<a;n++)for(var i=t[n].joints,s=0,o=i.length;s<o;s++)e[i[s]].isBone=!0;for(var l=0,c=e.length;l<c;l++){var u=e[l];void 0!==u.mesh&&(this._addNodeRef(this.meshCache,u.mesh),void 0!==u.skin&&(r[u.mesh].isSkinnedMesh=!0)),void 0!==u.camera&&this._addNodeRef(this.cameraCache,u.camera)}}},{key:"_addNodeRef",value:function(e,t){void 0!==t&&(void 0===e.refs[t]&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}},{key:"_getNodeRef",value:function(e,t,r){var n=this;if(e.refs[t]<=1)return r;var a=r.clone();return function e(t,r){var a,i=n.associations.get(t),s=(null!=i&&n.associations.set(r,i),D(t.children.entries()));try{for(s.s();!(a=s.n()).done;){var o=T(a.value,2),l=o[0];e(o[1],r.children[l])}}catch(e){s.e(e)}finally{s.f()}}(r,a),a.name+="_instance_"+e.uses[t]++,a}},{key:"_invokeOne",value:function(e){var t=Object.values(this.plugins);t.push(this);for(var r=0;r<t.length;r++){var n=e(t[r]);if(n)return n}return null}},{key:"_invokeAll",value:function(e){for(var t=Object.values(this.plugins),r=(t.unshift(this),[]),n=0;n<t.length;n++){var a=e(t[n]);a&&r.push(a)}return r}},{key:"getDependency",value:function(e,t){var r=e+":"+t,n=this.cache.get(r);if(!n){switch(e){case"scene":n=this.loadScene(t);break;case"node":n=this._invokeOne((function(e){return e.loadNode&&e.loadNode(t)}));break;case"mesh":n=this._invokeOne((function(e){return e.loadMesh&&e.loadMesh(t)}));break;case"accessor":n=this.loadAccessor(t);break;case"bufferView":n=this._invokeOne((function(e){return e.loadBufferView&&e.loadBufferView(t)}));break;case"buffer":n=this.loadBuffer(t);break;case"material":n=this._invokeOne((function(e){return e.loadMaterial&&e.loadMaterial(t)}));break;case"texture":n=this._invokeOne((function(e){return e.loadTexture&&e.loadTexture(t)}));break;case"skin":n=this.loadSkin(t);break;case"animation":n=this._invokeOne((function(e){return e.loadAnimation&&e.loadAnimation(t)}));break;case"camera":n=this.loadCamera(t);break;default:if(n=this._invokeOne((function(r){return r!=this&&r.getDependency&&r.getDependency(e,t)})))break;throw new Error("Unknown type: "+e)}this.cache.add(r,n)}return n}},{key:"getDependencies",value:function(e){var t,r,n=this.cache.get(e);return n||(r=(t=this).json[e+("mesh"===e?"es":"s")]||[],n=Promise.all(r.map((function(r,n){return t.getDependency(e,n)}))),this.cache.add(e,n)),n}},{key:"loadBuffer",value:function(e){var t=this.json.buffers[e],r=this.fileLoader;if(t.type&&"arraybuffer"!==t.type)throw new Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(void 0===t.uri&&0===e)return Promise.resolve(this.extensions[N.KHR_BINARY_GLTF].body);var a=this.options;return new Promise((function(e,i){r.load(n.LoaderUtils.resolveURL(t.uri,a.path),e,void 0,(function(){i(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))}))}))}},{key:"loadBufferView",value:function(e){var t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then((function(e){var r=t.byteLength||0,n=t.byteOffset||0;return e.slice(n,n+r)}))}},{key:"loadAccessor",value:function(e){var t,r=this,a=this.json,i=this.json.accessors[e];if(void 0===i.bufferView&&void 0===i.sparse)return e=de[i.type],s=ce[i.componentType],t=!0===i.normalized,s=new s(i.count*e),Promise.resolve(new n.BufferAttribute(s,e,t));var s=[];return void 0!==i.bufferView?s.push(this.getDependency("bufferView",i.bufferView)):s.push(null),void 0!==i.sparse&&(s.push(this.getDependency("bufferView",i.sparse.indices.bufferView)),s.push(this.getDependency("bufferView",i.sparse.values.bufferView))),Promise.all(s).then((function(e){var t,s=e[0],o=de[i.type],l=ce[i.componentType],c=l.BYTES_PER_ELEMENT,u=i.byteOffset||0,h=void 0!==i.bufferView?a.bufferViews[i.bufferView].byteStride:void 0,d=!0===i.normalized,p=h&&h!==c*o?(f=Math.floor(u/h),m="InterleavedBuffer:"+i.bufferView+":"+i.componentType+":"+f+":"+i.count,(g=r.cache.get(m))||(t=new l(s,f*h,i.count*h/c),g=new n.InterleavedBuffer(t,h/c),r.cache.add(m,g)),new n.InterleavedBufferAttribute(g,o,u%h/c,d)):(t=null===s?new l(i.count*o):new l(s,u,i.count*o),new n.BufferAttribute(t,o,d));if(void 0!==i.sparse){var f=ce[i.sparse.indices.componentType],m=i.sparse.indices.byteOffset||0,g=i.sparse.values.byteOffset||0,v=new f(e[1],m,i.sparse.count*de.SCALAR),b=new l(e[2],g,i.sparse.count*o);null!==s&&(p=new n.BufferAttribute(p.array.slice(),p.itemSize,p.normalized));for(var y=0,x=v.length;y<x;y++){var w=v[y];if(p.setX(w,b[y*o]),2<=o&&p.setY(w,b[y*o+1]),3<=o&&p.setZ(w,b[y*o+2]),4<=o&&p.setW(w,b[y*o+3]),5<=o)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return p}))}},{key:"loadTexture",value:function(e){var t=this.json,r=this.options,n=t.textures[e].source,a=(t=t.images[n],this.textureLoader);return t.uri&&null!==(r=r.manager.getHandler(t.uri))&&(a=r),this.loadTextureImage(e,n,a)}},{key:"loadTextureImage",value:function(e,t,r){var a=this,i=this.json,s=i.textures[e],o=i.images[t],l=(o.uri||o.bufferView)+":"+s.sampler;return this.textureCache[l]?this.textureCache[l]:(t=this.loadImageSource(t,r,e).then((function(t){t.flipY=!1,t.name=s.name||o.name||"";var r=(i.samplers||{})[s.sampler]||{};return t.magFilter=ue[r.magFilter]||n.LinearFilter,t.minFilter=ue[r.minFilter]||n.LinearMipmapLinearFilter,t.wrapS=he[r.wrapS]||n.RepeatWrapping,t.wrapT=he[r.wrapT]||n.RepeatWrapping,a.associations.set(t,{textures:e}),a.options.ex.loadTexture({texture:t,textureDef:s}),t})).catch((function(){return null})),this.textureCache[l]=t)}},{key:"loadImageSource",value:function(e,t,r){var a=this,i=this.json,s=this.options,o=i.textures[r];if(void 0!==this.sourceCache[e])return this.sourceCache[e].then((function(e){return e.clone()}));var l=i.images[e],c=self.URL||self.webkitURL,u=l.uri||"",h=!1;if(void 0!==l.bufferView)u=a.getDependency("bufferView",l.bufferView).then((function(e){h=!0;var t=new Blob([e],{type:l.mimeType});return{sourceURI:u=c.createObjectURL(t),blob:t,bufferView:e}}));else if(void 0===l.uri)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");return r=Promise.resolve(u).then((function(e){var r=e.sourceURI,i=e.blob;return new Promise((function(e,l){if(0===i.size)return c=new n.Texture,e({texture:c,blob:i});var c;o.isHdr?((c=new FileReader).readAsDataURL(i),c.addEventListener("load",(function(t){t=t.target.result,a.rgbeLoader.loadAsync(t).then((function(t){t.encoding=n.sRGBEncoding,t.needsUpdate=!0,e({texture:t,blob:i})}))}))):!0===t.isImageBitmapLoader?(c=function(t,r){(t=new n.Texture(t)).needsUpdate=!0,e({texture:t,blob:r})},t.load(n.LoaderUtils.resolveURL(r,s.path),c,void 0,l,o)):(s.ex.options.loadConfig.reverseTexture,t.load(n.LoaderUtils.resolveURL(r,s.path),(function(t){e({texture:t,blob:i})}),void 0,l))}))})).then((function(e){var t=e.texture;return e=e.blob,"editor"===s.ex.options.mode?(o.isHdr||(t.userData.url=u),t.userData.blob=e):!0===h&&c.revokeObjectURL(u),t.userData.mimeType=l.mimeType||(0<(e=l.uri||"").search(/\.jpe?g($|\?)/i)||0===e.search(/^data\:image\/jpeg/)?"image/jpeg":0<e.search(/\.webp($|\?)/i)||0===e.search(/^data\:image\/webp/)?"image/webp":"image/png"),t})).catch((function(e){throw console.log(e,"error"),console.error("THREE.GLTFLoader: Couldn't loadImageSource texture",u),e})),this.sourceCache[e]=r}},{key:"assignTexture",value:function(e,t,r,n){var a=this;return this.getDependency("texture",r.index).then((function(i){return i?(void 0===r.texCoord||0==r.texCoord||"aoMap"===t&&1==r.texCoord||console.warn("THREE.GLTFLoader: Custom UV set "+r.texCoord+" for texture "+t+" not yet supported."),a.extensions[N.KHR_TEXTURE_TRANSFORM]&&(s=void 0!==r.extensions?r.extensions[N.KHR_TEXTURE_TRANSFORM]:void 0)&&(o=a.associations.get(i),i=a.extensions[N.KHR_TEXTURE_TRANSFORM].extendTexture(i,s),a.associations.set(i,o)),void 0!==n&&(i.encoding=n),e[t]=i):null;var s,o}))}},{key:"assignFinalMaterial",value:function(e){var t,r,a=e.geometry,i=e.material,s=void 0===a.attributes.tangent,o=void 0!==a.attributes.color,l=void 0===a.attributes.normal;e.isPoints?(t="PointsMaterial:"+i.uuid,(r=this.cache.get(t))||(r=new n.PointsMaterial,n.Material.prototype.copy.call(r,i),r.color.copy(i.color),r.map=i.map,r.sizeAttenuation=!1,this.cache.add(t,r)),i=r):e.isLine&&(t="LineBasicMaterial:"+i.uuid,(r=this.cache.get(t))||(r=new n.LineBasicMaterial,n.Material.prototype.copy.call(r,i),r.color.copy(i.color),this.cache.add(t,r)),i=r),(s||o||l)&&(t="ClonedMaterial:"+i.uuid+":",s&&(t+="derivative-tangents:"),o&&(t+="vertex-colors:"),l&&(t+="flat-shading:"),(r=this.cache.get(t))||(r=i.clone(),o&&(r.vertexColors=!0),l&&(r.flatShading=!0),s&&(r.normalScale&&(r.normalScale.y*=-1),r.clearcoatNormalScale&&(r.clearcoatNormalScale.y*=-1)),this.cache.add(t,r),this.associations.set(r,this.associations.get(i)))),i.aoMap&&void 0===a.attributes.uv2&&void 0!==a.attributes.uv&&a.setAttribute("uv2",a.attributes.uv),this.options.ex.loadMaterial({material:i,materialDef:i.userData,model:e}),e.material=i}},{key:"getMaterialType",value:function(){return n.MeshStandardMaterial}},{key:"loadMaterial",value:function(e){var t,r,a=this,i=this.json,s=this.extensions,o=i.materials[e],l={},c=(i=[],(o.extensions||{})[N.KHR_MATERIALS_UNLIT]?(r=s[N.KHR_MATERIALS_UNLIT],t=r.getMaterialType(),i.push(r.extendParams(l,o,a))):(r=o.pbrMetallicRoughness||{},l.color=new n.Color(1,1,1),l.opacity=1,Array.isArray(r.baseColorFactor)&&(c=r.baseColorFactor,l.color.fromArray(c),l.opacity=c[3]),void 0!==r.baseColorTexture&&i.push(a.assignTexture(l,"map",r.baseColorTexture,n.sRGBEncoding)),l.metalness=void 0!==r.metallicFactor?r.metallicFactor:1,l.roughness=void 0!==r.roughnessFactor?r.roughnessFactor:1,void 0!==r.metallicRoughnessTexture&&(i.push(a.assignTexture(l,"metalnessMap",r.metallicRoughnessTexture)),i.push(a.assignTexture(l,"roughnessMap",r.metallicRoughnessTexture))),t=this._invokeOne((function(t){return t.getMaterialType&&t.getMaterialType(e)})),i.push(Promise.all(this._invokeAll((function(t){return t.extendMaterialParams&&t.extendMaterialParams(e,l)}))))),!0===o.doubleSided&&(l.side=n.DoubleSide),o.alphaMode||"OPAQUE");return"BLEND"===c?(l.transparent=!0,l.depthWrite=!1):(l.transparent=!1,"MASK"===c&&(l.alphaTest=void 0!==o.alphaCutoff?o.alphaCutoff:.5)),void 0!==o.normalTexture&&t!==n.MeshBasicMaterial&&(i.push(a.assignTexture(l,"normalMap",o.normalTexture)),l.normalScale=new n.Vector2(1,1),void 0!==o.normalTexture.scale&&(r=o.normalTexture.scale,l.normalScale.set(r,r))),void 0!==o.occlusionTexture&&t!==n.MeshBasicMaterial&&(i.push(a.assignTexture(l,"aoMap",o.occlusionTexture)),void 0!==o.occlusionTexture.strength&&(l.aoMapIntensity=o.occlusionTexture.strength)),void 0!==o.emissiveFactor&&t!==n.MeshBasicMaterial&&(l.emissive=(new n.Color).fromArray(o.emissiveFactor)),void 0!==o.emissiveTexture&&t!==n.MeshBasicMaterial&&i.push(a.assignTexture(l,"emissiveMap",o.emissiveTexture,n.sRGBEncoding)),Promise.all(i).then((function(){var r=new t(l);return o.name&&(r.name=o.name),ve(r,o),a.associations.set(r,{materials:e}),o.extensions&&ge(s,r,o),r}))}},{key:"createUniqueName",value:function(e){for(var t=n.PropertyBinding.sanitizeNodeName(e||""),r=t,a=1;this.nodeNamesUsed[r];++a)r=t+"_"+a;return this.nodeNamesUsed[r]=!0,r}},{key:"loadGeometries",value:function(e){for(var t=this,r=this.extensions,a=this.primitiveCache,i=[],s=0,o=e.length;s<o;s++){var l=e[s],c=(u=void 0,u=(u=(c=l).extensions&&c.extensions[N.KHR_DRACO_MESH_COMPRESSION])?"draco:"+u.bufferView+":"+u.indices+":"+be(u.attributes):c.indices+":"+be(c.attributes)+":"+c.mode),u=a[c];u?i.push(u.promise):(u=void 0,u=l.extensions&&l.extensions[N.KHR_DRACO_MESH_COMPRESSION]?function(e){return r[N.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,t).then((function(r){return Se(r,e,t)}))}(l):Se(new n.BufferGeometry,l,t),a[c]={primitive:l,promise:u},i.push(u))}return Promise.all(i)}},{key:"loadMesh",value:function(e){for(var t=this,r=this.json,a=this.extensions,i=r.meshes[e],s=i.primitives,o=[],l=0,c=s.length;l<c;l++){var u=void 0===s[l].material?(void 0===(u=this.cache).DefaultMaterial&&(u.DefaultMaterial=new n.MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:n.FrontSide})),u.DefaultMaterial):this.getDependency("material",s[l].material);o.push(u)}return o.push(t.loadGeometries(s)),Promise.all(o).then((function(r){for(var o=r.slice(0,r.length-1),l=r[r.length-1],c=[],u=0,h=l.length;u<h;u++){var d=l[u],f=s[u],m=void 0,g=o[u];if(f.mode===le.TRIANGLES||f.mode===le.TRIANGLE_STRIP||f.mode===le.TRIANGLE_FAN||void 0===f.mode)!0!==(m=new(!0===i.isSkinnedMesh?n.SkinnedMesh:n.Mesh)(d,g)).isSkinnedMesh||m.geometry.attributes.skinWeight.normalized||m.normalizeSkinWeights(),f.mode===le.TRIANGLE_STRIP?m.geometry=(0,p.Vs)(m.geometry,n.TriangleStripDrawMode):f.mode===le.TRIANGLE_FAN&&(m.geometry=(0,p.Vs)(m.geometry,n.TriangleFanDrawMode));else if(f.mode===le.LINES)m=new n.LineSegments(d,g);else if(f.mode===le.LINE_STRIP)m=new n.Line(d,g);else if(f.mode===le.LINE_LOOP)m=new n.LineLoop(d,g);else{if(f.mode!==le.POINTS)throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+f.mode);m=new n.Points(d,g)}if(0<Object.keys(m.geometry.morphAttributes).length){M=S=w=x=y=v=void 0;var v=m,b=i;if(v.updateMorphTargets(),void 0!==b.weights)for(var y=0,x=b.weights.length;y<x;y++)v.morphTargetInfluences[y]=b.weights[y];if(b.extras&&Array.isArray(b.extras.targetNames)){var w=b.extras.targetNames;if(v.morphTargetInfluences.length===w.length){v.morphTargetDictionary={};for(var S=0,M=w.length;S<M;S++)v.morphTargetDictionary[w[S]]=S}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}m.name=t.createUniqueName(i.name||"mesh_"+e),ve(m,i),f.extensions&&ge(a,m,f),t.assignFinalMaterial(m),c.push(m)}for(var T=0,_=c.length;T<_;T++)t.associations.set(c[T],{meshes:e,primitives:T});if(1===c.length)return c[0];var E=new n.Group;t.associations.set(E,{meshes:e});for(var D=0,k=c.length;D<k;D++)E.add(c[D]);return E}))}},{key:"loadCamera",value:function(e){var t,r=(e=this.json.cameras[e])[e.type];if(r)return"perspective"===e.type?t=new n.PerspectiveCamera(n.MathUtils.radToDeg(r.yfov),r.aspectRatio||1,r.znear||1,r.zfar||2e6):"orthographic"===e.type&&(t=new n.OrthographicCamera(-r.xmag,r.xmag,r.ymag,-r.ymag,r.znear,r.zfar)),e.name&&(t.name=this.createUniqueName(e.name)),ve(t,e),Promise.resolve(t);console.warn("THREE.GLTFLoader: Missing camera parameters.")}},{key:"loadSkin",value:function(e){for(var t=this.json.skins[e],r=[],a=0,i=t.joints.length;a<i;a++)r.push(this.getDependency("node",t.joints[a]));return void 0!==t.inverseBindMatrices?r.push(this.getDependency("accessor",t.inverseBindMatrices)):r.push(null),Promise.all(r).then((function(e){for(var r=e.pop(),a=e,i=[],s=[],o=0,l=a.length;o<l;o++){var c=a[o];c?(i.push(c),c=new n.Matrix4,null!==r&&c.fromArray(r.array,16*o),s.push(c)):console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[o])}return new n.Skeleton(i,s)}))}},{key:"loadAnimation",value:function(e){for(var t=this.json.animations[e],r=[],a=[],i=[],s=[],o=[],l=0,c=t.channels.length;l<c;l++){var u=t.channels[l],h=t.samplers[u.sampler],d=(u=u.target).node,p=void 0!==t.parameters?t.parameters[h.input]:h.input,f=void 0!==t.parameters?t.parameters[h.output]:h.output;r.push(this.getDependency("node",d)),a.push(this.getDependency("accessor",p)),i.push(this.getDependency("accessor",f)),s.push(h),o.push(u)}return Promise.all([Promise.all(r),Promise.all(a),Promise.all(i),Promise.all(s),Promise.all(o)]).then((function(r){for(var a=r[0],i=r[1],s=r[2],o=r[3],l=r[4],c=[],u=0,h=a.length;u<h;u++)!function(e){var t=a[e],r=i[e],u=s[e],h=o[e],d=l[e];if(void 0!==t){t.updateMatrix();var p=void 0;switch(fe[d.path]){case fe.weights:p=n.NumberKeyframeTrack;break;case fe.rotation:p=n.QuaternionKeyframeTrack;break;default:p=n.VectorKeyframeTrack}e=t.name||t.uuid;var f=void 0!==h.interpolation?me[h.interpolation]:n.InterpolateLinear,m=[],g=(fe[d.path]===fe.weights?t.traverse((function(e){e.morphTargetInfluences&&m.push(e.name||e.uuid)})):m.push(e),u.array);if(u.normalized){for(var v=ye(g.constructor),b=new Float32Array(g.length),y=0,x=g.length;y<x;y++)b[y]=g[y]*v;g=b}for(var w=0,S=m.length;w<S;w++){var M=new p(m[w]+"."+fe[d.path],r.array,g,f);"CUBICSPLINE"===h.interpolation&&(M.createInterpolant=function(e){return new(this instanceof n.QuaternionKeyframeTrack?oe:ie)(this.times,this.values,this.getValueSize()/3,e)},M.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0),c.push(M)}}}(u);return r=t.name||"animation_"+e,new n.AnimationClip(r,void 0,c)}))}},{key:"createNodeMesh",value:function(e){var t=this.json,r=this,n=t.nodes[e];return void 0===n.mesh?null:r.getDependency("mesh",n.mesh).then((function(e){return e=r._getNodeRef(r.meshCache,n.mesh,e),void 0!==n.weights&&e.traverse((function(e){if(e.isMesh)for(var t=0,r=n.weights.length;t<r;t++)e.morphTargetInfluences[t]=n.weights[t]})),e}))}},{key:"loadNode",value:function(e){var t=this.json,r=this.extensions,a=this,i=t.nodes[e],s=i.name?a.createUniqueName(i.name):"";return function(){for(var t=[],r=a._invokeOne((function(t){return t.createNodeMesh&&t.createNodeMesh(e)})),n=(r&&t.push(r),void 0!==i.camera&&t.push(a.getDependency("camera",i.camera).then((function(e){return a._getNodeRef(a.cameraCache,i.camera,e)}))),a._invokeAll((function(t){return t.createNodeAttachment&&t.createNodeAttachment(e)})).forEach((function(e){t.push(e)})),[]),s=i.children||[],o=0,l=s.length;o<l;o++)n.push(a.getDependency("node",s[o]));return r=void 0===i.skin?Promise.resolve(null):a.getDependency("skin",i.skin),Promise.all([Promise.all(t),Promise.all(n),r])}().then((function(t){var o=t[0],l=t[1],c=t[2],u=!0===i.isBone?new n.Bone:1<o.length?new n.Group:1===o.length?o[0]:new n.Object3D;if(u!==o[0])for(var h=0,d=o.length;h<d;h++)u.add(o[h]);i.name&&(u.userData.name=i.name,u.name=s),ve(u,i),i.extensions&&ge(r,u,i),void 0!==i.matrix?((t=new n.Matrix4).fromArray(i.matrix),u.applyMatrix4(t)):(void 0!==i.translation&&u.position.fromArray(i.translation),void 0!==i.rotation&&u.quaternion.fromArray(i.rotation),void 0!==i.scale&&u.scale.fromArray(i.scale)),a.associations.has(u)||a.associations.set(u,{}),a.associations.get(u).nodes=e,null!==c&&u.traverse((function(e){e.isSkinnedMesh&&e.bind(c,xe)}));for(var p=0,f=l.length;p<f;p++)u.add(l[p]);return a.options.ex.loadNode({node:u,nodeDef:i})||u}))}},{key:"loadScene",value:function(e){for(var t=this.extensions,r=(e=this.json.scenes[e],this),a=new n.Group,i=(e.name&&(a.name=r.createUniqueName(e.name)),ve(a,e),e.extensions&&ge(t,a,e),e.nodes||[]),s=[],o=0,l=i.length;o<l;o++)s.push(r.getDependency("node",i[o]));return Promise.all(s).then((function(e){for(var t=0,i=e.length;t<i;t++)a.add(e[t]);return r.options.ex.loadScene(a),r.associations=function(e){var t,a=new Map,i=D(r.associations);try{for(i.s();!(t=i.n()).done;){var s=T(t.value,2),o=s[0],l=s[1];(o instanceof n.Material||o instanceof n.Texture)&&a.set(o,l)}}catch(e){i.e(e)}finally{i.f()}return e.traverse((function(e){var t=r.associations.get(e);null!=t&&a.set(e,t)})),a}(a),a}))}}]),e}();function Se(e,t,r){var a,i=t.attributes,s=[];for(a in i){var o=pe[a]||a.toLowerCase();o in e.attributes||s.push(function(t,n){return r.getDependency("accessor",t).then((function(t){e.setAttribute(n,t)}))}(i[a],o))}void 0===t.indices||e.index||(l=r.getDependency("accessor",t.indices).then((function(t){e.setIndex(t)})),s.push(l)),ve(e,t);var l=e,c=t,u=r,h=c.attributes,d=new n.Box3;if(void 0!==h.POSITION){var p=(h=u.json.accessors[h.POSITION]).min,f=h.max;if(void 0===p||void 0===f)console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");else{d.set(new n.Vector3(p[0],p[1],p[2]),new n.Vector3(f[0],f[1],f[2])),h.normalized&&(p=ye(ce[h.componentType]),d.min.multiplyScalar(p),d.max.multiplyScalar(p));var m=c.targets;if(void 0!==m){for(var g=new n.Vector3,v=new n.Vector3,b=0,y=m.length;b<y;b++){var x,w,S=m[b];void 0!==S.POSITION&&(w=(S=u.json.accessors[S.POSITION]).min,x=S.max,void 0!==w&&void 0!==x?(v.setX(Math.max(Math.abs(w[0]),Math.abs(x[0]))),v.setY(Math.max(Math.abs(w[1]),Math.abs(x[1]))),v.setZ(Math.max(Math.abs(w[2]),Math.abs(x[2]))),S.normalized&&(w=ye(ce[S.componentType]),v.multiplyScalar(w)),g.max(v)):console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION."))}d.expandByVector(g)}l.boundingBox=d,f=new n.Sphere,d.getCenter(f.center),f.radius=d.min.distanceTo(d.max)/2,l.boundingSphere=f}}return Promise.all(s).then((function(){if(void 0===t.targets)return e;for(var n=e,a=t.targets,i=r,s=!1,o=!1,l=!1,c=0,u=a.length;c<u;c++){var h=a[c];if(void 0!==h.POSITION&&(s=!0),void 0!==h.NORMAL&&(o=!0),void 0!==h.COLOR_0&&(l=!0),s&&o&&l)break}if(!s&&!o&&!l)return Promise.resolve(n);for(var d=[],p=[],f=[],m=0,g=a.length;m<g;m++){var v,b=a[m];s&&(v=void 0!==b.POSITION?i.getDependency("accessor",b.POSITION):n.attributes.position,d.push(v)),o&&(v=void 0!==b.NORMAL?i.getDependency("accessor",b.NORMAL):n.attributes.normal,p.push(v)),l&&(b=void 0!==b.COLOR_0?i.getDependency("accessor",b.COLOR_0):n.attributes.color,f.push(b))}return Promise.all([Promise.all(d),Promise.all(p),Promise.all(f)]).then((function(e){var t=e[0],r=e[1];return e=e[2],s&&(n.morphAttributes.position=t),o&&(n.morphAttributes.normal=r),l&&(n.morphAttributes.color=e),n.morphTargetsRelative=!0,n}))}))}var Me=r(1794),Te=r(6272);class _e{constructor(e,t){this.runScene=e,this.helper=t}setTextureLoader(e){this.textureLoader=e,this.initTextureLoader(e)}initTextureLoader(e){e instanceof w?(this.helper.isImageBitmapLoader=!0,e.setOptions({reverseTexture:this.helper.loadConfig.reverseTexture,textureQuality:this.runScene.optionsEx.options.texture.quality})):this.helper.isImageBitmapLoader=!1}}class Ee{constructor(e,t){this.pending=[],this.models=[],this.module=new Me.Z,this.isImageBitmapLoader=!0,this.runScene=e,this.loadConfig=t,this.options=new _e(e,this),this.callback("mountModule",null)}beforeLoader(e){this.callback("getJSON",e),this.json=e;var t=this.processBase64(e);return"editor"===this.runScene.optionsEx.options.mode?(this.callback("beforeParse",e),!0):(t&&this.callback("beforeParse",e),t)}loadTexture(e){this.callback("loadTexture",e)}processBase64(e){if(null==(t=e.asset)||!t.ex)return!0;var t=e.asset.ex.base64;return!t||!!(e=(0,Te.Ne)(t))&&(t=Number(e),!isNaN(t)&&(new Date).getTime()<t)}callback(e,t){var r,n;return this.loadConfig.triggerCb&&null!=(r=null==(n=this.runScene.cb.loaderer.gltf[e])?void 0:n.cb)&&r.call(n,t),null!=(n=null==(r=this.loadConfig.callBack)?void 0:r[e])&&n.call(r,t),this.runScene.exporter.gltf.module.loadCallback({type:e,json:this.json,data:t,config:this.loadConfig,core:this})}loadMaterial(e){this.callback("loadMaterial",e)}loadNode(e){if(1===(e=this.callback("loadNode",e)).length)return e[0]}}class De{constructor(e,t){this.options=e,this.runScene=t}static getGltfLoader(e){let t=this._gltf;if(!t){t=this._gltf=new j;const r=new d;r.setDecoderPath(e),this._gltf.setMeshoptDecoder(s),this._gltf.setDRACOLoader(r)}return t}parse(e){const{arrayBuffer:t,onDone:r,onError:n}=e;De.getGltfLoader(this.runScene.optionsEx.options.decodePath).parse(t,"",r,(e=>{console.log(e,"e"),n(e)}),this)}valid(e){return this.options.core.beforeLoader(e)}loadTexture(e){return this.options.core.loadTexture(e)}loadMaterial(e){return this.options.core.loadMaterial(e)}loadNode(e){return this.options.core.loadNode(e)}setTextureLoader(e){this.options.core.options.setTextureLoader(e)}loadScene(e){this.scene=e,this.options.models.push(e)}onBuildNodeHierarchy(e){const{nodeId:t,parentObject:r,node:n,idMap:a,children:i}=e;a&&a.set(t,n);try{if(void 0!==i&&(null==i?void 0:i.length)===r.children.length){let e=!0;i.forEach((t=>{a.get(t)||(e=!1)})),e&&(r.children=[...a.entries()].sort(((e,t)=>e[0]-t[0])).map((e=>{var[,e]=e;return e})),a.clear())}}catch(e){console.log(e,"e")}}}var ke=function(e,t,r,n){return new(r=r||Promise)((function(a,i){function s(e){try{l(n.next(e))}catch(e){i(e)}}function o(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?a(e.value):((t=e.value)instanceof r?t:new r((function(e){e(t)}))).then(s,o)}l((n=n.apply(e,t||[])).next())}))};class Oe{constructor(e){this.dracoPath="./draco/",this._gltf=new j,this.runScene=e}init(){const e=new d;e.setDecoderPath(this.runScene.optionsEx.options.decodePath),this._gltf.setMeshoptDecoder(s),this._gltf.setDRACOLoader(e)}load(e,t){return ke(this,void 0,void 0,(function*(){var r=yield a().get(e,{responseType:"arraybuffer",onDownloadProgress:e=>{var r,{total:e,loaded:n}=e;let a=n/e;1<(a=a<0?0:a)&&(a=1);var n=Number(a.toFixed(2));e=Math.floor(100*n),null!=(r=null==(n=null==t?void 0:t.callBack)?void 0:n.progress)&&r.call(n,e),this.runScene.optionsEx.log("下载场景进度:"+e,"detail"),null!=t&&t.triggerCb&&this.runScene.cb.loaderer.gltf.progress.cb(e)}}).then((e=>e.data)).catch((e=>{this.runScene.optionsEx.log("下载场景失败:",e)}));return r?this.parse(r,t):Promise.resolve()}))}parse(e,t){const r=(0,S.deepMergeObject)({cleanJSON:!0,triggerCb:!1,reverseTexture:!1,callBack:{mountModule:void 0,getJSON:void 0,beforeParse:void 0,afterParse:void 0,lazyLoadedTexture:void 0,loaded:void 0,loadMaterial:void 0,loadNode:void 0,modelLoaded:void 0,progress:void 0,getArrayBuffer:void 0,complete:void 0,loadedGltf:void 0,loadTexture:void 0},module:{light:!0,model:!0,camera:!0,controls:!0,tags:!0,objects:!0,timeline:!0,sceneConfig:!0}},t||{}),n=new Ee(this.runScene,r);return n.callback("getArrayBuffer",e),new Promise((t=>{new De({rootModel:this.runScene.assetsEx.get().scene,models:[],core:n,runScene:this.runScene,loadConfig:r,mode:this.runScene.optionsEx.options.mode},this.runScene).parse({arrayBuffer:e,onDone:e=>ke(this,void 0,void 0,(function*(){n.callback("loadedGltf",e);try{yield this.afterParse(e.parser.options.ex.options,e,r)}catch(e){this.runScene.cb.error.cb({tip:"加载glb出错",msg:e}),console.log(e,"e")}t(n.models)})),onError:e=>{console.log(e,"_a")}})}))}afterParse(e,t,r){var n;return ke(this,void 0,void 0,(function*(){const a=e.core;yield Promise.all(a.pending),a.callback("afterParse",{options:e,json:t,loadConfig:r});var{cleanJSON:i,callBack:s}=r;if(!t.asset.ex){const{models:r,core:n}=e,a=this.runScene.sceneEx.cleanUnlessLevel(r[0]);n.models.push(a),0<t.animations.length&&(a.animations=[...t.animations])}this.runScene.optionsEx.log(t,"detail"),a.callback("complete",{models:e.models,json:t}),null!=(n=null==s?void 0:s.getJSON)&&n.call(s,t),i&&this.disposeJSON(t)}))}disposeJSON(e){}}var Pe=r(3736),Ae=r(110);class Ce{constructor(e){this._objectLoader=new n.ObjectLoader,this.runScene=e,this._parser=new Re(e)}parse(e){return function(e,t,r,n){return new(r=r||Promise)((function(t,a){function i(e){try{o(n.next(e))}catch(e){a(e)}}function s(e){try{o(n.throw(e))}catch(e){a(e)}}function o(e){var n;e.done?t(e.value):((n=e.value)instanceof r?n:new r((function(e){e(n)}))).then(i,s)}o((n=n.apply(e,[])).next())}))}(this,0,void 0,(function*(){var t=yield this._objectLoader.parseAsync(JSON.parse(e));return this._parser.afterParse(this.runScene.sceneEx.cleanUnlessLevel(t))}))}}class Re{constructor(e){this.runScene=e}parseModel(e){e.material&&this.parseMaterial(e)}parseMaterial(e){var t=e.material;"SpriteMaterial"===t.type&&(0,Pe.M)(t,"type",Ae.Z.tools.type),this.runScene.uniqueEx.material.add(e.material)}afterParse(e){return e instanceof Array?e.map((e=>{e.traverse((e=>{this.parseModel(e)}))})):e.traverse((e=>{this.parseModel(e)})),e}}class Le{constructor(e){this.imgBitMap=new n.ImageBitmapLoader,this.object=new n.ObjectLoader,this.runScene=e,this.gltf=new Oe(e),this.json=new Ce(e)}init(){this.gltf.init()}}const Ie=new class{constructor(){this.load=new n.AnimationLoader}parse(e){return this.load.parse(e)}}},7880:(e,t,r)=>{r.d(t,{Ws:()=>$,ZP:()=>ee,ee:()=>te}),t=r(1863);var n,a,i=r(932),s=r(4707),o=r(8881),l=r(6651),c=r(3735),u=r(3736);class h{constructor(e){this.runScene=e}undo(e){var{material:e,list:t,val:r}=e;this.runScene.undoEx.addUndo(new c.Z({target:e,typeList:["uniforms",...t],newVal:r}).execute())}}(n=h).IgnoredAttributes=["_listeners","version","userData","uuid","name","type","defines"],h.TextureNames=["sideWallTex","backWallTex","floorTex","ceilingTex"],h.tools={type:"FakeInterior",getTextures:e=>{const t=[];return e.uniforms.ceilingTex.value&&t.push({type:"ceilingTex",texture:e.uniforms.ceilingTex.value}),e.uniforms.floorTex.value&&t.push({type:"floorTex",texture:e.uniforms.floorTex.value}),e.uniforms.sideWallTex.value&&t.push({type:"sideWallTex",texture:e.uniforms.sideWallTex.value}),e.uniforms.backWallTex.value&&t.push({type:"backWallTex",texture:e.uniforms.backWallTex.value}),t},create:(e,t)=>{var r=new o.ShaderMaterial({uniforms:(0,l.d9)(d.uniforms),vertexShader:d.vertexShader,fragmentShader:d.fragmentShader});return n.tools.bind(r),r},parseData:e=>{const{texture:t,normal:r,material:a}=e,{data:i,load:s}=t,c=new o.ShaderMaterial({uniforms:(0,l.d9)(d.uniforms),vertexShader:d.vertexShader,fragmentShader:d.fragmentShader}),u=[];return s&&u.push(...i.map((e=>()=>{"ceilingTex"===e.type?c.uniforms.ceilingTex.value=e.texture||null:"floorTex"===e.type?c.uniforms.floorTex.value=e.texture||null:"sideWallTex"===e.type?c.uniforms.sideWallTex.value=e.texture||null:"backWallTex"===e.type&&(c.uniforms.backWallTex.value=e.texture||null)}))),Object.keys(r.uniforms).filter((e=>!h.TextureNames.includes(e))).map((e=>{var t=r.uniforms[e];c.uniforms[e].value="roomsXYZPropsW"===e||"positionOffsetRoomsXYZPropsW"===e||"roomColorTint"===e?new o.Vector4(t.x,t.y,t.z,t.w):t})),c.name=r.name,c.userData.id=a.userData.id,n.tools.bind(c),{material:c,setTextureFns:u}},toNormal:e=>{const t=(0,i.createDefMaterial)(),r=(t.userData=Object.assign({},t.userData),{}),a=e.uniforms,s=d.uniforms;return Object.keys(a).filter((e=>!h.TextureNames.includes(e))).map((e=>{var t,n,i,l,c,u,h=a[e].value,d=s[e].value;h instanceof o.Vector4?(({x:t,y:n,z:i}=h),({x:l,y:c,z:u}=d),t===l&&n===c&&i===u||(r[e]=h)):h!==d&&(r[e]=h)})),{material:t,normal:{type:n.tools.type,uniforms:r,name:e.name},textures:n.tools.getTextures(e)}},clone:(e,t)=>e,copy:(e,t)=>{const r=n.tools.create(t);return Object.keys(r).filter((e=>!h.IgnoredAttributes.includes(e))).map((t=>{r[t]=e[t]})),r},bind:e=>{(0,u.M)(e,"type",n.tools.type)},validType:e=>"FakeInterior"===e.userData.type};const d={uniforms:{roomIntensity:{value:1},roomColorTint:{value:new o.Vector4(1,1,1,1)},sideWallTex:{value:null},backWallTex:{value:null},floorTex:{value:null},ceilingTex:{value:null},sideWallTexTiling:{value:.097},backWallTexTiling:{value:.097},floorTexTiling:{value:.15},ceilingTexTiling:{value:.15},roomTile:{value:.3},roomsXYZPropsW:{value:new o.Vector4(.35,.65,.1,1)},positionOffsetRoomsXYZPropsW:{value:new o.Vector4(4.7,2,-11,-3)},depthTest:{value:!0},depthWrite:{value:!0}},vertexShader:"\n varying vec2 vUv;\n varying vec3 vPos;\n varying mat4 vModelMatrix;\n \n void main() {\n vUv = uv;\n vPos = position;\n vModelMatrix = modelMatrix;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n }\n ",fragmentShader:"\n uniform float roomIntensity;\n uniform vec4 roomColorTint;\n \n uniform sampler2D sideWallTex;\n uniform sampler2D backWallTex;\n uniform sampler2D floorTex;\n uniform sampler2D ceilingTex;\n \n uniform float sideWallTexTiling;\n uniform float backWallTexTiling;\n uniform float floorTexTiling;\n uniform float ceilingTexTiling;\n \n uniform float roomTile;\n uniform vec4 roomsXYZPropsW;\n uniform vec4 positionOffsetRoomsXYZPropsW;\n \n varying vec2 vUv;\n varying vec3 vPos;\n varying mat4 vModelMatrix;\n \n void main() {\n vec4 interpVertexPos = vec4(vPos.xyz, vPos.z);\n // 将相机世界空间坐标转换为对象空间坐标\n vec4 cameraObjectPos = inverse(vModelMatrix) * vec4(cameraPosition, 1.0);\n vec4 transCameraPos = vec4(cameraObjectPos.xyz, cameraObjectPos.z);\n \n vec4 temp1 = (interpVertexPos - positionOffsetRoomsXYZPropsW);\n vec4 temp2 = ((roomsXYZPropsW + vec4(-1E-05, -1E-05, -1E-05, -1E-05)) * roomTile);\n vec4 V2 = transCameraPos - positionOffsetRoomsXYZPropsW;\n vec4 V1 = temp1 - V2;\n vec4 middleman = ((floor(temp2 * temp1) + step(vec4(0, 0, 0, 0), V1)) / temp2 - V2) / V1;\n \n // Side Walls\n vec2 sideWallUv = (middleman.x * V1 + V2).zy * sideWallTexTiling;\n vec4 sideWallColor = texture2D(sideWallTex, sideWallUv);\n \n // Back Wall\n vec2 backWallUv = (middleman.z * V1 + V2).xy * backWallTexTiling;\n vec4 backWallColor = texture2D(backWallTex, backWallUv);\n \n // Floor Ceiling\n vec2 floorUv = ((middleman.y * V1) + V2).xz * floorTexTiling;\n vec2 ceilingUv = ((middleman.y * V1) + V2).xz * ceilingTexTiling;\n vec4 floorColor = texture2D(floorTex, floorUv);\n vec4 ceilingColor = texture2D(ceilingTex, ceilingUv);\n vec4 cfColor = mix(floorColor, ceilingColor, step(0.0, V1.y));\n \n // Mix\n float compareXZ = 0.0;\n float stepXZ = step(middleman.z, middleman.x);\n if(stepXZ <= 0.0)\n compareXZ = middleman.x;\n else\n compareXZ = middleman.z;\n \n vec4 wallColor = vec4(0);\n if(stepXZ <= 0.0)\n wallColor = sideWallColor;\n else\n wallColor = backWallColor;\n \n vec4 finalColor = vec4(0);\n if(middleman.y <= compareXZ)\n finalColor = cfColor;\n else\n finalColor = wallColor;\n \n // Tint Room\n vec4 tintColor = roomColorTint * finalColor * roomIntensity;\n \n gl_FragColor = tintColor;\n }\n "};class p{constructor(e){this.runScene=e}undo(e){var{material:e,list:t,val:r}=e;this.runScene.undoEx.addUndo(new c.Z({target:e,typeList:[...t],newVal:r}).execute())}}(a=p).IgnoredAttributes=["_listeners","version","userData","uuid","name","type","defines"],p.TextureNames=["envMap","displacementMap"],p.tools={type:"Fresnel",getTextures:e=>{const t=[];return e.envMap&&t.push({type:"envMap",texture:e.envMap}),e.displacementMap&&t.push({type:"displacementMap",texture:e.displacementMap}),t},create:(e,t)=>{const r=new f(void 0,void 0,e);return r.insertFresnelShader(),a.tools.bind(r),(t=t||e.modelEx.select)&&(r.name=t.name),r},parseData:(e,t)=>{const{texture:r,normal:n,material:s}=e,{data:o,load:l}=r,c=(0,i.mergeMaterial)(s,new f(void 0,void 0,t)),u=[];return l&&u.push(...o.map((e=>()=>{c[e.type]=e.texture}))),Object.keys(n.uniforms).filter((e=>!p.TextureNames.includes(e))).map((e=>{c[e]=n.uniforms[e]})),c.insertFresnelShader(),c.name=n.name,c.userData.id=s.userData.id,a.tools.bind(c),{material:c,setTextureFns:u}},toNormal:e=>{const t=(0,i.mergeMaterial)(e,(0,i.createDefMaterial)()),r=(t.userData=Object.assign({},t.userData),t.name=e.name,{}),n=m.uniforms;return Object.keys(n).filter((e=>!p.TextureNames.includes(e))).map((t=>{var a=e[t],i=n[t].value;"fresnelBias"===t||"fresnelScale"===t||"fresnelPower"===t||"isSurge"===t?a.value!==i&&(r[t]=a):a!==i&&(r[t]=a)})),{material:t,normal:{type:a.tools.type,uniforms:r,name:e.name},textures:a.tools.getTextures(e)}},clone:(e,t)=>e,copy:(e,t)=>{const r=a.tools.create(t);return Object.keys(r).filter((e=>!p.IgnoredAttributes.includes(e))).map((t=>{r[t]=e[t]})),r},bind:e=>{(0,u.M)(e,"type",a.tools.type)},validType:e=>"Fresnel"===e.userData.type};class f extends o.MeshPhysicalMaterial{constructor(e,t,r){if(e?super(e):(super(),this.emissive=new o.Color(65535),this.envMap=null,this.displacementMap=null,this.metalness=0,this.roughness=0,this.ior=1.5,this.transmission=1,this.opacity=1,this.transparent=!0,this.thickness=0),this.runScene=r,this.isSpecialMaterial=!0,t?(this.fresnelBias=new o.Uniform(t.fresnelBias),this.fresnelScale=new o.Uniform(t.fresnelScale),this.fresnelPower=new o.Uniform(t.fresnelPower)):(this.fresnelBias=new o.Uniform(m.uniforms.fresnelBias.value),this.fresnelScale=new o.Uniform(m.uniforms.fresnelScale.value),this.fresnelPower=new o.Uniform(m.uniforms.fresnelPower.value)),this.clock=new o.Clock,this.isSurge=new o.Uniform(!1),this.deltaTime=new o.Uniform(0),!this.cubeCamera){const e=new o.WebGLCubeRenderTarget(2048);e.texture.mapping=o.CubeRefractionMapping,this.cubeCamera=new o.CubeCamera(.1,1e5,e),this.runScene.assetsEx.scene.add(this.cubeCamera),this.runScene.cb.render.add("Fresnel",(()=>{this.update()}))}}insertFresnelShader(){this.onBeforeCompile=e=>{e.uniforms.isSurge=this.isSurge,e.uniforms.deltaTime=this.deltaTime,e.uniforms.fresnelBias=this.fresnelBias,e.uniforms.fresnelScale=this.fresnelScale,e.uniforms.fresnelPower=this.fresnelPower,e.vertexShader=e.vertexShader.replace(/varying vec3 vWorldPosition;/g,m.vertexParas),e.vertexShader=e.vertexShader.replace(/#include <begin_vertex>/g,m.vertexShader1),e.vertexShader=e.vertexShader.replace(/vWorldPosition = worldPosition.xyz;/g,m.vertexShader2),e.fragmentShader=e.fragmentShader.replace(/#include <transmission_pars_fragment>/g,m.fragmentParas),e.fragmentShader=e.fragmentShader.replace(/vec3 totalEmissiveRadiance = emissive;/g,m.fragmentShaderEmissive)}}update(){this.clock&&(this.deltaTime.value+=3*this.clock.getDelta()),this.cubeCamera&&(this.cubeCamera.position.copy(this.runScene.assetsEx.camera.position),this.cubeCamera.update(this.runScene.assetsEx.renderer,this.runScene.assetsEx.scene))}}const m={uniforms:{depthTest:new o.Uniform(!0),depthWrite:new o.Uniform(!0),isSurge:new o.Uniform(!1),deltaTime:new o.Uniform(0),fresnelBias:new o.Uniform(0),fresnelScale:new o.Uniform(1),fresnelPower:new o.Uniform(3)},vertexParas:"\n uniform bool isSurge;\n uniform float deltaTime;\n varying vec3 vWorldPosition;\n varying vec3 vWorldNormal;\n ",vertexShader1:"\n vec3 transformed = vec3(position);\n if(isSurge) {\n // 0.15作为系数控制气泡表面波纹的稀疏程度,数值越大越密\n float wobbleValue = 0.15 * transformed.y + deltaTime;\n // 三角函数的系数控制气泡表面波纹的波动幅度,数值越大波幅越大\n vec3 wobblePos = vec3(0.75 * cos(wobbleValue) + 0.25 * sin(wobbleValue));\n transformed += wobblePos;\n }\n ",vertexShader2:"\n vWorldPosition = worldPosition.xyz;\n vWorldNormal = normalize(vec3(modelMatrix * vec4(normal, 0.0)));\n ",fragmentParas:"\n #include <transmission_pars_fragment>\n varying vec3 vWorldNormal;\n uniform float fresnelBias;\n uniform float fresnelScale;\n uniform float fresnelPower;\n ",fragmentShaderEmissive:"\n vec3 viewDir = normalize(cameraPosition - vWorldPosition);\n float fresnelNdot = dot(viewDir, vWorldNormal);\n float fresnelValue = fresnelBias + fresnelScale * pow(1.0 - fresnelNdot, fresnelPower);\n // fresnelValue = [0, 1], 0=center,1=edge\n \n vec3 totalEmissiveRadiance = emissive * fresnelValue;\n "};var g,v,b=r(3263),y=r(1398);const x={color:s.Gf.color,opacity:s.Gf.opacity};class w{constructor(e){this.runScene=e}}(g=w).tools={type:"LineBasicMaterial",bind(e){(0,u.M)(e,"type","LineBasicMaterial")},create:()=>{var e=new o.LineBasicMaterial;return g.tools.bind(e),e},parseData:e=>{const{texture:t,normal:r,core:n,material:a}=e,{data:i,load:s}=t,o=[];return s&&o.push(...b.F6.filter(i.map((e=>{const{type:t,texture:r}=e;if(r)return()=>{n.runScene.uniqueEx.texture.addMaterial(r,{material:a,type:t})}})))),n.runScene.materialEx.parseNromals(r,a),g.tools.bind(a),{material:a,setTextureFns:o}},toNormal:e=>({material:e.clone(),normal:{type:g.tools.type},textures:[]}),clone:(e,t)=>e,copy:e=>e.clone(),getTextures:()=>[],snapshot:{getDiff:e=>y.LV.getDiff(x,e),set:e=>{const{map:t,material:r,runScene:n,data:a}=e;y.LV.set({def:x,data:a,runScene:n,map:t,target:r}),t.data.completedCbs.push((()=>{(0,i.updateMaterial)(r)}))}},validType:e=>e.type===g.tools.type};class S{constructor(e){this.runScene=e}undo(e){const{material:t,list:r,val:n}=e;this.runScene.undoEx.addUndo(new c.Z({target:t,typeList:[...r],newVal:n,cb:()=>{t.needsUpdate=!0}}).execute())}}(v=S).IgnoredAttributes=["_listeners","version","userData","uuid","name","type","defines"],S.TextureNames=["alphaMap","bumpMap","displacementMap","map","normalMap","matcap"],S.tools={type:"Matcap",getTextures:e=>{const t=[];return S.TextureNames.forEach((r=>{e[r]&&t.push({type:r,texture:e[r]})})),t},create:(e,t)=>{const r=new o.MeshMatcapMaterial;return v.tools.bind(r),(t=t||e.modelEx.select)&&(r.name="Matcap-"+t.name),r},parseData:e=>{const{normal:t,texture:r,material:n}=e,{data:a,load:s}=r,l=(0,i.mergeMaterial)(n,new o.MeshMatcapMaterial),c=(delete l.emissive,[]);return s&&c.push(...a.map((e=>()=>{l[e.type]=e.texture}))),Object.keys(t.uniforms).filter((e=>!S.IgnoredAttributes.includes(e))).map((e=>{l[e]="normalScale"===e?new o.Vector2(t.uniforms[e].x,t.uniforms[e].y):t.uniforms[e]})),l.name=t.name,l.userData.id=n.userData.id,v.tools.bind(l),{material:l,setTextureFns:c}},toNormal:e=>{var t=v.tools.getTextures(e);const r=(0,i.mergeMaterial)(e,(0,i.createDefMaterial)()),n=(r.userData=Object.assign({},r.userData),r.name=e.name,{}),a=new o.MeshMatcapMaterial;return Object.keys(e).filter((e=>!S.TextureNames.includes(e))).filter((e=>!S.IgnoredAttributes.includes(e))).map((t=>{var r=e[t],i=a[t];"bumpScale"===t||"displacementScale"===t||"displacementBias"===t||"depthTest"===t||"depthWrite"===t||"transparent"===t||"opacity"===t?r!==i&&(n[t]=r):"normalScale"!==t||r.x===i.x&&r.y===i.y||(n[t]=r)})),{material:r,normal:{type:v.tools.type,uniforms:n,name:e.name},textures:t}},clone:(e,t)=>e,copy:(e,t)=>{const r=v.tools.create(t);return Object.keys(r).filter((e=>!S.IgnoredAttributes.includes(e))).map((t=>{r[t]=e[t]})),r},bind:e=>{(0,u.M)(e,"type",v.tools.type)},validType:e=>"Matcap"===e.userData.type};const M="\nvec3 mod289(vec3 x) {\n return x - floor(x * (1.0 / 289.0)) * 289.0;\n}\n\nvec2 mod289(vec2 x) {\n return x - floor(x * (1.0 / 289.0)) * 289.0;\n}\n\nvec3 permute(vec3 x) {\n return mod289(((x*34.0)+1.0)*x);\n}\n\nfloat noise2D(vec2 v) {\n const vec4 C = vec4(0.211324865405187, // (3.0-sqrt(3.0))/6.0\n 0.366025403784439, // 0.5*(sqrt(3.0)-1.0)\n -0.577350269189626, // -1.0 + 2.0 * C.x\n 0.024390243902439); // 1.0 / 41.0\n// First corner\nvec2 i = floor(v + dot(v, C.yy) );\nvec2 x0 = v - i + dot(i, C.xx);\n\n// Other corners\nvec2 i1;\n//i1.x = step( x0.y, x0.x ); // x0.x > x0.y ? 1.0 : 0.0\n//i1.y = 1.0 - i1.x;\ni1 = (x0.x > x0.y) ? vec2(1.0, 0.0) : vec2(0.0, 1.0);\n// x0 = x0 - 0.0 + 0.0 * C.xx ;\n// x1 = x0 - i1 + 1.0 * C.xx ;\n// x2 = x0 - 1.0 + 2.0 * C.xx ;\nvec4 x12 = x0.xyxy + C.xxzz;\nx12.xy -= i1;\n\n// Permutations\ni = mod289(i); // Avoid truncation effects in permutation\nvec3 p = permute( permute( i.y + vec3(0.0, i1.y, 1.0 )) + i.x + vec3(0.0, i1.x, 1.0 ));\n\nvec3 m = max(0.5 - vec3(dot(x0,x0), dot(x12.xy,x12.xy), dot(x12.zw,x12.zw)), 0.0);\nm = m*m ;\nm = m*m ;\n\n// Gradients: 41 points uniformly over a line, mapped onto a diamond.\n// The ring size 17*17 = 289 is close to a multiple of 41 (41*7 = 287)\n\nvec3 x = 2.0 * fract(p * C.www) - 1.0;\nvec3 h = abs(x) - 0.5;\nvec3 ox = floor(x + 0.5);\nvec3 a0 = x - ox;\n\n// Normalise gradients implicitly by scaling m\n// Approximation of: m *= inversesqrt( a0*a0 + h*h );\nm *= 1.79284291400159 - 0.85373472095314 * ( a0*a0 + h*h );\n\n// Compute final noise value at P\nvec3 g;\ng.x = a0.x * x0.x + h.x * x0.y;\ng.yz = a0.yz * x12.xz + h.yz * x12.yw;\nreturn 130.0 * dot(m, g);\n}\n ",T="\n vec3 mod289(vec3 x) {\n return x - floor(x * (1.0 / 289.0)) * 289.0;\n }\n \n vec4 mod289(vec4 x) {\n return x - floor(x * (1.0 / 289.0)) * 289.0;\n }\n \n vec4 permute(vec4 x) {\n return mod289(((x*34.0)+1.0)*x);\n }\n \n vec4 taylorInvSqrt(vec4 r) {\n return 1.79284291400159 - 0.85373472095314 * r;\n }\n \n float noise3D(vec3 v) {\n const vec2 C = vec2(1.0/6.0, 1.0/3.0);\n const vec4 D = vec4(0.0, 0.5, 1.0, 2.0);\n \n // First corner\n vec3 i = floor(v + dot(v, C.yyy));\n vec3 x0 = v - i + dot(i, C.xxx);\n \n // Other corners\n vec3 g = step(x0.yzx, x0.xyz);\n vec3 l = 1.0 - g;\n vec3 i1 = min(g.xyz, l.zxy);\n vec3 i2 = max(g.xyz, l.zxy);\n \n // x0 = x0 - 0.0 + 0.0 * C.xxx;\n // x1 = x0 - i1 + 1.0 * C.xxx;\n // x2 = x0 - i2 + 2.0 * C.xxx;\n // x3 = x0 - 1.0 + 3.0 * C.xxx;\n vec3 x1 = x0 - i1 + C.xxx;\n vec3 x2 = x0 - i2 + C.yyy;\n // 2.0*C.x = 1/3 = C.y\n vec3 x3 = x0 - D.yyy;\n // -1.0+3.0*C.x = -0.5 = -D.y\n \n // Permutations\n i = mod289(i);\n vec4 p = permute(permute(permute(i.z + vec4(0.0, i1.z, i2.z, 1.0 )) + i.y + vec4(0.0, i1.y, i2.y, 1.0 )) + i.x + vec4(0.0, i1.x, i2.x, 1.0 ));\n \n // Gradients: 7x7 points over a square, mapped onto an octahedron.\n // The ring size 17*17 = 289 is close to a multiple of 49 (49*6 = 294)\n float n_ = 0.142857142857; // 1.0/7.0\n vec3 ns = n_ * D.wyz - D.xzx;\n \n vec4 j = p - 49.0 * floor(p * ns.z * ns.z); // mod(p,7*7)\n \n vec4 x_ = floor(j * ns.z);\n vec4 y_ = floor(j - 7.0 * x_ ); // mod(j,N)\n \n vec4 x = x_ *ns.x + ns.yyyy;\n vec4 y = y_ *ns.x + ns.yyyy;\n vec4 h = 1.0 - abs(x) - abs(y);\n \n vec4 b0 = vec4( x.xy, y.xy );\n vec4 b1 = vec4( x.zw, y.zw );\n \n //vec4 s0 = vec4(lessThan(b0,0.0))*2.0 - 1.0;\n //vec4 s1 = vec4(lessThan(b1,0.0))*2.0 - 1.0;\n vec4 s0 = floor(b0)*2.0 + 1.0;\n vec4 s1 = floor(b1)*2.0 + 1.0;\n vec4 sh = -step(h, vec4(0.0));\n \n vec4 a0 = b0.xzyw + s0.xzyw*sh.xxyy;\n vec4 a1 = b1.xzyw + s1.xzyw*sh.zzww;\n \n vec3 p0 = vec3(a0.xy,h.x);\n vec3 p1 = vec3(a0.zw,h.y);\n vec3 p2 = vec3(a1.xy,h.z);\n vec3 p3 = vec3(a1.zw,h.w);\n \n //Normalise gradients\n vec4 norm = taylorInvSqrt(vec4(dot(p0,p0), dot(p1,p1), dot(p2, p2), dot(p3,p3)));\n p0 *= norm.x;\n p1 *= norm.y;\n p2 *= norm.z;\n p3 *= norm.w;\n \n // Mix final noise value\n vec4 m = max(0.6 - vec4(dot(x0,x0), dot(x1,x1), dot(x2,x2), dot(x3,x3)), 0.0);\n m = m * m;\n return 42.0 * dot( m*m, vec4( dot(p0,x0), dot(p1,x1), dot(p2,x2), dot(p3,x3) ) );\n }\n ",_={defines:{USE_UV:!0,USE_MAP:!0},uniforms:{mapArray:{value:[null,null,null,null,null,null]},maskArray:{value:[null,null,null,null,null]},mapUvTransArray:{value:[new o.Matrix3,new o.Matrix3,new o.Matrix3,new o.Matrix3,new o.Matrix3,new o.Matrix3]},maskUvTransArray:{value:[new o.Matrix3,new o.Matrix3,new o.Matrix3,new o.Matrix3,new o.Matrix3]},diffuse:{value:new o.Color(16777215)},uvTransform:{value:new o.Matrix3},shadowShade:{value:.6}},vertex:"\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n\nvoid main() {\n #include <uv_vertex>\n #include <uv2_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <worldpos_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n // vUv = (uvTransform * vec3(uv, 1.0)).xy;\n}\n ",fragment:"\nuniform vec3 diffuse;\nuniform float opacity;\n\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\n\n#define MAX_TEX 6\nuniform mat3 mapUvTransArray[MAX_TEX];\nuniform mat3 maskUvTransArray[MAX_TEX - 1];\nuniform sampler2D mapArray[MAX_TEX];\nuniform sampler2D maskArray[MAX_TEX - 1];\nuniform float shadowShade;\n\n// Insert Noise2D\nfloat sum(vec3 v) {return v.x + v.y + v.z;}\nvec3 textureNoTile(sampler2D tex, vec2 tUv, float offsetScale) {\n // cheap (cache friendly) lookup\n float k = noise2D(0.25 * tUv);\n\n float l = k * 8.0;\n float f = fract(l);\n float ia = floor(l);\n float ib = ia + 1.0;\n\n // can replace with any other hash\n vec2 offa = sin(vec2(3.0, 7.0) * ia);\n vec2 offb = sin(vec2(3.0, 7.0) * ib);\n\n vec2 duvdx = dFdx(tUv);\n vec2 duvdy = dFdy(tUv);\n vec3 cola = textureGrad(tex, tUv + offsetScale * offa, duvdx, duvdy).xyz;\n vec3 colb = textureGrad(tex, tUv + offsetScale * offb, duvdx, duvdy).xyz;\n\n return mix(cola, colb, smoothstep(0.2, 0.8, f - 0.1 * sum(cola-colb)));\n}\nvec4 texSampler(sampler2D tex, vec2 tUv, float offsetScale) {\n return vec4(textureNoTile(tex, tUv, offsetScale), 1.0);\n}\n\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4(diffuse, opacity);\n #include <logdepthbuf_fragment>\n \n // Custom UV Start\n #if MAX_TEX > 0\n vec2 vCustomMapUv[MAX_TEX];\n for (int i = 0; i < MAX_TEX; i++) {\n vCustomMapUv[i] = (mapUvTransArray[i] * vec3(vUv, 1.0)).xy;\n }\n #endif\n #if MAX_TEX > 1\n vec2 vCustomMaskUv[MAX_TEX - 1];\n for (int i = 0; i < MAX_TEX - 1; i++) {\n vCustomMaskUv[i] = (maskUvTransArray[i] * vec3(vUv, 1.0)).xy;\n }\n #endif\n // Custom UV End\n \n // Custom Texture Start\n float offsetScale = 1.2;\n vec4 maskColor = vec4(1.0);\n vec4 textureColor = vec4(1.0);\n #if MAX_TEX > 0\n textureColor = texSampler(mapArray[0], vCustomMapUv[0], offsetScale);\n #endif\n #if MAX_TEX > 1\n maskColor = texture2D(maskArray[0], vCustomMaskUv[0]);\n textureColor = mix(textureColor, texSampler(mapArray[1], vCustomMapUv[1], offsetScale), maskColor.r);\n #endif\n #if MAX_TEX > 2\n maskColor = texture2D(maskArray[1], vCustomMaskUv[1]);\n textureColor = mix(textureColor, texSampler(mapArray[2], vCustomMapUv[2], offsetScale), maskColor.r);\n #endif\n #if MAX_TEX > 3\n maskColor = texture2D(maskArray[2], vCustomMaskUv[2]);\n textureColor = mix(textureColor, texSampler(mapArray[3], vCustomMapUv[3], offsetScale), maskColor.r);\n #endif\n #if MAX_TEX > 4\n maskColor = texture2D(maskArray[3], vCustomMaskUv[3]);\n textureColor = mix(textureColor, texSampler(mapArray[4], vCustomMapUv[4], offsetScale), maskColor.r);\n #endif\n #if MAX_TEX > 5\n maskColor = texture2D(maskArray[4], vCustomMaskUv[4]);\n textureColor = mix(textureColor, texSampler(mapArray[5], vCustomMapUv[5], offsetScale), maskColor.r);\n #endif\n diffuseColor *= textureColor;\n // Custom Texture End\n \n // ReflectedLight reflectedLight = ReflectedLight(vec3(0.0), vec3(0.0), vec3(0.0), vec3(0.0));\n // reflectedLight.indirectDiffuse *= diffuseColor.rgb;\n // vec3 outgoingLight = reflectedLight.indirectDiffuse;\n vec3 outgoingLight = diffuseColor.rgb;\n #include <output_fragment>\n \n // gl_FragColor = vec4(diffuse, opacity * (1.0 - getShadowMask()));\n gl_FragColor.rgb *= vec3(getShadowMask() * (1.0 - shadowShade) + shadowShade);\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n}\n "};var E,D,k=r(3729);const O={diffuse:{type:"color",label:["uniforms","diffuse","value"],val:{r:1,g:1,b:1},shortKey:"df"},shadowShade:{type:"number",label:["uniforms","shadowShade","value"],val:.6,shortKey:"ss"},terrainMap0:{type:"texture",val:null,get:e=>(e=e.uniforms.mapArray.value[0])?(0,k.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.mapArray.value[0]=r},shortKey:"p0"},terrainMap1:{type:"texture",val:null,get:e=>(e=e.uniforms.mapArray.value[1])?(0,k.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.mapArray.value[1]=r},shortKey:"p1"},terrainMap2:{type:"texture",val:null,get:e=>(e=e.uniforms.mapArray.value[2])?(0,k.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.mapArray.value[2]=r},shortKey:"p2"},terrainMap3:{type:"texture",val:null,get:e=>(e=e.uniforms.mapArray.value[3])?(0,k.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.mapArray.value[3]=r},shortKey:"p3"},terrainMap4:{type:"texture",val:null,get:e=>(e=e.uniforms.mapArray.value[4])?(0,k.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.mapArray.value[4]=r},shortKey:"p4"},terrainMap5:{type:"texture",val:null,get:e=>(e=e.uniforms.mapArray.value[5])?(0,k.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.mapArray.value[5]=r},shortKey:"p5"},terrainMap6:{type:"texture",val:null,get:e=>(e=e.uniforms.mapArray.value[6])?(0,k.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.mapArray.value[6]=r},shortKey:"p6"},terrainMap7:{type:"texture",val:null,get:e=>(e=e.uniforms.mapArray.value[7])?(0,k.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.mapArray.value[7]=r},shortKey:"p7"},terrainMask0:{type:"texture",val:null,get:e=>(e=e.uniforms.maskArray.value[0])?(0,k.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.maskArray.value[0]=r},shortKey:"k0"},terrainMask1:{type:"texture",val:null,get:e=>(e=e.uniforms.maskArray.value[1])?(0,k.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.maskArray.value[1]=r},shortKey:"k1"},terrainMask2:{type:"texture",val:null,get:e=>(e=e.uniforms.maskArray.value[2])?(0,k.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.maskArray.value[2]=r},shortKey:"k2"},terrainMask3:{type:"texture",val:null,get:e=>(e=e.uniforms.maskArray.value[3])?(0,k.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.maskArray.value[3]=r},shortKey:"k3"},terrainMask4:{type:"texture",val:null,get:e=>(e=e.uniforms.maskArray.value[4])?(0,k.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.maskArray.value[4]=r},shortKey:"k4"},terrainMask5:{type:"texture",val:null,get:e=>(e=e.uniforms.maskArray.value[5])?(0,k.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.maskArray.value[5]=r},shortKey:"k5"},terrainMask6:{type:"texture",val:null,get:e=>(e=e.uniforms.maskArray.value[6])?(0,k.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.maskArray.value[6]=r},shortKey:"k6"}};class P{constructor(e){this.runScene=e}undo(e){var{material:e,list:t,val:r}=e;this.runScene.undoEx.addUndo(new c.Z({target:e,typeList:["uniforms",...t],newVal:r}).execute())}insertShader(e){e&&(e.onBeforeCompile=t=>{t.defines=_.defines,this.mergeUniforms(e.uniforms,t.uniforms),t.vertexShader=_.vertex,t.fragmentShader=_.fragment,t.fragmentShader=t.fragmentShader.replace(/\/\/ Insert Noise2D/g,M)})}mergeUniforms(e,t){if(e&&t)for(const r in e)t[r]=e[r]}onTexRepeatChange(e,t,r){e&&0<=t&&(r?(r=e.uniforms.mapArray.value[t],e.uniforms.mapUvTransArray.value[t].identity(),e.uniforms.mapUvTransArray.value[t].scale(r.repeat.x,r.repeat.y)):(r=e.uniforms.maskArray.value[t],e.uniforms.maskUvTransArray.value[t].identity(),e.uniforms.maskUvTransArray.value[t].scale(r.repeat.x,r.repeat.y)))}}(E=P).IgnoredAttributes=["_listeners","version","userData","uuid","name","type","defines"],P.TextureNames=["terrainMap0","terrainMap1","terrainMap2","terrainMap3","terrainMap4","terrainMap5","terrainMap6","terrainMap7","terrainMask0","terrainMask1","terrainMask2","terrainMask3","terrainMask4","terrainMask5","terrainMask6"],P.tools={type:"MixTexture",getTextures:e=>{const t=[];return P.TextureNames.forEach((r=>{var n=parseInt(r.slice(-1));r.startsWith("terrainMap")?e.uniforms.mapArray.value[n]&&t.push({type:r,texture:e.uniforms.mapArray.value[n]}):r.startsWith("terrainMask")&&e.uniforms.maskArray.value[n]&&t.push({type:r,texture:e.uniforms.maskArray.value[n]})})),t},create:(e,t)=>{const r=new o.ShadowMaterial({color:0,opacity:1});return r.uniforms=o.UniformsUtils.clone(_.uniforms),e.materialEx.def.map.MixTexture.insertShader(r),E.tools.bind(r),r},parseData:(e,t)=>{const{texture:r,normal:n,material:a}=e,{data:i,load:s}=r,l=new o.ShadowMaterial({color:0,opacity:1}),c=(l.uniforms=o.UniformsUtils.clone(_.uniforms),t.materialEx.def.map.MixTexture.insertShader(l),[]);return s&&c.push(...i.map((e=>()=>{var r=parseInt(e.type.slice(-1));e.type.startsWith("terrainMap")?(l.uniforms.mapArray.value[r]=e.texture,t.materialEx.def.map.MixTexture.onTexRepeatChange(l,r,!0)):e.type.startsWith("terrainMask")&&(l.uniforms.maskArray.value[r]=e.texture,t.materialEx.def.map.MixTexture.onTexRepeatChange(l,r,!1))}))),Object.keys(n.uniforms).filter((e=>!P.TextureNames.includes(e))).map((e=>{var t=n.uniforms[e];"diffuse"===e?l.uniforms[e].value=new o.Color(parseInt(t,16)):"uvTransform"!==e&&(l.uniforms[e].value=t)})),l.name=n.name,l.userData.id=a.userData.id,E.tools.bind(l),{material:l,setTextureFns:c}},toNormal:e=>{const t=(0,i.createDefMaterial)(),r=(t.userData=Object.assign(Object.assign({},t.userData),{normal:{type:E.tools.type,uniforms:{},name:e.name},textures:E.tools.getTextures(e)}),{}),n=e.uniforms,a=_.uniforms;return Object.keys(n).filter((e=>"mapArray"!==e&&"maskArray"!==e&&"mapUvTransArray"!==e&&"maskUvTransArray"!==e)).map((e=>{const t=n[e].value,i=a[e].value;"diffuse"===e?t.getHexString()!==i.getHexString()&&(r[e]=t.getHexString()):"uvTransform"!==e&&t!==i&&(r[e]=t)})),{material:t,normal:{type:E.tools.type,uniforms:r,name:e.name},textures:E.tools.getTextures(e)}},clone:(e,t)=>e,copy:(e,t)=>{const r=E.tools.create(t);return Object.keys(r).filter((e=>!P.IgnoredAttributes.includes(e))).map((t=>{r[t]=e[t]})),r},bind:e=>{(0,u.M)(e,"type",E.tools.type)},validType:e=>"MixTexture"===e.userData.type,snapshot:{getDiff:e=>y.LV.getDiff(O,e),set:e=>{const{map:t,material:r,runScene:n,data:a}=e;y.LV.set({def:O,data:a,runScene:n,map:t,target:r}),t.data.completedCbs.push((()=>{(0,i.updateMaterial)(r)}))}}};class A{constructor(e){this.runScene=e}}(D=A).tools={type:"MyPointsMaterial",bind(e){(0,u.M)(e,"type","MyPointsMaterial")},getTextures:e=>["map","alphaMap"].map((t=>{var r=e[t];if(r)return{type:t,texture:r}})).filter((e=>e)),create:(e,t)=>(t=t.modelEx.def.vertices.rain.createMaterial(e),D.tools.bind(t),t),parseData:(e,t)=>{var{texture:e,material:r,normal:n}=e;const{data:a,load:s}=e,o=[];var{name:e,size:n}=n;const l=A.tools.create({size:n},t);return(0,k.x)(l,(0,k.Ki)(r)),l.fog=r.fog,e&&(l.name=e),s&&o.push(...a.map((e=>{const{type:t,texture:r}=e;return()=>{l[t]=r,(0,i.updateMaterial)(l)}}))),{material:l,setTextureFns:o}},toNormal:e=>{const t=(0,i.createDefMaterial)();var r={type:A.tools.type,name:e.name,size:e.size};return t.map=e.map,t.userData=Object.assign({},t.userData),{normal:r,textures:A.tools.getTextures(e),material:t}},clone:e=>e,copy:e=>{const t=e.clone();return t.userData.type=A.tools.type,t}};var C,R=r(110),L=r(6272),I=r(8089),B=r(5247);class j{constructor(e){this.runScene=e}undo(e){var{material:e,list:t,val:r}=e;this.runScene.undoEx.addUndo(new c.Z({target:e,typeList:[...t],newVal:r}).execute())}}(C=j).IgnoredAttributes=["_listeners","version","userData","color","emissive","uniforms","newColor","newColorMixnumber","uuid","name","type","defines"],j.TextureNames=["alphaMap","aoMap","bumpMap","displacementMap","emissiveMap","envMap","lightMap","map","metalnessMap","normalMap","roughnessMap","clearcoatMap","clearcoatNormalMap","clearcoatRoughnessMap","sheenRoughnessMap","sheenColorMap","specularIntensityMap","specularColorMap","thicknessMap","transmissionMap"],j.tools={type:"Physical",getTextures:e=>{const t=[];return j.TextureNames.forEach((r=>{e[r]&&t.push({type:r,texture:e[r]})})),t},create:(e,t)=>{const r=new B.Z.MeshPhysicalMaterial;return C.tools.bind(r),(t=t||e.modelEx.select)&&(r.name="MeshPhysicalMaterial-"+t.name),r},parseData:e=>{const{normal:t,texture:r,material:n}=e,{data:a,load:s}=r,l=(0,i.mergeMaterial)(n,new B.Z.MeshPhysicalMaterial),c=[];return s&&c.push(...a.map((e=>()=>{l[e.type]=e.texture}))),Object.keys(t.uniforms).filter((e=>!j.IgnoredAttributes.includes(e))).map((e=>{var r=t.uniforms[e];"attenuationColor"===e||"sheenColor"===e||"specularColor"===e?l[e]=(0,I.ZD)(r):"clearcoatNormalScale"===e?l[e]=new o.Vector2(r.x,r.y):"normalScale"===e?l[e].set(r,r):l[e]=r})),l.name=t.name,l.userData.id=n.userData.id,C.tools.bind(l),{material:l,setTextureFns:c}},toNormal:e=>{const t=(0,i.mergeMaterial)(e,(0,i.createDefMaterial)()),r=(t.name=e.name,{}),n=new B.Z.MeshPhysicalMaterial;return Object.keys(e).filter((e=>!j.TextureNames.includes(e))).filter((e=>!j.IgnoredAttributes.includes(e))).map((t=>{let a=e[t];const i=n[t];"attenuationColor"===t||"sheenColor"===t||"specularColor"===t?a.getHexString()!==i.getHexString()&&(r[t]=a.getHexString()):"clearcoatNormalScale"===t?a.x===i.x&&a.y===i.y||(r[t]=a):(0,L.Xq)(i,a)&&("normalScale"===t&&(a=a.x),r[t]=a)})),{material:t,normal:{type:C.tools.type,uniforms:r,name:e.name},textures:C.tools.getTextures(e)}},clone:(e,t)=>e,copy:(e,t)=>{const r=C.tools.create(t);return Object.keys(r).filter((e=>!j.IgnoredAttributes.includes(e))).map((t=>{r[t]=e[t]})),r},bind:e=>{(0,u.M)(e,"type",C.tools.type)},validType:e=>"MeshPhysicalMaterial"===e.type};var U=r(6001),N=r(5180);const z={uniforms:{tDiffuse:new o.Uniform(null),h:new o.Uniform(1/512)},vertexShader:"\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t}",fragmentShader:"\n\t\tuniform sampler2D tDiffuse;\n\t\tuniform float h;\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\t\t\tvec4 sum = vec4( 0.0 );\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 4.0 * h, vUv.y ) ) * 0.051;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 3.0 * h, vUv.y ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 2.0 * h, vUv.y ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 1.0 * h, vUv.y ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 1.0 * h, vUv.y ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 2.0 * h, vUv.y ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 3.0 * h, vUv.y ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 4.0 * h, vUv.y ) ) * 0.051;\n\t\t\t\n\t\t\tgl_FragColor = sum;\n\t\t}"},F={uniforms:{tDiffuse:new o.Uniform(null),v:new o.Uniform(1/512)},vertexShader:"\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t}",fragmentShader:"\n\t\tuniform sampler2D tDiffuse;\n\t\tuniform float v;\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\t\t\tvec4 sum = vec4( 0.0 );\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 4.0 * v ) ) * 0.051;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 3.0 * v ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 2.0 * v ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 1.0 * v ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 1.0 * v ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 2.0 * v ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 3.0 * v ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 4.0 * v ) ) * 0.051;\n\t\t\t\n\t\t\tgl_FragColor = sum;\n\t\t}"};var V,G;new o.Uniform(null),new o.Uniform(null),new o.Uniform(0),new o.Uniform(0),new o.Uniform(0),new o.Uniform(new o.Vector2),new o.Uniform(.1),new o.Uniform(1e3);class H{constructor(e){this.materials={},this.render=()=>{(0,U.mapObj)(this.materials,((e,t)=>{const{model:r,material:n}=t;n.update(r)}))},this.runScene=e,this.init(),this.runScene.cb.material.dispose.add("Reflector",this.dispose.bind(this))}init(){this.runScene.cb.render.add("Reflector-render",this.render),this.runScene.cb.model.add.add("",(({model:e})=>{var t;e.material&&"Reflector"===(null==(t=null==(t=e.material.userData)?void 0:t.tools)?void 0:t.type)&&(t=e.material,this.materials[t.userData.id]||(this.materials[t.userData.id]={model:e,material:t}))})),this.runScene.cb.model.remove.add("",(({model:e})=>{var t;e.material&&"Reflector"===(null==(t=null==(t=e.material.userData)?void 0:t.tools)?void 0:t.type)&&(t=e.material,delete this.materials[t.userData.id])}))}bindData(e){const t=e.material;var r=(0,U.getId)();t.userData.id=r,this.materials[r]=e}undo(e){var{material:e,list:t,val:r}=e;this.runScene.undoEx.addUndo(new c.Z({target:e,typeList:[...t],newVal:r}).execute())}dispose(){this.materials={}}}(V=H).IgnoredAttributes=["_listeners","version","userData","uuid","name","type","defines"],H.TextureNames=["map","normalMap","roughnessMap","metalnessMap","tDiffuse","tDiffuseBlur"],H.tools={type:"Reflector",getTextures:e=>(0,i.getTexturesByMaterial)(e),create:(e,t)=>{const r=new W(void 0,void 0,e);return r.insertReflectorShader(),V.tools.bind(r),(t=t||e.modelEx.select)&&(r.name=t.name),e.materialEx.def.map.Reflector.bindData({model:t,material:r}),r},parseData:(e,t)=>{const{texture:r,normal:n,models:a,material:s}=e,{data:l,load:c}=r,u=(0,i.mergeMaterial)(s,new W(void 0,void 0,t)),h=[];return c&&h.push(...l.map((e=>()=>{u[e.type]=e.texture}))),Object.keys(n.uniforms).filter((e=>!H.TextureNames.includes(e))).map((e=>{u[e]="normalScale"===e?new o.Vector2(n.uniforms[e].x,n.uniforms[e].y):n.uniforms[e]})),u.setRTSize(u.resolution),u.setBlurPass(u.blurSize),u.insertReflectorShader(),t.materialEx.def.map.Reflector.bindData({model:a[0],material:u}),u.name=n.name,u.userData.id=s.userData.id,V.tools.bind(u),{material:u,setTextureFns:h}},toNormal:e=>{const t=(0,i.mergeMaterial)(e,(0,i.createDefMaterial)()),r=(t.userData=Object.assign({},t.userData),t.name=e.name,{}),n=K.uniforms;return Object.keys(n).filter((e=>!H.TextureNames.includes(e))).map((t=>{var a=e[t],i=n[t].value;"mirror"===t||"mixBlur"===t||"mixStrength"===t||"mixContrast"===t?a.value!==i&&(r[t]=a):a!==i&&(r[t]=a)})),t.normalScale&&(r.normalScale=t.normalScale),{material:t,normal:{type:V.tools.type,uniforms:r,name:e.name},textures:V.tools.getTextures(e)}},clone:(e,t)=>e,copy:(e,t)=>{const r=V.tools.create(t);return Object.keys(r).filter((e=>!H.IgnoredAttributes.includes(e))).map((t=>{r[t]=e[t]})),r},bind:e=>{(0,u.M)(e,"type",V.tools.type)},validType:e=>"Reflector"===e.userData.type};class W extends o.MeshStandardMaterial{constructor(e,t,r){e?super(e):(super(),this.opacity=K.uniforms.opacity.value,this.transparent=K.uniforms.transparent.value,this.roughness=K.uniforms.roughness.value,this.metalness=K.uniforms.metalness.value),this.runScene=r,this.isSpecialMaterial=!0,t?(this.resolution=t.resolution,this.blurSize=t.blurSize,this.mirror=new o.Uniform(t.mirror),this.mixBlur=new o.Uniform(t.mixBlur),this.mixStrength=new o.Uniform(t.mixStrength),this.mixContrast=new o.Uniform(t.mixContrast)):(this.resolution=K.uniforms.resolution.value,this.blurSize=K.uniforms.blurSize.value,this.mirror=new o.Uniform(K.uniforms.mirror.value),this.mixBlur=new o.Uniform(K.uniforms.mixBlur.value),this.mixStrength=new o.Uniform(K.uniforms.mixStrength.value),this.mixContrast=new o.Uniform(K.uniforms.mixContrast.value)),this.textureMatrix=new o.Uniform(new o.Matrix4),this.reflectorWorldPosition=new o.Vector3,this.cameraWorldPosition=new o.Vector3,this.rotationMatrix=new o.Matrix4,this.normal=new o.Vector3,this.view=new o.Vector3,this.lookAtPosition=new o.Vector3,this.target=new o.Vector3,this.tempQuaternion=new o.Vector4,this.virtualCamera=new o.PerspectiveCamera,this.reflectorPlane=new o.Plane,this.clipPlane=new o.Vector4,e={minFilter:o.LinearFilter,magFilter:o.LinearFilter,type:o.HalfFloatType,encoding:this.runScene.assetsEx.get().renderer.outputEncoding},this.glRT1=new o.WebGLRenderTarget(this.resolution,this.resolution,e),this.glRT2=new o.WebGLRenderTarget(this.resolution,this.resolution,e),this.tDiffuse=new o.Uniform(this.glRT1.texture),this.tDiffuseBlur=new o.Uniform(this.glRT2.texture),this.hBlurPass=new N.T(z),this.hBlurPass.uniforms.h.value=1/this.blurSize,this.hBlurPass.clear=!1,this.hBlurPass.renderToScreen=!1,this.hBlurPass.enabled=0<this.blurSize,this.hBlurPass.material.depthWrite=!1,this.vBlurPass=new N.T(F),this.vBlurPass.uniforms.v.value=1/this.blurSize,this.vBlurPass.clear=!1,this.vBlurPass.renderToScreen=!1,this.vBlurPass.enabled=0<this.blurSize,this.vBlurPass.material.depthWrite=!1}insertReflectorShader(){this.onBeforeCompile=e=>{var t;null!=(t=e.defines)&&t.USE_UV||(e.defines.USE_UV=""),null!=(t=e.defines)&&t.USE_BLUR||(e.defines.USE_BLUR=""),e.uniforms.tDiffuse=this.tDiffuse,e.uniforms.tDiffuseBlur=this.tDiffuseBlur,e.uniforms.textureMatrix=this.textureMatrix,e.uniforms.mirror=this.mirror,e.uniforms.mixBlur=this.mixBlur,e.uniforms.mixStrength=this.mixStrength,e.uniforms.mixContrast=this.mixContrast,e.vertexShader=K.vertexParas+""+e.vertexShader,e.vertexShader=e.vertexShader.replace("#include <project_vertex>",K.vertexShader),e.fragmentShader=K.fragmentParas+""+e.fragmentShader,e.fragmentShader=e.fragmentShader.replace("#include <emissivemap_fragment>",K.fragmentShader)}}setRTSize(e){this.glRT1.setSize(e,e),this.glRT2.setSize(e,e),this.hBlurPass.setSize(e,e),this.vBlurPass.setSize(e,e)}setBlurPass(e){this.hBlurPass.enabled=0<e,this.hBlurPass.enabled&&(this.hBlurPass.uniforms.h.value=1/e),this.vBlurPass.enabled=0<e,this.vBlurPass.enabled&&(this.vBlurPass.uniforms.v.value=1/e)}copy(e){return super.copy(e),this.resolution=e.resolution,this.blurSize=e.blurSize,this.mirror.value=e.mirror.value,this.mixBlur.value=e.mixBlur.value,this.mixStrength.value=e.mixStrength.value,this.mixContrast.value=e.mixContrast.value,this}swapBuffers(){var e=this.glRT1;this.glRT1=this.glRT2,this.glRT2=e}beforeRender(e){if(this.reflectorWorldPosition.setFromMatrixPosition(e.matrixWorld),this.cameraWorldPosition.setFromMatrixPosition(this.runScene.assetsEx.get().camera.matrixWorld),this.rotationMatrix.extractRotation(e.matrixWorld),this.normal.set(0,0,1),this.normal.applyMatrix4(this.rotationMatrix),this.reflectorWorldPosition.addScaledVector(this.normal,0),this.view.subVectors(this.reflectorWorldPosition,this.cameraWorldPosition),!(0<this.view.dot(this.normal))){this.view.reflect(this.normal).negate(),this.view.add(this.reflectorWorldPosition),this.rotationMatrix.extractRotation(this.runScene.assetsEx.get().camera.matrixWorld),this.lookAtPosition.set(0,0,-1),this.lookAtPosition.applyMatrix4(this.rotationMatrix),this.lookAtPosition.add(this.cameraWorldPosition),this.target.subVectors(this.reflectorWorldPosition,this.lookAtPosition),this.target.reflect(this.normal).negate(),this.target.add(this.reflectorWorldPosition),this.virtualCamera.position.copy(this.view),this.virtualCamera.up.set(0,1,0),this.virtualCamera.up.applyMatrix4(this.rotationMatrix),this.virtualCamera.up.reflect(this.normal),this.virtualCamera.lookAt(this.target),this.virtualCamera.far=this.runScene.assetsEx.get().camera.far,this.virtualCamera.updateMatrixWorld(),this.virtualCamera.projectionMatrix.copy(this.runScene.assetsEx.get().camera.projectionMatrix),this.textureMatrix.value.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),this.textureMatrix.value.multiply(this.virtualCamera.projectionMatrix),this.textureMatrix.value.multiply(this.virtualCamera.matrixWorldInverse),this.textureMatrix.value.multiply(e.matrixWorld),this.reflectorPlane.setFromNormalAndCoplanarPoint(this.normal,this.reflectorWorldPosition),this.reflectorPlane.applyMatrix4(this.virtualCamera.matrixWorldInverse),this.clipPlane.set(this.reflectorPlane.normal.x,this.reflectorPlane.normal.y,this.reflectorPlane.normal.z,this.reflectorPlane.constant);const t=this.virtualCamera.projectionMatrix;this.tempQuaternion.x=(Math.sign(this.clipPlane.x)+t.elements[8])/t.elements[0],this.tempQuaternion.y=(Math.sign(this.clipPlane.y)+t.elements[9])/t.elements[5],this.tempQuaternion.z=-1,this.tempQuaternion.w=(1+t.elements[10])/t.elements[14],this.clipPlane.multiplyScalar(2/this.clipPlane.dot(this.tempQuaternion)),t.elements[2]=this.clipPlane.x,t.elements[6]=this.clipPlane.y,t.elements[10]=this.clipPlane.z+1,t.elements[14]=this.clipPlane.w}}update(e){e&&e.visible&&(this.beforeRender(e),e.visible=!1,this.runScene.assetsEx.get().renderer.setRenderTarget(this.glRT1),this.runScene.assetsEx.get().renderer.clear(),this.runScene.assetsEx.get().renderer.render(this.runScene.assetsEx.get().scene,this.virtualCamera),this.hBlurPass&&this.hBlurPass.enabled&&(this.hBlurPass.render(this.runScene.assetsEx.get().renderer,this.glRT2,this.glRT1,0,!1),this.swapBuffers()),this.vBlurPass&&this.vBlurPass.enabled&&(this.vBlurPass.render(this.runScene.assetsEx.get().renderer,this.glRT2,this.glRT1,0,!1),this.swapBuffers()),e.visible=!0,this.runScene.assetsEx.get().renderer.setRenderTarget(null))}}const K={uniforms:{opacity:new o.Uniform(1),transparent:new o.Uniform(!1),roughness:new o.Uniform(1),metalness:new o.Uniform(.6),resolution:new o.Uniform(1024),blurSize:new o.Uniform(1024),mirror:new o.Uniform(0),mixBlur:new o.Uniform(10),mixStrength:new o.Uniform(2),mixContrast:new o.Uniform(1),depthTest:new o.Uniform(!0),depthWrite:new o.Uniform(!0)},vertexParas:"\n uniform mat4 textureMatrix;\n varying vec4 my_vUv;\n ",vertexShader:"\n #include <project_vertex>\n my_vUv = textureMatrix * vec4(position, 1.0);\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n ",fragmentParas:"\n uniform sampler2D tDiffuse;\n uniform sampler2D tDiffuseBlur;\n uniform sampler2D tDepth;\n uniform sampler2D distortionMap;\n uniform float distortion;\n uniform float mirror;\n uniform float mixBlur;\n uniform float mixStrength;\n uniform float mixContrast;\n uniform float minDepthThreshold;\n uniform float maxDepthThreshold;\n uniform float depthScale;\n uniform float depthToBlurRatioBias;\n varying vec4 my_vUv;\n ",fragmentShader:"\n #include <emissivemap_fragment>\n float distortionFactor = 0.0;\n #ifdef USE_DISTORTION\n distortionFactor = texture2D(distortionMap, vUv).r * distortion;\n #endif\n \n vec4 new_vUv = my_vUv;\n new_vUv.x += distortionFactor;\n new_vUv.y += distortionFactor;\n \n vec4 base = texture2DProj(tDiffuse, new_vUv);\n vec4 blur = texture2DProj(tDiffuseBlur, new_vUv);\n \n vec4 merge = base;\n \n #ifdef USE_NORMALMAP\n vec2 normal_uv = vec2(0.0);\n vec4 normalColor = texture2D(normalMap, vUv * normalScale);\n vec3 my_normal = normalize( vec3( normalColor.r * 2.0 - 1.0, normalColor.b, normalColor.g * 2.0 - 1.0 ) );\n vec3 coord = new_vUv.xyz / new_vUv.w;\n normal_uv = coord.xy + coord.z * my_normal.xz * 0.05;\n vec4 base_normal = texture2D(tDiffuse, normal_uv);\n vec4 blur_normal = texture2D(tDiffuseBlur, normal_uv);\n merge = base_normal;\n blur = blur_normal;\n #endif\n \n float blurFactor = 0.0;\n float depthFactor = 0.0001;\n \n #ifdef USE_DEPTH\n vec4 depth = texture2DProj(tDepth, new_vUv);\n depthFactor = smoothstep(minDepthThreshold, maxDepthThreshold, 1.0-(depth.r * depth.a));\n depthFactor *= depthScale;\n depthFactor = max(0.0001, min(1.0, depthFactor));\n #ifdef USE_BLUR\n blur = blur * min(1.0, depthFactor + depthToBlurRatioBias);\n merge = merge * min(1.0, depthFactor + 0.5);\n #else\n merge = merge * depthFactor;\n #endif\n #endif\n \n float reflectorRoughnessFactor = roughness;\n #ifdef USE_ROUGHNESSMAP\n vec4 reflectorTexelRoughness = texture2D( roughnessMap, vUv );\n reflectorRoughnessFactor *= reflectorTexelRoughness.g;\n #endif\n \n #ifdef USE_BLUR\n blurFactor = min(1.0, mixBlur * reflectorRoughnessFactor);\n merge = mix(merge, blur, blurFactor);\n #endif\n \n vec4 newMerge = vec4(0.0, 0.0, 0.0, 1.0);\n newMerge.r = (merge.r - 0.5) * mixContrast + 0.5;\n newMerge.g = (merge.g - 0.5) * mixContrast + 0.5;\n newMerge.b = (merge.b - 0.5) * mixContrast + 0.5;\n \n diffuseColor.rgb = diffuseColor.rgb * ((1.0 - min(1.0, mirror)) + newMerge.rgb * mixStrength);\n "},q="\n#define STANDARD\n\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n varying vec3 vWorldPosition;\n#endif\n\n// Insert Noise3D\n\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n\nuniform float uTime;\nuniform float uWindForce;\nuniform float uWindSpeed;\nuniform float uWindWaveScale;\nvarying vec3 vWorldPos;\nvarying vec3 vWorldNor;\n\nvoid main() {\n #include <uv_vertex>\n #include <uv2_vertex>\n #include <color_vertex>\n #include <morphcolor_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n\n vec4 mvPosition = vec4(transformed, 1.0);\n #ifdef USE_INSTANCING\n mvPosition = instanceMatrix * mvPosition;\n #endif\n mvPosition = modelViewMatrix * mvPosition;\n\n // Wind Vertex Start\n vWorldNor = normalize((modelMatrix * vec4(transformedNormal, 1.0)).xyz);\n vWorldPos = (modelMatrix * vec4(transformed, 1.0)).xyz;\n float tSpeed = uTime * uWindSpeed * 5.0;\n float wNoise = noise3D((vWorldPos + vec3(tSpeed)) * uWindWaveScale);\n float pOffset = wNoise * uWindForce * 30.0;\n transformed.xyz += vec3(pOffset);\n gl_Position = projectionMatrix * modelViewMatrix * vec4(transformed, 1.0);\n // Wind Vertex End\n\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vViewPosition = - mvPosition.xyz;\n #include <worldpos_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n #ifdef USE_TRANSMISSION\n vWorldPosition = worldPosition.xyz;\n #endif\n}\n ",Z="\n#define STANDARD\n#ifdef PHYSICAL\n#define IOR\n#define SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n uniform float ior;\n#endif\n#ifdef SPECULAR\n uniform float specularIntensity;\n uniform vec3 specularColor;\n#ifdef USE_SPECULARINTENSITYMAP\n uniform sampler2D specularIntensityMap;\n#endif\n#ifdef USE_SPECULARCOLORMAP\n uniform sampler2D specularColorMap;\n#endif\n#endif\n#ifdef USE_CLEARCOAT\n uniform float clearcoat;\n uniform float clearcoatRoughness;\n#endif\n#ifdef USE_IRIDESCENCE\n uniform float iridescence;\n uniform float iridescenceIOR;\n uniform float iridescenceThicknessMinimum;\n uniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n uniform vec3 sheenColor;\n uniform float sheenRoughness;\n#ifdef USE_SHEENCOLORMAP\n uniform sampler2D sheenColorMap;\n#endif\n#ifdef USE_SHEENROUGHNESSMAP\n uniform sampler2D sheenRoughnessMap;\n#endif\n#endif\n\nuniform vec3 uColorGradient;\nuniform float uColorLevel;\nuniform float uColorFade;\nuniform float uLeavesCore;\nuniform vec3 uLeavesSize;\nuniform vec3 uLeavesPos;\n//uniform float uDirectLightOffset;\n//uniform float uDirectLightInt;\n//uniform float uIndirectLightInt;\nvarying vec3 vViewPosition;\nvarying vec3 vWorldPos;\nvarying vec3 vWorldNor;\n\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <bsdfs>\n//#include <iridescence_fragment>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_physical_pars_fragment>\n#include <transmission_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n//#include <iridescence_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\n\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4(diffuse, opacity);\n ReflectedLight reflectedLight = ReflectedLight(vec3(0.0), vec3(0.0), vec3(0.0), vec3(0.0));\n vec3 totalEmissiveRadiance = emissive;\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <roughnessmap_fragment>\n #include <metalnessmap_fragment>\n\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n #include <clearcoat_normal_fragment_begin>\n #include <clearcoat_normal_fragment_maps>\n #include <emissivemap_fragment>\n\n #ifdef USE_MAP\n // Gradient Colors Start\n float normalizeY = vWorldPos.y / uLeavesSize.y;\n float secColorMask = saturate((normalizeY + uColorLevel) * uColorFade * 30.0);\n vec3 diffuseColor2 = uColorGradient * texture2D(map, vUv).rgb;\n vec3 mixColor = mix(diffuseColor.rgb, diffuseColor2, secColorMask);\n diffuseColor.rgb = mixColor;\n // Gradient Colors End\n #endif\n\n // Custom Normal Start\n vec3 leafCore = vec3(uLeavesPos.x, uLeavesPos.y + uLeavesCore * uLeavesSize.y, uLeavesPos.z);\n normal = normalize(vWorldPos - leafCore);\n // Custom Normal End\n\n #include <lights_physical_fragment>\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n #include <aomap_fragment>\n\n // 直射光:DirectLight = IncidentLight\n // float dotNL = saturate(dot(geometry.normal, directLight.direction));\n // vec3 irradiance = dotNL * directLight.color;\n // reflectedLight.directDiffuse += irradiance * BRDF_Lambert(material.diffuseColor);\n // 间接光:IndirectLight = ReflectedLight\n // vec3 irradiance = getAmbientLightIrradiance(ambientLightColor);\n // irradiance += getLightProbeIrradiance(lightProbe, geometry.normal);\n // irradiance += getHemisphereLightIrradiance(hemisphereLights[i], geometry.normal);\n // reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert(material.diffuseColor);\n\n // Custom Lighting Start\n // float dotNL = dot(geometry.normal, directLight.direction);\n // vec3 customIrradiance = clamp((dotNL + uDirectLightOffset), 0.01, 1.0) * vec3(1.0, 0.87, 0.67);\n // vec3 customDirectLight = customIrradiance * diffuseColor.rgb * uDirectLightInt;\n // vec3 customIndirectLight = (irradiance + vWorldNor * 0.001) * diffuseColor.rgb * uIndirectLightInt;\n // vec3 totalDiffuse = customDirectLight + customIndirectLight;\n // Custom Lighting End\n\n vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n #include <transmission_fragment>\n vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n #ifdef USE_SHEEN\n float sheenEnergyComp = 1.0 - 0.157 * max3(material.sheenColor);\n outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecular;\n #endif\n #ifdef USE_CLEARCOAT\n float dotNVcc = saturate(dot(geometry.clearcoatNormal, geometry.viewDir));\n vec3 Fcc = F_Schlick(material.clearcoatF0, material.clearcoatF90, dotNVcc);\n outgoingLight = outgoingLight * (1.0 - material.clearcoat * Fcc) + clearcoatSpecular * material.clearcoat;\n #endif\n #include <output_fragment>\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}\n ",X={emissive:s.Gf.emissive,alphaTest:{type:"number",val:0,shortKey:"at"},colorGradient:{type:"color",label:["uniforms","colorGradient","value"],val:{r:0,g:1,b:0},shortKey:"cg"}};class Q{constructor(e){this.runScene=e}undo(e){const{material:t,list:r,val:n}=e;this.runScene.undoEx.addUndo(new c.Z({target:t,typeList:[...r],newVal:n,cb:()=>{t.needsUpdate=!0}}).execute())}}(G=Q).IgnoredAttributes=["_listeners","version","userData","uuid","name","type","defines","onBeforeCompile"],Q.TextureNames=["alphaMap","aoMap","displacementMap","emissiveMap","envMap","lightMap","map","metalnessMap","normalMap","roughnessMap"],Q.tools={type:"TreeLeaf",getTextures:e=>{const t=[];return Q.TextureNames.forEach((r=>{e[r]&&t.push({type:r,texture:e[r]})})),t},create:(e,t)=>{const r=new J(e);return G.tools.bind(r),(t=t||e.modelEx.select)&&(r.name=t.name,r.setSize(t),r.setWorldPos(t)),r},parseData:(e,t)=>{const{normal:r,texture:n,material:a,models:s}=e,{data:l,load:c}=n,u=(0,i.mergeMaterial)(a,new J(t)),h=(u.setSize(s[0]),u.setWorldPos(s[0]),[]);return c&&h.push(...l.map((e=>()=>{u[e.type]=e.texture}))),Object.keys(r.uniforms).filter((e=>!Q.IgnoredAttributes.includes(e))).map((e=>{var t=r.uniforms[e];"color"!==e&&"emissive"!==e&&("normalScale"===e?u[e]=new o.Vector2(t.x,t.y):"windForce"===e||"windSpeed"===e||"windWaveScale"===e||"colorLevel"===e||"colorFade"===e||"leavesCore"===e?u.uniforms[e]=new o.Uniform(t):"colorGradient"===e?u.uniforms[e]=new o.Uniform(new o.Color(parseInt(t,16))):u[e]=r.uniforms[e])})),u.name=r.name,u.userData.id=a.userData.id,G.tools.bind(u),{material:u,setTextureFns:h}},toNormal:(e,t)=>{var r=G.tools.getTextures(e);const n=(0,i.mergeMaterial)(e,(0,i.createDefMaterial)()),a=(n.name=e.name,{}),s=new J(t);return Object.keys(e).filter((e=>!Q.TextureNames.includes(e))).filter((e=>!Q.IgnoredAttributes.includes(e))).map((t=>{var r=e[t],n=s[t];"color"!==t&&"emissive"!==t&&("normalScale"===t?r.x===n.x&&r.y===n.y||(a[t]=r):"uniforms"===t?Object.keys(r).map((t=>{const r=e.uniforms[t].value,n=s.uniforms[t].value;"windForce"===t||"windSpeed"===t||"windWaveScale"===t||"colorLevel"===t||"colorFade"===t||"leavesCore"===t?r!==n&&(a[t]=r):"colorGradient"===t&&r.getHexString()!==n.getHexString()&&(a[t]=r.getHexString())})):r!==n&&(a[t]=r))})),{material:n,normal:{type:G.tools.type,uniforms:a,name:e.name},textures:r}},clone:(e,t)=>e,copy:(e,t)=>{const r=G.tools.create(t);return Object.keys(r).filter((e=>!Q.IgnoredAttributes.includes(e))).map((t=>{r[t]=e[t]})),r},bind:e=>{(0,u.M)(e,"type",G.tools.type)},validType:e=>"TreeLeaf"===e.userData.type,snapshot:{getDiff:e=>y.LV.getDiff(X,e),set:e=>{const{map:t,material:r,runScene:n,data:a}=e;y.LV.set({def:X,data:a,runScene:n,map:t,target:r}),t.data.completedCbs.push((()=>{(0,i.updateMaterial)(r)}))}}};const Y=new o.Clock;class J extends o.MeshStandardMaterial{constructor(e){super(),this.isSpecialMaterial=!0,this.uniforms={time:new o.Uniform(0),windForce:new o.Uniform(.3),windSpeed:new o.Uniform(.5),windWaveScale:new o.Uniform(.25),colorGradient:new o.Uniform(new o.Color(65280)),colorLevel:new o.Uniform(-.5),colorFade:new o.Uniform(-.25),leavesCore:new o.Uniform(.3),leavesSize:new o.Uniform(new o.Vector3),leavesPos:new o.Uniform(new o.Vector3)},this.insertShader(),e&&e.cb.render.add("TreeLeaf",(()=>{this.update()}))}insertShader(){this.onBeforeCompile=e=>{e.uniforms.uTime=this.uniforms.time,e.uniforms.uWindForce=this.uniforms.windForce,e.uniforms.uWindSpeed=this.uniforms.windSpeed,e.uniforms.uWindWaveScale=this.uniforms.windWaveScale,e.uniforms.uColorGradient=this.uniforms.colorGradient,e.uniforms.uColorLevel=this.uniforms.colorLevel,e.uniforms.uColorFade=this.uniforms.colorFade,e.uniforms.uLeavesCore=this.uniforms.leavesCore,e.uniforms.uLeavesSize=this.uniforms.leavesSize,e.uniforms.uLeavesPos=this.uniforms.leavesPos,e.vertexShader=q,e.fragmentShader=Z,e.vertexShader=e.vertexShader.replace(/\/\/ Insert Noise3D/g,T)}}update(){this.uniforms.time.value=Y.getElapsedTime()}setSize(e){var t=new o.Vector3;e.getWorldScale(t),t=new o.Vector3,(new o.Box3).setFromObject(e).getSize(t),this.uniforms.leavesSize.value=t}setWorldPos(e){var t=new o.Vector3;e.getWorldPosition(t),this.uniforms.leavesPos.value=t}}const $={SpriteMaterial:R.Z,FakeInterior:h,Fresnel:p,Matcap:S,MixTexture:P,Physical:j,Reflector:H,TreeLeaf:Q,BasicMaterial:s.ZP,LineBasicMaterial:w,MyPointsMaterial:A,Water:t.Z};class ee{constructor(e){this.runScene=e,this.map={SpriteMaterial:new R.Z(e),FakeInterior:new h(e),Fresnel:new p(e),Matcap:new S(e),MixTexture:new P(e),Physical:new j(e),Reflector:new H(e),TreeLeaf:new Q(e),BasicMaterial:new s.ZP(e)}}static create(e,t){return $[e].tools.create(t)}static copy(e,t,r){return $[e].tools.copy(t,r)}static clone(e,t){return $[e].tools.clone(t)}static toNromal(e,t,r){return $[e].tools.toNormal(t,r)}static parseData(e,t,r){var n=t.material;let a=e;return $.LineBasicMaterial.tools.validType(n)&&(a=$.LineBasicMaterial.tools.type),(null==(e=$[a])?void 0:e.tools.parseData(t,r))||{material:(0,i.createDefMaterial)(),setTextureFns:[]}}static bind(e){e.material&&("MeshStandardMaterial"===e.material.type?s.ZP.tools.bind(e):"SpriteMaterial"===e.material.type&&R.Z.tools.bind(e))}static getTextures(e){var t=te(e);if(t)return $[t].tools.getTextures(e);throw TypeError("该材质没有类型")}static parseNode(e){e.material&&(e=e.material,(0,i.isBaseMaterial)(e)&&s.ZP.tools.bind(e),e.isSpriteMaterial&&R.Z.tools.bind(e))}static validType(e,t){return!$[e].tools.validType||$[e].tools.validType(t)}}ee.snapshot={getDiff:e=>{var t=te(e);if($[t])return $[t].tools.snapshot.getDiff(e);throw TypeError("该材质没有类型")},set:e=>{var t=e.material;if(t=te(t),$[t])return $[t].tools.snapshot.set(e);throw TypeError("该材质没有类型")}};const te=e=>{var t=e.userData.type;if(t)return ee.validType(t,e)?t:void 0}},932:(e,t,r)=>{r.r(t),r.d(t,{SpecialMaterial:()=>B,createDefMaterial:()=>M,defAllMaterialMap:()=>w,defBaseMaterialMap:()=>x,default:()=>S,disposeMaterial:()=>_,getBaseTextures:()=>k,getMaterialType:()=>j,getTextures:()=>D,getTexturesByMaterial:()=>E,initMaterial:()=>P,isBaseMaterial:()=>I,isColor:()=>A,isMaterial:()=>R,materialIgnore:()=>U,mergeMaterial:()=>T,setDefMaterialForSameGeo:()=>L,setMaterialTexture:()=>O,updateMaterial:()=>C});var n=r(6001),a=r(8881),i=r(4330),s=r(1794),o=r(3736),l=r(898),c=r(8024),u=r(2510),h=r(3729),d=r(6272),p=r(4707),f=function(e,t,r,n){return new(r=r||Promise)((function(a,i){function s(e){try{l(n.next(e))}catch(e){i(e)}}function o(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?a(e.value):((t=e.value)instanceof r?t:new r((function(e){e(t)}))).then(s,o)}l((n=n.apply(e,t||[])).next())}))};class m{constructor(e){this.data=this.getData(),this.pending=[],this.clonedTextures=[],this.mount=e=>{e.core.module.set("material",this)},this.complete=()=>{this.reset()},this.load=e=>{e=e.data;var{materialDef:e,material:t,model:r}=e;P(t),this.data.materialIns[e.id]||(this.data.materialIns[e.id]={material:t,models:[]}),this.data.materialIns[e.id].models.push(r)},this.done=e=>f(this,void 0,void 0,(function*(){var{json:t,core:r}=e,{materialMap:n,textureMap:a}=(null==(n=t.asset)?void 0:n.ex)||{};yield this.processTextureMap(a||{}),this.processMaterialMap(n||{},t),this.processClonedTextures(),yield this.loadTextures(r)})),this.parser=null,this.loadTexture=e=>{var t=e.data;const{textureDef:r,texture:n}=t;(0,l.mergeDefUserData)(r,n.userData),e.core.isImageBitmapLoader||(n.userData.flipY=!0),this.data.textureIns[r.id]=this.runScene.textureEx.getSameTexture(r.md5,n)||n},this.processTextureMap=(()=>{const e=e=>{const{target:t,data:r}=e;var n;r&&(({x:e,y:n}="object"==typeof r?r:{x:r,y:r}),t.x=e,t.y=n)};return t=>Promise.all((0,n.mapObj)(t,((t,r)=>f(this,void 0,void 0,(function*(){var{format:a,center:i,rotation:s,offset:o,repeat:l,isHelper:c,encoding:u}=r;if(!c){let r=this.data.textureIns[t];if(r){if(r.userData.cubeMap){const e={};(0,n.mapObj)(r.userData.cubeMap,((t,r)=>{e[t]=this.data.textureIns[r].userData.blob}));var c=r.userData;(r=yield this.runScene.textureEx.praseCubeByBlobMap(e)).userData=Object.assign(Object.assign({},c),r.userData),void 0!==r.userData.lightProbeIntensity&&(c=this.runScene.textureEx.setLightProbeForCube(r,!0,r.userData.lightProbeIntensity),r.userData.lightProbe=c),r.userData.blob=e.px,this.data.textureIns[t]=r}r.encoding=u||3e3,r.format=a,e({target:r.repeat,data:l}),e({target:r.center,data:i}),e({target:r.offset,data:o}),s&&(r.rotation=s),this.runScene.textureEx.initTextureAndAddtoAll(r)}}})))))})(),this.processMaterialMap=(()=>{const e=e=>f(this,void 0,void 0,(function*(){const{textures:t,normal:r,models:a,material:i}=e;var s=(0,n.mapObj)(t,((e,t)=>({type:e,texture:this.data.textureIns[t]})));const{material:o,setTextureFns:l}=this.runScene.materialEx.parseData(r.type,{normal:r,texture:{data:s,load:this.runScene.optionsEx.options.texture.load},core:this,models:a,material:i});o&&(0<l.length&&this.lazyLoadFns.push(...l),a.map((e=>e.material=o)))}));return(t,r)=>Promise.all((0,n.mapObj)(t,((t,a)=>f(this,void 0,void 0,(function*(){var i=this.data.materialIns[t];if(i){const{material:t,models:s}=i;if(t){const{normal:o,textures:l}=a;o.type||(o.type=p.ZP.tools.type),"scene"===(null==(i=null==(i=r.asset)?void 0:i.ex)?void 0:i.type)&&r.asset.ex.sceneEx.materialId===t.userData.id&&(0,n.mapObj)(l,((e,r)=>{r=this.data.textureIns[r],O({material:t,type:e,texture:r})})),yield e({textures:l,models:s,material:t,normal:o}),t.needsUpdate=!0}}})))))})(),this.lazyLoadFns=[],this.loadTextures=(()=>{const e=e=>{e.callback("lazyLoadedTexture",""),this.runScene.optionsEx.log("贴图懒加载完毕","base","success")},t=(r,n,a)=>{const i=this.lazyLoadFns[r];if(!i)return n(0),e(a);i(),setTimeout((()=>t(++r,n,a)),this.runScene.optionsEx.options.texture.lazyLoad.intervalTime)};return e=>new Promise((r=>{this.runScene.optionsEx.options.texture.lazyLoad.open?t(0,r,e):(this.lazyLoadFns.map((e=>e())),r(0))}))})(),this.afterParse=e=>{const{data:t,core:r,json:n}=e;if("material"===(null==(e=null==(e=n.asset)?void 0:e.ex)?void 0:e.type)){e=t.options.models;const[n]=e,a=[];n.material?(this.runScene.materialEx.add(n.material),a.push(n.material)):n.children.map((e=>{e.material&&(a.push(e.material),this.runScene.materialEx.add(e.material))})),r.models.push(...a)}},this.runScene=e}getData(){return{materialMap:{},textureMap:{},materialIns:{},textureIns:{}}}getMap(){return new s.Z({loadedGltf:e=>{e.core.pending.push(this.done(e))},loadMaterial:this.load,loadTexture:this.loadTexture,afterParse:this.afterParse,complete:this.complete,mountModule:this.mount})}processInput(e,t){return f(this,void 0,void 0,(function*(){this.parser=t}))}processClonedTextures(){this.clonedTextures.map((e=>{var t=(0,l.getCloneIdFromTexture)(e);(t=this.data.textureIns[t])?(e.image=t.image,e.needsUpdate=!0,"editor"===this.runScene.optionsEx.options.mode&&(e.userData.blob=t.userData.blob,e.userData.md5=t.userData.md5,e.userData.url=t.userData.url,(0,l.bindTextureBaseData)(e,this.runScene))):(this.runScene.textureEx.delete(e),(0,o.bv)(e,"cloneSourceId"),(0,l.disposeTexture)(e))}))}reset(){this.clonedTextures=[],this.data=this.getData(),this.pending=[],this.lazyLoadFns=[]}}var g=r(7880),v=r(7201);class b{constructor(e){this.resetItem=e=>{"material"===e.type&&e.datas.map((t=>{const r=t.data;let n=r.get("material");n||(n={},r.set("material",n)),e.targets.map((e=>{var t=(0,g.ee)(e);t&&g.Ws[t].tools.snapshot&&(t=(0,h.Ki)(e))&&(n[t]=this.getItem(e))}))}))},this.getDiff=()=>{let e={};return this.runScene.uniqueEx.material.getAll("values").map((t=>{t=t.material;var r=(0,g.ee)(t);r&&g.Ws[r].tools.snapshot&&(r=(0,h.Ki)(t))&&(e[r]=this.getItem(t))})),e},this.create=e=>{var t=this.getDiff();0!==(0,v.objLength)(t)&&e.data.set("material",t)},this.set=e=>{var t=e.snapshot.data.get("material");t&&(0,n.mapObj)(t,((t,r)=>{(t=this.runScene.uniqueEx.material.get(t))&&g.ZP.snapshot.set({material:t,data:r,runScene:this.runScene,map:e})}))},this.runScene=e,this.runScene.cb.snapshot.create.add("material",this.create),this.runScene.cb.snapshot.set.add("material",this.set),this.runScene.cb.snapshot.getLength.add("material",(e=>{var t=e.data.data.get("material");t&&(e.inputData.material=Object.keys(t).length)})),this.runScene.cb.snapshot.resetItem.add("material",this.resetItem)}getItem(e){return g.ZP.snapshot.getDiff(e)}}t=r(110);var y=function(e,t,r,n){return new(r=r||Promise)((function(a,i){function s(e){try{l(n.next(e))}catch(e){i(e)}}function o(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?a(e.value):((t=e.value)instanceof r?t:new r((function(e){e(t)}))).then(s,o)}l((n=n.apply(e,t||[])).next())}))};const x={depthTest:!0,depthWrite:!0,alphaTest:0,side:0,displacementScale:1,visible:!0,normalScale:{x:1,y:1},aoMapIntensity:1,lightMapIntensity:1,envMapIntensity:1,fog:!0},w=["color","emissive","roughness","metalness","normalScale","aoMapIntensity","displacementScale","transparent","lightMapIntensity","envMapIntensity","opacity","alphaTest","fog"];class S{constructor(e){this.materialX={},this.clean=()=>{this.dispose()},this.defMaterial=M(),this.addCb=e=>{this.runScene.cb.material.add.cb(e)},this.runScene=e,this.def=new g.ZP(e),this.snaphot=new b(e),this.runScene.cb.unique.material.add.add("engine-material-add",(e=>{this.addCb(e)})),this.runScene.cb.clean.add("EngineMaterial",this.clean),this.import=new m(e)}init(){var e={name:"material",loadCallBacks:this.import.getMap(),exportCallBacks:new s.Z};this.runScene.exporter.gltf.module.bind(e)}parse(e){g.Ws.LineBasicMaterial.tools.validType(e)&&g.Ws.LineBasicMaterial.tools.bind(e),this.setEnvStrength(e,this.runScene.sceneEx.envStrength)}add(e,t,r){U.is(e)||this.runScene.uniqueEx.material.add(e,t,r)}setEnvStrength(e,t,r=!1){void 0===e.envMapIntensity||e.envMapIntensity===t||!r&&e.envMapIntensity!==this.runScene.sceneEx.envStrength||(e.envMapIntensity=t,C(e))}create(e="BasicMaterial"){return e=g.ZP.create(e,this.runScene),this.add(e),e}toArray(){return(0,n.mapObj)(this.runScene.uniqueEx.material.map,((e,t)=>t.material))}copy(e){var t=j(e);if(t){const r=g.ZP.copy(t,e,this.runScene);return r.userData.id=(0,n.getId)(),r}}clone(e){var t=j(e);if(t){const r=g.ZP.clone(t,e);return r.userData.id=(0,n.getId)(),r}}setNormals(e,t=!0){const{info:r,newVal:n,materials:a,oldval:i,cb:s}=e;let o=n;return o.isVector2&&(o=o.clone()),e=a.map((e=>new c.Z({info:r,target:e,newVal:o,oldVal:i||e[r],runScene:this.runScene,cb:s}).execute())),t&&this.runScene.undoEx.addUndo(e),e}setNormal(e,t=!0){return e=new c.Z(Object.assign(Object.assign({},e),{runScene:this.runScene})).execute(),t&&this.runScene.undoEx.addUndo(e),e}setTextures(e,t=!0){return y(this,void 0,void 0,(function*(){const{info:r,newVal:n,materials:a,oldVal:i}=e;if(e.newVal=yield this.runScene.textureEx.parse(n),(0,l.isCubeTexture)(e.newVal)&&"envMap"!==r)throw this.runScene.optionsEx.log("立方体纹理只适用于环境","base","info"),TypeError("类型错误");"envMap"!==r||(0,l.isCubeTexture)(e.newVal)||(0,l.setTextureMapping)(e.newVal);var s=a.map((t=>new c.Z({info:r,target:t,newVal:e.newVal,oldVal:i||t[r],runScene:this.runScene}).execute()));return t&&this.runScene.undoEx.addUndo(s),a[0][r]}))}setTexture(e,t=!0){return y(this,void 0,void 0,(function*(){var{info:r,newVal:n,target:a}=e;if(e.newVal=yield this.runScene.textureEx.parse(n),(0,l.isCubeTexture)(e.newVal)&&"envMap"!==r)throw this.runScene.optionsEx.log("立方体纹理只适用于环境","base","info"),TypeError("类型错误");return"envMap"!==r||e.newVal.isCubeTexture||(0,l.setTextureMapping)(e.newVal),n=new c.Z(Object.assign(Object.assign({},e),{oldVal:a[r],runScene:this.runScene})).execute(),t&&this.runScene.undoEx.addUndo(n),e.newVal}))}resetMaterial(e,t,r){const{addUndo:n,includeChild:a}=r=(0,d.Gm)({addUndo:!0,includeChild:!1},r);if(e&&t){const r=new Set;((0,d.lG)(e,"array")?e:[e]).map((e=>{a?e.traverse((e=>{I(e.material)&&r.add(e)})):e.material&&r.add(e)}));const i=[];r.forEach((e=>{i.push(new u.Z({target:e,runScene:this.runScene,info:"material",newVal:t,oldVal:e.material}).execute())})),this.runScene.modelEx.select===e&&this.runScene.cb.setSelectMaterial.cb(t),n&&this.runScene.undoEx.addUndo(i)}}toNromal(e){var t=j(e);if(t){const r=g.ZP.toNromal(t,e,this.runScene);return r.material.userData=Object.assign(Object.assign({},r.material.userData),e.userData),r}}setSelect(e){this.select=e,this.runScene.cb.setSelectMaterial.cb(e)}parseData(e,t){return g.ZP.parseData(e,t,this.runScene)}dispose(){this.runScene.cb.material.dispose.cb("")}remove(e){const t=this.runScene.uniqueEx.material.getModels((0,h.Ki)(e));t&&(this.resetMaterial(t.toArray(),M()),this.runScene.cb.material.remove.cb(e))}getDefNromals(e){var t;return"BasicMaterial"!==(null==(t=e.userData)?void 0:t.type)?{}:(0,d.ad)(x,e)}parseNromals(e,t){(0,n.mapObj)(e,((e,r)=>{var n,a,i,s,o;void 0!==x[e]&&("object"==typeof r?(({x:i,y:s,z:o}=r),null!=(a=null==(n=t[e])?void 0:n.set)&&a.call(n,i,s,o)):t[e]=r)}))}isBaseMaterial(e){return"MeshStandardMaterial"===e.type&&"BasicMaterial"===e.userData.type&&!e.userData.isTimeLineUsed&&p.ZP.isDefVal(e)}setByType(e,t){"SpriteMaterial"===e&&!t.isSprite||(e=this.create(e))&&(this.add(e),this.runScene.modelEx.setMaterial(t,e))}}const M=e=>{const t=new a.MeshStandardMaterial(e);return t.userData.id=(0,n.getId)(),p.ZP.tools.bind(t),t},T=(e,t)=>(w.map((r=>{const n=e[r];"object"==typeof n&&(t[r]=n.clone()),t[r]=n})),t),_=e=>{e.dispose();const t=E(e);0!==t.length&&t.map((e=>{e=e.texture,(0,l.disposeTexture)(e)}))},E=e=>k(e),D=e=>g.ZP.getTextures(e)||k(e),k=e=>i.zX.map((t=>({type:t,texture:e[t]}))).filter((e=>e.texture)),O=e=>{const{material:t,type:r,texture:n}=e;"envMap"!==r||(0,l.isCubeTexture)(n)||(0,l.setTextureMapping)(n),t[r]=n,t.needsUpdate=!0},P=e=>{e.vertexColors=!1,e.depthWrite=!0,e.needsUpdate=!1},A=e=>null==e?void 0:e.isColor,C=e=>{e.needsUpdate=!0},R=e=>null==e?void 0:e.isMaterial,L=e=>{},I=e=>(null==e?void 0:e.isMeshStandardMaterial)&&!e.isSpecialMaterial,B={Sprite:t.Z},j=e=>(null==(e=null==e?void 0:e.userData)?void 0:e.type)||"BasicMaterial",U={set(e,t){t?(0,o.M)(e,"ignore",!0):delete e.userData.ignore},is:e=>!0===(0,o.is)(e,"ignore")}},4707:(e,t,r)=>{r.d(t,{ZP:()=>v,Gf:()=>g});var n=r(8881),a=r(4330),i=r(3263),s=r(3736);const o="\n#define STANDARD\nuniform int uvCount;\n ",l="\nattribute vec2 uv2;\nvarying vec2 vUv2;\nuniform mat3 uv2Transform;\n ",c="\nvUv2 = (uv2Transform * vec3(uv2, 1)).xy;\n ",u="\nvarying vec2 vUv2;\n ",h="\n#ifdef USE_MAP\n vec4 sampledDiffuseColor = vec4(0.0);\n if(uvCount > 1) sampledDiffuseColor = texture2D(map, vUv2);\n else sampledDiffuseColor = texture2D(map, vUv);\n \n #ifdef DECODE_VIDEO_TEXTURE\n sampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w );\n #endif\n diffuseColor *= sampledDiffuseColor;\n#endif\n ",d="\n#ifdef USE_EMISSIVEMAP\n vec4 emissiveColor = vec4(0.0);\n if(uvCount > 1) emissiveColor = texture2D(emissiveMap, vUv2);\n else emissiveColor = texture2D(emissiveMap, vUv);\n totalEmissiveRadiance *= emissiveColor.rgb;\n#endif\n ";var p,f=r(1398),m=r(932);const g={color:{type:"color",val:{r:1,g:1,b:1},shortKey:"clr"},map:{type:"texture",val:null,shortKey:"map"},emissiveMap:{type:"texture",val:null,shortKey:"em"},roughnessMap:{type:"texture",val:null,shortKey:"rm"},emissive:{type:"color",val:{r:0,g:0,b:0},shortKey:"emi"},roughness:{type:"number",val:1,shortKey:"rgh"},metalness:{type:"number",val:0,shortKey:"meta"},metalnessMap:{type:"texture",val:null,shortKey:"mm"},lightMap:{type:"texture",val:null,shortKey:"lm"},lightMapIntensity:{type:"number",val:1,shortKey:"lmi"},envMap:{type:"texture",val:null,shortKey:"envm"},envMapIntensity:{type:"number",val:1,shortKey:"envI"},transparent:{type:"other",val:!1,shortKey:"trans"},opacity:{type:"number",val:1,shortKey:"opc",before:({target:e,end:t})=>{t<1&&!e.transparent&&(e.transparent=!0,(0,m.updateMaterial)(e))}},depthTest:{type:"other",val:!0,shortKey:"dt"},depthWrite:{type:"other",val:!0,shortKey:"dw"},fog:{type:"other",val:!0,shortKey:"fo"},wireframe:{type:"other",val:!1,shortKey:"wf"},alphaMap:{type:"texture",val:null,shortKey:"alpm"}};class v{constructor(e){this.init(e)}init(e){e.cb.material.add.add("base-material",(e=>{(0,m.isBaseMaterial)(e)&&"MeshPhysicalMaterial"!==e.type&&(v.tools.bind(e),e.userData.uvCount||(e.userData.uvCount=new n.Uniform(1)),e.onBeforeCompile=t=>{t.uniforms.uvCount=e.userData.uvCount,t.vertexShader=t.vertexShader.replace(/#include <uv2_pars_vertex>/g,l),t.vertexShader=t.vertexShader.replace(/#include <uv2_vertex>/g,c),t.fragmentShader=t.fragmentShader.replace(/#define STANDARD/g,o),t.fragmentShader=t.fragmentShader.replace(/#include <uv2_pars_fragment>/g,u),t.fragmentShader=t.fragmentShader.replace(/#include <map_fragment>/g,h),t.fragmentShader=t.fragmentShader.replace(/#include <emissivemap_fragment>/g,d)})}))}static isDefVal(e){for(const t in this.defVal){const r=this.defVal[t],a=e[t];if(r instanceof n.Color){if(r.getHexString()!==a.getHexString())return!1}else if("object"==typeof r){if(a.x!==r.x)return!1}else if(a!==r)return!1}for(const t of a.zX)if(e[t])return!1;return!0}create(){return(0,m.createDefMaterial)()}}(p=v).tools={type:"BasicMaterial",bind(e){(0,s.M)(e,"type","BasicMaterial")},create:()=>{var e=new n.MeshStandardMaterial;return p.tools.bind(e),e},parseData:e=>{const{texture:t,normal:r,core:n,material:a}=e,{data:s,load:o}=t,l=[];return o&&l.push(...i.F6.filter(s.map((e=>{const{type:t,texture:r}=e;if(r)return()=>{n.runScene.uniqueEx.texture.addMaterial(r,{material:a,type:t}),(0,m.setMaterialTexture)({material:a,type:t,texture:r})}})))),n.runScene.materialEx.parseNromals(r,a),{material:a,setTextureFns:l}},toNormal:e=>({material:e.clone(),normal:{type:v.tools.type},textures:(0,m.getBaseTextures)(e)}),clone:(e,t)=>e,copy:e=>e.clone(),getTextures:e=>(0,m.getBaseTextures)(e),snapshot:{getDiff:e=>f.LV.getDiff(g,e),set:e=>{const{map:t,material:r,runScene:n,data:a}=e;f.LV.set({def:g,data:a,runScene:n,map:t,target:r}),t.data.completedCbs.push((()=>{(0,m.updateMaterial)(r)}))}},validType:e=>"MeshStandardMaterial"===e.type},v.defVal={color:new n.Color(16777215),emissive:new n.Color(0),roughness:1,metalness:0,lightMapIntensity:1,aoMapIntensity:1,emissiveIntensity:1,bumpScale:1,normalScale:new n.Vector2(1,1),displacementScale:1,envMapIntensity:1,wireframe:!1,transparent:!1,depthTest:!0,depthWrite:!0,opacity:1,fog:!0}},110:(e,t,r)=>{r.d(t,{Z:()=>h});var n,a=r(8881),i=r(6756),s=r(3736),o=r(1398),l=r(3729),c=r(932);const u={color:(t=r(4707)).Gf.color,map:t.Gf.map,opacity:t.Gf.opacity};class h{constructor(e){this.modelParse={toNormal:e=>{e=e.model;const t=(0,i.createDefModel)("Box");return t.userData.normal=Object.assign({type:"MySpriteMaterial"},e.userData),t.material=e.material,this.merge(e,t),t},parse:e=>{var{model:e,normal:t}=e;const r=(0,i.createDefModel)("Sprite");var n=e.userData.layers;return(0,i.setLayers)(r,n),r.userData=Object.assign(Object.assign({},t),r.userData),this.merge(e,r),r.material=e.material,r}},this.merge=(e,t)=>{t.position.copy(e.position),t.rotation.copy(e.rotation),t.scale.copy(e.scale),t.renderOrder=e.renderOrder,t.castShadow=e.castShadow,t.receiveShadow=e.receiveShadow,t.name=e.name,t.name=e.name,(0,s.M)(e,"name",e.name),(0,i.setLayers)(t,1===e.layers.mask?0:1)},this.type="Sprite",this.runScene=e;const{parse:t,toNormal:r}=this.modelParse;e.cb.inited.add("MySpriteMaterial",(()=>{e.modelEx.importAndExport.addParses(this.type,{parse:t,toNormal:r}),e.modelEx.importAndExport.addParses("MySpriteMaterial",{parse:t,toNormal:r})}))}}(n=h).tools={type:"SpriteMaterial",bind(e){(0,s.M)(e,"type","SpriteMaterial")},getTextures:e=>["map","alphaMap"].map((t=>{var r=e[t];if(r)return{type:t,texture:r}})).filter((e=>e)),create:()=>{var e=new a.SpriteMaterial;return n.tools.bind(e),e},parseData:(e,t)=>{var{texture:e,material:r,normal:n}=e;const{data:a,load:i}=e,s=[],o=(0,c.mergeMaterial)(r,h.tools.create(t));(0,l.x)(o,(0,l.Ki)(r));var{depthWrite:e,depthTest:t,name:r,fog:n}=n;return!1===n&&(o.fog=!1),void 0!==e&&(o.depthWrite=e),void 0!==t&&(o.depthTest=t),r&&(o.name=r),i&&s.push(...a.map((e=>{const{type:t,texture:r}=e;return()=>{o[t]=r}}))),{material:o,setTextureFns:s}},toNormal:e=>{const t=(0,c.mergeMaterial)(e,(0,c.createDefMaterial)());var r=Object.assign({},t.userData);const n={type:h.tools.type,name:e.name};return e.fog||(n.fog=!1),e.depthWrite!==c.defBaseMaterialMap.depthWrite&&(n.depthWrite=e.depthWrite),e.depthTest!==c.defBaseMaterialMap.depthTest&&(n.depthTest=e.depthTest),t.userData=r,{normal:n,textures:h.tools.getTextures(e),material:t}},clone:e=>e,copy:e=>{const t=e.clone();return t.userData.type=h.tools.type,t},snapshot:{getDiff:e=>o.LV.getDiff(u,e),set:e=>{const{map:t,material:r,runScene:n,data:a}=e;o.LV.set({def:u,data:a,runScene:n,map:t,target:r}),t.data.completedCbs.push((()=>{(0,c.updateMaterial)(r)}))}}}},3801:(e,t,r)=>{r.d(t,{Ju:()=>i,t9:()=>a,zf:()=>s});var n=r(3736);const a={isDynamic:()=>{}},i={isDeleted(e,t=!1){var r;return!!e&&(!(null==(r=null==e?void 0:e.userData)||!r.isDeleted)||!!t&&i.isDeleted(e.parent,t))},setDeleted(e,t){e.userData&&(t?(0,n.M)(e,"isDeleted",!0):null!=(t=null==e?void 0:e.userData)&&delete t.isDeleted)}},s={setLock(e){(0,n.M)(e,"lock",!0)},reLock(e){delete e.userData.lock},isLock(e,t=!1){if(!e||"Scene"===e.type)return!1;var r=e.userData.lock;return t?!!r||s.isLock(e.parent,t):void 0!==r&&r}}},6756:(e,t,r)=>{r.r(t),r.d(t,{closeModelEvent:()=>fe,createDefModel:()=>G,createSpecialModel:()=>V,default:()=>F,delClonedModel:()=>ne,deletedModel:()=>z.Ju,disposeModel:()=>H,dynamicModel:()=>z.t9,getClonedIdModel:()=>te,getDeepModels:()=>Y,getIdMapByModel:()=>de,getModelSize:()=>oe,hasSkeleton:()=>J,helperModel:()=>ue,instanceModel:()=>W,isDynamicModel:()=>ee,isGLowModel:()=>ae,isGroup:()=>se,isHelper:()=>X,isSprite:()=>ie,lockModel:()=>z.zf,mergeModel:()=>K,normalModel:()=>ce,selectableModel:()=>le,setClonedModel:()=>re,setDynamicModel:()=>$,setHelper:()=>Z,setLayers:()=>Q,tempModel:()=>pe,uselessGroup:()=>he,withAnima:()=>q});var n=r(6001),a=r(8881),i=r(4091),s=r(4230);const o=["Group","Box","Circle","Cylinder","Dodecahedron","Icosahedron","Lathe","Octahedron","Plane","Ring","Sphere","Sprite","Tetrahedron","Torus","TorusKnot","Tube","Reflector","VerticesRain","Water"];var l=r(1794),c=r(272),u=r(5247),h=r(1269),d=r(7880),p=r(932),f=r(3736);class m extends r(4773).Z{constructor(e){super(e),this.type="添加模型",this.isUndoAdd=!0}_execute(e){return Promise.reject()}undo(){this.remove({model:this.model,parent:this.parent,addTree:this.addTree,isClone:this.isClone,runScene:this.runScene})}redo(){this.add({model:this.model,parent:this.parent,addTree:this.addTree,isClone:this.isClone,runScene:this.runScene})}execute(){return this.redo(),this}}var g=r(3735),v=r(2510);class b extends r(4616).Z{constructor(e){super(),this.type="修改父元素",this.isUndoParent=!0,this.runScene=e.runScene,this.oldParent=e.oldParent,this.newParent=e.newParent,this.target=e.target}execute(){return this.redo(),this}_execute(e,t){e.attach(this.target),this.runScene.cb.model.setParent.cb({model:this.target,parent:e}),(null==(e=this.runScene.modelEx.select)?void 0:e.userData.id)===t.userData.id&&this.runScene.modelEx.selectNull()}undo(){this._execute(this.oldParent,this.newParent)}redo(){this._execute(this.newParent,this.oldParent)}}const y=b;var x=r(7169),w=r(4380),S=r(3729),M=r(8089),T=r(2677);class _{constructor(e){this.definfo={speed:1,size:10,length:2e3},this.map=new l.Z,this.modelParse={toNormal:e=>{const{model:t,runScene:r}=e,n=G("Box");e=(0,S.Ki)(t);var a=r.modelEx.def.vertices.rain.map.get(e);if(n.material=t.material,!e||!a)throw TypeError("缺少属性");var{length:e,size:a,speed:i,fog:s}=a;return n.userData.normal={type:_.modelTools.type,length:e,size:a,speed:i,fog:s,materialId:(0,S.Ki)(t.material)},n},parse:e=>{const{runScene:t,normal:r,model:n}=e,a=t.modelEx.def.create(_.modelTools.type,r);return a.material=n.material,a.material.fog=r.fog,a.material.needsUpdate=!0,a.material.userData.id=r.materialId,a}},this.update=()=>{const e=this.runScene.assetsEx.get().camera;this.map.map(((t,r)=>{const{model:n,length:a,speed:i,del:s}=r;if(!s){n.position.set(e.position.x,e.position.y,e.position.z);for(let e=0;e<a;e++)n.geometry.attributes.position.setY(e,n.geometry.attributes.position.getY(e)-i),0<=i?n.geometry.attributes.position.getY(e)<=-1e3&&n.geometry.attributes.position.setY(e,1e3):1e3<=n.geometry.attributes.position.getY(e)&&n.geometry.attributes.position.setY(e,-1e3),n.geometry.attributes.position.needsUpdate=!0}}))},this.tools={type:"VerticesRain",merge:function(e,t){},toNormal:function(e){const t=G("Box");var r=(0,S.Ki)(e),n=this.map.get(r);if(t.material.map=e.material.map,r&&n)return t.userData.normal=Object.assign({type:this.tools.type},n),t;throw TypeError("缺少属性")},parseData:function(e,t){}},(this.runScene=e).cb.render.add("verticesRain",this.update),e.cb.model.add.add("verticesRain",(({model:e})=>{var t;if((null==(t=e.userData.normal)?void 0:t.type)===this.tools.type){const t=this.map.get((0,S.Ki)(e));t&&(t.del=!1)}})),e.cb.model.remove.add("verticesRain",(({model:e})=>{var t;if((null==(t=e.userData.normal)?void 0:t.type)===this.tools.type){const t=this.map.get((0,S.Ki)(e));t&&(t.del=!0)}})),e.cb.clean.add("verticesRain",(()=>{this.map.clear()}));const{toNormal:t,parse:r}=this.modelParse;e.cb.inited.add("VerticesRain",(()=>{e.modelEx.importAndExport.addParses(_.modelTools.type,{toNormal:t,parse:r})}))}bindMaterial(e,t){(0,f.M)(e,"id",t||(0,n.getId)()),(0,f.M)(e,"type","MyPointsMaterial")}create(e){var t=(e=e||this.definfo).length;const r=new T.Sf.Points(this.createGeo(t),this.createMaterial(e));return r.name="雨雪",r.renderOrder=1,t=(0,n.getId)(),(0,f.M)(r,"id",t),this.bindMaterial(r.material),(0,f.M)(r,"type",this.tools.type),(0,f.M)(r,"normal",{type:this.tools.type}),this.map.set(t,{model:r,length:e.length,size:e.size,speed:e.speed,fog:r.material.fog,del:!1}),r}createGeo(e){let t=[];const r=new a.BufferGeometry;for(let r=0;r<e;r++){var n=2e3*Math.random()-1e3,i=2e3*Math.random()-1e3,s=2e3*Math.random()-1e3;t.push(n,i,s)}return r.setAttribute("position",new a.Float32BufferAttribute(t,3)),r}createMaterial(e){var{size:e,map:t}=e;return new T.Sf.PointsMaterial({blending:T.Sf.AdditiveBlending,depthTest:!1,transparent:!0,size:e,fog:!0,map:t})}setForModel(e){var{model:e,type:t,data:r}=e;(e=(0,S.Ki)(e))&&this.set(e,t,r)}set(e,t,r){const n=this.map.get(e);if(n){const{model:e,size:i}=n;switch(t){case"show":e.visible=r;break;case"length":e.geometry=this.createGeo(r),n[t]=r;break;case"size":var a=e.material;e.material=this.createMaterial({map:e.material.map,size:r}),this.bindMaterial(e.material,(0,S.Ki)(a)),n[t]=r;break;case"speed":n[t]=r;break;case"fog":e.material.fog=r,e.material.needsUpdate=!0,n[t]=r;break;case"texture":a=e.material,e.material=this.createMaterial({map:r,size:i}),this.bindMaterial(e.material,(0,S.Ki)(a))}}}}_.modelTools={type:"VerticesRain",parseData:function(e,t,r){const n=r.modelEx.def.create(_.modelTools.type,t);return n.material=e.material,n.material.userData.id=t.materialId,n},toNormal:(e,t,r)=>{const n=G("Box");var a=(0,S.Ki)(e);if(t=t.modelEx.def.vertices.rain.map.get(a),n.material=e.material,!a||!t)throw TypeError("缺少属性");var{length:a,size:t,speed:i}=t;return n.userData.normal={type:_.modelTools.type,length:a,size:t,speed:i,materialId:(0,S.Ki)(e.material)},n}};class E{constructor(e){this.runScene=e,this.rain=new _(e)}}var D=r(1863);class k{constructor(e){this.runScene=e,this.vertices=new E(e),this.water=new D.Z(e)}create(e,t){let r;return"VerticesRain"===e?r=this.vertices.rain.create(t):"Water"===e?r=this.water.create():o.includes(e)&&(r=(0,M.Py)(e,t)),d.ZP.parseNode(r),r}}var O=r(5317);class P{constructor(e){this.runScene=e}init(){this.bindEvent()}bindEvent(){}}var A=r(2353),C=r(110);class R{constructor(e){this.data=this.getData(),this.parses=new l.Z,this.nodeType={MySpriteMaterial:C.Z,VerticesRain:_},this.mount=e=>{e.core.module.set("model",this)},this.complete=()=>{this.data=this.getData()},this.loadNodeDef=e=>{let{node:t,nodeDef:r}=e;(0,n.mapObj)(this.runScene.modelEx.defNodeMap,((e,n)=>{var a=r[e];null!=a&&(t[e]=a)})),r.wireframe&&(t.material.wireframe=!0)},this.load=e=>{var{data:e,core:t}=e;return this.loadNodeDef(e),this.loadExtras(e,t),e.node},this.done=()=>{this.removeHelperModel()},this.afterParse=e=>{const{config:t,data:r,json:n,core:a}=e;if("model"===(null==(e=null==(e=n.asset)?void 0:e.ex)?void 0:e.type)){if(null==(e=t.module)||!e.model)return[];let n=["glb_model"===(e=(e=r.options).models[0]).name&&(null==e?void 0:e.children[0])||e];var[e]=n;he.is(e)&&(n=[...e.children]),a.models.push(...n),this.mergeClone()}},this.toNromal=e=>{var t=e.type;const r=this.parses.get(t);return r?r.toNormal(e):e.model},this.parse=e=>{var t=e.type;const r=this.parses.get(t);if(r)return r.parse(e)},this.runScene=e}getData(){return{map:new l.Z,clonedMap:{},instancedMap:{},helperModels:[]}}getMap(){return new l.Z({loadNode:this.load,loadedGltf:this.done,afterParse:this.afterParse,complete:this.complete,mountModule:this.mount})}addParses(e,t){this.parses.set(e,t)}loadExtras(e,t){let{node:r,nodeDef:n}=e;if(n.extras){const{layers:o,normal:l,local:c,cloneId:u,id:h,animations:d,isDynamic:p}=n.extras;var a,i=ee(r,!0),s=("running"!==this.runScene.optionsEx.options.mode||i||null!=(s=this.runScene.optionsEx.options.renderConfig)&&s.matrixAutoUpdate||(r.matrixAutoUpdate=!1),d&&(r.animations=A.B.parse(d)),p&&(r.userData.isDynamic=!0),!u||i||(this.data.instancedMap[u]||(this.data.instancedMap[u]=new Set),this.data.instancedMap[u].add(r)),c&&([s,i,a]=c.split(","),r.position.set(s,i,a)),o&&(r.layers.enable(1),this.runScene.cb.model.setLayers.cb({model:r,val:1})),n.extras.isHelper&&this.data.helperModels.push(r),l&&([i,...a]=(s=this.parse({type:l.type,model:e.node,normal:l,runScene:this.runScene}))instanceof Array?s:[s],e.node=i,t.models.push(...a)),h&&this.data.map.set(h,e.node),null==(a=null==(i=null==(s=e.node)?void 0:s.material)?void 0:i.userData)?void 0:a.id);if(s){const r=t.module.get("material").data.materialIns[s];r&&r.models.push(e.node)}}}removeHelperModel(){this.data.helperModels.map((e=>{var t;return null==(t=e.parent)?void 0:t.remove(e)}))}mergeClone(){var e;this.runScene.optionsEx.options.instanceClone&&"running"===this.runScene.optionsEx.options.mode&&(this.runScene.assetsEx.scene.updateMatrixWorld(),e=this.data.instancedMap,(0,n.mapObj)(e,((e,t)=>{var r,n=this.runScene.uniqueEx.model.map[e];t.size<2||!n||!n.geometry||ee(n,!0)||(r=W(n,[...t]),this.runScene.modelEx.add(r,void 0,{isClone:!1,select:!1,addUndo:!1}),ae(n)&&this.runScene.modelEx.setGlow(r,!0),this.runScene.modelEx.remove(n,!1),t.forEach((e=>this.runScene.modelEx.remove(e,!1))),t.clear(),delete this.data.instancedMap[e])}))),this.data.instancedMap={}}mergeGeometry(){}}var L=r(7201),I=r(228),B=r(1398);const j={position:{type:"v3",val:{x:0,y:0,z:0},shortKey:"po"},rotation:{type:"v3",val:{x:0,y:0,z:0},shortKey:"ro"},scale:{type:"v3",val:{x:1,y:1,z:1},shortKey:"scl"},visible:{type:"other",val:!0,shortKey:"vi"},castShadow:{type:"other",val:!1,shortKey:"ca"},receiveShadow:{type:"other",val:!1,shortKey:"rec"},renderOrder:{type:"other",val:0,shortKey:"ren"}};class U{constructor(e){this.resetItem=e=>{"model"===e.type&&e.datas.map((t=>{const r=t.data;let n=r.get("model");n||(n={},r.set("model",n));const a=new c.Z;if(e.targets.map((e=>{e.traverse((e=>{var t=(0,S.Ki)(e);t&&(e.material&&a.add(e.material),n[t]=this.getItem(e))}))})),0!==a.size){const t=new c.Z;a.map((e=>{const r=d.ZP.getTextures(e);0!==r.length&&t.add(r.map((e=>e.texture)))})),this.runScene.cb.snapshot.resetItem.cb({type:"texture",datas:e.datas,targets:t.toArray()}),this.runScene.cb.snapshot.resetItem.cb({type:"material",datas:e.datas,targets:a.toArray()})}}))},this.create=e=>{var t=this.getDiff(this.runScene.sceneEx.getClearModels());0!==(0,L.objLength)(t)&&e.data.set("model",t)},this.set=e=>{var t=e.snapshot.data.get("model");if(t){const r=e.data.completedCbs;this.runScene.pp.clearAllOutlineObj(),(0,n.mapObj)(t,((t,n)=>{const a=this.runScene.uniqueEx.model.get(t);a&&(B.LV.set({def:j,runScene:this.runScene,data:n,target:a,map:e}),t=n[j.visible.shortKey],a.visible=void 0===t,r.push((()=>{var e;this.runScene.modelEx.setGlow(a,!!n.isGLow),n.isOutline?this.runScene.modelEx.setOutline(a,!0):a.userData.outline&&(a.userData.outline=!1),this.runScene.cb.model.change.cb({model:a,type:"visible",val:a.visible}),n.materialId&&n.materialId!==(0,S.Ki)(a.material)&&(e=this.runScene.uniqueEx.material.get(n.materialId))&&this.runScene.materialEx.resetMaterial(a,e,{addUndo:!1,includeChild:!1})})))}))}},this.runScene=e,this.runScene.cb.snapshot.create.add("model",this.create),this.runScene.cb.snapshot.set.add("model",this.set),this.runScene.cb.snapshot.getLength.add("model",(e=>{var t=e.data.data.get("model");t&&(e.inputData.model=Object.keys(t).length)})),this.runScene.cb.snapshot.resetItem.add("model",this.resetItem),this.runScene.cb.snapshot.getByType.add("model",(({targets:e,type:t,data:r})=>{"model"===t&&this.resetItem({type:t,datas:[r],targets:e})}))}getItem(e){const t=B.LV.getDiff(j,e);return ae(e)&&(t.isGLow=!0),(0,I.S)(e)&&(t.isOutline=!0),e.material&&(t.materialId=(0,S.Ki)(e.material)),t}getDiff(e){const t={};return e.map((e=>{e.traverse((e=>{var r=(0,S.Ki)(e);r&&(t[r]=this.getItem(e))}))})),t}getData(){}}class N{constructor(e){this.copyData={name:"",data:void 0,modelId:""},this.useMap={name:"",model:void 0},this.onModelMove=e=>{var t;if(this.useMap.model&&0!==this.useMap.name.length&&this.get(e)&&(t=this.getLocalDataByName(e,this.useMap.name))){var{x:t,y:r,z:n,tx:i,ty:s,tz:o}=t.data;let u=e=(0,M.VU)(e,this.runScene.assetsEx.scene);var{x:e,y:l,z:c}=e;e={x:e+t,y:l+r,z:c+n},void 0!==i&&void 0!==s&&void 0!==o&&(u=new a.Vector3(e.x+i,e.y+s,e.z+o)),this.runScene.assetsEx.camera.position.set(e.x,e.y,e.z),this.runScene.assetsEx.camera.lookAt(u),this.runScene.assetsEx.controls.target.copy(u)}},(this.runScene=e).cb.model.setVector3.add("ModelExCamFlow",(({type:e,model:t})=>{"position"===e&&this.onModelMove(t)}))}teigger(){this.runScene.events.model.enable}link(e,t){var r=this.get(e);if(r&&(r=r[t])){let n=(0,S.Ki)(e);"id"===r.type&&(n=r.data),this.copyData={name:t,modelId:n,data:void 0}}}getDataById(e,t){return null==(e=null==(e=this.runScene.modelEx.getById(e))?void 0:e.userData[N.savedStr])?void 0:e[t]}copy(e,t){(e=this.getLocalDataByName(e,t))&&(this.copyData={name:t,data:e.data,modelId:""})}paste(e){const{name:t,modelId:r,data:n}=this.copyData;e.map((e=>{n?this.set({model:e,local:n,name:t,state:!0}):0<r.length&&this.set({model:e,modelId:r,name:t,state:!0})}))}set(e){var{model:e,local:t,name:r,state:n,modelId:a}=e;let i=this.get(e);if(i){if(!n)return void delete i[r]}else{if(!n)return;i={},(0,f.M)(e,N.savedStr,i)}n&&(a?a!==(0,S.Ki)(e)&&(i[r]={type:"id",data:a}):i[r]={type:"data",data:t||this.getBetween(e)})}use(e,t){this.useMap.model=e,this.useMap.name=t}clearUse(){this.useMap.model=void 0}get(e){return(0,f.is)(e,N.savedStr)}getBetween(e){var{x:e,y:t,z:r}=(0,M.VU)(e,this.runScene.assetsEx.scene),{x:n,y:a,z:i}=this.runScene.assetsEx.controls.target;return{x:this.runScene.assetsEx.camera.position.x-e,y:this.runScene.assetsEx.camera.position.y-t,z:this.runScene.assetsEx.camera.position.z-r,tx:n-this.runScene.assetsEx.camera.position.x,ty:a-this.runScene.assetsEx.camera.position.y,tz:i-this.runScene.assetsEx.camera.position.z}}used(e,t){return(0,S.Ki)(e)===(0,S.Ki)(this.useMap.model)&&t===this.useMap.name}getLocalDataByName(e,t){var r=this.get(e);if(r&&(r=r[t]))return"id"!==r.type?r:r.data!==(0,S.Ki)(e)?this.getDataById(r.data,t):void 0}getLocalByName(e,t){if(e=this.get(e))return e[t]}focus(e,t){if(t=this.getLocalDataByName(e,t)){var{x:r,y:n,z:i}=t.data,{x:s,y:o,z:l}=(0,M.VU)(e,this.runScene.assetsEx.scene);let c;c=void 0!==t.data.tx&&void 0!==t.data.ty&&void 0!==t.data.tz?new a.Vector3(t.data.tx,t.data.ty,t.data.tz):(0,M.VU)(e,this.runScene.assetsEx.scene),t={x:s+r,y:o+n,z:l+i},this.runScene.cameraEx.anima({x:t.x,y:t.y,z:t.z,tx:t.x+c.x,ty:t.y+c.y,tz:t.z+c.z},{time:.5})}}}N.savedStr="camFLow";var z=r(3801);class F{constructor(e){this._selectModel=void 0,this.geometryMap=new l.Z,this.clonedMap=new l.Z,this.defNodeMap={castShadow:!1,receiveShadow:!1,renderOrder:0,visible:!0},this.clean=()=>{this.reset()},this.add=(()=>{const e=(e,t)=>{t?(this.runScene.uniqueEx.model.add(e,{hasReset:!0}),this.runScene.cb.model.clone.cb(e)):this.runScene.uniqueEx.model.add(e)};return(t,r,n)=>{var{addUndo:a,isClone:i,select:s,addToTree:o}=(0,O.mergeObject)({addUndo:!0,isClone:!1,select:!1,addToTree:!0},n);return t instanceof Array?t.map((e=>this.add(e,r,n))):(e(t,i),this.setGeometryMap(t),this.setCloneMap(t),o=new m({model:t,parent:r||this.runScene.sceneEx.get(),isClone:i,addTree:o,runScene:this.runScene}).execute(),!0===a&&this.runScene.undoEx.addUndo(o),s&&this.setSelectByModel(t,{isDomTreeActive:!1,isClone:i}),o)}})(),this.deepIsVisible=e=>"Scene"===e.type||!!e.visible&&!!e.parent&&this.deepIsVisible(e.parent),this.runScene=e,this.clone=(e=>(t,r=!0)=>{if(e.lightEx.isLight(t))return e.lightEx.clone(t);var a,i,s=J(t),o=(e=>{const t={};return(0,O.getModelMap)(e,"id",(e=>{0<e.animations.length&&(t[(0,S.Ki)(e)]=e.animations)})),t})(t),l=(s=s?function(e){var t=new Map,r=new Map,n=e.clone();return function e(t,r,n){n(t,r);for(var a=0;a<t.children.length;a++)e(t.children[a],r.children[a],n)}(e,n,(function(e,n){t.set(n,e),r.set(e,n)})),n.traverse((function(e){var n,a;e.isSkinnedMesh&&(a=(n=t.get(e)).skeleton.bones,e.skeleton=n.skeleton.clone(),e.bindMatrix.copy(n.bindMatrix),e.skeleton.bones=a.map((function(e){return r.get(e)})),e.bind(e.skeleton,e.bindMatrix))})),n}(t):t.clone(),l=t,(0,f.M)(s,"cloneId",te(l)||l.userData.id),(0,f.is)(t,"isDynamic")&&$(s,!0),(0,O.getModelMap)(s,"id"));c=s,(i=null==t?void 0:t.material)&&(a=d.ZP.clone((0,d.ee)(i),i))&&a.uuid!==i.uuid&&(e.materialEx.resetMaterial(c,a,{addUndo:!0}),e.materialEx.add(a,t,i));{var c={newModel:s,newModelMap:l,animaMap:o};const{animaMap:t,newModelMap:r}=c;(0,n.mapObj)(t,((t,a)=>{const i=r[t],s={};i&&(i.animations=[...a.map((e=>{const t=e.clone();return t.tracks.map((e=>{var[t]=e.name.split(".");s[t]||(s[t]=[]),s[t].push(e)})),t}))],(0,n.mapObj)(s,((t,r)=>{var a=i.getObjectByName(t);if(a){(0,f.M)(a,"id",(0,n.getId)());const i=e.uniqueEx.model.parseName(a);r.map((e=>{e.name=i+e.name.slice(t.length)}))}})))}))}return r&&e.uniqueEx.model.add(s,{hasReset:!0}),s})(e),this.runScene.cb.clean.add("EngineModel",this.clean),this.export=new P(e),this.importAndExport=new R(e),this.snapsot=new U(e),this.def=new k(e),this.camFlow=new N(e),this.runScene.cb.loaderer.gltf.getArrayBuffer.add("EngineModel",(()=>{this.selectNull()}))}get select(){return this._selectModel}set select(e){this.setSelectByModel(e)}set(e,t,r){this[t]=r,this.runScene.cb.model.change.cb({model:e,type:t,val:r})}init(){var e={name:"node",loadCallBacks:this.importAndExport.getMap(),exportCallBacks:new l.Z};this.runScene.exporter.gltf.module.bind(e),this.runScene.cb.unique.model.add.add("model",(({model:e})=>{(0,I.S)(e)&&this.setOutline(e,!0)}))}getSelectedModels(){return[this.select,...this.runScene.multipSelector.getSelectedList("value")].filter((e=>e))}setGeometryMap(e){if((0,O.validType)(e,"array"))return e.map((e=>this.setGeometryMap(e)));var t;e.geometry&&(t=e.geometry.uuid,this.geometryMap.get(t)||this.geometryMap.set(t,new Set),this.geometryMap.get(t).add((0,S.Ki)(e))),this.setGeometryMap(e.children)}isSameGeo(e,t){var{normal:e,position:r,uv:n}=e.attributes,{normal:t,position:a,uv:i}=t.attributes;return e.array.length===t.array.length&&r.array.length===a.array.length&&n.array.length===i.array.length&&(e=(0,O.sameArr)([...e.array],[...t.array],20),t=(0,O.sameArr)([...r.array],[...a.array],20),r=(0,O.sameArr)([...n.array],[...i.array],20),e&&t&&r)}getClonedIdFromModel(e){if(e.geometry){for(const e of this.clonedMap){const[r,n]=e;if(0!==n.size){var t=n.values()[0];if(!t)return;const e=this.runScene.uniqueEx.model.get(t);if(!e||!e.geometry)return;if(this.isSameGeo(e.geometry,e.geometry))return r}}this.clonedMap.map(((e,t)=>{t.size}))}}setCloneMap(e){if((0,O.validType)(e,"array"))return e.map((e=>this.setGeometryMap(e)));var t=te(e);(t||this.getClonedIdFromModel(e))&&(this.clonedMap.get(t)||this.clonedMap.set(t,new c.Z),this.clonedMap.get(t).add((0,S.Ki)(e)),this.setCloneMap(e.children))}removeCloneMap(e){this.clonedMap.get((0,S.Ki)(e))}replaceClonedGroup(e,t){t=te(t)||(0,S.Ki)(t);const r=this.clonedMap.get(t);r&&0!==r.size&&(e.userData.id=t,r.map((t=>{if(t=this.runScene.modelEx.getById(t)){var{position:r,rotation:n,scale:a,name:i,parent:s}=t;this.remove(t,!1);const o=this.runScene.modelEx.clone(e);o.userData.id=(0,S.Ki)(t),o.position.copy(r),o.rotation.copy(n),o.scale.copy(a),o.name=i,this.add(o,s,{addUndo:!1,isClone:!0,select:!1})}})))}replaceGeometry(e,t){t=t.uuid;const r=this.geometryMap.get(t);r&&0!==r.size&&(r.forEach((t=>{const r=this.runScene.uniqueEx.model.get(t);r&&(r.geometry=e,r.updateMatrix())})),this.geometryMap.delete(t),this.geometryMap.set(e.uuid,r))}setSelectByModel(e,t){this.runScene.optionsEx.log({model:e,userData:e.userData,material:e.material,textures:e.material?d.ZP.getTextures(e.material):{}},"detail");var{isDomTreeActive:t,isClone:r}=t||{};if(this.runScene.events.key.ctrl&&!r)this.runScene.multipSelector.add(e);else{if(this.runScene.multipSelector.isEmpty()||this.runScene.multipSelector.setEmpty(),this._selectModel){if(this._selectModel===e)return void(this.runScene.helperEx.focusModelId||this.runScene.helperEx.focus(e));this.runScene.lightEx.setNull(this._selectModel),this.runScene.cb.model.unFocus.cb(this._selectModel)}e&&(this.runScene.cb.model.focus.cb({model:e,status:!0,domActive:!t}),this.runScene.materialEx.setSelect(e.material),this.runScene.cb.model.setSelect.cb(e),(this._selectModel=e).isCamera||(this.runScene.helperEx.focus(e),this.runScene.lightEx.setSelect(e)))}}setSelectById(e){(e=this.runScene.uniqueEx.model.get(e))&&this.setSelectByModel(e)}remove(e,t=!0){let r=[];Array.isArray(e)?r.push(...e):r.push(e),e=r.map((e=>new x.Z({runScene:this.runScene,model:e,parent:e.parent||this.runScene.sceneEx.get()}).execute())),t&&this.runScene.undoEx.addUndo(e)}isNavieV3(e,t){var{x:e,y:r,z:n}=e;return e===(t=t?1:0)&&r===t&&n===t}isNavieV2(e,t=0){var{x:e,y:r}=e;return e===t&&r===t}isUnless(e){return!e.material&&this.isNavieV3(e.position,!1)&&this.isNavieV3(e.rotation,!1)&&this.isNavieV3(e.scale,!0)&&0===e.children.length&&!q(e)}isUnlessLevel(e){return this.isNavieV3(e.position,!1)&&this.isNavieV3(e.rotation,!1)&&this.isNavieV3(e.scale,!0)&&1===e.children.length&&!q(e)}create(e="Box"){return e=(0,O.getModelByType)(e),d.ZP.parseNode(e),e}getById(e){return Array.isArray(e)?e.map((e=>this.runScene.uniqueEx.model.get(e))).filter((e=>e)):this.runScene.uniqueEx.model.get(e)}getLevel(e,t=0){return e.parent&&"Scene"!==e.parent.type?this.getLevel(e.parent,++t):t}selectNull(){var e=this._selectModel;e&&(this.runScene.cb.model.unFocus.cb(e),this.runScene.materialEx.setSelect(null),this.runScene.lightEx.setNull(e)),this._selectModel=void 0,this.runScene.cb.model.setSelect.cb(null),this.runScene.helperEx.unfocus()}cloneV3(e){return e.clone()}setParent(e,t,r=!0){if(t=new y({oldParent:e.parent,newParent:t,target:e,runScene:this.runScene}).execute(),!r)return t;this.runScene.undoEx.addUndo(t)}_setV3(e){const{model:t,info:r,newV3:n}=e;if(Array.isArray(t))return t.map((e=>{e[r].set(n.x,n.y,n.z),e.updateMatrix()}));t[r].set(n.x,n.y,n.z),t.updateMatrix()}update(e){if(Array.isArray(e))return e.map((e=>e.updateMatrix()));e.updateMatrix()}setV3(e,t=!0,r=!0){let{model:n,info:i,newV3:s,oldV3:o}=e;var l,c;if(s.isVector3||s.isEuler||(({x:u,y:l,z:c}=s),s=new a.Vector3(u,l,c)),(0,O.isRunning)(this.runScene))return this._setV3(e);var u=n instanceof Array?n.map((e=>new w.Z({target:e,info:i,runScene:this.runScene,oldV3:o||e[i].clone(),newV3:s}).execute(r))):new w.Z({target:n,info:i,oldV3:o||n[i].clone(),newV3:s,runScene:this.runScene}).execute(r);t&&this.runScene.undoEx.addUndo(u)}setNormal(e,t=!0){const{model:r,oldVal:n,info:a,val:i,executeCb:s}=e;return e=r instanceof Array?r.map((e=>new v.Z({target:e,info:a,runScene:this.runScene,oldVal:n||r[a],newVal:i,executeCb:s}).execute())):new v.Z({target:r,info:a,runScene:this.runScene,oldVal:n||r[a],newVal:i,executeCb:s}).execute(),t&&this.runScene.undoEx.addUndo(e),e}setMaterial(e,t,r=!0){var n=new v.Z({target:e,info:"material",runScene:this.runScene,oldVal:e.material,newVal:t}).execute();this.select===e&&this.runScene.cb.setSelectMaterial.cb(t),e.material.needsUpdate=!0,r&&this.runScene.undoEx.addUndo(n)}addDef(e){this.add(this.def.create(e),void 0,{select:!0})}isModel(e){return!((0,h.RQ)(e)||(0,s.N)(s.N))}getSphere(){var e=new a.MeshBasicMaterial,t=new a.SphereGeometry(.7,150,150);return new a.Mesh(t,e)}getIndexByModel(e){var t;return e.parent?null==(t=e.parent)?void 0:t.children.findIndex((t=>t===e)):-1}getBeTweenChildByTwoModel(e,t){if(e.parent.uuid===t.parent.uuid){var r=this.getIndexByModel(e);if(t=this.getIndexByModel(t),-1!==r&&-1!==t){const n=Math.max(r,t),a=r===n?t:r;return e.parent.children.map(((e,t)=>t>a&&t<n&&e)).filter((e=>e))}}}setMultip(e){var{model:e,typeList:t,newVal:r}=e;this.runScene.undoEx.addUndo(new g.Z({target:e,typeList:t,newVal:r}).execute())}createGroup(e,t,r){const n=t||new a.Group,i=[];i.push(new m({model:n,runScene:this.runScene,parent:r||this.runScene.assetsEx.get().scene}).execute()),e instanceof Array?i.push(...e.map((e=>new y({target:e,oldParent:e.parent,newParent:n,runScene:this.runScene}).execute()))):i.push(new y({target:e,oldParent:e.parent,newParent:n,runScene:this.runScene}).execute()),r&&this.runScene.cb.model.setOpen.cb({isOpen:!0,model:r}),this.runScene.cb.model.setOpen.cb({isOpen:!0,model:n}),this.runScene.cb.model.setMainStatue.cb({status:!0,model:n}),this.runScene.undoEx.addUndo(i),this.setSelectByModel(n)}cleanGroup(e,t=!0){if(e instanceof Array){const t=(0,n.multiArrToArr)(e.map((e=>(this.runScene.cb.model.unFocus.cb(e),this.cleanGroup(e,!1)))).filter((e=>e)));return this.runScene.undoEx.addUndo(t),t}if(this.runScene.cb.model.unFocus.cb(e),0!==e.children.length){const r=[],n=e.children.map((e=>{if(e.parent.parent)return new y({target:e,oldParent:e.parent,newParent:e.parent.parent,runScene:this.runScene})})).filter((e=>e));return r.push(...n.map((e=>e.execute()))),r.push(new x.Z({runScene:this.runScene,model:e,parent:e.parent}).execute()),t&&this.runScene.undoEx.addUndo(r),r}}hideOther(e){const t=e.uuid,r=0<e.children.length,n=this.runScene.sceneEx.getClearModels(),a=[];n.map((n=>{n.traverse((n=>{r?!1===(0,O.deepFindParentByUuid)(n,t)&&n.uuid!==e.uuid&&a.push(n):n.uuid!==e.uuid&&a.push(n)}))}));var i=a.map((e=>new v.Z({target:e,info:"visible",newVal:!1,runScene:this.runScene,oldVal:e.visible}).execute()));this.runScene.undoEx.addUndo(i),(0,O.setParentVisible)(e,!0)}showAll(){const e=this.runScene.sceneEx.getClearModels(),t=[];e.map((e=>{e.traverse((e=>{"materialHelper"!==e.name&&!1===e.visible&&t.push(e)}))}));var r=t.map((e=>new v.Z({target:e,info:"visible",runScene:this.runScene,newVal:!0,oldVal:e.visible}).execute()));this.runScene.undoEx.addUndo(r)}removeHide(){const e=this.runScene.sceneEx.getClearModels(),t=new Set,r=[];e.map((e=>{e.traverse((e=>{e.visible||t.add(e)}))})),t.forEach((e=>{r.push(new x.Z({runScene:this.runScene,model:e,parent:e.parent}).execute())})),this.runScene.undoEx.addUndo(r)}_getModel(e){var t=this.runScene.uniqueEx.model.nameMap[e];if(t)return this.runScene.uniqueEx.model.get(t)||this.runScene.assetsEx.scene.getObjectByName(e)}getModel(e,t="array"){if(!(e instanceof Array))return this._getModel(e);if("array"===t)return e.map((e=>this._getModel(e)));if("map"===t){const t={};return e.map((e=>{t[e]=this.getModel(e)})),t}}getWorldLocal(e){this.runScene.assetsEx.scene.updateMatrixWorld(!0);var t=new a.Vector3;return e.getWorldPosition(t),t}getClickObj(e,t,r=!1){let n=new a.Raycaster,i=new a.Vector2,s=(i.x=e.offsetX/this.runScene.assetsEx.engineDom.clientWidth*2-1,i.y=-e.offsetY/this.runScene.assetsEx.engineDom.clientHeight*2+1,n.setFromCamera(i,this.runScene.assetsEx.camera),n.intersectObjects(t,!0)),o={intersects:null,obj:null};if(0===s.length)return o;if(r){if(0===(e=s.filter((e=>(0,O.isVisible)(e.object)))).length)return o;o={intersects:e,obj:e[0].object}}else o={intersects:s,obj:s[0].object};return o}getCamLocal(){var{x:e,y:t,z:r}=this.runScene.assetsEx.camera.position,{x:n,y:a,z:i}=this.runScene.assetsEx.controls.target;return{cx:e,cy:t,cz:r,tx:n,ty:a,tz:i}}camAnima(e,t,r=1,n,a){return(0,O.anima)(e,t,r,(e=>{a&&a(e),this.runScene.assetsEx.camera.position.set(e.cx,e.cy,e.cz),this.runScene.assetsEx.controls.target.set(e.tx,e.ty,e.tz),this.runScene.assetsEx.camera.lookAt(this.runScene.assetsEx.controls.target)}),(e=>{n&&n()}))}setGlow(e,t=!0){t=t?1:0,0==(e.userData.layers=t)?e.layers.set(0):e.layers.enable(1),this.runScene.cb.model.setLayers.cb({model:e,val:t})}setOutline(e,t=!0){e.userData.outline=t,this.runScene.pp.addOutlineObj(e,t),this.runScene.cb.model.setOutline.cb({model:e,val:t})}focus(e){const{scene:t,camera:r,renderer:n,controls:i}=this.runScene.assetsEx.get(),s=new a.Vector3,o=new a.Vector3;if("Mesh"===e.type||"Group"===e.type||"Object3D"===e.type){const e=this.runScene.helperEx.boxHelper;if(e.update(),!e||!e.object)return;var l=n.domElement.getBoundingClientRect();let t=l.width/l.height;const i=new a.Vector3;l=e.geometry.attributes.position.array,i.set(Math.abs(l[0]-l[3]),Math.abs(l[1]-l[7]),Math.abs(l[2]-l[14])),o.x=.5*(l[0]+l[3]),o.y=.5*(l[1]+l[7]),o.z=.5*(l[2]+l[14]);let c=new a.Vector3;c.subVectors(r.position,o),c.projectOnPlane(new a.Vector3(0,1,0)),c.normalize(),1<t&&(t=1/t),l=2*Math.tan(.5*r.fov*Math.PI/180),l=i.length()/t/l,s.addVectors(o,c.multiplyScalar(l))}else{t.updateMatrixWorld(!0),l=new a.Vector3,e.getWorldPosition(l),o.set(l.x,l.y,l.z);let n=new a.Vector3;n.subVectors(r.position,o),n.projectOnPlane(new a.Vector3(0,1,0)),n.normalize(),s.addVectors(o,n.multiplyScalar(3))}(0,O.anima)({positionX:r.position.x,positionY:r.position.y,positionZ:r.position.z,targetX:i.target.x,targetY:i.target.y,targetZ:i.target.z},{positionX:s.x,positionY:s.y,positionZ:s.z,targetX:o.x,targetY:o.y,targetZ:o.z},.5,(e=>{r.position.set(e.positionX,e.positionY,e.positionZ),r.lookAt(e.targetX,e.targetY,e.targetZ),i.target.set(e.targetX,e.targetY,e.targetZ),i.update()}))}instance(e){this.runScene.assetsEx.scene.updateMatrixWorld();const t={},r=Array.isArray(e)?e:[e],a=[];r.map((e=>{e.traverse((e=>{var r;e.geometry&&!ee(e)&&(r=te(e))&&(a.push(e),t[r]||(t[r]=new Set),t[r].add(e))}))})),(0,n.mapObj)(t,((e,t)=>{e=this.runScene.uniqueEx.model.get(e),t.size<2||!e||(t=W(e,[...t]),this.runScene.modelEx.add(t,void 0,{isClone:!1,select:!1,addUndo:!1}),ae(e)&&this.setGlow(t,!0),this.runScene.modelEx.remove(e,!1))})),a.map((e=>{this.runScene.modelEx.remove(e,!1)}))}reset(){const e=this.runScene.sceneEx.getClearModels();let t=[];e.map((e=>e.traverse((e=>t.push(e))))),t.map((e=>{H(e,{remove:!1}),this.runScene.cb.model.dispose.cb(e)})),this.runScene.modelEx.selectNull(),this.geometryMap.clear()}getHoverFromModels(e,t,r){const{getOriginData:n,ignoreMove:i}=(0,O.mergeObject)({ignoreMove:!1,getOriginData:!1},r);this.runScene.cb.events.pointer.move.add("get-hover-from-models",(r=>{if(i||!this.runScene.events.mouse.isMove){const i=new a.Raycaster,u=new a.Vector2,{engineDom:h,camera:d}=this.runScene.assetsEx.get();var{top:s,left:o,width:l,height:c}=h.getBoundingClientRect(),o=r.pageX-o;r=r.pageY-s,u.x=o/l*2-1,u.y=-r/c*2+1,i.setFromCamera(u,d);const p=i.intersectObjects(e||[],!0);null!=t&&t(0===p.length?null:n?p:p.map((e=>e.object)))}}))}}const V=e=>{},G=e=>{if(o.includes(e))return e=(0,O.getModelByType)(e),d.ZP.parseNode(e),e;throw TypeError("")},H=(e,t)=>{t=(t||{}).remove;const{geometry:r,material:n}=e;r&&(null!=r&&r.dispose(),delete e.geometry),n&&((0,p.disposeMaterial)(e.material),e.material.dispose(),delete e.material),!1!==t&&e.parent&&e.parent.remove(e)},W=(e,t)=>{var{material:r,geometry:n}=e;const a=new u.Z.InstancedMesh(n,r,t.length+1);return[e,...t].map(((e,t)=>{e.updateMatrix(),a.setMatrixAt(t,e.matrixWorld)})),a.name=e.name,a},K=(e,t)=>{const r=[];if(t.map((e=>{e=e.geometry,r.push(e)})),t=i.qf(r))return new u.Z.Mesh(t,e)},q=e=>0!==e.animations.length,Z=e=>{e&&e.userData&&(e.userData.isHelper=!0)},X=e=>null==(e=null==e?void 0:e.userData)?void 0:e.isHelper,Q=(e,t)=>{null!=t&&(0===t?e.layers.set(0):e.layers.enable(1),(0,f.M)(e,"layers",t))},Y=e=>{const t=[];e.traverse((e=>{t.push(e)}))},J=e=>{let t=!1;if(e)return e.traverse((e=>{e.isSkinnedMesh&&(t=!0)})),t},$=(e,t)=>{t?(0,f.M)(e,"isDynamic",!0):delete e.userData.isDynamic},ee=(e,t)=>e&&t?!!e.userData.isDynamic||!!e.parent&&ee(e.parent,t):null==(t=null==e?void 0:e.userData)?void 0:t.isDynamic,te=e=>e.userData.cloneId,re=(e,t)=>{(0,f.M)(e,"cloneId",t)},ne=e=>{delete e.userData.cloneId},ae=e=>1===e.userData.layers,ie=e=>e.isSprite,se=e=>{},oe=e=>{var t=new a.Vector3;return(new a.Box3).setFromObject(e).getSize(t),t},le={open(e){delete e.userData.unSelectable},close(e){e.userData.unSelectable=!0},is:e=>void 0===e.userData.unSelectable},ce={set(e,t){t?delete e.userData.unNormal:e.userData.unNormal=!0},is:e=>!(0,s.N)(e)&&void 0===e.userData.unNormal,hasUnNormal:e=>void 0!==(null==(e=null==e?void 0:e.userData)?void 0:e.unNormal)},ue={is:e=>null==(e=null==e?void 0:e.userData)?void 0:e.isHelper,set(e,t=!0){t?e.userData.isHelper=!0:delete e.userData.isHelper}},he={is:e=>null==(e=null==e?void 0:e.userData)?void 0:e.uselessGroup,set(e,t){t?e.userData.uselessGroup=!0:delete e.userData.uselessGroup}},de=(e,t)=>{let r=[];Array.isArray(e)?r.push(...e):r.push(e);const n={};return r.map((e=>e.traverse((e=>{null!=t&&t(e),n[(0,S.Ki)(e)]=e})))),n},pe={is:e=>!(null==(e=null==e?void 0:e.userData)||!e.isTemp),set(e,t){t?e.userData.isTemp=t:delete e.userData.isTemp}},fe={is:e=>!(null==(e=null==e?void 0:e.userData)||!e.closeEvent),set(e,t){t?e.userData.closeEvent=t:delete e.userData.closeEvent}}},1863:(e,t,r)=>{r.d(t,{Z:()=>b});var n=r(6001),a=r(8881);function i(e){return(i="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})(e)}function s(e,t){return(s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function o(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function l(e){return(l=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var c,u=function(e){var t=n;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&s(t,e);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=l(e);if(r=t?(r=l(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===i(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return o(n)}}(n);function n(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},i=this;if(!(i instanceof(l=n)))throw new TypeError("Cannot call a class as a function");(i=r.call(this,e)).isWater=!0;var s=o(i),l=void 0!==t.textureWidth?t.textureWidth:512,c=(e=void 0!==t.textureHeight?t.textureHeight:512,void 0!==t.clipBias?t.clipBias:0),u=void 0!==t.alpha?t.alpha:1,h=void 0!==t.time?t.time:0,d=void 0!==t.waterNormals?t.waterNormals:null,p=void 0!==t.sunDirection?t.sunDirection:new a.Vector3(.70707,.70707,0),f=new a.Color(void 0!==t.sunColor?t.sunColor:16777215),m=new a.Color(void 0!==t.waterColor?t.waterColor:8355711),g=void 0!==t.eye?t.eye:new a.Vector3(0,0,0),v=void 0!==t.distortionScale?t.distortionScale:20,b=void 0!==t.side?t.side:a.FrontSide,y=(t=void 0!==t.fog&&t.fog,new a.Plane),x=new a.Vector3,w=new a.Vector3,S=new a.Vector3,M=new a.Matrix4,T=new a.Vector3(0,0,-1),_=new a.Vector4,E=new a.Vector3,D=new a.Vector3,k=new a.Vector4,O=new a.Matrix4,P=new a.PerspectiveCamera,A=new a.WebGLRenderTarget(l,e);return l={uniforms:a.UniformsUtils.merge([a.UniformsLib.fog,a.UniformsLib.lights,{normalSampler:{value:null},mirrorSampler:{value:null},alpha:{value:1},time:{value:0},size:{value:1},distortionScale:{value:20},textureMatrix:{value:new a.Matrix4},sunColor:{value:new a.Color(8355711)},sunDirection:{value:new a.Vector3(.70707,.70707,0)},eye:{value:new a.Vector3},waterColor:{value:new a.Color(5592405)}}]),vertexShader:"\n\t\t\t\tuniform mat4 textureMatrix;\n\t\t\t\tuniform float time;\n\n\t\t\t\tvarying vec4 mirrorCoord;\n\t\t\t\tvarying vec4 worldPosition;\n\n\t\t\t\t#include <common>\n\t\t\t\t#include <fog_pars_vertex>\n\t\t\t\t#include <shadowmap_pars_vertex>\n\t\t\t\t#include <logdepthbuf_pars_vertex>\n\n\t\t\t\tvoid main() {\n\t\t\t\t\tmirrorCoord = modelMatrix * vec4( position, 1.0 );\n\t\t\t\t\tworldPosition = mirrorCoord.xyzw;\n\t\t\t\t\tmirrorCoord = textureMatrix * mirrorCoord;\n\t\t\t\t\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t\tgl_Position = projectionMatrix * mvPosition;\n\n\t\t\t\t#include <beginnormal_vertex>\n\t\t\t\t#include <defaultnormal_vertex>\n\t\t\t\t#include <logdepthbuf_vertex>\n\t\t\t\t#include <fog_vertex>\n\t\t\t\t#include <shadowmap_vertex>\n\t\t\t}",fragmentShader:"\n\t\t\t\tuniform sampler2D mirrorSampler;\n\t\t\t\tuniform float alpha;\n\t\t\t\tuniform float time;\n\t\t\t\tuniform float size;\n\t\t\t\tuniform float distortionScale;\n\t\t\t\tuniform sampler2D normalSampler;\n\t\t\t\tuniform vec3 sunColor;\n\t\t\t\tuniform vec3 sunDirection;\n\t\t\t\tuniform vec3 eye;\n\t\t\t\tuniform vec3 waterColor;\n\n\t\t\t\tvarying vec4 mirrorCoord;\n\t\t\t\tvarying vec4 worldPosition;\n\n\t\t\t\tvec4 getNoise( vec2 uv ) {\n\t\t\t\t\tvec2 uv0 = ( uv / 103.0 ) + vec2(time / 17.0, time / 29.0);\n\t\t\t\t\tvec2 uv1 = uv / 107.0-vec2( time / -19.0, time / 31.0 );\n\t\t\t\t\tvec2 uv2 = uv / vec2( 8907.0, 9803.0 ) + vec2( time / 101.0, time / 97.0 );\n\t\t\t\t\tvec2 uv3 = uv / vec2( 1091.0, 1027.0 ) - vec2( time / 109.0, time / -113.0 );\n\t\t\t\t\tvec4 noise = texture2D( normalSampler, uv0 ) +\n\t\t\t\t\t\ttexture2D( normalSampler, uv1 ) +\n\t\t\t\t\t\ttexture2D( normalSampler, uv2 ) +\n\t\t\t\t\t\ttexture2D( normalSampler, uv3 );\n\t\t\t\t\treturn noise * 0.5 - 1.0;\n\t\t\t\t}\n\n\t\t\t\tvoid sunLight( const vec3 surfaceNormal, const vec3 eyeDirection, float shiny, float spec, float diffuse, inout vec3 diffuseColor, inout vec3 specularColor ) {\n\t\t\t\t\tvec3 reflection = normalize( reflect( -sunDirection, surfaceNormal ) );\n\t\t\t\t\tfloat direction = max( 0.0, dot( eyeDirection, reflection ) );\n\t\t\t\t\tspecularColor += pow( direction, shiny ) * sunColor * spec;\n\t\t\t\t\tdiffuseColor += max( dot( sunDirection, surfaceNormal ), 0.0 ) * sunColor * diffuse;\n\t\t\t\t}\n\n\t\t\t\t#include <common>\n\t\t\t\t#include <packing>\n\t\t\t\t#include <bsdfs>\n\t\t\t\t#include <fog_pars_fragment>\n\t\t\t\t#include <logdepthbuf_pars_fragment>\n\t\t\t\t#include <lights_pars_begin>\n\t\t\t\t#include <shadowmap_pars_fragment>\n\t\t\t\t#include <shadowmask_pars_fragment>\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\t#include <logdepthbuf_fragment>\n\t\t\t\t\tvec4 noise = getNoise( worldPosition.xz * size );\n\t\t\t\t\tvec3 surfaceNormal = normalize( noise.xzy * vec3( 1.5, 1.0, 1.5 ) );\n\n\t\t\t\t\tvec3 diffuseLight = vec3(0.0);\n\t\t\t\t\tvec3 specularLight = vec3(0.0);\n\n\t\t\t\t\tvec3 worldToEye = eye-worldPosition.xyz;\n\t\t\t\t\tvec3 eyeDirection = normalize( worldToEye );\n\t\t\t\t\tsunLight( surfaceNormal, eyeDirection, 100.0, 2.0, 0.5, diffuseLight, specularLight );\n\n\t\t\t\t\tfloat distance = length(worldToEye);\n\n\t\t\t\t\tvec2 distortion = surfaceNormal.xz * ( 0.001 + 1.0 / distance ) * distortionScale;\n\t\t\t\t\tvec3 reflectionSample = vec3( texture2D( mirrorSampler, mirrorCoord.xy / mirrorCoord.w + distortion ) );\n\n\t\t\t\t\tfloat theta = max( dot( eyeDirection, surfaceNormal ), 0.0 );\n\t\t\t\t\tfloat rf0 = 0.3;\n\t\t\t\t\tfloat reflectance = rf0 + ( 1.0 - rf0 ) * pow( ( 1.0 - theta ), 5.0 );\n\t\t\t\t\tvec3 scatter = max( 0.0, dot( surfaceNormal, eyeDirection ) ) * waterColor;\n\t\t\t\t\tvec3 albedo = mix( ( sunColor * diffuseLight * 0.3 + scatter ) * getShadowMask(), ( vec3( 0.1 ) + reflectionSample * 0.9 + reflectionSample * specularLight ), reflectance);\n\t\t\t\t\tvec3 outgoingLight = albedo;\n\t\t\t\t\tgl_FragColor = vec4( outgoingLight, alpha );\n\n\t\t\t\t\t#include <tonemapping_fragment>\n\t\t\t\t\t#include <fog_fragment>\n\t\t\t\t}"},(e=new a.ShaderMaterial({fragmentShader:l.fragmentShader,vertexShader:l.vertexShader,uniforms:a.UniformsUtils.clone(l.uniforms),lights:!0,side:b,fog:t})).uniforms.mirrorSampler.value=A.texture,e.uniforms.textureMatrix.value=O,e.uniforms.alpha.value=u,e.uniforms.time.value=h,e.uniforms.normalSampler.value=d,e.uniforms.sunColor.value=f,e.uniforms.waterColor.value=m,e.uniforms.sunDirection.value=p,e.uniforms.distortionScale.value=v,e.uniforms.eye.value=g,s.material=e,s.onBeforeRender=function(e,t,r){var n,a,i;w.setFromMatrixPosition(s.matrixWorld),S.setFromMatrixPosition(r.matrixWorld),M.extractRotation(s.matrixWorld),x.set(0,0,1),x.applyMatrix4(M),E.subVectors(w,S),0<E.dot(x)||(E.reflect(x).negate(),E.add(w),M.extractRotation(r.matrixWorld),T.set(0,0,-1),T.applyMatrix4(M),T.add(S),D.subVectors(w,T),D.reflect(x).negate(),D.add(w),P.position.copy(E),P.up.set(0,1,0),P.up.applyMatrix4(M),P.up.reflect(x),P.lookAt(D),P.far=r.far,P.updateMatrixWorld(),P.projectionMatrix.copy(r.projectionMatrix),O.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),O.multiply(P.projectionMatrix),O.multiply(P.matrixWorldInverse),y.setFromNormalAndCoplanarPoint(x,w),y.applyMatrix4(P.matrixWorldInverse),_.set(y.normal.x,y.normal.y,y.normal.z,y.constant),n=P.projectionMatrix,k.x=(Math.sign(_.x)+n.elements[8])/n.elements[0],k.y=(Math.sign(_.y)+n.elements[9])/n.elements[5],k.z=-1,k.w=(1+n.elements[10])/n.elements[14],_.multiplyScalar(2/_.dot(k)),n.elements[2]=_.x,n.elements[6]=_.y,n.elements[10]=_.z+1-c,n.elements[14]=_.w,g.setFromMatrixPosition(r.matrixWorld),n=e.getRenderTarget(),a=e.xr.enabled,i=e.shadowMap.autoUpdate,s.visible=!1,e.xr.enabled=!1,e.shadowMap.autoUpdate=!1,e.setRenderTarget(A),e.state.buffers.depth.setMask(!0),!1===e.autoClear&&e.clear(),e.render(t,P),s.visible=!0,e.xr.enabled=a,e.shadowMap.autoUpdate=i,e.setRenderTarget(n),void 0!==(t=r.viewport)&&e.state.viewport(t))},i}return t=n,Object.defineProperty(t,"prototype",{writable:!1}),t}(a.Mesh),h=r(1794),d=r(932),p=(t=r(4707),r(2677)),f=r(3736),m=r(3729),g=r(8089),v=r(6756);t.Gf.fog;class b{constructor(e){this.catchModel=new h.Z,this.map=new h.Z,this.inited=()=>{this.runScene.cb.render.add(b.type,this.render),this.runScene.cb.model.add.add(b.type,this.onModelAdd),this.runScene.cb.model.remove.add(b.type,this.onModelDel),this.runScene.modelEx.importAndExport.addParses("Water",{toNormal:e=>this.process(e),parse:e=>{const t=this.create();return e=e.model,t.name=e.name,t.visible=e.visible,t.position.copy(e.position),t.rotation.copy(e.rotation),t.scale.copy(e.scale),this.catchModel.set(e.userData.normal.id,{model:t,material:t.material}),t.material=e.material,t.userData=Object.assign({},e.userData),t}}),this.runScene.cb.loaderer.gltf.complete.add("water-model",this.complete),this.runScene.cb.load.complete.add("water-model",this.complete)},this.complete=()=>{this.catchModel.map(((e,t)=>{const{model:r,material:n}=t;t=r.material,b.mergeMaterial(t,n),this.bindMaterialData(n),r.material=n})),this.catchModel.clear()},this.process=e=>{if(e=e.model,!this.is(e))return e;const t=(0,v.createDefModel)("Box");return t.userData.normal=Object.assign({type:"Water"},e.userData),t.name=e.name,t.visible=e.visible,t.position.copy(e.position),t.rotation.copy(e.rotation),t.scale.copy(e.scale),t.material=e.material,t},this.onModelAdd=e=>{var t;this.is(e.model)&&(e=e.model,(t=(0,m.Ki)(e))&&this.map.set(t,e))},this.onModelDel=e=>{this.is(e.model)&&(e=e.model,(e=(0,m.Ki)(e))&&this.map.delete(e))},this.render=()=>{0!==this.map.size&&this.map.map(((e,t)=>{t.material.uniforms.time.value+=t.material.userData.speed||1/60}))},this.runScene=e,this.runScene.cb.inited.add(b.type,this.inited)}create(){const e=new u(new a.PlaneGeometry(1e3,1e3),{textureWidth:512,textureHeight:512,sunDirection:new p.Sf.Vector3,sunColor:16711680,waterColor:16777215,distortionScale:3.7});return this.bindData(e),e.rotation.x=-Math.PI/2,e}static create(){const e=new u(new a.PlaneGeometry(1e3,1e3),{textureWidth:512,textureHeight:512,sunDirection:new p.Sf.Vector3,sunColor:16711680,waterColor:16777215,distortionScale:3.7});return e.rotation.x=-Math.PI/2,e}is(e){return"Water"===(null==(e=e.userData.normal)?void 0:e.type)}bindData(e){e.userData.normal={type:"Water"},e.name="water",this.bindMaterialData(e.material)}bindMaterialData(e){e.userData.type="Water",e.userData.id=e.userData.id||(0,n.getId)(),e.userData.tools=b.tools}set(e,t,r){e.material[t]=r}static mergeMaterial(e,t){var{fog:r,side:n}=e,{waterColor:a,distortionScale:i,normalSampler:s}=e.uniforms;t.fog=r,t.side=n,t.uniforms.normalSampler.value=s.value,t.uniforms.waterColor.value.copy(a.value),t.uniforms.distortionScale.value=i.value,t.userData=Object.assign({},e.userData)}}(c=b).type="water-model",b.tools={type:"Water",bind(e){(0,f.M)(e,"type","Water")},getTextures:e=>["normalSampler"].map((t=>{var r=e.uniforms[t].value;if(r)return{type:t,texture:r}})).filter((e=>e)),create:()=>{const e=c.create();return e.material.type=c.tools.type,e.material.userData.tools=c.tools,e.material},parseData:(e,t)=>{const{texture:r,material:n,normal:a}=e,{data:i,load:s}=r,o=[],l=c.tools.create(t);var{side:e,fog:t,waterColor:u,distortionScale:h,speed:d}=a;return l.fog=void 0===t||t,e&&(l.side=e),u&&(l.uniforms.waterColor.value=(0,g.ZD)(u)),void 0!==h&&(l.uniforms.distortionScale.value=h),void 0!==d&&(n.userData.speed=d),s&&o.push(...i.map((e=>{const{type:t,texture:r}=e;return()=>{l.uniforms[t].value=r}}))),l.userData=Object.assign({},n.userData),{material:l,setTextureFns:o}},toNormal:e=>{const t=(0,d.createDefMaterial)();var r={type:"Water",id:(0,m.Ki)(t)};const n={type:"Water"};return e.fog||(n.fog=!1),0!==e.side&&(n.side=e.side),e.userData.speed&&(n.speed=e.userData.speed),n.waterColor=e.uniforms.waterColor.value.getHexString(),n.distortionScale=e.uniforms.distortionScale.value,t.userData=r,{normal:n,textures:b.tools.getTextures(e),material:t}},clone:e=>e,copy:e=>{const t=e.clone();return t.userData.type=b.tools.type,t}}},228:(e,t,r)=>{r.d(t,{Q:()=>d,S:()=>p});var n=r(2677),a=r(8881),i=r(4819),s=r(6608);function o(e){return(o="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})(e)}function l(e,t){return(l=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function c(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=u(e);if(r=t?(r=u(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===o(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function u(e){return(u=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var h=function(e){var t=n;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&l(t,e);var r=c(n);function n(e,t,o,l){var c;if(!(this instanceof n))throw new TypeError("Cannot call a class as a function");return(c=r.call(this)).renderScene=t,c.renderCamera=o,c.selectedObjects=void 0!==l?l:[],c.visibleEdgeColor=new a.Color(1,1,1),c.hiddenEdgeColor=new a.Color(.1,.04,.02),c.edgeGlow=0,c.usePatternTexture=!1,c.edgeThickness=1,c.edgeStrength=3,c.downSampleRatio=2,c.pulsePeriod=0,c._visibilityCache=new Map,c.resolution=void 0!==e?new a.Vector2(e.x,e.y):new a.Vector2(256,256),t=Math.round(c.resolution.x/c.downSampleRatio),o=Math.round(c.resolution.y/c.downSampleRatio),c.renderTargetMaskBuffer=new a.WebGLRenderTarget(c.resolution.x,c.resolution.y),c.renderTargetMaskBuffer.texture.name="OutlinePass.mask",c.renderTargetMaskBuffer.texture.generateMipmaps=!1,c.depthMaterial=new a.MeshDepthMaterial,c.depthMaterial.side=a.DoubleSide,c.depthMaterial.depthPacking=a.RGBADepthPacking,c.depthMaterial.blending=a.NoBlending,c.prepareMaskMaterial=c.getPrepareMaskMaterial(),c.prepareMaskMaterial.side=a.DoubleSide,c.prepareMaskMaterial.fragmentShader=function(e,t){return t=t.isPerspectiveCamera?"perspective":"orthographic",e.replace(/DEPTH_TO_VIEW_Z/g,t+"DepthToViewZ")}(c.prepareMaskMaterial.fragmentShader,c.renderCamera),c.renderTargetDepthBuffer=new a.WebGLRenderTarget(c.resolution.x,c.resolution.y),c.renderTargetDepthBuffer.texture.name="OutlinePass.depth",c.renderTargetDepthBuffer.texture.generateMipmaps=!1,c.renderTargetMaskDownSampleBuffer=new a.WebGLRenderTarget(t,o),c.renderTargetMaskDownSampleBuffer.texture.name="OutlinePass.depthDownSample",c.renderTargetMaskDownSampleBuffer.texture.generateMipmaps=!1,c.renderTargetBlurBuffer1=new a.WebGLRenderTarget(t,o),c.renderTargetBlurBuffer1.texture.name="OutlinePass.blur1",c.renderTargetBlurBuffer1.texture.generateMipmaps=!1,c.renderTargetBlurBuffer2=new a.WebGLRenderTarget(Math.round(t/2),Math.round(o/2)),c.renderTargetBlurBuffer2.texture.name="OutlinePass.blur2",c.renderTargetBlurBuffer2.texture.generateMipmaps=!1,c.edgeDetectionMaterial=c.getEdgeDetectionMaterial(),c.renderTargetEdgeBuffer1=new a.WebGLRenderTarget(t,o),c.renderTargetEdgeBuffer1.texture.name="OutlinePass.edge1",c.renderTargetEdgeBuffer1.texture.generateMipmaps=!1,c.renderTargetEdgeBuffer2=new a.WebGLRenderTarget(Math.round(t/2),Math.round(o/2)),c.renderTargetEdgeBuffer2.texture.name="OutlinePass.edge2",c.renderTargetEdgeBuffer2.texture.generateMipmaps=!1,c.separableBlurMaterial1=c.getSeperableBlurMaterial(4),c.separableBlurMaterial1.uniforms.texSize.value.set(t,o),c.separableBlurMaterial1.uniforms.kernelRadius.value=1,c.separableBlurMaterial2=c.getSeperableBlurMaterial(4),c.separableBlurMaterial2.uniforms.texSize.value.set(Math.round(t/2),Math.round(o/2)),c.separableBlurMaterial2.uniforms.kernelRadius.value=4,c.overlayMaterial=c.getOverlayMaterial(),l=s.C,c.copyUniforms=a.UniformsUtils.clone(l.uniforms),c.copyUniforms.opacity.value=1,c.materialCopy=new a.ShaderMaterial({uniforms:c.copyUniforms,vertexShader:l.vertexShader,fragmentShader:l.fragmentShader,blending:a.NoBlending,depthTest:!1,depthWrite:!1,transparent:!0}),c.enabled=!0,c.needsSwap=!1,c._oldClearColor=new a.Color,c.oldClearAlpha=1,c.fsQuad=new i.T(null),c.tempPulseColor1=new a.Color,c.tempPulseColor2=new a.Color,c.textureMatrix=new a.Matrix4,c}return t=n,(e=[{key:"dispose",value:function(){this.renderTargetMaskBuffer.dispose(),this.renderTargetDepthBuffer.dispose(),this.renderTargetMaskDownSampleBuffer.dispose(),this.renderTargetBlurBuffer1.dispose(),this.renderTargetBlurBuffer2.dispose(),this.renderTargetEdgeBuffer1.dispose(),this.renderTargetEdgeBuffer2.dispose(),this.depthMaterial.dispose(),this.prepareMaskMaterial.dispose(),this.edgeDetectionMaterial.dispose(),this.separableBlurMaterial1.dispose(),this.separableBlurMaterial2.dispose(),this.overlayMaterial.dispose(),this.materialCopy.dispose(),this.fsQuad.dispose()}},{key:"setSize",value:function(e,t){this.renderTargetMaskBuffer.setSize(e,t),this.renderTargetDepthBuffer.setSize(e,t),e=Math.round(e/this.downSampleRatio),t=Math.round(t/this.downSampleRatio),this.renderTargetMaskDownSampleBuffer.setSize(e,t),this.renderTargetBlurBuffer1.setSize(e,t),this.renderTargetEdgeBuffer1.setSize(e,t),this.separableBlurMaterial1.uniforms.texSize.value.set(e,t),e=Math.round(e/2),t=Math.round(t/2),this.renderTargetBlurBuffer2.setSize(e,t),this.renderTargetEdgeBuffer2.setSize(e,t),this.separableBlurMaterial2.uniforms.texSize.value.set(e,t)}},{key:"changeVisibilityOfSelectedObjects",value:function(e){var t=this._visibilityCache;function r(r){r.isMesh&&(!0===e?r.visible=t.get(r):(t.set(r,r.visible),r.visible=e))}for(var n=0;n<this.selectedObjects.length;n++)this.selectedObjects[n].traverse(r)}},{key:"changeVisibilityOfNonSelectedObjects",value:function(e){var t=this._visibilityCache,r=[];function n(e){e.isMesh&&r.push(e)}for(var a=0;a<this.selectedObjects.length;a++)this.selectedObjects[a].traverse(n);this.renderScene.traverse((function(n){if(n.isMesh||n.isSprite){for(var a,i=!1,s=0;s<r.length;s++)if(r[s].id===n.id){i=!0;break}!1===i&&(a=n.visible,!1!==e&&!0!==t.get(n)||(n.visible=e),t.set(n,a))}else(n.isPoints||n.isLine)&&(!0===e?n.visible=t.get(n):(t.set(n,n.visible),n.visible=e))}))}},{key:"updateTextureMatrix",value:function(){this.textureMatrix.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),this.textureMatrix.multiply(this.renderCamera.projectionMatrix),this.textureMatrix.multiply(this.renderCamera.matrixWorldInverse)}},{key:"render",value:function(e,t,r,a,i){var s,o;0<this.selectedObjects.length&&(e.getClearColor(this._oldClearColor),this.oldClearAlpha=e.getClearAlpha(),s=e.autoClear,e.autoClear=!1,i&&e.state.buffers.stencil.setTest(!1),e.setClearColor(16777215,1),this.changeVisibilityOfSelectedObjects(!1),o=this.renderScene.background,this.renderScene.background=null,this.renderScene.overrideMaterial=this.depthMaterial,e.setRenderTarget(this.renderTargetDepthBuffer),e.clear(),e.render(this.renderScene,this.renderCamera),this.changeVisibilityOfSelectedObjects(!0),this._visibilityCache.clear(),this.updateTextureMatrix(),this.changeVisibilityOfNonSelectedObjects(!1),this.renderScene.overrideMaterial=this.prepareMaskMaterial,this.prepareMaskMaterial.uniforms.cameraNearFar.value.set(this.renderCamera.near,this.renderCamera.far),this.prepareMaskMaterial.uniforms.depthTexture.value=this.renderTargetDepthBuffer.texture,this.prepareMaskMaterial.uniforms.textureMatrix.value=this.textureMatrix,e.setRenderTarget(this.renderTargetMaskBuffer),e.clear(),e.render(this.renderScene,this.renderCamera),this.renderScene.overrideMaterial=null,this.changeVisibilityOfNonSelectedObjects(!0),this._visibilityCache.clear(),this.renderScene.background=o,this.fsQuad.material=this.materialCopy,this.copyUniforms.tDiffuse.value=this.renderTargetMaskBuffer.texture,e.setRenderTarget(this.renderTargetMaskDownSampleBuffer),e.clear(),this.fsQuad.render(e),this.tempPulseColor1.copy(this.visibleEdgeColor),this.tempPulseColor2.copy(this.hiddenEdgeColor),0<this.pulsePeriod&&(o=.625+.75*Math.cos(.01*performance.now()/this.pulsePeriod)/2,this.tempPulseColor1.multiplyScalar(o),this.tempPulseColor2.multiplyScalar(o)),this.fsQuad.material=this.edgeDetectionMaterial,this.edgeDetectionMaterial.uniforms.maskTexture.value=this.renderTargetMaskDownSampleBuffer.texture,this.edgeDetectionMaterial.uniforms.texSize.value.set(this.renderTargetMaskDownSampleBuffer.width,this.renderTargetMaskDownSampleBuffer.height),this.edgeDetectionMaterial.uniforms.visibleEdgeColor.value=this.tempPulseColor1,this.edgeDetectionMaterial.uniforms.hiddenEdgeColor.value=this.tempPulseColor2,e.setRenderTarget(this.renderTargetEdgeBuffer1),e.clear(),this.fsQuad.render(e),this.fsQuad.material=this.separableBlurMaterial1,this.separableBlurMaterial1.uniforms.colorTexture.value=this.renderTargetEdgeBuffer1.texture,this.separableBlurMaterial1.uniforms.direction.value=n.BlurDirectionX,this.separableBlurMaterial1.uniforms.kernelRadius.value=this.edgeThickness,e.setRenderTarget(this.renderTargetBlurBuffer1),e.clear(),this.fsQuad.render(e),this.separableBlurMaterial1.uniforms.colorTexture.value=this.renderTargetBlurBuffer1.texture,this.separableBlurMaterial1.uniforms.direction.value=n.BlurDirectionY,e.setRenderTarget(this.renderTargetEdgeBuffer1),e.clear(),this.fsQuad.render(e),this.fsQuad.material=this.separableBlurMaterial2,this.separableBlurMaterial2.uniforms.colorTexture.value=this.renderTargetEdgeBuffer1.texture,this.separableBlurMaterial2.uniforms.direction.value=n.BlurDirectionX,e.setRenderTarget(this.renderTargetBlurBuffer2),e.clear(),this.fsQuad.render(e),this.separableBlurMaterial2.uniforms.colorTexture.value=this.renderTargetBlurBuffer2.texture,this.separableBlurMaterial2.uniforms.direction.value=n.BlurDirectionY,e.setRenderTarget(this.renderTargetEdgeBuffer2),e.clear(),this.fsQuad.render(e),this.fsQuad.material=this.overlayMaterial,this.overlayMaterial.uniforms.maskTexture.value=this.renderTargetMaskBuffer.texture,this.overlayMaterial.uniforms.edgeTexture1.value=this.renderTargetEdgeBuffer1.texture,this.overlayMaterial.uniforms.edgeTexture2.value=this.renderTargetEdgeBuffer2.texture,this.overlayMaterial.uniforms.patternTexture.value=this.patternTexture,this.overlayMaterial.uniforms.edgeStrength.value=this.edgeStrength,this.overlayMaterial.uniforms.edgeGlow.value=this.edgeGlow,this.overlayMaterial.uniforms.usePatternTexture.value=this.usePatternTexture,i&&e.state.buffers.stencil.setTest(!0),e.setRenderTarget(r),this.fsQuad.render(e),e.setClearColor(this._oldClearColor,this.oldClearAlpha),e.autoClear=s),this.renderToScreen&&(this.fsQuad.material=this.materialCopy,this.copyUniforms.tDiffuse.value=r.texture,e.setRenderTarget(null),this.fsQuad.render(e))}},{key:"getPrepareMaskMaterial",value:function(){return new a.ShaderMaterial({uniforms:{depthTexture:{value:null},cameraNearFar:{value:new a.Vector2(.5,.5)},textureMatrix:{value:null}},vertexShader:"#include <morphtarget_pars_vertex>\n\t\t\t\t#include <skinning_pars_vertex>\n\n\t\t\t\tvarying vec4 projTexCoord;\n\t\t\t\tvarying vec4 vPosition;\n\t\t\t\tuniform mat4 textureMatrix;\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\t#include <skinbase_vertex>\n\t\t\t\t\t#include <begin_vertex>\n\t\t\t\t\t#include <morphtarget_vertex>\n\t\t\t\t\t#include <skinning_vertex>\n\t\t\t\t\t#include <project_vertex>\n\n\t\t\t\t\tvPosition = mvPosition;\n\n\t\t\t\t\tvec4 worldPosition = vec4( transformed, 1.0 );\n\n\t\t\t\t\t#ifdef USE_INSTANCING\n\n\t\t\t\t\t\tworldPosition = instanceMatrix * worldPosition;\n\n\t\t\t\t\t#endif\n\t\t\t\t\t\n\t\t\t\t\tworldPosition = modelMatrix * worldPosition;\n\n\t\t\t\t\tprojTexCoord = textureMatrix * worldPosition;\n\n\t\t\t\t}",fragmentShader:"#include <packing>\n\t\t\t\tvarying vec4 vPosition;\n\t\t\t\tvarying vec4 projTexCoord;\n\t\t\t\tuniform sampler2D depthTexture;\n\t\t\t\tuniform vec2 cameraNearFar;\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tfloat depth = unpackRGBAToDepth(texture2DProj( depthTexture, projTexCoord ));\n\t\t\t\t\tfloat viewZ = - DEPTH_TO_VIEW_Z( depth, cameraNearFar.x, cameraNearFar.y );\n\t\t\t\t\tfloat depthTest = (-vPosition.z > viewZ) ? 1.0 : 0.0;\n\t\t\t\t\tgl_FragColor = vec4(0.0, depthTest, 1.0, 1.0);\n\n\t\t\t\t}"})}},{key:"getEdgeDetectionMaterial",value:function(){return new a.ShaderMaterial({uniforms:{maskTexture:{value:null},texSize:{value:new a.Vector2(.5,.5)},visibleEdgeColor:{value:new a.Vector3(1,1,1)},hiddenEdgeColor:{value:new a.Vector3(1,1,1)}},vertexShader:"varying vec2 vUv;\n\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}",fragmentShader:"varying vec2 vUv;\n\n\t\t\t\tuniform sampler2D maskTexture;\n\t\t\t\tuniform vec2 texSize;\n\t\t\t\tuniform vec3 visibleEdgeColor;\n\t\t\t\tuniform vec3 hiddenEdgeColor;\n\n\t\t\t\tvoid main() {\n\t\t\t\t\tvec2 invSize = 1.0 / texSize;\n\t\t\t\t\tvec4 uvOffset = vec4(1.0, 0.0, 0.0, 1.0) * vec4(invSize, invSize);\n\t\t\t\t\tvec4 c1 = texture2D( maskTexture, vUv + uvOffset.xy);\n\t\t\t\t\tvec4 c2 = texture2D( maskTexture, vUv - uvOffset.xy);\n\t\t\t\t\tvec4 c3 = texture2D( maskTexture, vUv + uvOffset.yw);\n\t\t\t\t\tvec4 c4 = texture2D( maskTexture, vUv - uvOffset.yw);\n\t\t\t\t\tfloat diff1 = (c1.r - c2.r)*0.5;\n\t\t\t\t\tfloat diff2 = (c3.r - c4.r)*0.5;\n\t\t\t\t\tfloat d = length( vec2(diff1, diff2) );\n\t\t\t\t\tfloat a1 = min(c1.g, c2.g);\n\t\t\t\t\tfloat a2 = min(c3.g, c4.g);\n\t\t\t\t\tfloat visibilityFactor = min(a1, a2);\n\t\t\t\t\tvec3 edgeColor = 1.0 - visibilityFactor > 0.001 ? visibleEdgeColor : hiddenEdgeColor;\n\t\t\t\t\tgl_FragColor = vec4(edgeColor, 1.0) * vec4(d);\n\t\t\t\t}"})}},{key:"getSeperableBlurMaterial",value:function(e){return new a.ShaderMaterial({defines:{MAX_RADIUS:e},uniforms:{colorTexture:{value:null},texSize:{value:new a.Vector2(.5,.5)},direction:{value:new a.Vector2(.5,.5)},kernelRadius:{value:1}},vertexShader:"varying vec2 vUv;\n\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}",fragmentShader:"#include <common>\n\t\t\t\tvarying vec2 vUv;\n\t\t\t\tuniform sampler2D colorTexture;\n\t\t\t\tuniform vec2 texSize;\n\t\t\t\tuniform vec2 direction;\n\t\t\t\tuniform float kernelRadius;\n\n\t\t\t\tfloat gaussianPdf(in float x, in float sigma) {\n\t\t\t\t\treturn 0.39894 * exp( -0.5 * x * x/( sigma * sigma))/sigma;\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\t\t\t\t\tvec2 invSize = 1.0 / texSize;\n\t\t\t\t\tfloat sigma = kernelRadius/2.0;\n\t\t\t\t\tfloat weightSum = gaussianPdf(0.0, sigma);\n\t\t\t\t\tvec4 diffuseSum = texture2D( colorTexture, vUv) * weightSum;\n\t\t\t\t\tvec2 delta = direction * invSize * kernelRadius/float(MAX_RADIUS);\n\t\t\t\t\tvec2 uvOffset = delta;\n\t\t\t\t\tfor( int i = 1; i <= MAX_RADIUS; i ++ ) {\n\t\t\t\t\t\tfloat x = kernelRadius * float(i) / float(MAX_RADIUS);\n\t\t\t\t\t\tfloat w = gaussianPdf(x, sigma);\n\t\t\t\t\t\tvec4 sample1 = texture2D( colorTexture, vUv + uvOffset);\n\t\t\t\t\t\tvec4 sample2 = texture2D( colorTexture, vUv - uvOffset);\n\t\t\t\t\t\tdiffuseSum += ((sample1 + sample2) * w);\n\t\t\t\t\t\tweightSum += (2.0 * w);\n\t\t\t\t\t\tuvOffset += delta;\n\t\t\t\t\t}\n\t\t\t\t\tgl_FragColor = diffuseSum/weightSum;\n\t\t\t\t}"})}},{key:"getOverlayMaterial",value:function(){return new a.ShaderMaterial({uniforms:{maskTexture:{value:null},edgeTexture1:{value:null},edgeTexture2:{value:null},patternTexture:{value:null},edgeStrength:{value:1},edgeGlow:{value:1},usePatternTexture:{value:0}},vertexShader:"varying vec2 vUv;\n\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}",fragmentShader:"varying vec2 vUv;\n\n\t\t\t\tuniform sampler2D maskTexture;\n\t\t\t\tuniform sampler2D edgeTexture1;\n\t\t\t\tuniform sampler2D edgeTexture2;\n\t\t\t\tuniform sampler2D patternTexture;\n\t\t\t\tuniform float edgeStrength;\n\t\t\t\tuniform float edgeGlow;\n\t\t\t\tuniform bool usePatternTexture;\n\n\t\t\t\tvoid main() {\n\t\t\t\t\tvec4 edgeValue1 = texture2D(edgeTexture1, vUv);\n\t\t\t\t\tvec4 edgeValue2 = texture2D(edgeTexture2, vUv);\n\t\t\t\t\tvec4 maskColor = texture2D(maskTexture, vUv);\n\t\t\t\t\tvec4 patternColor = texture2D(patternTexture, 6.0 * vUv);\n\t\t\t\t\tfloat visibilityFactor = 1.0 - maskColor.g > 0.0 ? 1.0 : 0.5;\n\t\t\t\t\tvec4 edgeValue = edgeValue1 + edgeValue2 * edgeGlow;\n\t\t\t\t\tvec4 finalColor = edgeStrength * maskColor.r * edgeValue;\n\t\t\t\t\tif(usePatternTexture)\n\t\t\t\t\t\tfinalColor += + visibilityFactor * (1.0 - maskColor.r) * (1.0 - patternColor.r);\n\t\t\t\t\tgl_FragColor = finalColor;\n\t\t\t\t}",blending:a.AdditiveBlending,depthTest:!1,depthWrite:!1,transparent:!0})}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),n}(i.w);h.BlurDirectionX=new a.Vector2(1,0),h.BlurDirectionY=new a.Vector2(0,1);class d{constructor(e){this.mtuPP=e,this.mtuPP.renderer&&this.postProcessing()}postProcessing(){this.outlinePass||(this.outlinePass=new h(this.mtuPP.rtSize,this.mtuPP.mainScene,this.mtuPP.mainCamera)),this.mtuPP.effectComposer.addPass(this.outlinePass)}setOutlineData(e,t){this.outlinePass[e]="visibleEdgeColor"===e||"hiddenEdgeColor"===e?new n.Sf.Color(t):t}dispose(){this.outlinePass&&(this.outlinePass.dispose(),this.outlinePass=null)}addSelectedObject(e,t=!0){this.outlinePass&&e&&(this.outlinePass.selectedObjects||(this.outlinePass.selectedObjects=[]),t?this.isObjExist(e)||(e.userData.outline=!0,this.outlinePass.selectedObjects.push(e)):this.outlinePass.selectedObjects.map(((t,r)=>{t.uuid===e.uuid&&(e.userData.outline=!1,this.outlinePass.selectedObjects.splice(r,1))})))}clearAllOutlineObj(){this.outlinePass&&(this.outlinePass.selectedObjects=[])}isObjExist(e){if(!e||!this.outlinePass||!this.outlinePass.selectedObjects)return!1;let t=!1;return this.outlinePass.selectedObjects.forEach((r=>{e.uuid===r.uuid&&(t=!0)})),t}enablePass(e){this.outlinePass&&this.outlinePass.enabled!==e&&(this.outlinePass.enabled=e)}}const p=e=>e.userData.outline},7738:(e,t,r)=>{r.d(t,{ZP:()=>i,sH:()=>s});var n=r(8881),a=r(5247);class i{constructor(e){this.inited=()=>{this.runScene.exporter.gltf.options.addOption({type:"renderer",process:()=>{var{outputEncoding:e,toneMapping:t,toneMappingExposure:r}=this.runScene.assetsEx.renderer;return JSON.stringify({outputEncoding:e,toneMapping:t,toneMappingExposure:r})},parse:e=>{var t,r;e&&(({outputEncoding:e,toneMapping:t,toneMappingExposure:r}=JSON.parse(e)),this.setEncoding(3e3===e?"def":"srgb"),this.setExposure(r),this.setToneMapping(Object.keys(o)[t]))}})},this.setSize=(e,t)=>{var{width:r,height:n}=this.getDomSize();this.runScene.setSize(e||r,t||n),this.runScene.cb.renderEx.setSize.cb({width:r,height:n})},this.runScene=e,this.runScene.cb.resize.add("render-ex-resize",(()=>{this.setSize()})),e.cb.inited.add("render",this.inited)}setBackground(e){this.runScene.assetsEx.engineDom.style.background=e}create(e){let t=new n.WebGLRenderer({antialias:!0,alpha:!0,powerPreference:"high-performance",precision:"highp"});return t.domElement.style.position="absolute",t.setPixelRatio(window.devicePixelRatio),t.shadowMap.enabled=!0,t.shadowMap.type=n.PCFSoftShadowMap,t.physicallyCorrectLights=!0,t.localClippingEnabled=!0,e.appendChild(t.domElement),t}setEncoding(e){this.runScene.assetsEx.renderer.outputEncoding="def"===e?a.Z.LinearEncoding:a.Z.sRGBEncoding}setToneMapping(e){this.runScene.assetsEx.renderer.toneMapping=o[e]}setExposure(e){this.runScene.assetsEx.renderer.toneMappingExposure=e}getDomSize(){var{width:e,height:t}=this.runScene.assetsEx.get().engineDom.getBoundingClientRect();return{width:e,height:t}}}const s=(e,t)=>{t=(t||{}).removeDom,!(e.render=()=>{})!==t&&e.domElement.remove(),e.setAnimationLoop(null),e.dispose(),e.renderLists&&e.renderLists.dispose()},o={NoToneMapping:a.Z.NoToneMapping,LinearToneMapping:a.Z.LinearToneMapping,ReinhardToneMapping:a.Z.ReinhardToneMapping,CineonToneMapping:a.Z.CineonToneMapping,ACESFilmicToneMapping:a.Z.ACESFilmicToneMapping,CustomToneMapping:a.Z.CustomToneMapping}},2677:(e,t,r)=>{r.d(t,{Gc:()=>ha,al:()=>rt,ch:()=>h,Az:()=>et,Sf:()=>da,cQ:()=>u,ZP:()=>pa}),t={};var n=(r.r(t),r.d(t,{FBXLoader:()=>Yt}),r(3300)),a=r.n(n),i=r(6001),s=r(8881);class o{constructor(e){this.runScene=e}}var l=r(2353),c=r(5247),u=r(5317),h=r(6756);class d extends o{constructor(e){super(e),this.map={},this.clock=new s.Clock,this.tickIndex=void 0,this.playings=new Set,this.updates={},this.clean=()=>{this.reset()},e.cb.model.add.add("anima-parse",(({model:e})=>{this.parses(e)})),e.cb.model.remove.add("anima-parse",(({model:e})=>{this.onModelDelete(e)})),this.runScene.cb.clean.add("EngineHelper",this.clean)}onModelDelete(e){e.traverse((e=>{(0,h.withAnima)(e)&&e.animations.map((t=>{t.id&&(this.close(e,t.name),delete this.map[t.id])}))}))}parses(e){e.traverse((e=>this.parse(e)))}findId(e,t){for(const r of e.animations)if(r.name===t)return r.id}parse(e,t){if(0!==e.animations.length||t){const a=e.animations.length?e.animations:l.B.parse(t),o=new s.AnimationMixer(e);for(const t of a){var r=(0,i.getId)(),n=(t.id=r,o.clipAction(t));const a={finished:()=>{},loop:()=>{}};o.addEventListener("finished",(()=>a.finished())),o.addEventListener("loop",(()=>a.loop())),this.map[r]={mixer:o,action:n,model:e,time:0,runState:"close",clip:t,eventMap:a}}a.map((t=>{e.animations.find((e=>e.uuid===t.uuid))||e.animations.push(t)}))}}play(e,t,r){e=this.findId(e,t);const n=this.map[e];if(n&&!this.playings.has(n)){t=(0,u.mergeObject)({onLoop:()=>{},onProgress:()=>{},onFinished:()=>{},onClose:()=>{},onPause:()=>{},onResume:()=>{},onBeforeEnd:()=>{},loop:!1,lastFrame:!0,reset:!0},r);const{onProgress:a,onBeforeEnd:i,onLoop:s,onFinished:o,lastFrame:l,loop:h,reset:d}=t,{action:p,clip:f,eventMap:m}=(this.map[e].options=t,n);p.stop(),r=d?0:n.time,p.time=r,this.setPlayState(n,!0),d&&p.reset(),p.play();let g=!(n.runState="play");this.setUpdates(e,(()=>{var e=(0,u.getProgress)(p.time,f.duration,!0);99<=e&&!g&&(i(),g=!0),a(e)})),h?(p.loop=c.Z.LoopRepeat,m.loop=s):(l&&(p.clampWhenFinished=!0),p.loop=c.Z.LoopOnce,m.finished=()=>{this.setPlayState(n,!1),a(100),o()})}}pause(e,t){e=this.findId(e,t);const r=this.map[e];r&&this.playings.has(r)&&(this.updateTime(r),this.setPlayState(r,!1),r.options.onPause(),r.runState="pause")}resume(e,t){var r=this.findId(e,t);const n=this.map[r];n&&this.playings.has(n)&&(n.options.onResume(),this.play(e,t,null==(r=this.map[t])?void 0:r.options))}playAll(){this.pauseAll(),this.playings.clear(),Object.values(this.map).map((e=>{this.playings.add(e);const t=e.action;t.time=0,t.play()})),this.anima()}setValue(e){let t=this.clock.getDelta();Object.keys(this.map).map((r=>{const{mixer:n,action:a}=this.map[r];a.play(),a.time=e,n.update(t)}))}getDetal(){return this.clock.getDelta()}update(e){const t=e||this.getDetal();(0,i.mapObj)(this.updates,((e,r)=>r(t)))}anima(){let e=this.clock.getDelta();this.update(e),this.playings.forEach((t=>{t.mixer.update(e)})),this.tickIndex=window.requestAnimationFrame(this.anima.bind(this))}closeAnima(){window.cancelAnimationFrame(this.tickIndex)}resetItem(e){const{mixer:t,action:r}=e;r.reset(),r.stop(),t.time=0}pauseAll(){this.closeAnima(),this.playings.forEach((e=>this.resetItem(e))),this.playings.clear()}reset(){this.pauseAll(),this.map={},this.playings.clear(),this.closeAnima()}updateTime(e,t){e.time=t||e.action.time}setPlayState(e,t){t?(this.playings.add(e),1===this.playings.size&&this.anima()):(this.playings.delete(e),delete this.updates[e.clip.id],0===this.playings.size&&this.closeAnima())}getItem(e,t){return e=this.findId(e,t),this.map[e]}close(e,t,r){e=this.findId(e,t);const n=this.map[e];n&&this.playings.has(n)&&n.options&&((t=(0,u.mergeObject)({resetAction:!0},r).resetAction)&&n.action.reset(),this.setPlayState(n,!1),this.updateTime(n,0),n.options.onClose(),n.options=null,n.runState="pause")}setUpdates(e,t){this.updates[e]=t}fadeTo(e){var{lastModel:e,lastName:t,nextModel:r,nextName:n,duration:a}=e;e=this.findId(e,t);const i=this.map[e];i&&(t=this.findId(r,n),(e=this.map[t])&&i.action.crossFadeTo(e.action,a,!0))}resetTime(e,t){const r=this.getItem(e,t);r&&(r.action.time=0)}}var p=r(3693),f=r(699);class m{constructor(e){this.scene=null,this.camera=null,this.controls=null,this.renderer=null,this.engineDom=null,this.clean=()=>{var e=this.get().camera;this.runScene.controlsEx.reset(),this.runScene.cameraEx.reset(e)},this.disposeRender=e=>{e&&(e.render=()=>{},e.domElement.remove())},this.runScene=e,this.runScene.cb.clean.add("assets",this.clean)}initRender3(){const e=new p.lX;return e.setSize(this.engineDom.clientWidth,this.engineDom.clientHeight),e.domElement.style.position="absolute",e.domElement.style.top=String(0),e.domElement.className="css3dRenderer",this.engineDom.appendChild(e.domElement),this.runScene.cb.resize.add("render-3",(({width:t,height:r})=>{e.setSize(t,r)})),e}initRender2(){const e=new f.M;return e.setSize(this.engineDom.clientWidth,this.engineDom.clientHeight),e.domElement.style.position="absolute",e.domElement.classList.add("css2dRenderer"),e.domElement.style.top="0px",e.domElement.style.left="0px",this.engineDom.insertBefore(e.domElement,this.engineDom.childNodes[0]),this.runScene.cb.resize.add("render-2",(({width:t,height:r})=>{e.setSize(t,r)})),e}reset(){var e=this.get().camera;this.runScene.renderEx.setSize(),this.runScene.cameraEx.reset(e),this.runScene.controlsEx.reset()}dispose(){this.disposeRender(this.render2),this.disposeRender(this.render3)}setRender2(e){e?this.render2=this.initRender2():this.render2&&(this.disposeRender(this.render2),this.render2=null)}setRender3(e){e?this.render3=this.initRender3():this.render3&&(this.disposeRender(this.render3),this.render3=null)}init(e){var t=this.runScene.sceneEx.create(),r=this.runScene.cameraEx.pCam,n=this.runScene.renderEx.create(e),a=this.runScene.controlsEx.create(r,e),{render2:i,render3:s}=this.runScene.optionsEx.options;return this.camera=r,this.scene=t,this.renderer=n,this.controls=a,this.engineDom=e,this.runScene.renderEx.setSize(),this.setRender2(i),this.setRender3(s),{scene:t,camera:r,render:n,controls:a,engineDom:e}}get(){var{scene:e,renderer:t,controls:r,engineDom:n}=this;return{scene:e,camera:this.runScene.cameraEx.getCamera(),renderer:t,controls:r,engineDom:n}}}class g{constructor(){this.cbs=[],this.cb=e=>this.cbs.map((t=>{var r;return null==(r=t.fn)?void 0:r.call(t,e)})).filter((e=>e)),this.emit=this.cb}add(e,t){return this.cbs.push({fn:t,name:e})}on(e,t){return this.add(t||"custom_"+(0,i.getId)(),e)}get(e){var t=this.cbs.findIndex((t=>t.name===e));if(-1!==t)return{data:this.cbs[t],index:t}}reset(e,t){return!!(e=this.get(e))&&(e.data.fn=t,!0)}remove(e){this.reset(e,null)}delete(e){void 0!==(e=(this.get(e)||{}).index)&&this.cbs.splice(e,1)}}class v{constructor(){this.resize=new g,this.renderEx={setSize:new g},this.setSelectMaterial=new g,this.setScene=new g,this.reset=new g,this.render=new g,this.tick=new g,this.controlsChange=new g,this.baseLog=new g,this.inited=new g,this.texture={add:new g,remove:new g,set:new g,setAnima:new g},this.multipSelect={add:new g},this.model={setVector3:new g,multiSelect:{setEmpty:new g},change:new g,setSelect:new g,click:new g,add:new g,remove:new g,multipDrop:new g,focus:new g,unFocus:new g,changeName:new g,setOpen:new g,setMainStatue:new g,setVisible:new g,setParent:new g,setLayers:new g,setOutline:new g,clone:new g,dispose:new g},this.material={add:new g,remove:new g,dispose:new g,setName:new g},this.unique={model:{add:new g},material:{add:new g}},this.tranControls={changing:new g},this.undo={undo:new g,redo:new g,addUndos:new g,addRedus:new g,removeUndos:new g,undoByIndex:new g,reset:new g},this.scene={save:new g,saveNet:new g,setEnvStrength:new g},this.timeLine={setProgress:new g,playGroup:new g,setGroupMap:new g,reset:new g,closeGroup:new g},this.events={key:{down:new g,up:new g},mouse:{move:new g,down:new g,up:new g},pointer:{rightTrigger:new g,down:new g,up:new g,move:new g,trigger:new g},model:{addOptions:new g}},this.pp={glow:{setData:new g,setStatus:new g},outline:{setData:new g,setStatus:new g},ao:{setData:new g,setStatus:new g},vignette:{setData:new g,setStatus:new g}},this.load={getJSON:new g,progress:new g,complete:new g},this.exporter={gltf:{before:new g,complete:new g}},this.loaderer={gltf:{loadNode:new g,lazyLoadedTexture:new g,loaded:new g,modelLoaded:new g,progress:new g,getJSON:new g,getArrayBuffer:new g,complete:new g}},this.custom=new Proxy({},{get:(e,t)=>(e[t]||(e[t]=new g),e[t])}),this.tags={parseJSON:new g,clear:new g},this.snapshot={create:new g,set:new g,resetItem:new g,delete:new g,getLength:new g,getByType:new g},this.clean=new g,this.objects={sky:{setState:new g}},this.error=new g}}var b=r(4230),y=r(3151),x=r(3263);const w={autoRotate:!1,autoRotateSpeed:2,dampingFactor:.05,enableDamping:!1,enablePan:!0,enableRotate:!0,enableZoom:!0,maxAzimuthAngle:1/0,maxDistance:1/0,maxPolarAngle:Math.PI,minAzimuthAngle:-1/0,minDistance:0,minPolarAngle:0,panSpeed:1,rotateSpeed:1,screenSpacePanning:!0,zoomSpeed:1,target:{x:0,y:0,z:0}};class S{constructor(e){this.inited=()=>{const e=this.runScene.assetsEx.controls;e.addEventListener("change",this.change),this.runScene.exporter.gltf.options.addOption({type:"controls",process:()=>{var t=(0,u.getDiff)(w,e);return JSON.stringify(t)},parse:e=>{e&&this.parse(JSON.parse(e))}})},this.change=e=>{this.runScene.cb.controlsChange.cb(e)},this.parse=e=>{const t=this.runScene.assetsEx.controls;(0,i.mapObj)(e,((e,r)=>{void 0!==r&&(x.YD.is(r)?t[e].set(r.x,r.y,r.z):t[e]=r)})),t.update()},(this.runScene=e).cb.inited.add("controls",this.inited)}reset(){this.parse(w)}create(e,t){return new y.z(e,t)}static toJSON(e){return e.target}static setTarget(e,t,r){var{x:n,y:a,z:i}=t,{x:r,y:s,z:o}=r||e.target;this.setTargetData.anima&&(this.setTargetData.anima.kill(),this.setTargetData.anima=null,this.setTarget(e,t,this.setTargetData.nowData)),this.setTargetData.anima=(0,u.anima)({x:r,y:s,z:o},{x:n,y:a,z:i},.5,(t=>{var{x:r,y:n,z:a}=t;e.target.set(r,n,a),e.update(),this.setTargetData.nowData=t}),(()=>{this.setTargetData.anima=null}))}}S.setTargetData={anima:null,nowData:null};var M=r(1794);class T{constructor(e){this.alt=!1,this.ctrl=!1,this.shift=!1,this.unExec=new M.Z,this.specialKeyDebounce=()=>{this.ctrl=!1,this.shift=!1,this.alt=!1},this.fns={down:{s:e=>{this.ctrl&&(e.preventDefault(),this.allFn.s_saveScene())},d:e=>{this.ctrl&&(e.preventDefault(),this.allFn.d_copyModel())},alt:()=>{this.alt=!0},control:()=>{this.ctrl=!0},ctrl:()=>{this.ctrl=!0},shift:()=>{this.shift=!0},f11:()=>{this.events.runScene.cb.resize.cb(this.events.runScene.renderEx.getDomSize())},w:e=>{e.preventDefault(),e.stopPropagation(),this.events.runScene.helperEx.transContro.changeMode("position")},e:()=>{this.events.runScene.helperEx.transContro.changeMode("rotation")},f:()=>{this.allFn.f_focusModel()},delete:()=>{this.events.runScene.helperEx.unfocus();var e=this.events.runScene.multipSelector.getSelectedList("value");this.events.runScene.sceneEx.remove(this.events.runScene.modelEx.select||e),e&&this.events.runScene.multipSelector.delete()},z:e=>{this.ctrl&&this.allFn.z_undo(e)},y:e=>{this.ctrl&&this.allFn.y_redo(e)},r:e=>{this.events.runScene.helperEx.transContro.changeMode("scale"),e.preventDefault()}},up:{s:()=>{this.ctrl},alt:()=>{this.alt=!1},control:()=>{this.ctrl=!1},ctrl:()=>{this.ctrl=!1},shift:()=>{this.shift=!1}}},this.allFn={s_saveScene:()=>function(e,t,r,n){return new(r=r||Promise)((function(t,a){function i(e){try{o(n.next(e))}catch(e){a(e)}}function s(e){try{o(n.throw(e))}catch(e){a(e)}}function o(e){var n;e.done?t(e.value):((n=e.value)instanceof r?n:new r((function(e){e(n)}))).then(i,s)}o((n=n.apply(e,[])).next())}))}(this,0,void 0,(function*(){this.events.runScene.optionsEx.log("正在保存","base","info"),this.events.runScene.cb.scene.saveNet.cb("")})),d_copyModel:()=>{var e,t=this.events.runScene.modelEx.select;t&&(this.events.runScene.modelEx.selectNull(),(e=this.events.runScene.modelEx.clone(t,!1))&&this.events.runScene.modelEx.add(e,t.parent,{isClone:!0,select:!0}))},f_focusModel:()=>{var e=this.events.runScene.modelEx.select;e&&this.events.runScene.modelEx.focus(e)},z_undo:e=>{this.events.runScene.undoEx.undo()},y_redo:e=>{this.events.runScene.undoEx.redo()}},this.events=e}init(e){"running"!==this.events.runScene.optionsEx.options.mode&&(this.events.addEvent({dom:document,name:"keydown",fn:this.keyDown.bind(this)}),this.events.addEvent({dom:document,name:"keyup",fn:this.keyUp.bind(this)}),this.events.runScene.cb.model.setSelect.add("reset-unexec",(()=>{this.unExec.delete("delete")})),this.events.addEvent({dom:window,name:"blur",fn:this.specialKeyDebounce}))}keyDown(e){var t,r;"INPUT"!==document.activeElement.nodeName&&(r=e.key.toLowerCase(),this.events.runScene.cb.events.key.down.cb({key:r,event:e}),this.unExec.get(r)||null!=(r=(t=this.fns.down)[r])&&r.call(t,e))}keyUp(e){var t,r;"INPUT"!==document.activeElement.nodeName&&(r=e.key.toLowerCase(),this.events.runScene.cb.events.key.up.cb({key:r,event:e}),null!=(r=(t=this.fns.up)[r])&&r.call(t,e))}}var _=r(3801),E=r(6272);class D{constructor(e){this.downPosition={0:{x:0,y:0},2:{x:0,y:0}},this.enableUp=!0,this.isMove=!1,this.moveEvent=new MouseEvent("move"),this.down=e=>{0!==e.button&&2!==e.button||(this.downPosition[e.button]={x:e.offsetX,y:e.offsetY}),this.isMove=!0},this.up=e=>{var t,r,n,a;this.isMove=!1,1===e.button||null!=(t=this.events.runScene.helperEx.transContro)&&t.isDraggingChange||(t=e.offsetX,r=e.offsetY,({x:n,y:a}=this.downPosition[e.button]),(0,E.nx)(t,n,10)&&(0,E.nx)(r,a,10)&&(0===e.button&&this.trigger(e),2===e.button&&(this.events.runScene.modelEx.select||this.trigger(e),this.events.runScene.cb.events.pointer.rightTrigger.cb(e))))},this.selectable=!0,this.events=e}getEventLocal(e,t){var{top:e,left:r,width:n,height:a}=e.getBoundingClientRect();return{x:(t.pageX-r)/n*2-1,y:-(t.pageY-e)/a*2+1}}init(e){var t=this.events.runScene.optionsEx.options.event.base;let r=e;"dom"===t?r=e:"canvas"===t?r=this.events.runScene.assetsEx.renderer.domElement:"window"===t&&(r=window),this.events.addEvent({dom:r,name:"pointerdown",fn:this.down.bind(this)}),this.events.addEvent({dom:r,name:"pointerup",fn:this.up.bind(this)}),this.events.addEvent({dom:r,name:"pointerdown",fn:this.events.runScene.cb.events.pointer.down.cb}),this.events.addEvent({dom:r,name:"pointerup",fn:this.events.runScene.cb.events.pointer.up.cb}),this.events.addEvent({dom:r,name:"pointermove",fn:e=>{this.moveEvent=e,this.events.runScene.cb.events.pointer.move.cb(e)}}),this.events.addEvent({dom:r,name:"mousemove",fn:this.events.runScene.cb.events.mouse.move.cb}),this.events.addEvent({dom:r,name:"mousedown",fn:this.events.runScene.cb.events.mouse.down.cb}),this.events.addEvent({dom:r,name:"mouseup",fn:this.events.runScene.cb.events.mouse.up.cb})}getTriggerModels(e,t){const r=new s.Raycaster,n=new s.Vector2;var{engineDom:a,camera:i,scene:o}=this.events.runScene.assetsEx.get(),{x:a,y:e}=this.getEventLocal(a,e);n.x=a,n.y=e,r.setFromCamera(n,i),a=(t||o.children).filter((e=>{if((!this.events.runScene.helperEx.isHelper(e)||e.userData.id)&&!e.userData.unClick)return e}));const l=r.intersectObjects(a,!0);return this.events.runScene.cb.events.pointer.trigger.cb(l),l.map((e=>e.object))}removeHideOrLockModel(e){return e.find((e=>this.events.runScene.modelEx.deepIsVisible(e)&&!_.zf.isLock(e,!0)&&h.selectableModel.is(e)))}trigger(e){let t=this.removeHideOrLockModel(this.getTriggerModels(e));if(this.selectable){if(!t)return this.events.runScene.multipSelector.setEmpty(),void this.events.runScene.modelEx.selectNull();if(this.events.runScene.helperEx.isHelper(t)&&(e=this.events.runScene.uniqueEx.getId(t),t=this.events.runScene.uniqueEx.model.get(e)),!this.enableUp){if(t===this.events.runScene.helperEx.transContro.multipObj)return;this.enableUp=!0}if(this.events.runScene.cb.model.click.cb(t),this.events.key.ctrl)return this.enableUp=!1,this.events.runScene.multipSelector.add(t);if(this.events.key.shift){const e=t.parent;return e?void e.children.map((e=>{this.events.runScene.multipSelector.add(e)})):void 0}this.events.runScene.modelEx.setSelectByModel(t),this.events.runScene.lightEx.isLight(t)&&this.events.runScene.lightEx.setSelect(t)}}}var k=r(272),O=r(3729);class P{constructor(e){this.options=new M.Z,this.enable=!0,this.lockData=new M.Z,this.foucedModel=new k.Z,this.addOptions=e=>{var{name:e,map:t}=e;this.options.set(e,t)},this.hoverModel=new k.Z,this.map={click:new M.Z,hover:new M.Z,mouseLeave:new M.Z},this.onClick=e=>{var t,r;this.enable&&(t=(0,O.Ki)(e))&&(r=this.map.click.get(t))&&this.triggerEvent({model:e,method:"click",saved:r,id:t})},this.onHover=e=>{var t,r=(0,O.Ki)(e);!r||(t=this.map.hover.get(r))&&(this.onFouce(r),this.triggerEvent({model:e,saved:t,method:"hover",id:r}))},this.onMouseLeave=()=>{this.events.runScene.modelEx.getById(this.foucedModel.toArray()).map((e=>{var t,r=(0,O.Ki)(e);!r||(t=this.map.mouseLeave.get(r))&&(this.foucedModel.delete(r),this.triggerEvent({model:e,method:"mouseLeave",saved:t,id:r}))}))},this.events=e}setState(e){this.enable=e}init(){this.events.runScene.cb.model.click.add("event-model",this.onClick),this.events.runScene.cb.events.model.addOptions.add("event-model",this.addOptions),this.events.runScene.cb.unique.model.add.add("event-model",(({model:e})=>{var t;null!=(t=e.userData.events)&&t.map((t=>{var[t,r,n]=t.split("-");this.set({model:e,method:t,child:n,type:r})}))})),this.events.runScene.cb.events.pointer.move.add("get-hover-from-models",(0,i.fnDebounce)((e=>{if(0!==this.hoverModel.size&&this.enable){const i=new s.Raycaster,o=new s.Vector2,{engineDom:l,camera:c}=this.events.runScene.assetsEx.get();var{top:t,left:r,width:n,height:a}=l.getBoundingClientRect(),r=e.pageX-r;e=e.pageY-t,o.x=r/n*2-1,o.y=-e/a*2+1,i.setFromCamera(o,c);const u=i.intersectObjects(this.hoverModel.toArray(),!0);0===u.length?this.onMouseLeave():(t=u.map((e=>e.object)),this.onHover(t[0]))}}),10))}del(e){const{model:t,type:r,child:n,method:a}=e;var i=(0,O.Ki)(t);if(i){let s=this.map[a].get(i);if(s){let i=s.get(r);i&&("hover"===a&&this.hoverModel.delete(this.hoverModel.find((e=>(0,O.Ki)(e)===(0,O.Ki)(t)))),i.remove(n),this.bindDataForModel(e,!1))}}}set(e){const{model:t,type:r,child:n,method:a}=e;var i=(0,O.Ki)(t);if(i){let s=this.map[a],o=s.get(i),l=(o||(o=new M.Z,s.set(i,o)),o.get(r));l||(l=new k.Z,o.set(r,l)),"hover"!==a||this.hoverModel.find((e=>(0,O.Ki)(e)===(0,O.Ki)(t)))||this.hoverModel.add(t),l.add(n),this.bindDataForModel(e)}}bindDataForModel(e,t=!0){const{model:r,type:n,child:a,method:i}=e;let s=r.userData.events;s||(r.userData.events=s=[]);const o=i+"-"+n+"-"+a;-1===(e=s.findIndex((e=>e===o)))?t&&s.push(o):t||s.splice(e,1)}hasEvent(e){const{model:t,method:r,type:n,child:a}=e,i=[r,n,a].join("-");return!!t.userData.events&&-1!==t.userData.events.findIndex((e=>e===i))}validCanBeTrigger(e,t){return null==(e=this.lockData.get(e))||!e.has(t)}triggerEvent(e){const{model:t,id:r,saved:n}=e;h.closeModelEvent.is(t)||n.map(((e,n)=>{if(this.validCanBeTrigger(r,e)){const a=this.options.get(e);a&&(this.setLock({id:r,type:e,isAdd:!0}),a.parse({model:t,childs:n.toArray()}).then((()=>{this.setLock({id:r,type:e,isAdd:!1})})))}}))}setLock(e){var{id:e,type:t,isAdd:r}=e;let n=this.lockData.get(e);n||(n=new k.Z,this.lockData.set(e,n)),r?n.add(t):n.delete(t)}onFouce(e){this.map.mouseLeave.get(e)&&this.foucedModel.add(e)}}function A(){var e=0,t=document.createElement("div");function r(e){return t.appendChild(e.dom),e}function n(r){for(var n=0;n<t.children.length;n++)t.children[n].style.display=n===r?"block":"none";e=r}t.style.cssText="position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000",t.addEventListener("click",(function(r){r.preventDefault(),n(++e%t.children.length)}),!1);var a,i=(performance||Date).now(),s=i,o=0,l=r(new A.Panel("FPS","#0ff","#002")),c=r(new A.Panel("MS","#0f0","#020"));return self.performance&&self.performance.memory&&(a=r(new A.Panel("MB","#f08","#201"))),n(0),{REVISION:16,dom:t,addPanel:r,showPanel:n,begin:function(){i=(performance||Date).now()},end:function(){o++;var e,t=(performance||Date).now();return c.update(t-i,200),s+1e3<=t&&(l.update(1e3*o/(t-s),100),s=t,o=0,a&&(e=performance.memory,a.update(e.usedJSHeapSize/1048576,e.jsHeapSizeLimit/1048576))),t},update:function(){i=this.end()},domElement:t,setMode:n}}A.Panel=function(e,t,r){var n=1/0,a=0,i=Math.round,s=i(window.devicePixelRatio||1),o=80*s,l=48*s,c=3*s,u=2*s,h=3*s,d=15*s,p=74*s,f=30*s,m=document.createElement("canvas"),g=(m.width=o,m.height=l,m.style.cssText="width:80px;height:48px",m.getContext("2d"));return g.font="bold "+9*s+"px Helvetica,Arial,sans-serif",g.textBaseline="top",g.fillStyle=r,g.fillRect(0,0,o,l),g.fillStyle=t,g.fillText(e,c,u),g.fillRect(h,d,p,f),g.fillStyle=r,g.globalAlpha=.9,g.fillRect(h,d,p,f),{dom:m,update:function(l,v){n=Math.min(n,l),a=Math.max(a,l),g.fillStyle=r,g.globalAlpha=1,g.fillRect(0,0,o,d),g.fillStyle=t,g.fillText(i(l)+" "+e+" ("+i(n)+"-"+i(a)+")",c,u),g.drawImage(m,h+s,d,p-s,f,h,d,p-s,f),g.fillRect(h+p-s,d,s,f),g.fillStyle=r,g.globalAlpha=.9,g.fillRect(h+p-s,d,s,i((1-l/v)*f))}}};const C=A;class R{constructor(e,t){this.options={msg:{show:!1,level:"base"},run:!0,decodePath:"./draco/",showFps:!1,loadInterval:2e3,mode:"running",hideLocal:!1,instanceClone:!0,render2:!1,render3:!1,coverSameId:!1,renderConfig:{mode:"tick",frame:-1,scriptFrame:-1,matrixAutoUpdate:!1,stop:!1,triggerEvent:!0},event:{base:"dom"},texture:{load:!0,lazyLoad:{open:!1,intervalTime:16.6},quality:1},pp:{open:!0,glow:{open:!1}}},this.exporterOptions={compressTexture:!1,notMaterial:!1,outTime:(0,u.getTime)(7)},this.sceneOptions={loaded:!1},this.setLoadInterval=(()=>{let e=null;return t=>{const{inputInterval:r,cb:n}=t;e&&clearTimeout(e),e=setTimeout((()=>{n(),e=null,clearTimeout(e)}),r)}})(),this.runScene=e,this.options=(0,u.deepMergeObject)(this.options,t||{})}init(e){this.options.showFps&&(this.addFps(e),this.runScene.cb.render.add("optionx-ex-render",this.render.bind(this)))}addFps(e){this.stats=C(),this.stats.showPanel(0),e.appendChild(this.stats.dom)}render(){var e;null!=(e=this.stats)&&e.update()}log(e,t="detail",r="success"){var n;null!=(n=null==(n=this.options)?void 0:n.msg)&&n.show&&("base"===this.options.msg.level&&"base"===t&&this.runScene.cb.baseLog.cb({msg:e,type:r}),console.log(e))}}const L=e=>e.optionsEx.options;function I(e){return(I="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})(e)}function B(){B=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n=(p="function"==typeof Symbol?Symbol:{}).iterator||"@@iterator",a=p.asyncIterator||"@@asyncIterator",i=p.toStringTag||"@@toStringTag";function s(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(t){s=function(e,t,r){return e[t]=r}}function o(e,t,r,n){var a,i,s,o;return t=t&&t.prototype instanceof u?t:u,t=Object.create(t.prototype),n=new x(n||[]),t._invoke=(a=e,i=r,s=n,o="suspendedStart",function(e,t){if("executing"===o)throw new Error("Generator is already running");if("completed"===o){if("throw"===e)throw t;return{value:void 0,done:!0}}for(s.method=e,s.arg=t;;){var r=s.delegate;if(r&&(r=function e(t,r){var n=t.iterator[r.method];if(void 0===n){if(r.delegate=null,"throw"===r.method){if(t.iterator.return&&(r.method="return",r.arg=void 0,e(t,r),"throw"===r.method))return c;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return c}return"throw"===(n=l(n,t.iterator,r.arg)).type?(r.method="throw",r.arg=n.arg,r.delegate=null,c):(n=n.arg)?n.done?(r[t.resultName]=n.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=void 0),r.delegate=null,c):n:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,c)}(r,s),r)){if(r===c)continue;return r}if("next"===s.method)s.sent=s._sent=s.arg;else if("throw"===s.method){if("suspendedStart"===o)throw o="completed",s.arg;s.dispatchException(s.arg)}else"return"===s.method&&s.abrupt("return",s.arg);if(o="executing","normal"===(r=l(a,i,s)).type){if(o=s.done?"completed":"suspendedYield",r.arg===c)continue;return{value:r.arg,done:s.done}}"throw"===r.type&&(o="completed",s.method="throw",s.arg=r.arg)}}),t}function l(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=o;var c={};function u(){}function h(){}function d(){}var p,f,m=(s(p={},n,(function(){return this})),(f=(f=Object.getPrototypeOf)&&f(f(w([]))))&&f!==t&&r.call(f,n)&&(p=f),d.prototype=u.prototype=Object.create(p));function g(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function v(e,t){var n;this._invoke=function(a,i){function s(){return new t((function(n,s){!function n(a,i,s,o){var c;if("throw"!==(a=l(e[a],e,i)).type)return(i=(c=a.arg).value)&&"object"==I(i)&&r.call(i,"__await")?t.resolve(i.__await).then((function(e){n("next",e,s,o)}),(function(e){n("throw",e,s,o)})):t.resolve(i).then((function(e){c.value=e,s(c)}),(function(e){return n("throw",e,s,o)}));o(a.arg)}(a,i,n,s)}))}return n=n?n.then(s,s):s()}}function b(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function y(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function x(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(b,this),this.reset(!0)}function w(e){if(e){var t,a=e[n];if(a)return a.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return t=-1,(a=function n(){for(;++t<e.length;)if(r.call(e,t))return n.value=e[t],n.done=!1,n;return n.value=void 0,n.done=!0,n}).next=a}return{next:S}}function S(){return{value:void 0,done:!0}}return s(m,"constructor",h.prototype=d),s(d,"constructor",h),h.displayName=s(d,i,"GeneratorFunction"),e.isGeneratorFunction=function(e){return!!(e="function"==typeof e&&e.constructor)&&(e===h||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,d):(e.__proto__=d,s(e,i,"GeneratorFunction")),e.prototype=Object.create(m),e},e.awrap=function(e){return{__await:e}},g(v.prototype),s(v.prototype,a,(function(){return this})),e.AsyncIterator=v,e.async=function(t,r,n,a,i){void 0===i&&(i=Promise);var s=new v(o(t,r,n,a),i);return e.isGeneratorFunction(r)?s:s.next().then((function(e){return e.done?e.value:s.next()}))},g(m),s(m,i,"Generator"),s(m,n,(function(){return this})),s(m,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t,r=[];for(t in e)r.push(t);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=w,x.prototype={constructor:x,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(y),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(r,n){return s.type="throw",s.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var a=this.tryEntries.length-1;0<=a;--a){var i=this.tryEntries[a],s=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var o=r.call(i,"catchLoc"),l=r.call(i,"finallyLoc");if(o&&l){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(o){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;0<=n;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var i=a;break}}var s=(i=i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc?null:i)?i.completion:{};return s.type=e,s.arg=t,i?(this.method="next",this.next=i.finallyLoc,c):this.complete(s)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),c},finish:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),y(r),c}},catch:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var r,n,a=this.tryEntries[t];if(a.tryLoc===e)return"throw"===(r=a.completion).type&&(n=r.arg,y(a)),n}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:w(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),c}},e}function j(e,t,r,n,a,i,s){try{var o=e[i](s),l=o.value}catch(e){return void r(e)}o.done?t(l):Promise.resolve(l).then(n,a)}function U(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function N(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function z(e,t,r){t&&N(e.prototype,t),r&&N(e,r),Object.defineProperty(e,"prototype",{writable:!1})}var F={POSITION:["byte","byte normalized","unsigned byte","unsigned byte normalized","short","short normalized","unsigned short","unsigned short normalized"],NORMAL:["byte normalized","short normalized"],TANGENT:["byte normalized","short normalized"],TEXCOORD:["byte","byte normalized","unsigned byte","short","short normalized","unsigned short"]},V=function(){function e(){U(this,e),this.pluginCallbacks=[],this.register((function(e){return new he(e)})),this.register((function(e){return new de(e)})),this.register((function(e){return new me(e)})),this.register((function(e){return new ge(e)})),this.register((function(e){return new ve(e)})),this.register((function(e){return new be(e)})),this.register((function(e){return new pe(e)})),this.register((function(e){return new fe(e)})),this.register((function(e){return new ye(e)})),this.register((function(e){return new xe(e)}))}return z(e,[{key:"register",value:function(e){return-1===this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.push(e),this}},{key:"unregister",value:function(e){return-1!==this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}},{key:"parse",value:function(e,t,r,n){for(var a=new ue,i=[],s=0,o=this.pluginCallbacks.length;s<o;s++)i.push(this.pluginCallbacks[s](a));a.setPlugins(i),a.write(e,t,n).catch(r)}},{key:"parseAsync",value:function(e,t){var r=this;return new Promise((function(n,a){r.parse(e,n,a,t)}))}}]),e}(),G=5120,H=5121,W=5122,K=5123,q=(n=9728,9729),Z=9984,X=9985,Q=9986,Y=9987,J=33071,$=33648,ee=10497,te="KHR_mesh_quantization",re={},ne=(re[s.NearestFilter]=n,re[s.NearestMipmapNearestFilter]=Z,re[s.NearestMipmapLinearFilter]=Q,re[s.LinearFilter]=q,re[s.LinearMipmapNearestFilter]=X,re[s.LinearMipmapLinearFilter]=Y,re[s.ClampToEdgeWrapping]=J,re[s.RepeatWrapping]=ee,re[s.MirroredRepeatWrapping]=$,{scale:"scale",position:"translation",quaternion:"rotation",morphTargetInfluences:"weights"}),ae=new s.Color;function ie(e,t){return e.length===t.length&&e.every((function(e,r){return e===t[r]}))}function se(e){return 4*Math.ceil(e/4)}function oe(e,t){var r=1<arguments.length&&void 0!==t?t:0,n=se(e.byteLength);if(n===e.byteLength)return e;var a=new Uint8Array(n);if(a.set(new Uint8Array(e)),0!==r)for(var i=e.byteLength;i<n;i++)a[i]=r;return a.buffer}function le(){return"undefined"==typeof document&&"undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas")}function ce(e,t){return void 0!==e.toBlob?new Promise((function(r){return e.toBlob(r,t)})):("image/jpeg"===t?r=.92:"image/webp"===t&&(r=.8),e.convertToBlob({type:t,quality:r}));var r}var ue=function(){function e(){U(this,e),this.plugins=[],this.options={},this.pending=[],this.buffers=[],this.byteOffset=0,this.buffers=[],this.nodeMap=new Map,this.skins=[],this.extensionsUsed={},this.extensionsRequired={},this.uids=new Map,this.uid=0,this.json={asset:{version:"2.0",generator:"THREE.GLTFExporter"}},this.cache={meshes:new Map,attributes:new Map,attributesNormalized:new Map,materials:new Map,textures:new Map,images:new Map}}var t,r;return z(e,[{key:"setPlugins",value:function(e){this.plugins=e}},{key:"write",value:(t=B().mark((function e(t,r){var n,a,i,s,o,l,c,u,h,d=arguments;return B().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=2<d.length&&void 0!==d[2]?d[2]:{},this.options=Object.assign({binary:!1,trs:!1,onlyVisible:!0,maxTextureSize:1/0,animations:[],includeCustomExtensions:!1},n),0<this.options.animations.length&&(this.options.trs=!0),this.processInput(t),e.next=6,Promise.all(this.pending);case 6:return i=(a=this).buffers,s=a.json,n=a.options,e.next=12,a.options.myOptions.helper.done(s);case 12:l=a.extensionsUsed,c=a.extensionsRequired,o=new Blob(i,{type:"application/octet-stream"}),l=Object.keys(l),c=Object.keys(c),0<l.length&&(s.extensionsUsed=l),0<c.length&&(s.extensionsRequired=c),s.buffers&&0<s.buffers.length&&(s.buffers[0].byteLength=o.size),!0===n.binary?((u=new FileReader).readAsArrayBuffer(o),u.onloadend=function(){var e=oe(u.result),t=new DataView(new ArrayBuffer(8)),n=(t.setUint32(0,e.byteLength,!0),t.setUint32(4,5130562,!0),oe((n=JSON.stringify(s),(new TextEncoder).encode(n).buffer),32)),a=new DataView(new ArrayBuffer(8)),i=(a.setUint32(0,n.byteLength,!0),a.setUint32(4,1313821514,!0),new ArrayBuffer(12)),o=((l=new DataView(i)).setUint32(0,1179937895,!0),l.setUint32(4,2,!0),12+a.byteLength+n.byteLength+t.byteLength+e.byteLength),l=(l.setUint32(8,o,!0),new Blob([i,a,n,t,e],{type:"application/octet-stream"})),c=new FileReader;c.readAsArrayBuffer(l),c.onloadend=function(){r(c.result)}}):s.buffers&&0<s.buffers.length?((h=new FileReader).readAsDataURL(o),h.onloadend=function(){var e=h.result;s.buffers[0].uri=e,r(s)}):r(s);case 21:case"end":return e.stop()}}),e,this)})),r=function(){var e=this,r=arguments;return new Promise((function(n,a){var i=t.apply(e,r);function s(e){j(i,n,a,s,o,"next",e)}function o(e){j(i,n,a,s,o,"throw",e)}s(void 0)}))},function(e,t){return r.apply(this,arguments)})},{key:"serializeUserData",value:function(e,t){if(0!==Object.keys(e.userData).length){var r=this.options,n=this.extensionsUsed;try{var a=JSON.parse(JSON.stringify(e.userData));if(r.includeCustomExtensions&&a.gltfExtensions){for(var i in void 0===t.extensions&&(t.extensions={}),a.gltfExtensions)t.extensions[i]=a.gltfExtensions[i],n[i]=!0;delete a.gltfExtensions}0<Object.keys(a).length&&(t.extras=a)}catch(t){console.warn("THREE.GLTFExporter: userData of '"+e.name+"' won't be serialized because of JSON.stringify error - "+t.message)}}}},{key:"getUID",value:function(e){var t,r=1<arguments.length&&void 0!==arguments[1]&&arguments[1];return!1===this.uids.has(e)&&((t=new Map).set(!0,this.uid++),t.set(!1,this.uid++),this.uids.set(e,t)),this.uids.get(e).get(r)}},{key:"isNormalizedNormalAttribute",value:function(e){if(this.cache.attributesNormalized.has(e))return!1;for(var t=new s.Vector3,r=0,n=e.count;r<n;r++)if(5e-4<Math.abs(t.fromBufferAttribute(e,r).length()-1))return!1;return!0}},{key:"createNormalizedNormalAttribute",value:function(e){var t=this.cache;if(t.attributesNormalized.has(e))return t.attributesNormalized.get(e);for(var r=e.clone(),n=new s.Vector3,a=0,i=r.count;a<i;a++)n.fromBufferAttribute(r,a),0===n.x&&0===n.y&&0===n.z?n.setX(1):n.normalize(),r.setXYZ(a,n.x,n.y,n.z);return t.attributesNormalized.set(e,r),r}},{key:"applyTextureTransform",value:function(e,t){var r=!1,n={};0===t.offset.x&&0===t.offset.y||(n.offset=t.offset.toArray(),r=!0),0!==t.rotation&&(n.rotation=t.rotation,r=!0),1===t.repeat.x&&1===t.repeat.y||(n.scale=t.repeat.toArray(),r=!0),r&&(e.extensions=e.extensions||{},e.extensions.KHR_texture_transform=n,this.extensionsUsed.KHR_texture_transform=!0)}},{key:"buildMetalRoughTexture",value:function(e,t){if(e===t)return e;function r(e){return e.encoding===s.sRGBEncoding?function(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}:function(e){return e}}console.warn("THREE.GLTFExporter: Merged metalnessMap and roughnessMap textures.");var n=e?e.image:null,a=t?t.image:null,i=Math.max(n?n.width:0,a?a.width:0),o=Math.max(n?n.height:0,a?a.height:0),l=le(),c=(l.width=i,l.height=o,l.getContext("2d")),u=(c.fillStyle="#00ffff",c.fillRect(0,0,i,o),c.getImageData(0,0,i,o));if(n){c.drawImage(n,0,0,i,o);for(var h=r(e),d=c.getImageData(0,0,i,o).data,p=2;p<d.length;p+=4)u.data[p]=256*h(d[p]/256)}if(a){c.drawImage(a,0,0,i,o);for(var f=r(t),m=c.getImageData(0,0,i,o).data,g=1;g<m.length;g+=4)u.data[g]=256*f(m[g]/256)}return c.putImageData(u,0,0),(n=(e||t).clone()).source=new s.Source(l),n.encoding=s.LinearEncoding,n}},{key:"processBuffer",value:function(e){var t=this.json,r=this.buffers;return t.buffers||(t.buffers=[{byteLength:0}]),r.push(e),0}},{key:"processBufferView",value:function(e,t,r,n,a){var i,o=this.json;switch(o.bufferViews||(o.bufferViews=[]),t){case G:case H:i=1;break;case W:case K:i=2;break;default:i=4}for(var l=se(n*e.itemSize*i),c=new DataView(new ArrayBuffer(l)),u=0,h=r;h<r+n;h++)for(var d=0;d<e.itemSize;d++){var p=void 0;4<e.itemSize?p=e.array[h*e.itemSize+d]:(0===d?p=e.getX(h):1===d?p=e.getY(h):2===d?p=e.getZ(h):3===d&&(p=e.getW(h)),!0===e.normalized&&(p=s.MathUtils.normalize(p,e.array))),5126===t?c.setFloat32(u,p,!0):5124===t?c.setInt32(u,p,!0):5125===t?c.setUint32(u,p,!0):t===W?c.setInt16(u,p,!0):t===K?c.setUint16(u,p,!0):t===G?c.setInt8(u,p):t===H&&c.setUint8(u,p),u+=i}var f={buffer:this.processBuffer(c.buffer),byteOffset:this.byteOffset,byteLength:l};return void 0!==a&&(f.target=a),34962===a&&(f.byteStride=e.itemSize*i),this.byteOffset+=l,o.bufferViews.push(f),{id:o.bufferViews.length-1,byteLength:0}}},{key:"processBufferViewImage",value:function(e){var t=this,r=t.json;return r.bufferViews||(r.bufferViews=[]),new Promise((function(n){var a=new FileReader;a.readAsArrayBuffer(e),a.onloadend=function(){var e=oe(a.result),i={buffer:t.processBuffer(e),byteOffset:t.byteOffset,byteLength:e.byteLength};t.byteOffset+=e.byteLength,n(r.bufferViews.push(i)-1)}}))}},{key:"processAccessor",value:function(e,t,r,n){var a,i=this.json;if(e.array.constructor===Float32Array)a=5126;else if(e.array.constructor===Int32Array)a=5124;else if(e.array.constructor===Uint32Array)a=5125;else if(e.array.constructor===Int16Array)a=W;else if(e.array.constructor===Uint16Array)a=K;else if(e.array.constructor===Int8Array)a=G;else{if(e.array.constructor!==Uint8Array)throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type.");a=H}if(0===(n=void 0===n?e.count:n))return null;var o,l=function(e,t,r){for(var n={min:new Array(e.itemSize).fill(Number.POSITIVE_INFINITY),max:new Array(e.itemSize).fill(Number.NEGATIVE_INFINITY)},a=t;a<t+r;a++)for(var i=0;i<e.itemSize;i++){var o=void 0;4<e.itemSize?o=e.array[a*e.itemSize+i]:(0===i?o=e.getX(a):1===i?o=e.getY(a):2===i?o=e.getZ(a):3===i&&(o=e.getW(a)),!0===e.normalized&&(o=s.MathUtils.normalize(o,e.array))),n.min[i]=Math.min(n.min[i],o),n.max[i]=Math.max(n.max[i],o)}return n}(e,r=void 0===r?0:r,n);return r={bufferView:(void 0!==t&&(o=e===t.index?34963:34962),t=this.processBufferView(e,a,r,n,o)).id,byteOffset:t.byteOffset,componentType:a,count:n,max:l.max,min:l.min,type:{1:"SCALAR",2:"VEC2",3:"VEC3",4:"VEC4",16:"MAT4"}[e.itemSize]},!0===e.normalized&&(r.normalized=!0),i.accessors||(i.accessors=[]),i.accessors.push(r)-1}},{key:"processImage",value:function(e,t,r,n){var a=4<arguments.length&&void 0!==arguments[4]?arguments[4]:"image/png";if(null===e)throw new Error("THREE.GLTFExporter: No valid image data found. Unable to process texture.");var i=this,o=i.cache,l=i.json,c=i.options,u=i.pending;if(void 0!==(o.images.has(e)||o.images.set(e,{}),o=o.images.get(e))[r=a+":flipY/"+r.toString()])return o[r];l.images||(l.images=[]);var h={mimeType:a},d=le(),p=(d.width=Math.min(e.width,c.maxTextureSize),d.height=Math.min(e.height,c.maxTextureSize),d.getContext("2d"));if(void 0!==e.data){t!==s.RGBAFormat&&console.error("GLTFExporter: Only RGBAFormat is supported."),(e.width>c.maxTextureSize||e.height>c.maxTextureSize)&&console.warn("GLTFExporter: Image size is bigger than maxTextureSize",e);for(var f=new Uint8ClampedArray(e.height*e.width*4),m=0;m<f.length;m+=4)f[m+0]=e.data[m+0],f[m+1]=e.data[m+1],f[m+2]=e.data[m+2],f[m+3]=e.data[m+3];p.putImageData(new ImageData(f,e.width,e.height),0,0)}else p.drawImage(e,0,0,d.width,d.height);return!0===c.binary?(null==n||null==(t=n.userData)?void 0:t.blob)instanceof Blob?u.push(new Promise((function(e){i.processBufferViewImage(n.userData.blob).then((function(t){h.bufferView=t,e()}))}))):u.push(ce(d,a).then((function(e){return i.processBufferViewImage(e)})).then((function(e){h.bufferView=e}))):void 0!==d.toDataURL?h.uri=d.toDataURL(a):u.push(ce(d,a).then((function(e){return(new FileReader).readAsDataURL(e)})).then((function(e){h.uri=e}))),p=l.images.push(h)-1,o[r]=p}},{key:"processSampler",value:function(e){var t=this.json;return t.samplers||(t.samplers=[]),e={magFilter:re[e.magFilter],minFilter:re[e.minFilter],wrapS:re[e.wrapS],wrapT:re[e.wrapT]},t.samplers.push(e)-1}},{key:"processTexture",value:function(e){var t=this.cache,r=this.json;if(t.textures.has(e))return t.textures.get(e);r.textures||(r.textures=[]),e.userData||(e.userData={});var n=("image/webp"===(a=(null==(a=e.userData)?void 0:a.mimeType)||"image/png")&&(a="image/png"),{sampler:this.processSampler(e),source:this.processImage(e.image,e.format,e.flipY,e,a)}),a=(e.name&&(n.name=e.name),this._invokeAll((function(t){t.writeTexture&&t.writeTexture(e,n)})),r.textures.push(n)-1);return t.textures.set(e,a),this.options.myOptions.helper.parseTexture({texture:e,textureDef:n}),a}},{key:"processMaterial",value:function(e){var t=this.cache,r=this.json;if(t.materials.has(e))return t.materials.get(e);if(e.isShaderMaterial)return console.warn("GLTFExporter: THREE.ShaderMaterial not supported."),null;r.materials||(r.materials=[]);var n={pbrMetallicRoughness:{}},a=(this.options.myOptions.helper.parseMaterial({material:e,materialDef:n,options:this}),!0!==e.isMeshStandardMaterial&&!0!==e.isMeshBasicMaterial&&console.warn("GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results."),e.color.toArray().concat([e.opacity])),i=(ie(a,[1,1,1,1])||(n.pbrMetallicRoughness.baseColorFactor=a),e.isMeshStandardMaterial?(n.pbrMetallicRoughness.metallicFactor=e.metalness,n.pbrMetallicRoughness.roughnessFactor=e.roughness):(n.pbrMetallicRoughness.metallicFactor=.5,n.pbrMetallicRoughness.roughnessFactor=.5),(e.metalnessMap||e.roughnessMap)&&(a=this.buildMetalRoughTexture(e.metalnessMap,e.roughnessMap),i={index:this.processTexture(a)},this.applyTextureTransform(i,a),n.pbrMetallicRoughness.metallicRoughnessTexture=i),e.map&&(a={index:this.processTexture(e.map)},this.applyTextureTransform(a,e.map),n.pbrMetallicRoughness.baseColorTexture=a),e.emissive&&(i=e.emissive,0<Math.max(i.r,i.g,i.b)&&(n.emissiveFactor=e.emissive.toArray()),e.emissiveMap&&(a={index:this.processTexture(e.emissiveMap)},this.applyTextureTransform(a,e.emissiveMap),n.emissiveTexture=a)),e.normalMap&&(i={index:this.processTexture(e.normalMap)},e.normalScale&&1!==e.normalScale.x&&(i.scale=e.normalScale.x),this.applyTextureTransform(i,e.normalMap),n.normalTexture=i),e.aoMap&&(a={index:this.processTexture(e.aoMap),texCoord:1},1!==e.aoMapIntensity&&(a.strength=e.aoMapIntensity),this.applyTextureTransform(a,e.aoMap),n.occlusionTexture=a),e.transparent?n.alphaMode="BLEND":0<e.alphaTest&&(n.alphaMode="MASK",n.alphaCutoff=e.alphaTest),e.side===s.DoubleSide&&(n.doubleSided=!0),""!==e.name&&(n.name=e.name),this.serializeUserData(e,n),this._invokeAll((function(t){t.writeMaterial&&t.writeMaterial(e,n)})),r.materials.push(n)-1);return t.materials.set(e,i),i}},{key:"processMesh",value:function(e){var t=this.cache,r=this.json,n=[e.geometry.uuid];if(Array.isArray(e.material))for(var a=0,i=e.material.length;a<i;a++)n.push(e.material[a].uuid);else n.push(e.material.uuid);var o=n.join(":");if(t.meshes.has(o))return t.meshes.get(o);var l,c,u,h=e.geometry,d=e.isLineSegments?1:e.isLineLoop?2:e.isLine?3:e.isPoints?0:e.material.wireframe?1:4,p={},f={},m=[],g=[],v={uv:"TEXCOORD_0",uv2:"TEXCOORD_1",color:"COLOR_0",skinWeight:"WEIGHTS_0",skinIndex:"JOINTS_0"},b=h.getAttribute("normal"),y=(void 0===b||this.isNormalizedNormalAttribute(b)||(console.warn("THREE.GLTFExporter: Creating normalized normal attribute from the non-normalized one."),h.setAttribute("normal",this.createNormalizedNormalAttribute(b))),null);for(c in h.attributes)"morph"!==c.slice(0,5)&&(l=h.attributes[c],c=v[c]||c.toUpperCase(),/^(POSITION|NORMAL|TANGENT|TEXCOORD_\d+|COLOR_\d+|JOINTS_\d+|WEIGHTS_\d+)$/.test(c)||(c="_"+c),t.attributes.has(this.getUID(l))?f[c]=t.attributes.get(this.getUID(l)):(y=null,u=l.array,"JOINTS_0"!==c||u instanceof Uint16Array||u instanceof Uint8Array||(console.warn('GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.'),y=new s.BufferAttribute(new Uint16Array(u),l.itemSize,l.normalized)),null!==(u=this.processAccessor(y||l,h))&&(c.startsWith("_")||this.detectMeshQuantization(c,l),f[c]=u,t.attributes.set(this.getUID(l),u))));if(void 0!==b&&h.setAttribute("normal",b),0===Object.keys(f).length)return null;if(void 0!==e.morphTargetInfluences&&0<e.morphTargetInfluences.length){var x=[],w=[],S={};if(void 0!==e.morphTargetDictionary)for(var M in e.morphTargetDictionary)S[e.morphTargetDictionary[M]]=M;for(var T=0;T<e.morphTargetInfluences.length;++T){var _,E={},D=!1;for(_ in h.morphAttributes)if("position"!==_&&"normal"!==_)D||(console.warn("GLTFExporter: Only POSITION and NORMAL morph are supported."),D=!0);else{var k=h.morphAttributes[_][T],O=_.toUpperCase(),P=h.attributes[_];if(t.attributes.has(this.getUID(k,!0)))E[O]=t.attributes.get(this.getUID(k,!0));else{var A=k.clone();if(!h.morphTargetsRelative)for(var C=0,R=k.count;C<R;C++)for(var L=0;L<k.itemSize;L++)0===L&&A.setX(C,k.getX(C)-P.getX(C)),1===L&&A.setY(C,k.getY(C)-P.getY(C)),2===L&&A.setZ(C,k.getZ(C)-P.getZ(C)),3===L&&A.setW(C,k.getW(C)-P.getW(C));E[O]=this.processAccessor(A,h),t.attributes.set(this.getUID(P,!0),E[O])}}g.push(E),x.push(e.morphTargetInfluences[T]),void 0!==e.morphTargetDictionary&&w.push(S[T])}p.weights=x,0<w.length&&(p.extras={},p.extras.targetNames=w)}if((b=Array.isArray(e.material))&&0===h.groups.length)return null;for(var I=b?e.material:[e.material],B=b?h.groups:[{materialIndex:0,start:void 0,count:void 0}],j=0,U=B.length;j<U;j++){var N={mode:d,attributes:f},z=(this.serializeUserData(h,N),0<g.length&&(N.targets=g),null!==h.index&&(z=this.getUID(h.index),void 0===B[j].start&&void 0===B[j].count||(z+=":"+B[j].start+":"+B[j].count),t.attributes.has(z)?N.indices=t.attributes.get(z):(N.indices=this.processAccessor(h.index,h,B[j].start,B[j].count),t.attributes.set(z,N.indices)),null===N.indices&&delete N.indices),this.processMaterial(I[B[j].materialIndex]));null!==z&&(N.material=z),m.push(N)}return p.primitives=m,r.meshes||(r.meshes=[]),this._invokeAll((function(t){t.writeMesh&&t.writeMesh(e,p)})),b=r.meshes.push(p)-1,t.meshes.set(o,b),b}},{key:"detectMeshQuantization",value:function(e,t){if(!this.extensionsUsed[te]){var r=void 0;switch(t.array.constructor){case Int8Array:r="byte";break;case Uint8Array:r="unsigned byte";break;case Int16Array:r="short";break;case Uint16Array:r="unsigned short";break;default:return}t.normalized&&(r+=" normalized"),t=e.split("_",1)[0],null!=(e=F[t])&&e.includes(r)&&(this.extensionsUsed[te]=!0,this.extensionsRequired[te]=!0)}}},{key:"processCamera",value:function(e){var t=this.json,r=(t.cameras||(t.cameras=[]),e.isOrthographicCamera),n={type:r?"orthographic":"perspective"};return r?n.orthographic={xmag:2*e.right,ymag:2*e.top,zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near}:n.perspective={aspectRatio:e.aspect,yfov:s.MathUtils.degToRad(e.fov),zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near},""!==e.name&&(n.name=e.type),t.cameras.push(n)-1}},{key:"processAnimation",value:function(e,t){for(var r=this.json,n=this.nodeMap,a=(r.animations||(r.animations=[]),(e=V.Utils.mergeMorphTargetTracks(e.clone(),t)).tracks),i=[],o=[],l=0;l<a.length;++l){var c=a[l],u=s.PropertyBinding.parseTrackName(c.name),h=s.PropertyBinding.findNode(t,u.nodeName),d=ne[u.propertyName];if(!(h="bones"===u.objectName?!0===h.isSkinnedMesh?h.skeleton.getBoneByName(u.objectIndex):void 0:h)||!d)return console.warn('THREE.GLTFExporter: Could not export animation track "%s".',c.name),null;u=c.values.length/c.times.length;var p=void(d===ne.morphTargetInfluences&&(u/=h.morphTargetInfluences.length));!0===c.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline?(p="CUBICSPLINE",u/=3):p=c.getInterpolation()===s.InterpolateDiscrete?"STEP":"LINEAR",o.push({input:this.processAccessor(new s.BufferAttribute(c.times,1)),output:this.processAccessor(new s.BufferAttribute(c.values,u)),interpolation:p}),i.push({sampler:o.length-1,target:{node:n.get(h),path:d}})}return r.animations.push({name:e.name||"clip_"+r.animations.length,samplers:o,channels:i}),r.animations.length-1}},{key:"processSkin",value:function(e){var t=this.json,r=this.nodeMap,n=t.nodes[r.get(e)],a=e.skeleton;if(void 0===a)return null;var i=e.skeleton.bones[0];if(void 0===i)return null;for(var o=[],l=new Float32Array(16*a.bones.length),c=new s.Matrix4,u=0;u<a.bones.length;++u){var h=a.bones[u];h=this.options.myOptions.helper.getNodeMapValueWithBone(h,r),o.push(h),c.copy(a.boneInverses[u]),c.multiply(e.bindMatrix).toArray(l,16*u)}return void 0===t.skins&&(t.skins=[]),t.skins.push({inverseBindMatrices:this.processAccessor(new s.BufferAttribute(l,16)),joints:o,skeleton:r.get(i)}),n.skin=t.skins.length-1}},{key:"processNode",value:function(e){var t,r,n=this.json,a=this.options,i=this.nodeMap,s=(n.nodes||(n.nodes=[]),{});if(e=a.myOptions.helper.parseNode({object:e,nodeDef:s,options:this}),a.trs?(r=e.quaternion.toArray(),h=e.position.toArray(),t=e.scale.toArray(),ie(r,[0,0,0,1])||(s.rotation=r),ie(h,[0,0,0])||(s.translation=h),ie(t,[1,1,1])||(s.scale=t)):(e.matrixAutoUpdate&&e.updateMatrix(),!1===ie(e.matrix.elements,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])&&(s.matrix=e.matrix.elements)),""!==e.name&&(s.name=String(e.name)),this.serializeUserData(e,s),e.isMesh||e.isLine||e.isPoints?null!==(r=this.processMesh(e))&&(s.mesh=r):e.isCamera&&(s.camera=this.processCamera(e)),e.isSkinnedMesh&&this.skins.push(e),0<e.children.length){for(var o=[],l=0,c=e.children.length;l<c;l++){var u=e.children[l];u.userData.isTemp||!u.visible&&!1!==a.onlyVisible||null!==(u=this.processNode(u))&&o.push(u)}0<o.length&&(s.children=o)}this._invokeAll((function(t){t.writeNode&&t.writeNode(e,s)}));var h=n.nodes.push(s)-1;return i.set(e,h),h}},{key:"processScene",value:function(e){for(var t=this.json,r=this.options,n=(t.scenes||(t.scenes=[],t.scene=0),{}),a=(""!==e.name&&(n.name=e.name),t.scenes.push(n),[]),i=0,s=e.children.length;i<s;i++){var o=e.children[i];o.userData.isTemp||!o.visible&&!1!==r.onlyVisible||null!==(o=this.processNode(o))&&a.push(o)}0<a.length&&(n.nodes=a),this.serializeUserData(e,n)}},{key:"processObjects",value:function(e){var t=new s.Scene;t.name="AuxScene";for(var r=0;r<e.length;r++)t.children.push(e[r]);this.processScene(t)}},{key:"processInput",value:function(e){for(var t,r,n=this.options,a=(e=e instanceof Array?e:[e],this._invokeAll((function(t){t.beforeParse&&t.beforeParse(e)})),[]),i=0;i<e.length;i++)e[i]instanceof s.Scene?this.processScene(e[i]):a.push(e[i]);1===a.length?(t=a[0],"model"===n.myOptions.helper.type&&((r=new s.Group).name="glb_model",r.add(t),t=r),this.processScene(t)):1<a.length&&this.processObjects(a);for(var o=0;o<this.skins.length;++o)this.processSkin(this.skins[o]);for(var l=0;l<n.animations.length;++l)this.processAnimation(n.animations[l],e[0]);this._invokeAll((function(t){t.afterParse&&t.afterParse(e)}))}},{key:"_invokeAll",value:function(e){for(var t=0,r=this.plugins.length;t<r;t++)e(this.plugins[t])}}]),e}(),he=function(){function e(t){U(this,e),this.writer=t,this.name="KHR_lights_punctual"}return z(e,[{key:"writeNode",value:function(e,t){var r,n,a;e.isLight&&(e.isDirectionalLight||e.isPointLight||e.isSpotLight?(r=(a=this.writer).json,a=a.extensionsUsed,n={},e.name&&(n.name=e.name),n.color=e.color.toArray(),n.intensity=e.intensity,e.isDirectionalLight?n.type="directional":e.isPointLight?(n.type="point",0<e.distance&&(n.range=e.distance)):e.isSpotLight&&(n.type="spot",0<e.distance&&(n.range=e.distance),n.spot={},n.spot.innerConeAngle=(e.penumbra-1)*e.angle*-1,n.spot.outerConeAngle=e.angle),void 0!==e.decay&&2!==e.decay&&console.warn("THREE.GLTFExporter: Light decay may be lost. glTF is physically-based, and expects light.decay=2."),!e.target||e.target.parent===e&&0===e.target.position.x&&0===e.target.position.y&&-1===e.target.position.z||console.warn("THREE.GLTFExporter: Light direction may be lost. For best results, make light.target a child of the light with position 0,0,-1."),a[this.name]||(r.extensions=r.extensions||{},r.extensions[this.name]={lights:[]},a[this.name]=!0),(a=r.extensions[this.name].lights).push(n),t.extensions=t.extensions||{},t.extensions[this.name]={light:a.length-1}):console.warn("THREE.GLTFExporter: Only directional, point, and spot lights are supported.",e))}}]),e}(),de=function(){function e(t){U(this,e),this.writer=t,this.name="KHR_materials_unlit"}return z(e,[{key:"writeMaterial",value:function(e,t){e.isMeshBasicMaterial&&(e=this.writer.extensionsUsed,t.extensions=t.extensions||{},t.extensions[this.name]={},e[this.name]=!0,t.pbrMetallicRoughness.metallicFactor=0,t.pbrMetallicRoughness.roughnessFactor=.9)}}]),e}(),pe=function(){function e(t){U(this,e),this.writer=t,this.name="KHR_materials_clearcoat"}return z(e,[{key:"writeMaterial",value:function(e,t){var r,n,a,i;e.isMeshPhysicalMaterial&&0!==e.clearcoat&&(n=(r=this.writer).extensionsUsed,(a={}).clearcoatFactor=e.clearcoat,e.clearcoatMap&&(i={index:r.processTexture(e.clearcoatMap)},r.applyTextureTransform(i,e.clearcoatMap),a.clearcoatTexture=i),a.clearcoatRoughnessFactor=e.clearcoatRoughness,e.clearcoatRoughnessMap&&(i={index:r.processTexture(e.clearcoatRoughnessMap)},r.applyTextureTransform(i,e.clearcoatRoughnessMap),a.clearcoatRoughnessTexture=i),e.clearcoatNormalMap&&(i={index:r.processTexture(e.clearcoatNormalMap)},r.applyTextureTransform(i,e.clearcoatNormalMap),a.clearcoatNormalTexture=i),t.extensions=t.extensions||{},t.extensions[this.name]=a,n[this.name]=!0)}}]),e}(),fe=function(){function e(t){U(this,e),this.writer=t,this.name="KHR_materials_iridescence"}return z(e,[{key:"writeMaterial",value:function(e,t){var r,n,a,i;e.isMeshPhysicalMaterial&&0!==e.iridescence&&(n=(r=this.writer).extensionsUsed,(a={}).iridescenceFactor=e.iridescence,e.iridescenceMap&&(i={index:r.processTexture(e.iridescenceMap)},r.applyTextureTransform(i,e.iridescenceMap),a.iridescenceTexture=i),a.iridescenceIor=e.iridescenceIOR,a.iridescenceThicknessMinimum=e.iridescenceThicknessRange[0],a.iridescenceThicknessMaximum=e.iridescenceThicknessRange[1],e.iridescenceThicknessMap&&(i={index:r.processTexture(e.iridescenceThicknessMap)},r.applyTextureTransform(i,e.iridescenceThicknessMap),a.iridescenceThicknessTexture=i),t.extensions=t.extensions||{},t.extensions[this.name]=a,n[this.name]=!0)}}]),e}(),me=function(){function e(t){U(this,e),this.writer=t,this.name="KHR_materials_transmission"}return z(e,[{key:"writeMaterial",value:function(e,t){var r,n,a,i;e.isMeshPhysicalMaterial&&0!==e.transmission&&(n=(r=this.writer).extensionsUsed,(a={}).transmissionFactor=e.transmission,e.transmissionMap&&(i={index:r.processTexture(e.transmissionMap)},r.applyTextureTransform(i,e.transmissionMap),a.transmissionTexture=i),t.extensions=t.extensions||{},t.extensions[this.name]=a,n[this.name]=!0)}}]),e}(),ge=function(){function e(t){U(this,e),this.writer=t,this.name="KHR_materials_volume"}return z(e,[{key:"writeMaterial",value:function(e,t){var r,n,a,i;e.isMeshPhysicalMaterial&&0!==e.transmission&&(n=(r=this.writer).extensionsUsed,(a={}).thicknessFactor=e.thickness,e.thicknessMap&&(i={index:r.processTexture(e.thicknessMap)},r.applyTextureTransform(i,e.thicknessMap),a.thicknessTexture=i),a.attenuationDistance=e.attenuationDistance,a.attenuationColor=e.attenuationColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=a,n[this.name]=!0)}}]),e}(),ve=function(){function e(t){U(this,e),this.writer=t,this.name="KHR_materials_ior"}return z(e,[{key:"writeMaterial",value:function(e,t){var r,n;e.isMeshPhysicalMaterial&&1.5!==e.ior&&(r=this.writer.extensionsUsed,(n={}).ior=e.ior,t.extensions=t.extensions||{},t.extensions[this.name]=n,r[this.name]=!0)}}]),e}(),be=function(){function e(t){U(this,e),this.writer=t,this.name="KHR_materials_specular"}return z(e,[{key:"writeMaterial",value:function(e,t){var r,n,a,i;e.isMeshPhysicalMaterial&&(1!==e.specularIntensity||!e.specularColor.equals(ae)||e.specularIntensityMap||e.specularColorTexture)&&(n=(r=this.writer).extensionsUsed,a={},e.specularIntensityMap&&(i={index:r.processTexture(e.specularIntensityMap)},r.applyTextureTransform(i,e.specularIntensityMap),a.specularTexture=i),e.specularColorMap&&(i={index:r.processTexture(e.specularColorMap)},r.applyTextureTransform(i,e.specularColorMap),a.specularColorTexture=i),a.specularFactor=e.specularIntensity,a.specularColorFactor=e.specularColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=a,n[this.name]=!0)}}]),e}(),ye=function(){function e(t){U(this,e),this.writer=t,this.name="KHR_materials_sheen"}return z(e,[{key:"writeMaterial",value:function(e,t){var r,n,a,i;e.isMeshPhysicalMaterial&&0!=e.sheen&&(n=(r=this.writer).extensionsUsed,a={},e.sheenRoughnessMap&&(i={index:r.processTexture(e.sheenRoughnessMap)},r.applyTextureTransform(i,e.sheenRoughnessMap),a.sheenRoughnessTexture=i),e.sheenColorMap&&(i={index:r.processTexture(e.sheenColorMap)},r.applyTextureTransform(i,e.sheenColorMap),a.sheenColorTexture=i),a.sheenRoughnessFactor=e.sheenRoughness,a.sheenColorFactor=e.sheenColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=a,n[this.name]=!0)}}]),e}(),xe=function(){function e(t){U(this,e),this.writer=t,this.name="KHR_materials_emissive_strength"}return z(e,[{key:"writeMaterial",value:function(e,t){var r,n;e.isMeshStandardMaterial&&1!==e.emissiveIntensity&&(r=this.writer.extensionsUsed,(n={}).emissiveStrength=e.emissiveIntensity,t.extensions=t.extensions||{},t.extensions[this.name]=n,r[this.name]=!0)}}]),e}();function we(e){return(we="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})(e)}function Se(){Se=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n=(p="function"==typeof Symbol?Symbol:{}).iterator||"@@iterator",a=p.asyncIterator||"@@asyncIterator",i=p.toStringTag||"@@toStringTag";function s(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(t){s=function(e,t,r){return e[t]=r}}function o(e,t,r,n){var a,i,s,o;return t=t&&t.prototype instanceof u?t:u,t=Object.create(t.prototype),n=new x(n||[]),t._invoke=(a=e,i=r,s=n,o="suspendedStart",function(e,t){if("executing"===o)throw new Error("Generator is already running");if("completed"===o){if("throw"===e)throw t;return{value:void 0,done:!0}}for(s.method=e,s.arg=t;;){var r=s.delegate;if(r&&(r=function e(t,r){var n=t.iterator[r.method];if(void 0===n){if(r.delegate=null,"throw"===r.method){if(t.iterator.return&&(r.method="return",r.arg=void 0,e(t,r),"throw"===r.method))return c;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return c}return"throw"===(n=l(n,t.iterator,r.arg)).type?(r.method="throw",r.arg=n.arg,r.delegate=null,c):(n=n.arg)?n.done?(r[t.resultName]=n.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=void 0),r.delegate=null,c):n:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,c)}(r,s),r)){if(r===c)continue;return r}if("next"===s.method)s.sent=s._sent=s.arg;else if("throw"===s.method){if("suspendedStart"===o)throw o="completed",s.arg;s.dispatchException(s.arg)}else"return"===s.method&&s.abrupt("return",s.arg);if(o="executing","normal"===(r=l(a,i,s)).type){if(o=s.done?"completed":"suspendedYield",r.arg===c)continue;return{value:r.arg,done:s.done}}"throw"===r.type&&(o="completed",s.method="throw",s.arg=r.arg)}}),t}function l(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=o;var c={};function u(){}function h(){}function d(){}var p,f,m=(s(p={},n,(function(){return this})),(f=(f=Object.getPrototypeOf)&&f(f(w([]))))&&f!==t&&r.call(f,n)&&(p=f),d.prototype=u.prototype=Object.create(p));function g(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function v(e,t){var n;this._invoke=function(a,i){function s(){return new t((function(n,s){!function n(a,i,s,o){var c;if("throw"!==(a=l(e[a],e,i)).type)return(i=(c=a.arg).value)&&"object"==we(i)&&r.call(i,"__await")?t.resolve(i.__await).then((function(e){n("next",e,s,o)}),(function(e){n("throw",e,s,o)})):t.resolve(i).then((function(e){c.value=e,s(c)}),(function(e){return n("throw",e,s,o)}));o(a.arg)}(a,i,n,s)}))}return n=n?n.then(s,s):s()}}function b(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function y(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function x(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(b,this),this.reset(!0)}function w(e){if(e){var t,a=e[n];if(a)return a.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return t=-1,(a=function n(){for(;++t<e.length;)if(r.call(e,t))return n.value=e[t],n.done=!1,n;return n.value=void 0,n.done=!0,n}).next=a}return{next:S}}function S(){return{value:void 0,done:!0}}return s(m,"constructor",h.prototype=d),s(d,"constructor",h),h.displayName=s(d,i,"GeneratorFunction"),e.isGeneratorFunction=function(e){return!!(e="function"==typeof e&&e.constructor)&&(e===h||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,d):(e.__proto__=d,s(e,i,"GeneratorFunction")),e.prototype=Object.create(m),e},e.awrap=function(e){return{__await:e}},g(v.prototype),s(v.prototype,a,(function(){return this})),e.AsyncIterator=v,e.async=function(t,r,n,a,i){void 0===i&&(i=Promise);var s=new v(o(t,r,n,a),i);return e.isGeneratorFunction(r)?s:s.next().then((function(e){return e.done?e.value:s.next()}))},g(m),s(m,i,"Generator"),s(m,n,(function(){return this})),s(m,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t,r=[];for(t in e)r.push(t);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=w,x.prototype={constructor:x,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(y),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(r,n){return s.type="throw",s.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var a=this.tryEntries.length-1;0<=a;--a){var i=this.tryEntries[a],s=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var o=r.call(i,"catchLoc"),l=r.call(i,"finallyLoc");if(o&&l){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(o){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;0<=n;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var i=a;break}}var s=(i=i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc?null:i)?i.completion:{};return s.type=e,s.arg=t,i?(this.method="next",this.next=i.finallyLoc,c):this.complete(s)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),c},finish:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),y(r),c}},catch:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var r,n,a=this.tryEntries[t];if(a.tryLoc===e)return"throw"===(r=a.completion).type&&(n=r.arg,y(a)),n}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:w(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),c}},e}function Me(e,t,r,n,a,i,s){try{var o=e[i](s),l=o.value}catch(e){return void r(e)}o.done?t(l):Promise.resolve(l).then(n,a)}function Te(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Ee(e,t,r){t&&_e(e.prototype,t),r&&_e(e,r),Object.defineProperty(e,"prototype",{writable:!1})}V.Utils={insertKeyframe:function(e,t){var r,n=e.getValueSize(),a=new e.TimeBufferType(e.times.length+1),i=new e.ValueBufferType(e.values.length+n),s=e.createInterpolant(new e.ValueBufferType(n));if(0===e.times.length){a[0]=t;for(var o=0;o<n;o++)i[o]=0;r=0}else if(t<e.times[0]){if(Math.abs(e.times[0]-t)<.001)return 0;a[0]=t,a.set(e.times,1),i.set(s.evaluate(t),0),i.set(e.values,n),r=0}else if(t>e.times[e.times.length-1]){if(Math.abs(e.times[e.times.length-1]-t)<.001)return e.times.length-1;a[a.length-1]=t,a.set(e.times,0),i.set(e.values,0),i.set(s.evaluate(t),e.values.length),r=a.length-1}else for(var l=0;l<e.times.length;l++){if(Math.abs(e.times[l]-t)<.001)return l;if(e.times[l]<t&&e.times[l+1]>t){a.set(e.times.slice(0,l+1),0),a[l+1]=t,a.set(e.times.slice(l+1),l+2),i.set(e.values.slice(0,(l+1)*n),0),i.set(s.evaluate(t),(l+1)*n),i.set(e.values.slice((l+1)*n),(l+2)*n),r=l+1;break}}return e.times=a,e.values=i,r},mergeMorphTargetTracks:function(e,t){for(var r=[],n={},a=e.tracks,i=0;i<a.length;++i){var o=a[i],l=s.PropertyBinding.parseTrackName(o.name),c=s.PropertyBinding.findNode(t,l.nodeName);if("morphTargetInfluences"!==l.propertyName||void 0===l.propertyIndex)r.push(o);else{if(o.createInterpolant!==o.InterpolantFactoryMethodDiscrete&&o.createInterpolant!==o.InterpolantFactoryMethodLinear){if(o.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline)throw new Error("THREE.GLTFExporter: Cannot merge tracks with glTF CUBICSPLINE interpolation.");console.warn("THREE.GLTFExporter: Morph target interpolation mode not yet supported. Using LINEAR instead."),(o=o.clone()).setInterpolation(s.InterpolateLinear)}var u=c.morphTargetInfluences.length,h=c.morphTargetDictionary[l.propertyIndex];if(void 0===h)throw new Error("THREE.GLTFExporter: Morph target name not found: "+l.propertyIndex);var d=void 0;if(void 0===n[c.uuid]){for(var p=new((d=o.clone()).ValueBufferType)(u*d.times.length),f=0;f<d.times.length;f++)p[f*u+h]=d.values[f];d.name=(l.nodeName||"")+".morphTargetInfluences",d.values=p,n[c.uuid]=d,r.push(d)}else{var m=o.createInterpolant(new o.ValueBufferType(1));d=n[c.uuid];for(var g=0;g<d.times.length;g++)d.values[g*u+h]=m.evaluate(d.times[g]);for(var v=0;v<o.times.length;v++){var b=this.insertKeyframe(d,o.times[v]);d.values[b*u+h]=o.values[v]}}}}return e.tracks=r,e}};var De={POSITION:["byte","byte normalized","unsigned byte","unsigned byte normalized","short","short normalized","unsigned short","unsigned short normalized"],NORMAL:["byte normalized","short normalized"],TANGENT:["byte normalized","short normalized"],TEXCOORD:["byte","byte normalized","unsigned byte","short","short normalized","unsigned short"]},ke=function(){function e(){Te(this,e),this.pluginCallbacks=[],this.register((function(e){return new Ge(e)})),this.register((function(e){return new He(e)})),this.register((function(e){return new qe(e)})),this.register((function(e){return new Ze(e)})),this.register((function(e){return new Xe(e)})),this.register((function(e){return new Qe(e)})),this.register((function(e){return new We(e)})),this.register((function(e){return new Ke(e)})),this.register((function(e){return new Ye(e)})),this.register((function(e){return new Je(e)}))}return Ee(e,[{key:"register",value:function(e){return-1===this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.push(e),this}},{key:"unregister",value:function(e){return-1!==this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}},{key:"parse",value:function(e,t,r,n){for(var a=new Ve,i=[],s=0,o=this.pluginCallbacks.length;s<o;s++)i.push(this.pluginCallbacks[s](a));a.setPlugins(i),a.write(e,t,n).catch(r)}},{key:"parseAsync",value:function(e,t){var r=this;return new Promise((function(n,a){r.parse(e,n,a,t)}))}}]),e}(),Oe=5120,Pe=5121,Ae=5122,Ce=5123,Re=(n=9728,Z=9729,Q=9984,q=9985,X=9986,Y=9987,J=33071,ee=33648,$=10497,"KHR_mesh_quantization"),Le={},Ie=(Le[s.NearestFilter]=n,Le[s.NearestMipmapNearestFilter]=Q,Le[s.NearestMipmapLinearFilter]=X,Le[s.LinearFilter]=Z,Le[s.LinearMipmapNearestFilter]=q,Le[s.LinearMipmapLinearFilter]=Y,Le[s.ClampToEdgeWrapping]=J,Le[s.RepeatWrapping]=$,Le[s.MirroredRepeatWrapping]=ee,{scale:"scale",position:"translation",quaternion:"rotation",morphTargetInfluences:"weights"}),Be=new s.Color;function je(e,t){return e.length===t.length&&e.every((function(e,r){return e===t[r]}))}function Ue(e){return 4*Math.ceil(e/4)}function Ne(e,t){var r=1<arguments.length&&void 0!==t?t:0,n=Ue(e.byteLength);if(n===e.byteLength)return e;var a=new Uint8Array(n);if(a.set(new Uint8Array(e)),0!==r)for(var i=e.byteLength;i<n;i++)a[i]=r;return a.buffer}function ze(){return"undefined"==typeof document&&"undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas")}function Fe(e,t){return void 0!==e.toBlob?new Promise((function(r){return e.toBlob(r,t)})):("image/jpeg"===t?r=.92:"image/webp"===t&&(r=.8),e.convertToBlob({type:t,quality:r}));var r}var Ve=function(){function e(){Te(this,e),this.plugins=[],this.options={},this.pending=[],this.buffers=[],this.byteOffset=0,this.buffers=[],this.nodeMap=new Map,this.skins=[],this.extensionsUsed={},this.extensionsRequired={},this.uids=new Map,this.uid=0,this.json={asset:{version:"2.0",generator:"THREE.GLTFExporter"}},this.cache={meshes:new Map,attributes:new Map,attributesNormalized:new Map,materials:new Map,textures:new Map,images:new Map}}var t,r;return Ee(e,[{key:"setPlugins",value:function(e){this.plugins=e}},{key:"write",value:(t=Se().mark((function e(t,r){var n,a,i,s,o,l,c,u=arguments;return Se().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=2<u.length&&void 0!==u[2]?u[2]:{},this.options=Object.assign({binary:!1,trs:!1,onlyVisible:!0,maxTextureSize:1/0,animations:[],includeCustomExtensions:!1},n),0<this.options.animations.length&&(this.options.trs=!0),this.processInput(t),e.next=6,Promise.all(this.pending);case 6:i=(o=this).buffers,a=o.json,n=o.options,s=o.extensionsUsed,o=o.extensionsRequired,i=new Blob(i,{type:"application/octet-stream"}),s=Object.keys(s),o=Object.keys(o),0<s.length&&(a.extensionsUsed=s),0<o.length&&(a.extensionsRequired=o),a.buffers&&0<a.buffers.length&&(a.buffers[0].byteLength=i.size),!0===n.binary?((l=new FileReader).readAsArrayBuffer(i),l.onloadend=function(){var e=Ne(l.result),t=new DataView(new ArrayBuffer(8)),n=(t.setUint32(0,e.byteLength,!0),t.setUint32(4,5130562,!0),Ne((n=JSON.stringify(a),(new TextEncoder).encode(n).buffer),32)),i=new DataView(new ArrayBuffer(8)),s=(i.setUint32(0,n.byteLength,!0),i.setUint32(4,1313821514,!0),new ArrayBuffer(12)),o=((c=new DataView(s)).setUint32(0,1179937895,!0),c.setUint32(4,2,!0),12+i.byteLength+n.byteLength+t.byteLength+e.byteLength),c=(c.setUint32(8,o,!0),new Blob([s,i,n,t,e],{type:"application/octet-stream"})),u=new FileReader;u.readAsArrayBuffer(c),u.onloadend=function(){r(u.result)}}):a.buffers&&0<a.buffers.length?((c=new FileReader).readAsDataURL(i),c.onloadend=function(){var e=c.result;a.buffers[0].uri=e,r(a)}):r(a);case 19:case"end":return e.stop()}}),e,this)})),r=function(){var e=this,r=arguments;return new Promise((function(n,a){var i=t.apply(e,r);function s(e){Me(i,n,a,s,o,"next",e)}function o(e){Me(i,n,a,s,o,"throw",e)}s(void 0)}))},function(e,t){return r.apply(this,arguments)})},{key:"serializeUserData",value:function(e,t){if(0!==Object.keys(e.userData).length){var r=this.options,n=this.extensionsUsed;try{var a=JSON.parse(JSON.stringify(e.userData));if(r.includeCustomExtensions&&a.gltfExtensions){for(var i in void 0===t.extensions&&(t.extensions={}),a.gltfExtensions)t.extensions[i]=a.gltfExtensions[i],n[i]=!0;delete a.gltfExtensions}0<Object.keys(a).length&&(t.extras=a)}catch(t){console.warn("THREE.GLTFExporter: userData of '"+e.name+"' won't be serialized because of JSON.stringify error - "+t.message)}}}},{key:"getUID",value:function(e){var t,r=1<arguments.length&&void 0!==arguments[1]&&arguments[1];return!1===this.uids.has(e)&&((t=new Map).set(!0,this.uid++),t.set(!1,this.uid++),this.uids.set(e,t)),this.uids.get(e).get(r)}},{key:"isNormalizedNormalAttribute",value:function(e){if(this.cache.attributesNormalized.has(e))return!1;for(var t=new s.Vector3,r=0,n=e.count;r<n;r++)if(5e-4<Math.abs(t.fromBufferAttribute(e,r).length()-1))return!1;return!0}},{key:"createNormalizedNormalAttribute",value:function(e){var t=this.cache;if(t.attributesNormalized.has(e))return t.attributesNormalized.get(e);for(var r=e.clone(),n=new s.Vector3,a=0,i=r.count;a<i;a++)n.fromBufferAttribute(r,a),0===n.x&&0===n.y&&0===n.z?n.setX(1):n.normalize(),r.setXYZ(a,n.x,n.y,n.z);return t.attributesNormalized.set(e,r),r}},{key:"applyTextureTransform",value:function(e,t){var r=!1,n={};0===t.offset.x&&0===t.offset.y||(n.offset=t.offset.toArray(),r=!0),0!==t.rotation&&(n.rotation=t.rotation,r=!0),1===t.repeat.x&&1===t.repeat.y||(n.scale=t.repeat.toArray(),r=!0),r&&(e.extensions=e.extensions||{},e.extensions.KHR_texture_transform=n,this.extensionsUsed.KHR_texture_transform=!0)}},{key:"buildMetalRoughTexture",value:function(e,t){if(e===t)return e;function r(e){return e.encoding===s.sRGBEncoding?function(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}:function(e){return e}}console.warn("THREE.GLTFExporter: Merged metalnessMap and roughnessMap textures.");var n=e?e.image:null,a=t?t.image:null,i=Math.max(n?n.width:0,a?a.width:0),o=Math.max(n?n.height:0,a?a.height:0),l=ze(),c=(l.width=i,l.height=o,l.getContext("2d")),u=(c.fillStyle="#00ffff",c.fillRect(0,0,i,o),c.getImageData(0,0,i,o));if(n){c.drawImage(n,0,0,i,o);for(var h=r(e),d=c.getImageData(0,0,i,o).data,p=2;p<d.length;p+=4)u.data[p]=256*h(d[p]/256)}if(a){c.drawImage(a,0,0,i,o);for(var f=r(t),m=c.getImageData(0,0,i,o).data,g=1;g<m.length;g+=4)u.data[g]=256*f(m[g]/256)}return c.putImageData(u,0,0),(n=(e||t).clone()).source=new s.Source(l),n.encoding=s.LinearEncoding,n}},{key:"processBuffer",value:function(e){var t=this.json,r=this.buffers;return t.buffers||(t.buffers=[{byteLength:0}]),r.push(e),0}},{key:"processBufferView",value:function(e,t,r,n,a){var i,o=this.json;switch(o.bufferViews||(o.bufferViews=[]),t){case Oe:case Pe:i=1;break;case Ae:case Ce:i=2;break;default:i=4}for(var l=Ue(n*e.itemSize*i),c=new DataView(new ArrayBuffer(l)),u=0,h=r;h<r+n;h++)for(var d=0;d<e.itemSize;d++){var p=void 0;4<e.itemSize?p=e.array[h*e.itemSize+d]:(0===d?p=e.getX(h):1===d?p=e.getY(h):2===d?p=e.getZ(h):3===d&&(p=e.getW(h)),!0===e.normalized&&(p=s.MathUtils.normalize(p,e.array))),5126===t?c.setFloat32(u,p,!0):5124===t?c.setInt32(u,p,!0):5125===t?c.setUint32(u,p,!0):t===Ae?c.setInt16(u,p,!0):t===Ce?c.setUint16(u,p,!0):t===Oe?c.setInt8(u,p):t===Pe&&c.setUint8(u,p),u+=i}var f={buffer:this.processBuffer(c.buffer),byteOffset:this.byteOffset,byteLength:l};return void 0!==a&&(f.target=a),34962===a&&(f.byteStride=e.itemSize*i),this.byteOffset+=l,o.bufferViews.push(f),{id:o.bufferViews.length-1,byteLength:0}}},{key:"processBufferViewImage",value:function(e){var t=this,r=t.json;return r.bufferViews||(r.bufferViews=[]),new Promise((function(n){var a=new FileReader;a.readAsArrayBuffer(e),a.onloadend=function(){var e=Ne(a.result),i={buffer:t.processBuffer(e),byteOffset:t.byteOffset,byteLength:e.byteLength};t.byteOffset+=e.byteLength,n(r.bufferViews.push(i)-1)}}))}},{key:"processAccessor",value:function(e,t,r,n){var a,i=this.json;if(e.array.constructor===Float32Array)a=5126;else if(e.array.constructor===Int32Array)a=5124;else if(e.array.constructor===Uint32Array)a=5125;else if(e.array.constructor===Int16Array)a=Ae;else if(e.array.constructor===Uint16Array)a=Ce;else if(e.array.constructor===Int8Array)a=Oe;else{if(e.array.constructor!==Uint8Array)throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type.");a=Pe}if(0===(n=void 0===n?e.count:n))return null;var o,l=function(e,t,r){for(var n={min:new Array(e.itemSize).fill(Number.POSITIVE_INFINITY),max:new Array(e.itemSize).fill(Number.NEGATIVE_INFINITY)},a=t;a<t+r;a++)for(var i=0;i<e.itemSize;i++){var o=void 0;4<e.itemSize?o=e.array[a*e.itemSize+i]:(0===i?o=e.getX(a):1===i?o=e.getY(a):2===i?o=e.getZ(a):3===i&&(o=e.getW(a)),!0===e.normalized&&(o=s.MathUtils.normalize(o,e.array))),n.min[i]=Math.min(n.min[i],o),n.max[i]=Math.max(n.max[i],o)}return n}(e,r=void 0===r?0:r,n);return r={bufferView:(void 0!==t&&(o=e===t.index?34963:34962),t=this.processBufferView(e,a,r,n,o)).id,byteOffset:t.byteOffset,componentType:a,count:n,max:l.max,min:l.min,type:{1:"SCALAR",2:"VEC2",3:"VEC3",4:"VEC4",16:"MAT4"}[e.itemSize]},!0===e.normalized&&(r.normalized=!0),i.accessors||(i.accessors=[]),i.accessors.push(r)-1}},{key:"processImage",value:function(e,t,r){var n=3<arguments.length&&void 0!==arguments[3]?arguments[3]:"image/png";if(null===e)throw new Error("THREE.GLTFExporter: No valid image data found. Unable to process texture.");var a=this,i=a.cache,o=a.json,l=a.options,c=a.pending,u=(i.images.has(e)||i.images.set(e,{}),i=i.images.get(e),n+":flipY/"+r.toString());if(void 0!==i[u])return i[u];o.images||(o.images=[]);var h={mimeType:n},d=ze(),p=(d.width=Math.min(e.width,l.maxTextureSize),d.height=Math.min(e.height,l.maxTextureSize),d.getContext("2d"));if(!0===r&&(p.translate(0,d.height),p.scale(1,-1)),void 0!==e.data){t!==s.RGBAFormat&&console.error("GLTFExporter: Only RGBAFormat is supported."),(e.width>l.maxTextureSize||e.height>l.maxTextureSize)&&console.warn("GLTFExporter: Image size is bigger than maxTextureSize",e);for(var f=new Uint8ClampedArray(e.height*e.width*4),m=0;m<f.length;m+=4)f[m+0]=e.data[m+0],f[m+1]=e.data[m+1],f[m+2]=e.data[m+2],f[m+3]=e.data[m+3];p.putImageData(new ImageData(f,e.width,e.height),0,0)}else p.drawImage(e,0,0,d.width,d.height);return!0===l.binary?c.push(Fe(d,n).then((function(e){return a.processBufferViewImage(e)})).then((function(e){h.bufferView=e}))):void 0!==d.toDataURL?h.uri=d.toDataURL(n):c.push(Fe(d,n).then((function(e){return(new FileReader).readAsDataURL(e)})).then((function(e){h.uri=e}))),r=o.images.push(h)-1,i[u]=r}},{key:"processSampler",value:function(e){var t=this.json;return t.samplers||(t.samplers=[]),e={magFilter:Le[e.magFilter],minFilter:Le[e.minFilter],wrapS:Le[e.wrapS],wrapT:Le[e.wrapT]},t.samplers.push(e)-1}},{key:"processTexture",value:function(e){var t=this.cache,r=this.json;if(t.textures.has(e))return t.textures.get(e);r.textures||(r.textures=[]);var n=("image/webp"===(a=e.userData.mimeType)&&(a="image/png"),{sampler:this.processSampler(e),source:this.processImage(e.image,e.format,e.flipY,a)}),a=(e.name&&(n.name=e.name),this._invokeAll((function(t){t.writeTexture&&t.writeTexture(e,n)})),r.textures.push(n)-1);return t.textures.set(e,a),a}},{key:"processMaterial",value:function(e){var t=this.cache,r=this.json;if(t.materials.has(e))return t.materials.get(e);if(e.isShaderMaterial)return console.warn("GLTFExporter: THREE.ShaderMaterial not supported."),null;r.materials||(r.materials=[]);var n={pbrMetallicRoughness:{}},a=(!0!==e.isMeshStandardMaterial&&!0!==e.isMeshBasicMaterial&&console.warn("GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results."),e.color.toArray().concat([e.opacity])),i=(je(a,[1,1,1,1])||(n.pbrMetallicRoughness.baseColorFactor=a),e.isMeshStandardMaterial?(n.pbrMetallicRoughness.metallicFactor=e.metalness,n.pbrMetallicRoughness.roughnessFactor=e.roughness):(n.pbrMetallicRoughness.metallicFactor=.5,n.pbrMetallicRoughness.roughnessFactor=.5),(e.metalnessMap||e.roughnessMap)&&(a=this.buildMetalRoughTexture(e.metalnessMap,e.roughnessMap),i={index:this.processTexture(a)},this.applyTextureTransform(i,a),n.pbrMetallicRoughness.metallicRoughnessTexture=i),e.map&&(a={index:this.processTexture(e.map)},this.applyTextureTransform(a,e.map),n.pbrMetallicRoughness.baseColorTexture=a),e.emissive&&(i=e.emissive,0<Math.max(i.r,i.g,i.b)&&(n.emissiveFactor=e.emissive.toArray()),e.emissiveMap&&(a={index:this.processTexture(e.emissiveMap)},this.applyTextureTransform(a,e.emissiveMap),n.emissiveTexture=a)),e.normalMap&&(i={index:this.processTexture(e.normalMap)},e.normalScale&&1!==e.normalScale.x&&(i.scale=e.normalScale.x),this.applyTextureTransform(i,e.normalMap),n.normalTexture=i),e.aoMap&&(a={index:this.processTexture(e.aoMap),texCoord:1},1!==e.aoMapIntensity&&(a.strength=e.aoMapIntensity),this.applyTextureTransform(a,e.aoMap),n.occlusionTexture=a),e.transparent?n.alphaMode="BLEND":0<e.alphaTest&&(n.alphaMode="MASK",n.alphaCutoff=e.alphaTest),e.side===s.DoubleSide&&(n.doubleSided=!0),""!==e.name&&(n.name=e.name),this.serializeUserData(e,n),this._invokeAll((function(t){t.writeMaterial&&t.writeMaterial(e,n)})),r.materials.push(n)-1);return t.materials.set(e,i),i}},{key:"processMesh",value:function(e){var t=this.cache,r=this.json,n=[e.geometry.uuid];if(Array.isArray(e.material))for(var a=0,i=e.material.length;a<i;a++)n.push(e.material[a].uuid);else n.push(e.material.uuid);var o=n.join(":");if(t.meshes.has(o))return t.meshes.get(o);var l,c,u,h=e.geometry,d=e.isLineSegments?1:e.isLineLoop?2:e.isLine?3:e.isPoints?0:e.material.wireframe?1:4,p={},f={},m=[],g=[],v={uv:"TEXCOORD_0",uv2:"TEXCOORD_1",color:"COLOR_0",skinWeight:"WEIGHTS_0",skinIndex:"JOINTS_0"},b=h.getAttribute("normal"),y=(void 0===b||this.isNormalizedNormalAttribute(b)||(console.warn("THREE.GLTFExporter: Creating normalized normal attribute from the non-normalized one."),h.setAttribute("normal",this.createNormalizedNormalAttribute(b))),null);for(c in h.attributes)"morph"!==c.slice(0,5)&&(l=h.attributes[c],c=v[c]||c.toUpperCase(),/^(POSITION|NORMAL|TANGENT|TEXCOORD_\d+|COLOR_\d+|JOINTS_\d+|WEIGHTS_\d+)$/.test(c)||(c="_"+c),t.attributes.has(this.getUID(l))?f[c]=t.attributes.get(this.getUID(l)):(y=null,u=l.array,"JOINTS_0"!==c||u instanceof Uint16Array||u instanceof Uint8Array||(console.warn('GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.'),y=new s.BufferAttribute(new Uint16Array(u),l.itemSize,l.normalized)),null!==(u=this.processAccessor(y||l,h))&&(c.startsWith("_")||this.detectMeshQuantization(c,l),f[c]=u,t.attributes.set(this.getUID(l),u))));if(void 0!==b&&h.setAttribute("normal",b),0===Object.keys(f).length)return null;if(void 0!==e.morphTargetInfluences&&0<e.morphTargetInfluences.length){var x=[],w=[],S={};if(void 0!==e.morphTargetDictionary)for(var M in e.morphTargetDictionary)S[e.morphTargetDictionary[M]]=M;for(var T=0;T<e.morphTargetInfluences.length;++T){var _,E={},D=!1;for(_ in h.morphAttributes)if("position"!==_&&"normal"!==_)D||(console.warn("GLTFExporter: Only POSITION and NORMAL morph are supported."),D=!0);else{var k=h.morphAttributes[_][T],O=_.toUpperCase(),P=h.attributes[_];if(t.attributes.has(this.getUID(k,!0)))E[O]=t.attributes.get(this.getUID(k,!0));else{var A=k.clone();if(!h.morphTargetsRelative)for(var C=0,R=k.count;C<R;C++)for(var L=0;L<k.itemSize;L++)0===L&&A.setX(C,k.getX(C)-P.getX(C)),1===L&&A.setY(C,k.getY(C)-P.getY(C)),2===L&&A.setZ(C,k.getZ(C)-P.getZ(C)),3===L&&A.setW(C,k.getW(C)-P.getW(C));E[O]=this.processAccessor(A,h),t.attributes.set(this.getUID(P,!0),E[O])}}g.push(E),x.push(e.morphTargetInfluences[T]),void 0!==e.morphTargetDictionary&&w.push(S[T])}p.weights=x,0<w.length&&(p.extras={},p.extras.targetNames=w)}if((b=Array.isArray(e.material))&&0===h.groups.length)return null;for(var I=b?e.material:[e.material],B=b?h.groups:[{materialIndex:0,start:void 0,count:void 0}],j=0,U=B.length;j<U;j++){var N={mode:d,attributes:f},z=(this.serializeUserData(h,N),0<g.length&&(N.targets=g),null!==h.index&&(z=this.getUID(h.index),void 0===B[j].start&&void 0===B[j].count||(z+=":"+B[j].start+":"+B[j].count),t.attributes.has(z)?N.indices=t.attributes.get(z):(N.indices=this.processAccessor(h.index,h,B[j].start,B[j].count),t.attributes.set(z,N.indices)),null===N.indices&&delete N.indices),this.processMaterial(I[B[j].materialIndex]));null!==z&&(N.material=z),m.push(N)}return p.primitives=m,r.meshes||(r.meshes=[]),this._invokeAll((function(t){t.writeMesh&&t.writeMesh(e,p)})),b=r.meshes.push(p)-1,t.meshes.set(o,b),b}},{key:"detectMeshQuantization",value:function(e,t){if(!this.extensionsUsed[Re]){var r=void 0;switch(t.array.constructor){case Int8Array:r="byte";break;case Uint8Array:r="unsigned byte";break;case Int16Array:r="short";break;case Uint16Array:r="unsigned short";break;default:return}t.normalized&&(r+=" normalized"),t=e.split("_",1)[0],null!=(e=De[t])&&e.includes(r)&&(this.extensionsUsed[Re]=!0,this.extensionsRequired[Re]=!0)}}},{key:"processCamera",value:function(e){var t=this.json,r=(t.cameras||(t.cameras=[]),e.isOrthographicCamera),n={type:r?"orthographic":"perspective"};return r?n.orthographic={xmag:2*e.right,ymag:2*e.top,zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near}:n.perspective={aspectRatio:e.aspect,yfov:s.MathUtils.degToRad(e.fov),zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near},""!==e.name&&(n.name=e.type),t.cameras.push(n)-1}},{key:"processAnimation",value:function(e,t){for(var r=this.json,n=this.nodeMap,a=(r.animations||(r.animations=[]),(e=ke.Utils.mergeMorphTargetTracks(e.clone(),t)).tracks),i=[],o=[],l=0;l<a.length;++l){var c=a[l],u=s.PropertyBinding.parseTrackName(c.name),h=s.PropertyBinding.findNode(t,u.nodeName),d=Ie[u.propertyName];if(!(h="bones"===u.objectName?!0===h.isSkinnedMesh?h.skeleton.getBoneByName(u.objectIndex):void 0:h)||!d)return console.warn('THREE.GLTFExporter: Could not export animation track "%s".',c.name),null;u=c.values.length/c.times.length;var p=void(d===Ie.morphTargetInfluences&&(u/=h.morphTargetInfluences.length));!0===c.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline?(p="CUBICSPLINE",u/=3):p=c.getInterpolation()===s.InterpolateDiscrete?"STEP":"LINEAR",o.push({input:this.processAccessor(new s.BufferAttribute(c.times,1)),output:this.processAccessor(new s.BufferAttribute(c.values,u)),interpolation:p}),i.push({sampler:o.length-1,target:{node:n.get(h),path:d}})}return r.animations.push({name:e.name||"clip_"+r.animations.length,samplers:o,channels:i}),r.animations.length-1}},{key:"processSkin",value:function(e){var t=this.json,r=this.nodeMap,n=t.nodes[r.get(e)],a=e.skeleton;if(void 0===a)return null;var i=e.skeleton.bones[0];if(void 0===i)return null;for(var o=[],l=new Float32Array(16*a.bones.length),c=new s.Matrix4,u=0;u<a.bones.length;++u)o.push(r.get(a.bones[u])),c.copy(a.boneInverses[u]),c.multiply(e.bindMatrix).toArray(l,16*u);return void 0===t.skins&&(t.skins=[]),t.skins.push({inverseBindMatrices:this.processAccessor(new s.BufferAttribute(l,16)),joints:o,skeleton:r.get(i)}),n.skin=t.skins.length-1}},{key:"processNode",value:function(e){var t,r,n=this.json,a=this.options,i=this.nodeMap,s=(n.nodes||(n.nodes=[]),{});if(a.trs?(r=e.quaternion.toArray(),h=e.position.toArray(),t=e.scale.toArray(),je(r,[0,0,0,1])||(s.rotation=r),je(h,[0,0,0])||(s.translation=h),je(t,[1,1,1])||(s.scale=t)):(e.matrixAutoUpdate&&e.updateMatrix(),!1===je(e.matrix.elements,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])&&(s.matrix=e.matrix.elements)),""!==e.name&&(s.name=String(e.name)),this.serializeUserData(e,s),e.isMesh||e.isLine||e.isPoints?null!==(r=this.processMesh(e))&&(s.mesh=r):e.isCamera&&(s.camera=this.processCamera(e)),e.isSkinnedMesh&&this.skins.push(e),0<e.children.length){for(var o=[],l=0,c=e.children.length;l<c;l++){var u=e.children[l];!u.visible&&!1!==a.onlyVisible||null!==(u=this.processNode(u))&&o.push(u)}0<o.length&&(s.children=o)}this._invokeAll((function(t){t.writeNode&&t.writeNode(e,s)}));var h=n.nodes.push(s)-1;return i.set(e,h),h}},{key:"processScene",value:function(e){for(var t=this.json,r=this.options,n=(t.scenes||(t.scenes=[],t.scene=0),{}),a=(""!==e.name&&(n.name=e.name),t.scenes.push(n),[]),i=0,s=e.children.length;i<s;i++){var o=e.children[i];!o.visible&&!1!==r.onlyVisible||null!==(o=this.processNode(o))&&a.push(o)}0<a.length&&(n.nodes=a),this.serializeUserData(e,n)}},{key:"processObjects",value:function(e){var t=new s.Scene;t.name="AuxScene";for(var r=0;r<e.length;r++)t.children.push(e[r]);this.processScene(t)}},{key:"processInput",value:function(e){for(var t=this.options,r=(e=e instanceof Array?e:[e],this._invokeAll((function(t){t.beforeParse&&t.beforeParse(e)})),[]),n=0;n<e.length;n++)e[n]instanceof s.Scene?this.processScene(e[n]):r.push(e[n]);0<r.length&&this.processObjects(r);for(var a=0;a<this.skins.length;++a)this.processSkin(this.skins[a]);for(var i=0;i<t.animations.length;++i)this.processAnimation(t.animations[i],e[0]);this._invokeAll((function(t){t.afterParse&&t.afterParse(e)}))}},{key:"_invokeAll",value:function(e){for(var t=0,r=this.plugins.length;t<r;t++)e(this.plugins[t])}}]),e}(),Ge=function(){function e(t){Te(this,e),this.writer=t,this.name="KHR_lights_punctual"}return Ee(e,[{key:"writeNode",value:function(e,t){var r,n,a;e.isLight&&(e.isDirectionalLight||e.isPointLight||e.isSpotLight?(r=(a=this.writer).json,a=a.extensionsUsed,n={},e.name&&(n.name=e.name),n.color=e.color.toArray(),n.intensity=e.intensity,e.isDirectionalLight?n.type="directional":e.isPointLight?(n.type="point",0<e.distance&&(n.range=e.distance)):e.isSpotLight&&(n.type="spot",0<e.distance&&(n.range=e.distance),n.spot={},n.spot.innerConeAngle=(e.penumbra-1)*e.angle*-1,n.spot.outerConeAngle=e.angle),void 0!==e.decay&&2!==e.decay&&console.warn("THREE.GLTFExporter: Light decay may be lost. glTF is physically-based, and expects light.decay=2."),!e.target||e.target.parent===e&&0===e.target.position.x&&0===e.target.position.y&&-1===e.target.position.z||console.warn("THREE.GLTFExporter: Light direction may be lost. For best results, make light.target a child of the light with position 0,0,-1."),a[this.name]||(r.extensions=r.extensions||{},r.extensions[this.name]={lights:[]},a[this.name]=!0),(a=r.extensions[this.name].lights).push(n),t.extensions=t.extensions||{},t.extensions[this.name]={light:a.length-1}):console.warn("THREE.GLTFExporter: Only directional, point, and spot lights are supported.",e))}}]),e}(),He=function(){function e(t){Te(this,e),this.writer=t,this.name="KHR_materials_unlit"}return Ee(e,[{key:"writeMaterial",value:function(e,t){e.isMeshBasicMaterial&&(e=this.writer.extensionsUsed,t.extensions=t.extensions||{},t.extensions[this.name]={},e[this.name]=!0,t.pbrMetallicRoughness.metallicFactor=0,t.pbrMetallicRoughness.roughnessFactor=.9)}}]),e}(),We=function(){function e(t){Te(this,e),this.writer=t,this.name="KHR_materials_clearcoat"}return Ee(e,[{key:"writeMaterial",value:function(e,t){var r,n,a,i;e.isMeshPhysicalMaterial&&0!==e.clearcoat&&(n=(r=this.writer).extensionsUsed,(a={}).clearcoatFactor=e.clearcoat,e.clearcoatMap&&(i={index:r.processTexture(e.clearcoatMap)},r.applyTextureTransform(i,e.clearcoatMap),a.clearcoatTexture=i),a.clearcoatRoughnessFactor=e.clearcoatRoughness,e.clearcoatRoughnessMap&&(i={index:r.processTexture(e.clearcoatRoughnessMap)},r.applyTextureTransform(i,e.clearcoatRoughnessMap),a.clearcoatRoughnessTexture=i),e.clearcoatNormalMap&&(i={index:r.processTexture(e.clearcoatNormalMap)},r.applyTextureTransform(i,e.clearcoatNormalMap),a.clearcoatNormalTexture=i),t.extensions=t.extensions||{},t.extensions[this.name]=a,n[this.name]=!0)}}]),e}(),Ke=function(){function e(t){Te(this,e),this.writer=t,this.name="KHR_materials_iridescence"}return Ee(e,[{key:"writeMaterial",value:function(e,t){var r,n,a,i;e.isMeshPhysicalMaterial&&0!==e.iridescence&&(n=(r=this.writer).extensionsUsed,(a={}).iridescenceFactor=e.iridescence,e.iridescenceMap&&(i={index:r.processTexture(e.iridescenceMap)},r.applyTextureTransform(i,e.iridescenceMap),a.iridescenceTexture=i),a.iridescenceIor=e.iridescenceIOR,a.iridescenceThicknessMinimum=e.iridescenceThicknessRange[0],a.iridescenceThicknessMaximum=e.iridescenceThicknessRange[1],e.iridescenceThicknessMap&&(i={index:r.processTexture(e.iridescenceThicknessMap)},r.applyTextureTransform(i,e.iridescenceThicknessMap),a.iridescenceThicknessTexture=i),t.extensions=t.extensions||{},t.extensions[this.name]=a,n[this.name]=!0)}}]),e}(),qe=function(){function e(t){Te(this,e),this.writer=t,this.name="KHR_materials_transmission"}return Ee(e,[{key:"writeMaterial",value:function(e,t){var r,n,a,i;e.isMeshPhysicalMaterial&&0!==e.transmission&&(n=(r=this.writer).extensionsUsed,(a={}).transmissionFactor=e.transmission,e.transmissionMap&&(i={index:r.processTexture(e.transmissionMap)},r.applyTextureTransform(i,e.transmissionMap),a.transmissionTexture=i),t.extensions=t.extensions||{},t.extensions[this.name]=a,n[this.name]=!0)}}]),e}(),Ze=function(){function e(t){Te(this,e),this.writer=t,this.name="KHR_materials_volume"}return Ee(e,[{key:"writeMaterial",value:function(e,t){var r,n,a,i;e.isMeshPhysicalMaterial&&0!==e.transmission&&(n=(r=this.writer).extensionsUsed,(a={}).thicknessFactor=e.thickness,e.thicknessMap&&(i={index:r.processTexture(e.thicknessMap)},r.applyTextureTransform(i,e.thicknessMap),a.thicknessTexture=i),a.attenuationDistance=e.attenuationDistance,a.attenuationColor=e.attenuationColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=a,n[this.name]=!0)}}]),e}(),Xe=function(){function e(t){Te(this,e),this.writer=t,this.name="KHR_materials_ior"}return Ee(e,[{key:"writeMaterial",value:function(e,t){var r,n;e.isMeshPhysicalMaterial&&1.5!==e.ior&&(r=this.writer.extensionsUsed,(n={}).ior=e.ior,t.extensions=t.extensions||{},t.extensions[this.name]=n,r[this.name]=!0)}}]),e}(),Qe=function(){function e(t){Te(this,e),this.writer=t,this.name="KHR_materials_specular"}return Ee(e,[{key:"writeMaterial",value:function(e,t){var r,n,a,i;e.isMeshPhysicalMaterial&&(1!==e.specularIntensity||!e.specularColor.equals(Be)||e.specularIntensityMap||e.specularColorTexture)&&(n=(r=this.writer).extensionsUsed,a={},e.specularIntensityMap&&(i={index:r.processTexture(e.specularIntensityMap)},r.applyTextureTransform(i,e.specularIntensityMap),a.specularTexture=i),e.specularColorMap&&(i={index:r.processTexture(e.specularColorMap)},r.applyTextureTransform(i,e.specularColorMap),a.specularColorTexture=i),a.specularFactor=e.specularIntensity,a.specularColorFactor=e.specularColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=a,n[this.name]=!0)}}]),e}(),Ye=function(){function e(t){Te(this,e),this.writer=t,this.name="KHR_materials_sheen"}return Ee(e,[{key:"writeMaterial",value:function(e,t){var r,n,a,i;e.isMeshPhysicalMaterial&&0!=e.sheen&&(n=(r=this.writer).extensionsUsed,a={},e.sheenRoughnessMap&&(i={index:r.processTexture(e.sheenRoughnessMap)},r.applyTextureTransform(i,e.sheenRoughnessMap),a.sheenRoughnessTexture=i),e.sheenColorMap&&(i={index:r.processTexture(e.sheenColorMap)},r.applyTextureTransform(i,e.sheenColorMap),a.sheenColorTexture=i),a.sheenRoughnessFactor=e.sheenRoughness,a.sheenColorFactor=e.sheenColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=a,n[this.name]=!0)}}]),e}(),Je=function(){function e(t){Te(this,e),this.writer=t,this.name="KHR_materials_emissive_strength"}return Ee(e,[{key:"writeMaterial",value:function(e,t){var r,n;e.isMeshStandardMaterial&&1!==e.emissiveIntensity&&(r=this.writer.extensionsUsed,(n={}).emissiveStrength=e.emissiveIntensity,t.extensions=t.extensions||{},t.extensions[this.name]=n,r[this.name]=!0)}}]),e}();ke.Utils={insertKeyframe:function(e,t){var r,n=e.getValueSize(),a=new e.TimeBufferType(e.times.length+1),i=new e.ValueBufferType(e.values.length+n),s=e.createInterpolant(new e.ValueBufferType(n));if(0===e.times.length){a[0]=t;for(var o=0;o<n;o++)i[o]=0;r=0}else if(t<e.times[0]){if(Math.abs(e.times[0]-t)<.001)return 0;a[0]=t,a.set(e.times,1),i.set(s.evaluate(t),0),i.set(e.values,n),r=0}else if(t>e.times[e.times.length-1]){if(Math.abs(e.times[e.times.length-1]-t)<.001)return e.times.length-1;a[a.length-1]=t,a.set(e.times,0),i.set(e.values,0),i.set(s.evaluate(t),e.values.length),r=a.length-1}else for(var l=0;l<e.times.length;l++){if(Math.abs(e.times[l]-t)<.001)return l;if(e.times[l]<t&&e.times[l+1]>t){a.set(e.times.slice(0,l+1),0),a[l+1]=t,a.set(e.times.slice(l+1),l+2),i.set(e.values.slice(0,(l+1)*n),0),i.set(s.evaluate(t),(l+1)*n),i.set(e.values.slice((l+1)*n),(l+2)*n),r=l+1;break}}return e.times=a,e.values=i,r},mergeMorphTargetTracks:function(e,t){for(var r=[],n={},a=e.tracks,i=0;i<a.length;++i){var o=a[i],l=s.PropertyBinding.parseTrackName(o.name),c=s.PropertyBinding.findNode(t,l.nodeName);if("morphTargetInfluences"!==l.propertyName||void 0===l.propertyIndex)r.push(o);else{if(o.createInterpolant!==o.InterpolantFactoryMethodDiscrete&&o.createInterpolant!==o.InterpolantFactoryMethodLinear){if(o.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline)throw new Error("THREE.GLTFExporter: Cannot merge tracks with glTF CUBICSPLINE interpolation.");console.warn("THREE.GLTFExporter: Morph target interpolation mode not yet supported. Using LINEAR instead."),(o=o.clone()).setInterpolation(s.InterpolateLinear)}var u=c.morphTargetInfluences.length,h=c.morphTargetDictionary[l.propertyIndex];if(void 0===h)throw new Error("THREE.GLTFExporter: Morph target name not found: "+l.propertyIndex);var d=void 0;if(void 0===n[c.uuid]){for(var p=new((d=o.clone()).ValueBufferType)(u*d.times.length),f=0;f<d.times.length;f++)p[f*u+h]=d.values[f];d.name=(l.nodeName||"")+".morphTargetInfluences",d.values=p,n[c.uuid]=d,r.push(d)}else{var m=o.createInterpolant(new o.ValueBufferType(1));d=n[c.uuid];for(var g=0;g<d.times.length;g++)d.values[g*u+h]=m.evaluate(d.times[g]);for(var v=0;v<o.times.length;v++){var b=this.insertKeyframe(d,o.times[v]);d.values[b*u+h]=o.values[v]}}}}return e.tracks=r,e}};class $e{constructor(e){this.map=new k.Z,this.loadMap=new M.Z,this.exportMap=new M.Z,this.runScene=e,this.loadMap}bind(e){this.processMap(e),this.map.add(e)}processMap(e){e.loadCallBacks.map(((e,t)=>{let r=this.loadMap.get(e);r||(r=new k.Z,this.loadMap.set(e,r)),r.add(t)})),e.exportCallBacks.map(((e,t)=>{let r=this.exportMap.get(e);r||(r=new k.Z,this.exportMap.set(e,r)),r.add(t)}))}loadCallback(e){const{type:t,json:r,data:n,config:a,core:i}=e;return null==(e=this.loadMap.get(t))?void 0:e.map((e=>e({json:r,data:n,config:a,core:i})))}}var et=r(898),tt=r(4330),rt=r(932),nt=r(3736),at=function(e,t,r,n){return new(r=r||Promise)((function(a,i){function s(e){try{l(n.next(e))}catch(e){i(e)}}function o(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?a(e.value):((t=e.value)instanceof r?t:new r((function(e){e(t)}))).then(s,o)}l((n=n.apply(e,t||[])).next())}))};class it{constructor(e){this.materialMap={},this.textureMap={},this.parseScenePeding=[],this.materialMapToJsonPending=[],this.geoDefMaterialMap=new M.Z;var{type:e,runScene:t,helper:r}=e;this.type=e,this.helper=r,this.runScene=t}parse(e){return at(this,void 0,void 0,(function*(){var t=this.createTextureGroup(e);"scene"===this.type&&this.parseScene(t),this.parseModel(e),this.materialMapToJson(),yield Promise.all(this.parseScenePeding),this.setMultipMaterial(t,Object.keys(this.textureMap))}))}createTextureGroup(e){const t=new s.Group;return t.name="back-texture-ex",t.userData.isHelper=!0,e.add(t),t}parseUnDelAbleTexture(){(0,i.mapObj)(this.runScene.uniqueEx.texture.map,((e,t)=>{t=t.texture,(0,et.isInvalidTexture)(t)||et.unDelAbleTexture.is(t)&&!this.mergeSame(t)&&this.parseTexture(t)}))}parseScene(e){this.helper.ex=Object.assign(Object.assign({},this.helper.ex),this._getBaseEx(e)),this.parseUnDelAbleTexture()}_getBaseEx(e){var t=this.runScene.sceneEx.get(),r=this.runScene.optionsEx.exporterOptions.outTime,n=this.runScene.sceneEx.envStrength;return{version:{core:"0.0.88",editor:"0.0.2"},base64:(0,E.Ni)(String(r)),camera:b.Z.toJSON(this.runScene),sceneEx:Object.assign(Object.assign({},nt.ZP.toJSON(t,this.runScene)),this._bindSceneTextures(e)),timeLine:this.runScene.timeLineEx.getSavedData(),envStrength:n,objects:this.runScene.objects.toJSON(),tags:this.runScene.tags.toJSON(),options:this.runScene.exporter.gltf.options.getOptions(t)}}_bindSceneTextures(e){var t=this.runScene.sceneEx.get();const r={};if((0,et.isTexture)(t.background)||(0,et.isTexture)(t.environment)){this.runScene.pp.setUpdate(!1);const{background:n,environment:a}=t,i=(this.runScene.pp.setUpdate(!0),(0,h.createDefModel)("Box")),s=(0,rt.createDefMaterial)();i.material=s,e.add(i),t=s.userData.id,r.materialId=t;let o=[];(0,et.isTexture)(n)&&(n.userData.notCompress=!0,o.push({type:"map",texture:n}),303===(s.map=n).mapping&&(r.backgroundMapping=303)),(0,et.isTexture)(a)&&(a.userData.notCompress=!0,o.push({type:"envMap",texture:a}),s.envMap=a),this.materialMap[t]={normalMaterial:s,models:[],normal:{},textures:o}}return r}compressLocal(e){var{x:t,y:r,z:n}=e.position;0===t&&0===r&&0===n||(e.position.set(0,0,0),e.userData.local=t+","+r+","+n)}parseModel(e){const t=new Set;e.traverse((e=>t.add(e))),t.forEach((e=>{this._processMaterial(e),this._processModel(e)}))}_processModel(e){(0,h.withAnima)(e)&&(t=e.animations.map((e=>e.toJSON())),(0,nt.M)(e,"animations",t));var t=this.runScene.modelEx.importAndExport.toNromal({type:(null==(t=null==(t=e.userData)?void 0:t.normal)?void 0:t.type)||e.type,model:e,runScene:this.runScene});t!==e&&(e.parent.add(t),e.parent.remove(e)),this.runScene.optionsEx.options.hideLocal&&this.compressLocal(t)}_processMaterial(e){if((0,rt.isMaterial)(e.material)){const n=this.materialMap[e.material.userData.id];if(n)return n.normalMaterial&&(e.material=n.normalMaterial),void n.models.push(e);var t=this.runScene.materialEx.isBaseMaterial(e.material),r=e.material;const{material:a,normal:i,textures:s}=t||this.runScene.optionsEx.exporterOptions.notMaterial?this.getMaterialFromModel(e):this.runScene.materialEx.toNromal(e.material);e.material=a,t=r.userData.id,a.userData.id=t,this.materialMap[t]={oldMaterial:r,normalMaterial:a,models:[e],normal:i,textures:s}}}materialMapToJson(){(0,i.mapObj)(this.materialMap,((e,t)=>{var{normalMaterial:t,textures:r,normal:n}=t,a=t.userData.id;this.helper.ex.materialMap[a]||(this.helper.ex.materialMap[a]={normal:n,textures:{}},this.mergeAndRemoveTexture(r,t,this.materialMapToJsonPending))})),this.parseScenePeding.push((0,i.eachTriggerArray)(this.materialMapToJsonPending))}mergeSame(e){return at(this,void 0,void 0,(function*(){e.userData||(e.userData={});var t=e.userData;if((0,et.isClonedTexture)(e))e=this.parseCloneTexture(e);else if((0,et.isCubeTexture)(e)){var r=this.textureMap[e.userData.id];e=r?r.texture:yield this.parseCubeTexture(e)}else for(const r in this.textureMap){var n=this.textureMap[r],{md5:a,texture:i}=n;if(t.md5===a&&e.mapping===i.mapping&&!(0,et.isClonedTexture)(n.texture))return{isSame:!0,texture:i}}return this.textureMap[e.userData.id]=Object.assign(Object.assign({},t),{texture:e}),{isSame:!1,texture:e}}))}parseTexture(e){var t,{format:r,repeat:n,center:a,rotation:i,offset:s}=e;const o={format:r};3e3!==e.encoding&&(o.encoding=3001),this.runScene.modelEx.isNavieV2(n,1)||(({x:r,y:t}=n),o.repeat=r===t?r:n),this.runScene.modelEx.isNavieV2(a,0)||(({x:t,y:r}=a),o.center=t===r?t:a),this.runScene.modelEx.isNavieV2(s,0)||(({x:n,y:r}=s),o.offset=n===r?n:s),0!==i&&(o.rotation=i),this.helper.ex.textureMap[e.userData.id]=o}parseCubeTexture(e){return new Promise((t=>at(this,void 0,void 0,(function*(){let r=new s.Texture(new Image(1,1));var n=Object.keys(e.userData.blobMap).map(((t,r)=>at(this,void 0,void 0,(function*(){var n=e.userData.blobMap[t],a=e.source.data[r];a=yield(0,et.parseImageBitMapByBlob)(a);const o=new s.Texture(a);o.needsUpdate=!0,a=(0,i.getId)(),(0,et.setMimeForTexture)(o,n.type),o.userData={id:a,blob:n,mimeType:n.type},e.userData.cubeMap||(e.userData.cubeMap={}),e.userData.cubeMap[t]=a,this.textureMap[a]=Object.assign(Object.assign({},o.userData),{texture:o}),this.helper.ex.textureMap[o.userData.id]={isHelper:!0,format:o.format}}))));yield Promise.all(n),e.userData.lightProbe&&(e.userData.lightProbeIntensity=e.userData.lightProbe.intensity),r.userData=Object.assign({},e.userData),t(r)}))))}mergeAndRemoveTexture(e,t,r){return at(this,void 0,void 0,(function*(){e.map((e=>{r.push((()=>at(this,void 0,void 0,(function*(){if(!(0,et.isInvalidTexture)(e.texture)){var{type:r,texture:n}=e;this.runScene.uniqueEx.texture.add(n),t[r]=null;const a=(yield this.mergeSame(n)).texture;this.helper.ex.textureMap[a.userData.id]||this.parseTexture(a),"normalMap"!==r||a.userData.isNormalMap||(a.userData.isNormalMap=!0),this.helper.ex.materialMap[t.userData.id].textures[r]=a.userData.id}}))))}))}))}parseCloneTexture(e){const t=e.clone();t.userData=Object.assign({},e.userData);var{width:e,height:r}=e.image;const n=document.createElement("canvas");return n.width=e,n.height=r,t.image=n,t.userData.blob=new Blob([]),t}setMultipMaterial(e,t){const r=this.runScene.modelEx.create("Box"),n=(0,rt.createDefMaterial)();r.material=n,e.add(r);for(const e of tt.sG){if(!t.length)return;var a=t.pop();if(!a)return;n[e]=this.textureMap[a].texture}t.length&&this.setMultipMaterial(e,t)}getMaterialFromModel(e){return e&&e.geometry?(e=e.geometry.uuid,this.geoDefMaterialMap.get(e)||this.geoDefMaterialMap.set(e,(0,rt.createDefMaterial)()),{material:this.geoDefMaterialMap.get(e),normal:{},textures:[]}):{material:this.runScene.materialEx.defMaterial,normal:{},textures:[]}}}class st extends o{constructor(){super(...arguments),this.savedMap=new M.Z,this.clonedMap=new M.Z}getSameNode(e){return this.savedMap.find(((t,r)=>r.materialUuid===e.material.uuid&&r.geometryUuid===e.geometry.uuid))}parseUnClonedModel(e){var t,r=(0,O.Ki)(e);e.material&&e.geometry&&((t=this.getSameNode(e))&&(0,h.setClonedModel)(e,t.id),this.savedMap.set(r,{id:r,geometryUuid:e.geometry.uuid,materialUuid:e.material.uuid}))}parseClonedModel(e){var t=(0,h.getClonedIdModel)(e),r=(0,O.Ki)(e);this.clonedMap.get(t)||this.clonedMap.set(t,{newId:void 0,ids:new Set});const n=this.clonedMap.get(t);n&&(n.ids.add(r),n.newId||this.runScene.uniqueEx.model.get(t)||(t=(0,O.Ki)(e),n.newId=t),n.newId&&(n.newId!==r?(0,h.setClonedModel)(e,n.newId):(0,h.delClonedModel)(e)))}parseNode(e){(0,h.getClonedIdModel)(e)?this.parseClonedModel(e):this.parseUnClonedModel(e)}}class ot{constructor(){this.savedMap=new M.Z}getSameCount(e){return this.savedMap.filterData(((t,r)=>r.geometry.attributes.normal.count===e)).map((e=>e.val))}setSameNode(e,t){e.geometry=t}getSameGeo(e,t){var{normal:r,position:n,uv:a}=e.attributes;for(const e of t){var{normal:i,position:s,uv:o}=e.attributes;if(r.array.length===i.array.length&&n.array.length===s.array.length&&a.array.length===o.array.length&&(i=(0,E.F1)([...r.array],[...i.array],2e3<r.length?2e3:"fill"),s=(0,E.F1)([...n.array],[...s.array],2e3<n.length?2e3:"fill"),o=(0,E.F1)([...a.array],[...o.array],2e3<a.length?2e3:"fill"),i&&s&&o))return e}}parseNode(e){if(e&&e.geometry&&e.geometry.attributes&&e.geometry.attributes.normal&&e.geometry.attributes.position&&e.geometry.attributes.uv&&!this.savedMap.get(e.geometry.uuid)){var t=e.geometry,r=(r=t.attributes.normal).count;const a=this.getSameCount(r);if(a){var n=this.getSameGeo(t,a.map((e=>e.geometry)));if(n)return this.setSameNode(e,n)}this.savedMap.set(t.uuid,{count:r,geometry:t})}}}class lt{constructor(){this.optionsConfigs={}}getParse(e){return this.optionsConfigs[e]}addOption(e){var t=e.type;if(this.optionsConfigs[t])throw TypeError("该配置项已被挂载");this.optionsConfigs[t]=e}getOptions(e){return Object.values(this.optionsConfigs).map((t=>{const{process:r,type:n}=t;return{type:n,data:r(e)}}))}}class ct{constructor(e){this.helperModels=[],this.mergeSameGeo=new ot,this.pending=[];var{type:e,runScene:t,model:r}=e;this.runScene=t,this.type=e,this.bindClondId=new st(t),this.ex={materialMap:{},textureMap:{},type:e},this.before=new it({helper:this,type:e,runScene:t}),this.pending.push(this.before.parse(r))}parseNode(e){let{object:t,nodeDef:r}=e;return this.mergeSameGeo.parseNode(t),this.bindClondId.parseNode(t),(0,i.mapObj)(this.runScene.modelEx.defNodeMap,((e,n)=>{t[e]!==n&&(r[e]=t[e])})),t.material&&t.material.wireframe&&(t.material.wireframe=!1,r.wireframe=!0),t}parseMaterial(e){const{material:t,materialDef:r}=e;r.id=t.userData.id,this.ex.materialMap[t.userData.id]||(this.ex.materialMap[t.userData.id]={normal:{},textures:{}}),this.ex.materialMap[t.userData.id].normal=Object.assign(Object.assign({},this.ex.materialMap[t.userData.id].normal),this.runScene.materialEx.getDefNromals(t))}parseTexture(e){let{texture:t,textureDef:r}=e;(0,et.mergeDefUserData)(t.userData,r),(0,et.isClonedTexture)(t)&&(r.cloneSourceId=(0,et.getCloneIdFromTexture)(t));var{width:e,height:n}=(0,et.getSizeByTexture)(t);r.size={w:e,h:n}}getNodeMapValueWithBone(e,t){for(const r of t.keys())if(r.userData.id===e.userData.id)return t.get(r)}done(e){e.asset.ex=this.ex,this.runScene.optionsEx.log([e,"json"]),this.runScene.cb.exporter.gltf.complete.cb({json:e})}}var ut=function(e,t,r,n){return new(r=r||Promise)((function(a,i){function s(e){try{l(n.next(e))}catch(e){i(e)}}function o(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?a(e.value):((t=e.value)instanceof r?t:new r((function(e){e(t)}))).then(s,o)}l((n=n.apply(e,t||[])).next())}))};class ht extends o{constructor(e){super(e),this._gltf=new V,this._originGltf=new ke,this.options=new lt,this.module=new $e(e)}getArrayBuffer(e=this.runScene.sceneEx.getClear(),t){return ut(this,void 0,void 0,(function*(){const r=new ct({type:t,runScene:this.runScene,model:e});return yield Promise.all(r.pending),new Promise((t=>{this._gltf.parse(e,(e=>{t(e)}),(e=>{console.log(e,"e")}),{binary:!0,onlyVisible:!1,includeCustomExtensions:!0,myOptions:{helper:r,optionsEx:this.runScene.optionsEx}})}))}))}getOriginArrayBuffer(e){return ut(this,void 0,void 0,(function*(){return new Promise((t=>{this._originGltf.parse(e,(e=>{t(e)}),(()=>{}),{binary:!0,onlyVisible:!1,includeCustomExtensions:!0,animations:[...e.animations]})}))}))}model(e,t=!0){return ut(this,void 0,void 0,(function*(){let r=e||this.runScene.modelEx.select,n=[];if(0!==(n=r?[r]:this.runScene.multipSelector.getSelectedList("value")).length){var a=(r=n[0]).name||r.type;const e=new s.Group;e.name="models",h.uselessGroup.set(e,!0),n.map((t=>e.add(this.runScene.modelEx.clone(t,!1))));var o=yield this.getArrayBuffer(e,"model");return t&&(0,i.downloadFile)(new Blob([o]),a+".glb"),o}}))}material(e){var t;return ut(this,void 0,void 0,(function*(){if(r=e||(null==(t=this.runScene.modelEx.select)?void 0:t.material)){const e=(0,h.createDefModel)("Group");let t=r;(t=r instanceof Array?t:[r]).map((t=>{const r=(0,h.createDefModel)("Box");r.material=t,e.add(r)}));var r=r.name||"material",n=yield this.getArrayBuffer(e,"material");(0,i.downloadFile)(new Blob([n]),r+".glb")}}))}scene(e=!0,t="scene"){return ut(this,void 0,void 0,(function*(){this.runScene.cb.exporter.gltf.before.cb(null);var r=yield this.getArrayBuffer(this.runScene.sceneEx.getClear(),t);return e&&(0,i.downloadFile)(new Blob([r]),"scene.glb"),r}))}originModel(e){return ut(this,void 0,void 0,(function*(){var t,r;e&&(t=e.name||e.type,r=yield this.getOriginArrayBuffer(e),(0,i.downloadFile)(new Blob([r]),t+".glb"))}))}}class dt extends o{constructor(e){super(e),this.gltf=new ht(e)}}n=function(e){return URL.createObjectURL(new Blob([e],{type:"text/javascript"}))};try{URL.revokeObjectURL(n(""))}catch(r){n=function(e){return"data:application/javascript;charset=UTF-8,"+encodeURI(e)}}for(var pt=Uint8Array,ft=Uint16Array,mt=Uint32Array,gt=new pt([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),vt=new pt([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),bt=new pt([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),yt=(Q=function(e,t){for(var r=new ft(31),n=0;n<31;++n)r[n]=t+=1<<e[n-1];var a=new mt(r[30]);for(n=1;n<30;++n)for(var i=r[n];i<r[n+1];++i)a[i]=i-r[n]<<5|n;return[r,a]},(X=Q(gt,2))[0]),xt=(Z=X[1],(yt[28]=258,Z[258]=28,q=Q(vt,0))[0]),wt=(q[1],new ft(32768)),St=0;St<32768;++St){var Mt=(43690&St)>>>1|(21845&St)<<1;wt[St]=((65280&(Mt=(61680&(Mt=(52428&Mt)>>>2|(13107&Mt)<<2))>>>4|(3855&Mt)<<4))>>>8|(255&Mt)<<8)>>>1}var Tt=function(e,t,r){for(var n=e.length,a=0,i=new ft(t);a<n;++a)++i[e[a]-1];var s=new ft(t);for(a=0;a<t;++a)s[a]=s[a-1]+i[a-1]<<1;if(r){var o=new ft(1<<t),l=15-t;for(a=0;a<n;++a)if(e[a])for(var c=a<<4|e[a],u=t-e[a],h=s[e[a]-1]++<<u,d=h|(1<<u)-1;h<=d;++h)o[wt[h]>>>l]=c}else for(o=new ft(n),a=0;a<n;++a)e[a]&&(o[a]=wt[s[e[a]-1]++]>>>15-e[a]);return o},_t=new pt(288);for(St=0;St<144;++St)_t[St]=8;for(St=144;St<256;++St)_t[St]=9;for(St=256;St<280;++St)_t[St]=7;for(St=280;St<288;++St)_t[St]=8;var Et=new pt(32);for(St=0;St<32;++St)Et[St]=5;var Dt=Tt(_t,9,1),kt=Tt(Et,5,1),Ot=function(e){for(var t=e[0],r=1;r<e.length;++r)e[r]>t&&(t=e[r]);return t},Pt=function(e,t,r){var n=t/8|0;return(e[n]|e[1+n]<<8)>>(7&t)&r},At=function(e,t){var r=t/8|0;return(e[r]|e[1+r]<<8|e[2+r]<<16)>>(7&t)},Ct=function(e){return(e/8|0)+(7&e&&1)},Rt=function(e,t,r){(null==r||r>e.length)&&(r=e.length);var n=new(e instanceof ft?ft:e instanceof mt?mt:pt)(r-(t=null==t||t<0?0:t));return n.set(e.subarray(t,r)),n};Y=new pt(0),J="undefined"!=typeof TextDecoder&&new TextDecoder;try{J.decode(Y,{stream:!0})}catch(r){}function Lt(e,t,r){var n=r.length-e-1;if(t>=r[n])return n-1;if(t<=r[e])return e;for(var a=e,i=n,s=Math.floor((a+i)/2);t<r[s]||t>=r[s+1];)t<r[s]?i=s:a=s,s=Math.floor((a+i)/2);return s}function It(e,t,r,n){for(var a=[],i=[],s=[],o=a[0]=1;o<=r;++o){i[o]=t-n[e+1-o],s[o]=n[e+o]-t;for(var l=0,c=0;c<o;++c){var u=s[c+1],h=i[o-c],d=a[c]/(u+h);a[c]=l+u*d,l=h*d}a[o]=l}return a}function Bt(e,t,r,n,a){for(var i=a<e?a:e,o=[],l=Lt(e,n,t),c=function(e,t,r,n,a){for(var i=[],s=0;s<=r;++s)i[s]=0;for(var o=[],l=0;l<=n;++l)o[l]=i.slice(0);for(var c=[],u=0;u<=r;++u)c[u]=i.slice(0);c[0][0]=1;for(var h=i.slice(0),d=i.slice(0),p=1;p<=r;++p){h[p]=t-a[e+1-p],d[p]=a[e+p]-t;for(var f=0,m=0;m<p;++m){var g=d[m+1],v=h[p-m],b=(c[p][m]=g+v,c[m][p-1]/c[p][m]);c[m][p]=f+g*b,f=v*b}c[p][p]=f}for(var y=0;y<=r;++y)o[0][y]=c[y][r];for(var x=0;x<=r;++x){for(var w=0,S=1,M=[],T=0;T<=r;++T)M[T]=i.slice(0);for(var _=M[0][0]=1;_<=n;++_){var E=0,D=x-_,k=r-_;_<=x&&(M[S][0]=M[w][0]/c[1+k][D],E=M[S][0]*c[D][k]);for(var O=x-1<=k?_-1:r-x,P=-1<=D?1:-D;P<=O;++P)M[S][P]=(M[w][P]-M[w][P-1])/c[1+k][D+P],E+=M[S][P]*c[D+P][k];x<=k&&(M[S][_]=-M[w][_-1]/c[1+k][x],E+=M[S][_]*c[x][k]),o[_][x]=E;var A=w;w=S,S=A}}for(var C=r,R=1;R<=n;++R){for(var L=0;L<=r;++L)o[R][L]*=C;C*=r-R}return o}(l,n,e,i,t),u=[],h=0;h<r.length;++h){var d=r[h].clone(),p=d.w;d.x*=p,d.y*=p,d.z*=p,u[h]=d}for(var f=0;f<=i;++f){for(var m=u[l-e].clone().multiplyScalar(c[f][0]),g=1;g<=e;++g)m.add(u[l-e+g].clone().multiplyScalar(c[f][g]));o[f]=m}for(var v=i+1;v<=a+1;++v)o[v]=new s.Vector4(0,0,0);return o}function jt(e){for(var t=e.length,r=[],n=[],a=0;a<t;++a){var i=e[a];r[a]=new s.Vector3(i.x,i.y,i.z),n[a]=i.w}for(var o=[],l=0;l<t;++l){for(var c=r[l].clone(),u=1;u<=l;++u)c.sub(o[l-u].clone().multiplyScalar(function(e,t){for(var r=1,n=2;n<=e;++n)r*=n;for(var a=1,i=2;i<=t;++i)a*=i;for(var s=2;s<=e-t;++s)a*=s;return r/a}(l,u)*n[u]));o[l]=c.divideScalar(n[0])}return o}function Ut(e){return(Ut="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})(e)}function Nt(e,t){return(Nt=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function zt(e){return(zt=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Ft,Vt,Gt,Ht=function(e){var t=n;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Nt(t,e);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=zt(e);if(r=t?(r=zt(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===Ut(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(e,t,a,i,o){var l;if(!(this instanceof n))throw new TypeError("Cannot call a class as a function");(l=r.call(this)).degree=e,l.knots=t,l.controlPoints=[],l.startKnot=i||0,l.endKnot=o||l.knots.length-1;for(var c=0;c<a.length;++c){var u=a[c];l.controlPoints[c]=new s.Vector4(u.x,u.y,u.z,u.w)}return l}return t=n,(e=[{key:"getPoint",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new s.Vector3;return e=this.knots[this.startKnot]+e*(this.knots[this.endKnot]-this.knots[this.startKnot]),e=function(e,t,r,n){for(var a=Lt(e,n,t),i=It(a,n,e,t),o=new s.Vector4(0,0,0,0),l=0;l<=e;++l){var c=r[a-e+l],u=i[l],h=c.w*u;o.x+=c.x*h,o.y+=c.y*h,o.z+=c.z*h,o.w+=c.w*u}return o}(this.degree,this.knots,this.controlPoints,e),1!==e.w&&e.divideScalar(e.w),t.set(e.x,e.y,e.z)}},{key:"getTangent",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new s.Vector3,r=(e=this.knots[0]+e*(this.knots[this.knots.length-1]-this.knots[0]),jt(Bt(r=this.degree,this.knots,this.controlPoints,e,1)));return t.copy(r[1]).normalize(),t}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),n}(s.Curve);function Wt(e){return(Wt="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})(e)}function Kt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function qt(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Zt(e,t,r){t&&qt(e.prototype,t),r&&qt(e,r),Object.defineProperty(e,"prototype",{writable:!1})}function Xt(e,t){return(Xt=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Qt(e){return(Qt=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Yt=function(e){var t=n;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Xt(t,e);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Qt(e);if(r=t?(r=Qt(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===Wt(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(e){return Kt(this,n),r.call(this,e)}return Zt(n,[{key:"load",value:function(e,t,r,n){var a=this,i=""===a.path?s.LoaderUtils.extractUrlBase(e):a.path,o=new s.FileLoader(this.manager);o.setPath(a.path),o.setResponseType("arraybuffer"),o.setRequestHeader(a.requestHeader),o.setWithCredentials(a.withCredentials),o.load(e,(function(r){try{t(a.parse(r,i))}catch(r){n?n(r):console.error(r),a.manager.itemError(e)}}),r,n)}},{key:"parse",value:function(e,t){if(n="Kaydara FBX Binary \0",(r=e).byteLength>=n.length&&n===fr(r,0,n.length))Ft=(new rr).parse(e);else{if(!function(e){for(var t=["K","a","y","d","a","r","a","\\","F","B","X","\\","B","i","n","a","r","y","\\","\\"],r=0,n=0;n<t.length;++n)if(function(t){var n=e[0];return e=e.slice(r+1),r++,n}()===t[n])return;return 1}(r=fr(e)))throw new Error("THREE.FBXLoader: Unknown format.");if(ir(r)<7e3)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+ir(r));Ft=(new tr).parse(r)}var r,n=new s.TextureLoader(this.manager).setPath(this.resourcePath||t).setCrossOrigin(this.crossOrigin);return new Jt(n,this.manager).parse(Ft)}}]),n}(s.Loader),Jt=function(){function e(t,r){Kt(this,e),this.textureLoader=t,this.manager=r}return Zt(e,[{key:"parse",value:function(){Vt=this.parseConnections();var e=this.parseImages(),t=(e=this.parseTextures(e),e=this.parseMaterials(e),this.parseDeformers()),r=(new $t).parse(t);return this.parseScene(t,r,e),Gt}},{key:"parseConnections",value:function(){var e=new Map;return"Connections"in Ft&&Ft.Connections.connections.forEach((function(t){var r=t[0],n=t[1],a=(t=t[2],e.has(r)||e.set(r,{parents:[],children:[]}),{ID:n,relationship:t});e.get(r).parents.push(a),e.has(n)||e.set(n,{parents:[],children:[]}),a={ID:r,relationship:t},e.get(n).children.push(a)})),e}},{key:"parseImages",value:function(){var e,t={},r={};if("Video"in Ft.Objects){var n,a=Ft.Objects.Video;for(n in a){var i,s,o=a[n];t[parseInt(n)]=o.RelativeFilename||o.Filename,"Content"in o&&(s=o.Content instanceof ArrayBuffer&&0<o.Content.byteLength,i="string"==typeof o.Content&&""!==o.Content,(s||i)&&(s=this.parseImage(a[n]),r[o.RelativeFilename||o.Filename]=s))}}for(e in t){var l=t[e];void 0!==r[l]?t[e]=r[l]:t[e]=t[e].split("\\").pop()}return t}},{key:"parseImage",value:function(e){var t,r=e.Content,n=e.RelativeFilename||e.Filename,a=n.slice(n.lastIndexOf(".")+1).toLowerCase();switch(a){case"bmp":t="image/bmp";break;case"jpg":case"jpeg":t="image/jpeg";break;case"png":t="image/png";break;case"tif":t="image/tiff";break;case"tga":null===this.manager.getHandler(".tga")&&console.warn("FBXLoader: TGA loader not found, skipping ",n),t="image/tga";break;default:return void console.warn('FBXLoader: Image type "'+a+'" is not supported.')}return"string"==typeof r?"data:"+t+";base64,"+r:(e=new Uint8Array(r),window.URL.createObjectURL(new Blob([e],{type:t})))}},{key:"parseTextures",value:function(e){var t=new Map;if("Texture"in Ft.Objects){var r,n=Ft.Objects.Texture;for(r in n){var a=this.parseTexture(n[r],e);t.set(parseInt(r),a)}}return t}},{key:"parseTexture",value:function(e,t){var r=((t=this.loadTexture(e,t)).ID=e.id,t.name=e.attrName,e.WrapModeU),n=e.WrapModeV;return r=void 0!==r?r.value:0,n=void 0!==n?n.value:0,t.wrapS=0===r?s.RepeatWrapping:s.ClampToEdgeWrapping,t.wrapT=0===n?s.RepeatWrapping:s.ClampToEdgeWrapping,"Scaling"in e&&(r=e.Scaling.value,t.repeat.x=r[0],t.repeat.y=r[1]),"Translation"in e&&(n=e.Translation.value,t.offset.x=n[0],t.offset.y=n[1]),t}},{key:"loadTexture",value:function(e,t){var r,n=this.textureLoader.path,a=Vt.get(e.id).children;return a="tga"===(void 0!==a&&0<a.length&&void 0!==t[a[0].ID]&&(0!==(r=t[a[0].ID]).indexOf("blob:")&&0!==r.indexOf("data:")||this.textureLoader.setPath(void 0)),t=e.FileName.slice(-3).toLowerCase())?null===(a=this.manager.getHandler(".tga"))?(console.warn("FBXLoader: TGA loader not found, creating placeholder texture for",e.RelativeFilename),new s.Texture):(a.setPath(this.textureLoader.path),a.load(r)):"psd"===t?(console.warn("FBXLoader: PSD textures are not supported, creating placeholder texture for",e.RelativeFilename),new s.Texture):this.textureLoader.load(r),this.textureLoader.setPath(n),a}},{key:"parseMaterials",value:function(e){var t=new Map;if("Material"in Ft.Objects){var r,n=Ft.Objects.Material;for(r in n){var a=this.parseMaterial(n[r],e);null!==a&&t.set(parseInt(r),a)}}return t}},{key:"parseMaterial",value:function(e,t){var r,n=e.id,a=e.attrName,i=e.ShadingModel;if("object"===Wt(i)&&(i=i.value),!Vt.has(n))return null;switch(e=this.parseParameters(e,t,n),i.toLowerCase()){case"phong":r=new s.MeshPhongMaterial;break;case"lambert":r=new s.MeshLambertMaterial;break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.',i),r=new s.MeshPhongMaterial}return r.setValues(e),r.name=a,r}},{key:"parseParameters",value:function(e,t,r){var n={},a=(e.BumpFactor&&(n.bumpScale=e.BumpFactor.value),e.Diffuse?n.color=(new s.Color).fromArray(e.Diffuse.value):!e.DiffuseColor||"Color"!==e.DiffuseColor.type&&"ColorRGB"!==e.DiffuseColor.type||(n.color=(new s.Color).fromArray(e.DiffuseColor.value)),e.DisplacementFactor&&(n.displacementScale=e.DisplacementFactor.value),e.Emissive?n.emissive=(new s.Color).fromArray(e.Emissive.value):!e.EmissiveColor||"Color"!==e.EmissiveColor.type&&"ColorRGB"!==e.EmissiveColor.type||(n.emissive=(new s.Color).fromArray(e.EmissiveColor.value)),e.EmissiveFactor&&(n.emissiveIntensity=parseFloat(e.EmissiveFactor.value)),e.Opacity&&(n.opacity=parseFloat(e.Opacity.value)),n.opacity<1&&(n.transparent=!0),e.ReflectionFactor&&(n.reflectivity=e.ReflectionFactor.value),e.Shininess&&(n.shininess=e.Shininess.value),e.Specular?n.specular=(new s.Color).fromArray(e.Specular.value):e.SpecularColor&&"Color"===e.SpecularColor.type&&(n.specular=(new s.Color).fromArray(e.SpecularColor.value)),this);return Vt.get(r).children.forEach((function(e){var r=e.relationship;switch(r){case"Bump":n.bumpMap=a.getTexture(t,e.ID);break;case"Maya|TEX_ao_map":n.aoMap=a.getTexture(t,e.ID);break;case"DiffuseColor":case"Maya|TEX_color_map":n.map=a.getTexture(t,e.ID),void 0!==n.map&&(n.map.encoding=s.sRGBEncoding);break;case"DisplacementColor":n.displacementMap=a.getTexture(t,e.ID);break;case"EmissiveColor":n.emissiveMap=a.getTexture(t,e.ID),void 0!==n.emissiveMap&&(n.emissiveMap.encoding=s.sRGBEncoding);break;case"NormalMap":case"Maya|TEX_normal_map":n.normalMap=a.getTexture(t,e.ID);break;case"ReflectionColor":n.envMap=a.getTexture(t,e.ID),void 0!==n.envMap&&(n.envMap.mapping=s.EquirectangularReflectionMapping,n.envMap.encoding=s.sRGBEncoding);break;case"SpecularColor":n.specularMap=a.getTexture(t,e.ID),void 0!==n.specularMap&&(n.specularMap.encoding=s.sRGBEncoding);break;case"TransparentColor":case"TransparencyFactor":n.alphaMap=a.getTexture(t,e.ID),n.transparent=!0;break;default:console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.",r)}})),n}},{key:"getTexture",value:function(e,t){return"LayeredTexture"in Ft.Objects&&t in Ft.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),t=Vt.get(t).children[0].ID),e.get(t)}},{key:"parseDeformers",value:function(){var e={},t={};if("Deformer"in Ft.Objects){var r,n=Ft.Objects.Deformer;for(r in n){var a,i=n[r],s=Vt.get(parseInt(r));"Skin"===i.attrType?((a=this.parseSkeleton(s,n)).ID=r,1<s.parents.length&&console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."),a.geometryID=s.parents[0].ID,e[r]=a):"BlendShape"===i.attrType&&((a={id:r}).rawTargets=this.parseMorphTargets(s,n),a.id=r,1<s.parents.length&&console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),t[r]=a)}}return{skeletons:e,morphTargets:t}}},{key:"parseSkeleton",value:function(e,t){var r=[];return e.children.forEach((function(e){var n=t[e.ID];"Cluster"===n.attrType&&(e={ID:e.ID,indices:[],weights:[],transformLink:(new s.Matrix4).fromArray(n.TransformLink.a)},"Indexes"in n&&(e.indices=n.Indexes.a,e.weights=n.Weights.a),r.push(e))})),{rawBones:r,bones:[]}}},{key:"parseMorphTargets",value:function(e,t){for(var r=[],n=0;n<e.children.length;n++){var a=e.children[n],i=t[a.ID],s={name:i.attrName,initialWeight:i.DeformPercent,id:i.id,fullWeights:i.FullWeights.a};if("BlendShapeChannel"!==i.attrType)return;s.geoID=Vt.get(parseInt(a.ID)).children.filter((function(e){return void 0===e.relationship}))[0].ID,r.push(s)}return r}},{key:"parseScene",value:function(e,t,r){Gt=new s.Group;var n=this.parseModels(e.skeletons,t,r),a=Ft.Objects.Model,i=this;n.forEach((function(e){var t=a[e.ID];i.setLookAtProperties(e,t),Vt.get(e.ID).parents.forEach((function(t){void 0!==(t=n.get(t.ID))&&t.add(e)})),null===e.parent&&Gt.add(e)})),this.bindSkeleton(e.skeletons,t,n),this.createAmbientLight(),Gt.traverse((function(e){var t;e.userData.transformData&&(e.parent&&(e.userData.transformData.parentMatrix=e.parent.matrix,e.userData.transformData.parentMatrixWorld=e.parent.matrixWorld),t=hr(e.userData.transformData),e.applyMatrix4(t),e.updateWorldMatrix())})),r=(new er).parse(),1===Gt.children.length&&Gt.children[0].isGroup&&(Gt.children[0].animations=r,Gt=Gt.children[0]),Gt.animations=r}},{key:"parseModels",value:function(e,t,r){var n,a=new Map,i=Ft.Objects.Model;for(n in i){var o=parseInt(n),l=i[n],c=Vt.get(o),u=this.buildSkeleton(c,e,o,l.attrName);if(!u){switch(l.attrType){case"Camera":u=this.createCamera(c);break;case"Light":u=this.createLight(c);break;case"Mesh":u=this.createMesh(c,t,r);break;case"NurbsCurve":u=this.createCurve(c,t);break;case"LimbNode":case"Root":u=new s.Bone;break;default:u=new s.Group}u.name=l.attrName?s.PropertyBinding.sanitizeNodeName(l.attrName):"",u.ID=o}this.getTransformData(u,l),a.set(o,u)}return a}},{key:"buildSkeleton",value:function(e,t,r,n){var a=null;return e.parents.forEach((function(e){for(var i in t)!function(i){var o=t[i];o.rawBones.forEach((function(t,i){var l;t.ID===e.ID&&(l=a,(a=new s.Bone).matrixWorld.copy(t.transformLink),a.name=n?s.PropertyBinding.sanitizeNodeName(n):"",a.ID=r,o.bones[i]=a,null!==l&&a.add(l))}))}(i)})),a}},{key:"createCamera",value:function(e){var t,r;if(e.children.forEach((function(e){void 0!==(e=Ft.Objects.NodeAttribute[e.ID])&&(r=e)})),void 0===r)t=new s.Object3D;else{var n=0,a=(void 0!==r.CameraProjectionType&&1===r.CameraProjectionType.value&&(n=1),1),i=(void 0!==r.NearPlane&&(a=r.NearPlane.value/1e3),1e3),o=(void 0!==r.FarPlane&&(i=r.FarPlane.value/1e3),window.innerWidth),l=window.innerHeight,c=(void 0!==r.AspectWidth&&void 0!==r.AspectHeight&&(o=r.AspectWidth.value,l=r.AspectHeight.value),o/l),u=45,h=(void 0!==r.FieldOfView&&(u=r.FieldOfView.value),r.FocalLength?r.FocalLength.value:null);switch(n){case 0:t=new s.PerspectiveCamera(u,c,a,i),null!==h&&t.setFocalLength(h);break;case 1:t=new s.OrthographicCamera(-o/2,o/2,l/2,-l/2,a,i);break;default:console.warn("THREE.FBXLoader: Unknown camera type "+n+"."),t=new s.Object3D}}return t}},{key:"createLight",value:function(e){var t,r;if(e.children.forEach((function(e){void 0!==(e=Ft.Objects.NodeAttribute[e.ID])&&(r=e)})),void 0===r)t=new s.Object3D;else{e=void 0===r.LightType?0:r.LightType.value;var n=16777215,a=(void 0!==r.Color&&(n=(new s.Color).fromArray(r.Color.value)),void 0===r.Intensity?1:r.Intensity.value/100),i=(void 0!==r.CastLightOnObject&&0===r.CastLightOnObject.value&&(a=0),0);switch(void 0!==r.FarAttenuationEnd&&(i=void 0!==r.EnableFarAttenuation&&0===r.EnableFarAttenuation.value?0:r.FarAttenuationEnd.value),e){case 0:t=new s.PointLight(n,a,i,1);break;case 1:t=new s.DirectionalLight(n,a);break;case 2:var o=Math.PI/3,l=(void 0!==r.InnerAngle&&(o=s.MathUtils.degToRad(r.InnerAngle.value)),0);void 0!==r.OuterAngle&&(l=s.MathUtils.degToRad(r.OuterAngle.value),l=Math.max(l,1)),t=new s.SpotLight(n,a,i,o,l,1);break;default:console.warn("THREE.FBXLoader: Unknown light type "+r.LightType.value+", defaulting to a PointLight."),t=new s.PointLight(n,a)}void 0!==r.CastShadows&&1===r.CastShadows.value&&(t.castShadow=!0)}return t}},{key:"createMesh",value:function(e,t,r){var n,a=null,i=null,o=[];return e.children.forEach((function(e){t.has(e.ID)&&(a=t.get(e.ID)),r.has(e.ID)&&o.push(r.get(e.ID))})),1<o.length?i=o:0<o.length?i=o[0]:(i=new s.MeshPhongMaterial({color:13421772}),o.push(i)),"color"in a.attributes&&o.forEach((function(e){e.vertexColors=!0})),a.FBX_Deformer?(n=new s.SkinnedMesh(a,i)).normalizeSkinWeights():n=new s.Mesh(a,i),n}},{key:"createCurve",value:function(e,t){e=e.children.reduce((function(e,r){return t.has(r.ID)?t.get(r.ID):e}),null);var r=new s.LineBasicMaterial({color:3342591,linewidth:1});return new s.Line(e,r)}},{key:"getTransformData",value:function(e,t){var r={};"InheritType"in t&&(r.inheritType=parseInt(t.InheritType.value)),r.eulerOrder="RotationOrder"in t?dr(t.RotationOrder.value):"ZYX","Lcl_Translation"in t&&(r.translation=t.Lcl_Translation.value),"PreRotation"in t&&(r.preRotation=t.PreRotation.value),"Lcl_Rotation"in t&&(r.rotation=t.Lcl_Rotation.value),"PostRotation"in t&&(r.postRotation=t.PostRotation.value),"Lcl_Scaling"in t&&(r.scale=t.Lcl_Scaling.value),"ScalingOffset"in t&&(r.scalingOffset=t.ScalingOffset.value),"ScalingPivot"in t&&(r.scalingPivot=t.ScalingPivot.value),"RotationOffset"in t&&(r.rotationOffset=t.RotationOffset.value),"RotationPivot"in t&&(r.rotationPivot=t.RotationPivot.value),e.userData.transformData=r}},{key:"setLookAtProperties",value:function(e,t){"LookAtProperty"in t&&Vt.get(e.ID).children.forEach((function(t){"LookAtProperty"===t.relationship&&"Lcl_Translation"in(t=Ft.Objects.Model[t.ID])&&(t=t.Lcl_Translation.value,void 0!==e.target?(e.target.position.fromArray(t),Gt.add(e.target)):e.lookAt((new s.Vector3).fromArray(t)))}))}},{key:"bindSkeleton",value:function(e,t,r){var n,a=this.parsePoseNodes();for(n in e)!function(n){var i=e[n];Vt.get(parseInt(i.ID)).parents.forEach((function(e){t.has(e.ID)&&(e=e.ID,Vt.get(e).parents.forEach((function(e){r.has(e.ID)&&r.get(e.ID).bind(new s.Skeleton(i.bones),a[e.ID])})))}))}(n)}},{key:"parsePoseNodes",value:function(){var e={};if("Pose"in Ft.Objects){var t,r,n=Ft.Objects.Pose;for(t in n)"BindPose"===n[t].attrType&&0<n[t].NbPoseNodes&&(r=n[t].PoseNode,Array.isArray(r)?r.forEach((function(t){e[t.Node]=(new s.Matrix4).fromArray(t.Matrix.a)})):e[r.Node]=(new s.Matrix4).fromArray(r.Matrix.a))}return e}},{key:"createAmbientLight",value:function(){var e,t,r;"GlobalSettings"in Ft&&"AmbientColor"in Ft.GlobalSettings&&(r=(t=Ft.GlobalSettings.AmbientColor.value)[0],e=t[1],t=t[2],0===r&&0===e&&0===t||(r=new s.Color(r,e,t),Gt.add(new s.AmbientLight(r,1))))}}]),e}(),$t=function(){function e(){Kt(this,e),this.negativeMaterialIndices=!1}return Zt(e,[{key:"parse",value:function(e){var t=new Map;if("Geometry"in Ft.Objects){var r,n=Ft.Objects.Geometry;for(r in n){var a=Vt.get(parseInt(r));a=this.parseGeometry(a,n[r],e),t.set(parseInt(r),a)}}return!0===this.negativeMaterialIndices&&console.warn("THREE.FBXLoader: The FBX file contains invalid (negative) material indices. The asset might not render as expected."),t}},{key:"parseGeometry",value:function(e,t,r){switch(t.attrType){case"Mesh":return this.parseMeshGeometry(e,t,r);case"NurbsCurve":return this.parseNurbsGeometry(t)}}},{key:"parseMeshGeometry",value:function(e,t,r){var n,a=r.skeletons,i=[],s=e.parents.map((function(e){return Ft.Objects.Model[e.ID]}));if(0!==s.length)return n=e.children.reduce((function(e,t){return void 0!==a[t.ID]?a[t.ID]:e}),null),e.children.forEach((function(e){void 0!==r.morphTargets[e.ID]&&i.push(r.morphTargets[e.ID])})),e=s[0],s={},"RotationOrder"in e&&(s.eulerOrder=dr(e.RotationOrder.value)),"InheritType"in e&&(s.inheritType=parseInt(e.InheritType.value)),"GeometricTranslation"in e&&(s.translation=e.GeometricTranslation.value),"GeometricRotation"in e&&(s.rotation=e.GeometricRotation.value),"GeometricScaling"in e&&(s.scale=e.GeometricScaling.value),e=hr(s),this.genGeometry(t,n,i,e)}},{key:"genGeometry",value:function(e,t,r,n){var a,i,o=new s.BufferGeometry,l=(e.attrName&&(o.name=e.attrName),this.parseGeoNode(e,t)),c=this.genBuffers(l),u=new s.Float32BufferAttribute(c.vertex,3);return u.applyMatrix4(n),o.setAttribute("position",u),0<c.colors.length&&o.setAttribute("color",new s.Float32BufferAttribute(c.colors,3)),t&&(o.setAttribute("skinIndex",new s.Uint16BufferAttribute(c.weightsIndices,4)),o.setAttribute("skinWeight",new s.Float32BufferAttribute(c.vertexWeights,4)),o.FBX_Deformer=t),0<c.normal.length&&(u=(new s.Matrix3).getNormalMatrix(n),(t=new s.Float32BufferAttribute(c.normal,3)).applyNormalMatrix(u),o.setAttribute("normal",t)),c.uvs.forEach((function(e,t){var r="uv"+(t+1).toString();o.setAttribute(r=0===t?"uv":r,new s.Float32BufferAttribute(c.uvs[t],2))})),l.material&&"AllSame"!==l.material.mappingType&&(a=c.materialIndex[0],i=0,c.materialIndex.forEach((function(e,t){e!==a&&(o.addGroup(i,t-i,a),a=e,i=t)})),0<o.groups.length&&(t=(u=o.groups[o.groups.length-1]).start+u.count)!==c.materialIndex.length&&o.addGroup(t,c.materialIndex.length-t,a),0===o.groups.length&&o.addGroup(0,c.materialIndex.length,c.materialIndex[0])),this.addMorphTargets(o,e,r,n),o}},{key:"parseGeoNode",value:function(e,t){var r={};if(r.vertexPositions=void 0!==e.Vertices?e.Vertices.a:[],r.vertexIndices=void 0!==e.PolygonVertexIndex?e.PolygonVertexIndex.a:[],e.LayerElementColor&&(r.color=this.parseVertexColors(e.LayerElementColor[0])),e.LayerElementMaterial&&(r.material=this.parseMaterialIndices(e.LayerElementMaterial[0])),e.LayerElementNormal&&(r.normal=this.parseNormals(e.LayerElementNormal[0])),e.LayerElementUV){r.uv=[];for(var n=0;e.LayerElementUV[n];)e.LayerElementUV[n].UV&&r.uv.push(this.parseUVs(e.LayerElementUV[n])),n++}return r.weightTable={},null!==t&&(r.skeleton=t).rawBones.forEach((function(e,t){e.indices.forEach((function(n,a){void 0===r.weightTable[n]&&(r.weightTable[n]=[]),r.weightTable[n].push({id:t,weight:e.weights[a]})}))})),r}},{key:"genBuffers",value:function(e){var t={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]},r=0,n=0,a=!1,i=[],s=[],o=[],l=[],c=[],u=[],h=this;return e.vertexIndices.forEach((function(d,p){var f,m,g,v,b=!1,y=(d<0&&(d^=-1,b=!0),[]),x=[];if(i.push(3*d,3*d+1,3*d+2),e.color&&(v=lr(p,r,d,e.color),o.push(v[0],v[1],v[2])),e.skeleton){for(void 0!==e.weightTable[d]&&e.weightTable[d].forEach((function(e){x.push(e.weight),y.push(e.id)})),4<x.length&&(a||(console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."),a=!0),m=[0,0,0,0],g=[0,0,0,0],x.forEach((function(e,t){var r=e,n=y[t];g.forEach((function(e,t,a){e<r&&(a[t]=r,r=e,a=m[t],m[t]=n,n=a)}))})),y=m,x=g);x.length<4;)x.push(0),y.push(0);for(var w=0;w<4;++w)c.push(x[w]),u.push(y[w])}e.normal&&(v=lr(p,r,d,e.normal),s.push(v[0],v[1],v[2])),e.material&&"AllSame"!==e.material.mappingType&&(f=lr(p,r,d,e.material)[0])<0&&(h.negativeMaterialIndices=!0,f=0),e.uv&&e.uv.forEach((function(e,t){e=lr(p,r,d,e),void 0===l[t]&&(l[t]=[]),l[t].push(e[0]),l[t].push(e[1])})),n++,b&&(4<n&&console.warn("THREE.FBXLoader: Polygons with more than four sides are not supported. Make sure to triangulate the geometry during export."),h.genFace(t,e,i,f,s,o,l,c,u,n),r++,n=0,i=[],s=[],o=[],l=[],c=[],u=[])})),t}},{key:"genFace",value:function(e,t,r,n,a,i,s,o,l,c){for(var u=2;u<c;u++)!function(c){e.vertex.push(t.vertexPositions[r[0]]),e.vertex.push(t.vertexPositions[r[1]]),e.vertex.push(t.vertexPositions[r[2]]),e.vertex.push(t.vertexPositions[r[3*(c-1)]]),e.vertex.push(t.vertexPositions[r[3*(c-1)+1]]),e.vertex.push(t.vertexPositions[r[3*(c-1)+2]]),e.vertex.push(t.vertexPositions[r[3*c]]),e.vertex.push(t.vertexPositions[r[3*c+1]]),e.vertex.push(t.vertexPositions[r[3*c+2]]),t.skeleton&&(e.vertexWeights.push(o[0]),e.vertexWeights.push(o[1]),e.vertexWeights.push(o[2]),e.vertexWeights.push(o[3]),e.vertexWeights.push(o[4*(c-1)]),e.vertexWeights.push(o[4*(c-1)+1]),e.vertexWeights.push(o[4*(c-1)+2]),e.vertexWeights.push(o[4*(c-1)+3]),e.vertexWeights.push(o[4*c]),e.vertexWeights.push(o[4*c+1]),e.vertexWeights.push(o[4*c+2]),e.vertexWeights.push(o[4*c+3]),e.weightsIndices.push(l[0]),e.weightsIndices.push(l[1]),e.weightsIndices.push(l[2]),e.weightsIndices.push(l[3]),e.weightsIndices.push(l[4*(c-1)]),e.weightsIndices.push(l[4*(c-1)+1]),e.weightsIndices.push(l[4*(c-1)+2]),e.weightsIndices.push(l[4*(c-1)+3]),e.weightsIndices.push(l[4*c]),e.weightsIndices.push(l[4*c+1]),e.weightsIndices.push(l[4*c+2]),e.weightsIndices.push(l[4*c+3])),t.color&&(e.colors.push(i[0]),e.colors.push(i[1]),e.colors.push(i[2]),e.colors.push(i[3*(c-1)]),e.colors.push(i[3*(c-1)+1]),e.colors.push(i[3*(c-1)+2]),e.colors.push(i[3*c]),e.colors.push(i[3*c+1]),e.colors.push(i[3*c+2])),t.material&&"AllSame"!==t.material.mappingType&&(e.materialIndex.push(n),e.materialIndex.push(n),e.materialIndex.push(n)),t.normal&&(e.normal.push(a[0]),e.normal.push(a[1]),e.normal.push(a[2]),e.normal.push(a[3*(c-1)]),e.normal.push(a[3*(c-1)+1]),e.normal.push(a[3*(c-1)+2]),e.normal.push(a[3*c]),e.normal.push(a[3*c+1]),e.normal.push(a[3*c+2])),t.uv&&t.uv.forEach((function(t,r){void 0===e.uvs[r]&&(e.uvs[r]=[]),e.uvs[r].push(s[r][0]),e.uvs[r].push(s[r][1]),e.uvs[r].push(s[r][2*(c-1)]),e.uvs[r].push(s[r][2*(c-1)+1]),e.uvs[r].push(s[r][2*c]),e.uvs[r].push(s[r][2*c+1])}))}(u)}},{key:"addMorphTargets",value:function(e,t,r,n){var a;0!==r.length&&(e.morphTargetsRelative=!0,e.morphAttributes.position=[],a=this,r.forEach((function(r){r.rawTargets.forEach((function(r){var i=Ft.Objects.Geometry[r.geoID];void 0!==i&&a.genMorphGeometry(e,t,i,n,r.name)}))})))}},{key:"genMorphGeometry",value:function(e,t,r,n,a){t=void 0!==t.PolygonVertexIndex?t.PolygonVertexIndex.a:[];for(var i=void 0!==r.Vertices?r.Vertices.a:[],o=void 0!==r.Indexes?r.Indexes.a:[],l=3*e.attributes.position.count,c=new Float32Array(l),u=0;u<o.length;u++){var h=3*o[u];c[h]=i[3*u],c[1+h]=i[3*u+1],c[2+h]=i[3*u+2]}l=this.genBuffers({vertexIndices:t,vertexPositions:c}),(t=new s.Float32BufferAttribute(l.vertex,3)).name=a||r.attrName,t.applyMatrix4(n),e.morphAttributes.position.push(t)}},{key:"parseNormals",value:function(e){var t=e.MappingInformationType,r=e.ReferenceInformationType,n=e.Normals.a,a=[];return"IndexToDirect"===r&&("NormalIndex"in e?a=e.NormalIndex.a:"NormalsIndex"in e&&(a=e.NormalsIndex.a)),{dataSize:3,buffer:n,indices:a,mappingType:t,referenceType:r}}},{key:"parseUVs",value:function(e){var t=e.MappingInformationType,r=e.ReferenceInformationType,n=[];return{dataSize:2,buffer:e.UV.a,indices:n="IndexToDirect"===r?e.UVIndex.a:n,mappingType:t,referenceType:r}}},{key:"parseVertexColors",value:function(e){var t=e.MappingInformationType,r=e.ReferenceInformationType,n=[];return{dataSize:4,buffer:e.Colors.a,indices:n="IndexToDirect"===r?e.ColorIndex.a:n,mappingType:t,referenceType:r}}},{key:"parseMaterialIndices",value:function(e){var t=e.MappingInformationType,r=e.ReferenceInformationType;if("NoMappingInformation"===t)return{dataSize:1,buffer:[0],indices:[0],mappingType:"AllSame",referenceType:r};for(var n=e.Materials.a,a=[],i=0;i<n.length;++i)a.push(i);return{dataSize:1,buffer:n,indices:a,mappingType:t,referenceType:r}}},{key:"parseNurbsGeometry",value:function(e){var t=parseInt(e.Order);if(isNaN(t))return console.error("THREE.FBXLoader: Invalid Order %s given for geometry ID: %s",e.Order,e.id),new s.BufferGeometry;for(var r=t-1,n=(t=e.KnotVector.a,[]),a=e.Points.a,i=0,o=a.length;i<o;i+=4)n.push((new s.Vector4).fromArray(a,i));if("Closed"===e.Form)n.push(n[0]);else if("Periodic"===e.Form)for(var l=r,c=t.length-1-l,u=0;u<r;++u)n.push(n[u]);return e=new Ht(r,t,n,l,c).getPoints(12*n.length),(new s.BufferGeometry).setFromPoints(e)}}]),e}(),er=function(){function e(){Kt(this,e)}return Zt(e,[{key:"parse",value:function(){var e=[],t=this.parseClips();if(void 0!==t)for(var r in t)r=t[r],r=this.addClip(r),e.push(r);return e}},{key:"parseClips",value:function(){var e;if(void 0!==Ft.Objects.AnimationCurve)return e=this.parseAnimationCurveNodes(),this.parseAnimationCurves(e),e=this.parseAnimationLayers(e),this.parseAnimStacks(e)}},{key:"parseAnimationCurveNodes",value:function(){var e,t=Ft.Objects.AnimationCurveNode,r=new Map;for(e in t){var n=t[e];null!==n.attrName.match(/S|R|T|DeformPercent/)&&(n={id:n.id,attr:n.attrName,curves:{}},r.set(n.id,n))}return r}},{key:"parseAnimationCurves",value:function(e){var t,r=Ft.Objects.AnimationCurve;for(t in r){var n,a={id:r[t].id,times:r[t].KeyTime.a.map(sr),values:r[t].KeyValueFloat.a},i=Vt.get(a.id);void 0!==i&&(n=i.parents[0].ID,(i=i.parents[0].relationship).match(/X/)?e.get(n).curves.x=a:i.match(/Y/)?e.get(n).curves.y=a:i.match(/Z/)?e.get(n).curves.z=a:i.match(/d|DeformPercent/)&&e.has(n)&&(e.get(n).curves.morph=a))}}},{key:"parseAnimationLayers",value:function(e){var t,r=Ft.Objects.AnimationLayer,n=new Map;for(t in r)!function(t){var r=[],a=Vt.get(parseInt(t));void 0!==a&&(a.children.forEach((function(t,n){if(e.has(t.ID)){var a=e.get(t.ID);if(void 0!==a.curves.x||void 0!==a.curves.y||void 0!==a.curves.z){if(void 0===r[n]){var i=Vt.get(t.ID).parents.filter((function(e){return void 0!==e.relationship}))[0].ID;if(void 0!==i){var o=Ft.Objects.Model[i.toString()];if(void 0===o)return void console.warn("THREE.FBXLoader: Encountered a unused curve.",t);var l={modelName:o.attrName?s.PropertyBinding.sanitizeNodeName(o.attrName):"",ID:o.id,initialPosition:[0,0,0],initialRotation:[0,0,0],initialScale:[1,1,1]};Gt.traverse((function(e){e.ID===o.id&&(l.transform=e.matrix,e.userData.transformData&&(l.eulerOrder=e.userData.transformData.eulerOrder))})),l.transform||(l.transform=new s.Matrix4),"PreRotation"in o&&(l.preRotation=o.PreRotation.value),"PostRotation"in o&&(l.postRotation=o.PostRotation.value),r[n]=l}}r[n]&&(r[n][a.attr]=a)}else void 0!==a.curves.morph&&(void 0===r[n]&&(i=Vt.get(t.ID).parents.filter((function(e){return void 0!==e.relationship}))[0].ID,t=Vt.get(i).parents[0].ID,t=Vt.get(t).parents[0].ID,t=Vt.get(t).parents[0].ID,t={modelName:(t=Ft.Objects.Model[t]).attrName?s.PropertyBinding.sanitizeNodeName(t.attrName):"",morphName:Ft.Objects.Deformer[i].attrName},r[n]=t),r[n][a.attr]=a)}})),n.set(parseInt(t),r))}(t);return n}},{key:"parseAnimStacks",value:function(e){var t,r=Ft.Objects.AnimationStack,n={};for(t in r){var a=(1<(a=Vt.get(parseInt(t)).children).length&&console.warn("THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers."),e.get(a[0].ID));n[t]={name:r[t].attrName,layer:a}}return n}},{key:"addClip",value:function(e){var t=[],r=this;return e.layer.forEach((function(e){t=t.concat(r.generateTracks(e))})),new s.AnimationClip(e.name,-1,t)}},{key:"generateTracks",value:function(e){var t=[],r=new s.Vector3,n=new s.Quaternion,a=new s.Vector3;return e.transform&&e.transform.decompose(r,n,a),r=r.toArray(),n=(new s.Euler).setFromQuaternion(n,e.eulerOrder).toArray(),a=a.toArray(),void 0!==e.T&&0<Object.keys(e.T.curves).length&&void 0!==(r=this.generateVectorTrack(e.modelName,e.T.curves,r,"position"))&&t.push(r),void 0!==e.R&&0<Object.keys(e.R.curves).length&&void 0!==(r=this.generateRotationTrack(e.modelName,e.R.curves,n,e.preRotation,e.postRotation,e.eulerOrder))&&t.push(r),void 0!==e.S&&0<Object.keys(e.S.curves).length&&void 0!==(n=this.generateVectorTrack(e.modelName,e.S.curves,a,"scale"))&&t.push(n),void 0!==e.DeformPercent&&void 0!==(r=this.generateMorphTrack(e))&&t.push(r),t}},{key:"generateVectorTrack",value:function(e,t,r,n){var a=this.getTimesForAllAxes(t);return t=this.getKeyframeTrackValues(a,t,r),new s.VectorKeyframeTrack(e+"."+n,a,t)}},{key:"generateRotationTrack",value:function(e,t,r,n,a,i){void 0!==t.x&&(this.interpolateRotations(t.x),t.x.values=t.x.values.map(s.MathUtils.degToRad)),void 0!==t.y&&(this.interpolateRotations(t.y),t.y.values=t.y.values.map(s.MathUtils.degToRad)),void 0!==t.z&&(this.interpolateRotations(t.z),t.z.values=t.z.values.map(s.MathUtils.degToRad));for(var o=this.getTimesForAllAxes(t),l=this.getKeyframeTrackValues(o,t,r),c=(void 0!==n&&((n=n.map(s.MathUtils.degToRad)).push(i),n=(new s.Euler).fromArray(n),n=(new s.Quaternion).setFromEuler(n)),void 0!==a&&((a=a.map(s.MathUtils.degToRad)).push(i),a=(new s.Euler).fromArray(a),a=(new s.Quaternion).setFromEuler(a).invert()),new s.Quaternion),u=new s.Euler,h=[],d=0;d<l.length;d+=3)u.set(l[d],l[d+1],l[d+2],i),c.setFromEuler(u),void 0!==n&&c.premultiply(n),void 0!==a&&c.multiply(a),c.toArray(h,d/3*4);return new s.QuaternionKeyframeTrack(e+".quaternion",o,h)}},{key:"generateMorphTrack",value:function(e){var t=e.DeformPercent.curves.morph,r=t.values.map((function(e){return e/100})),n=Gt.getObjectByName(e.modelName).morphTargetDictionary[e.morphName];return new s.NumberKeyframeTrack(e.modelName+".morphTargetInfluences["+n+"]",t.times,r)}},{key:"getTimesForAllAxes",value:function(e){var t=[];if(void 0!==e.x&&(t=t.concat(e.x.times)),void 0!==e.y&&(t=t.concat(e.y.times)),1<(t=(t=void 0!==e.z?t.concat(e.z.times):t).sort((function(e,t){return e-t}))).length){for(var r=1,n=t[0],a=1;a<t.length;a++){var i=t[a];i!==n&&(n=t[r]=i,r++)}t=t.slice(0,r)}return t}},{key:"getKeyframeTrackValues",value:function(e,t,r){var n=r,a=[],i=-1,s=-1,o=-1;return e.forEach((function(e){t.x&&(i=t.x.times.indexOf(e)),t.y&&(s=t.y.times.indexOf(e)),t.z&&(o=t.z.times.indexOf(e)),-1!==i?(e=t.x.values[i],a.push(e),n[0]=e):a.push(n[0]),-1!==s?(e=t.y.values[s],a.push(e),n[1]=e):a.push(n[1]),-1!==o?(e=t.z.values[o],a.push(e),n[2]=e):a.push(n[2])})),a}},{key:"interpolateRotations",value:function(e){for(var t=1;t<e.values.length;t++){var r=e.values[t-1],n=e.values[t]-r;if(180<=(a=Math.abs(n))){for(var a,i=n/(a/=180),s=r+i,o=(n=e.times[t-1],(e.times[t]-n)/a),l=n+o,c=[],u=[];l<e.times[t];)c.push(l),l+=o,u.push(s),s+=i;e.times=mr(e.times,t,c),e.values=mr(e.values,t,u)}}}}]),e}(),tr=function(){function e(){Kt(this,e)}return Zt(e,[{key:"getPrevNode",value:function(){return this.nodeStack[this.currentIndent-2]}},{key:"getCurrentNode",value:function(){return this.nodeStack[this.currentIndent-1]}},{key:"getCurrentProp",value:function(){return this.currentProp}},{key:"pushStack",value:function(e){this.nodeStack.push(e),this.currentIndent+=1}},{key:"popStack",value:function(){this.nodeStack.pop(),--this.currentIndent}},{key:"setCurrentProp",value:function(e,t){this.currentProp=e,this.currentPropName=t}},{key:"parse",value:function(e){this.currentIndent=0,this.allNodes=new ar,this.nodeStack=[],this.currentProp=[],this.currentPropName="";var t=this,r=e.split(/[\r\n]+/);return r.forEach((function(e,n){var a,i=e.match(/^[\s\t]*;/),s=e.match(/^[\s\t]*$/);i||s||(i=e.match("^\\t{"+t.currentIndent+"}(\\w+):(.*){",""),s=e.match("^\\t{"+t.currentIndent+"}(\\w+):[\\s\\t\\r\\n](.*)"),a=e.match("^\\t{"+(t.currentIndent-1)+"}}"),i?t.parseNodeBegin(e,i):s?t.parseNodeProperty(e,s,r[++n]):a?t.popStack():e.match(/^[^\s\t}]/)&&t.parseNodePropertyContinued(e))})),this.allNodes}},{key:"parseNodeBegin",value:function(e,t){var r=t[1].trim().replace(/^"/,"").replace(/"$/,""),n=(t=t[2].split(",").map((function(e){return e.trim().replace(/^"/,"").replace(/"$/,"")})),{name:r}),a=(t=this.parseNodeAttr(t),this.getCurrentNode());0===this.currentIndent?this.allNodes.add(r,n):r in a?("PoseNode"===r?a.PoseNode.push(n):void 0!==a[r].id&&(a[r]={},a[r][a[r].id]=a[r]),""!==t.id&&(a[r][t.id]=n)):"number"==typeof t.id?(a[r]={},a[r][t.id]=n):"Properties70"!==r&&(a[r]="PoseNode"===r?[n]:n),"number"==typeof t.id&&(n.id=t.id),""!==t.name&&(n.attrName=t.name),""!==t.type&&(n.attrType=t.type),this.pushStack(n)}},{key:"parseNodeAttr",value:function(e){var t=e[0],r=(""!==e[0]&&(t=parseInt(e[0]),isNaN(t)&&(t=e[0])),""),n="";return 1<e.length&&(r=e[1].replace(/^(\w+)::/,""),n=e[2]),{id:t,name:r,type:n}}},{key:"parseNodeProperty",value:function(e,t,r){var n=t[1].replace(/^"/,"").replace(/"$/,"").trim();if(t=t[2].replace(/^"/,"").replace(/"$/,"").trim(),"Properties70"===("Content"===n&&","===t&&(t=r.replace(/"/g,"").replace(/,$/,"").trim()),r=this.getCurrentNode()).name)this.parseNodeSpecialProperty(e,n,t);else{if("C"===n){e=t.split(",").slice(1);for(var a=parseInt(e[0]),i=(e=parseInt(e[1]),(i=t.split(",").slice(3)).map((function(e){return e.trim().replace(/^"/,"")}))),s=(n="connections",t=[a,e]),o=i,l=0,c=s.length,u=o.length;l<u;l++,c++)s[c]=o[l];void 0===r[n]&&(r[n]=[])}"Node"===n&&(r.id=t),n in r&&Array.isArray(r[n])?r[n].push(t):"a"!==n?r[n]=t:r.a=t,this.setCurrentProp(r,n),"a"===n&&","!==t.slice(-1)&&(r.a=pr(t))}}},{key:"parseNodePropertyContinued",value:function(e){var t=this.getCurrentNode();t.a+=e,","!==e.slice(-1)&&(t.a=pr(t.a))}},{key:"parseNodeSpecialProperty",value:function(e,t,r){r=r.split('",').map((function(e){return e.trim().replace(/^\"/,"").replace(/\s/,"_")}));var n=r[0],a=r[1],i=r[2],s=r[3],o=r[4];switch(a){case"int":case"enum":case"bool":case"ULongLong":case"double":case"Number":case"FieldOfView":o=parseFloat(o);break;case"Color":case"ColorRGB":case"Vector3D":case"Lcl_Translation":case"Lcl_Rotation":case"Lcl_Scaling":o=pr(o)}this.getPrevNode()[n]={type:a,type2:i,flag:s,value:o},this.setCurrentProp(this.getPrevNode(),n)}}]),e}(),rr=function(){function e(){Kt(this,e)}return Zt(e,[{key:"parse",value:function(e){var t=new nr(e),r=(t.skip(23),t.getUint32());if(r<6400)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+r);for(var n=new ar;!this.endOfContent(t);){var a=this.parseNode(t,r);null!==a&&n.add(a.name,a)}return n}},{key:"endOfContent",value:function(e){return e.size()%16==0?(e.getOffset()+160+16&-16)>=e.size():e.getOffset()+160+16>=e.size()}},{key:"parseNode",value:function(e,t){var r={},n=7500<=t?e.getUint64():e.getUint32(),a=7500<=t?e.getUint64():e.getUint32(),i=(7500<=t?e.getUint64():e.getUint32(),e.getUint8()),s=e.getString(i);if(0===n)return null;for(var o=[],l=0;l<a;l++)o.push(this.parseProperty(e));i=0<o.length?o[0]:"";var c=1<o.length?o[1]:"",u=2<o.length?o[2]:"";for(r.singleProperty=1===a&&e.getOffset()===n;n>e.getOffset();){var h=this.parseNode(e,t);null!==h&&this.parseSubNode(s,r,h)}return r.propertyList=o,"number"==typeof i&&(r.id=i),""!==c&&(r.attrName=c),""!==u&&(r.attrType=u),""!==s&&(r.name=s),r}},{key:"parseSubNode",value:function(e,t,r){var n,a,i,s,o;!0===r.singleProperty?(a=r.propertyList[0],Array.isArray(a)?(t[r.name]=r).a=a:t[r.name]=a):"Connections"===e&&"C"===r.name?(n=[],r.propertyList.forEach((function(e,t){0!==t&&n.push(e)})),void 0===t.connections&&(t.connections=[]),t.connections.push(n)):"Properties70"===r.name?Object.keys(r).forEach((function(e){t[e]=r[e]})):"Properties70"===e&&"P"===r.name?(a=r.propertyList[0],e=r.propertyList[1],i=r.propertyList[2],s=r.propertyList[3],0===a.indexOf("Lcl ")&&(a=a.replace("Lcl ","Lcl_")),o="Color"===(e=0===e.indexOf("Lcl ")?e.replace("Lcl ","Lcl_"):e)||"ColorRGB"===e||"Vector"===e||"Vector3D"===e||0===e.indexOf("Lcl_")?[r.propertyList[4],r.propertyList[5],r.propertyList[6]]:r.propertyList[4],t[a]={type:e,type2:i,flag:s,value:o}):void 0===t[r.name]?"number"==typeof r.id?(t[r.name]={},t[r.name][r.id]=r):t[r.name]=r:"PoseNode"===r.name?(Array.isArray(t[r.name])||(t[r.name]=[t[r.name]]),t[r.name].push(r)):void 0===t[r.name][r.id]&&(t[r.name][r.id]=r)}},{key:"parseProperty",value:function(e){var t=e.getString(1);switch(t){case"C":return e.getBoolean();case"D":return e.getFloat64();case"F":return e.getFloat32();case"I":return e.getInt32();case"L":return e.getInt64();case"R":return n=e.getUint32(),e.getArrayBuffer(n);case"S":return n=e.getUint32(),e.getString(n);case"Y":return e.getInt16();case"b":case"c":case"d":case"f":case"i":case"l":var r=e.getUint32(),n=e.getUint32(),a=e.getUint32();if(0===n)switch(t){case"b":case"c":return e.getBooleanArray(r);case"d":return e.getFloat64Array(r);case"f":return e.getFloat32Array(r);case"i":return e.getInt32Array(r);case"l":return e.getInt64Array(r)}n=function(e,t){return function(e,t,r){var n=e.length;if(!n||r&&!r.l&&n<5)return t||new pt(0);function a(e){var r=t.length;r<e&&((r=new pt(Math.max(2*r,e))).set(t),t=r)}var i=!t||r,s=!r||r.i,o=(r=r||{},t=t||new pt(3*n),r.f||0),l=r.p||0,c=r.b||0,u=r.l,h=r.d,d=r.m,p=r.n,f=8*n;do{if(!u){r.f=o=Pt(e,l,1);var m=Pt(e,l+1,3);if(l+=3,!m){var g=e[(_=Ct(l)+4)-4]|e[_-3]<<8;if(n<(S=_+g)){if(s)throw"unexpected EOF";break}i&&a(c+g),t.set(e.subarray(_,S),c),r.b=c+=g,r.p=l=8*S;continue}if(1==m)u=Dt,h=kt,d=9,p=5;else{if(2!=m)throw"invalid block type";g=Pt(e,l,31)+257;for(var v=Pt(e,l+10,15)+4,b=g+Pt(e,l+5,31)+1,y=(l+=14,new pt(b)),x=new pt(19),w=0;w<v;++w)x[bt[w]]=Pt(e,l+3*w,7);l+=3*v;var S,M=(1<<(S=Ot(x)))-1,T=Tt(x,S,1);for(w=0;w<b;){var _,E=T[Pt(e,l,M)];if(l+=15&E,(_=E>>>4)<16)y[w++]=_;else{var D=0,k=0;for(16==_?(k=3+Pt(e,l,3),l+=2,D=y[w-1]):17==_?(k=3+Pt(e,l,7),l+=3):18==_&&(k=11+Pt(e,l,127),l+=7);k--;)y[w++]=D}}m=y.subarray(0,g);var O=y.subarray(g);d=Ot(m),p=Ot(O),u=Tt(m,d,1),h=Tt(O,p,1)}if(f<l){if(s)throw"unexpected EOF";break}}i&&a(c+131072);for(var P=(1<<d)-1,A=(1<<p)-1,C=l;;C=l){var R=(D=u[At(e,l)&P])>>>4;if(f<(l+=15&D)){if(s)throw"unexpected EOF";break}if(!D)throw"invalid length/literal";if(R<256)t[c++]=R;else{if(256==R){C=l,u=null;break}var L,I=R-254,B=(264<R&&(L=gt[w=R-257],I=Pt(e,l,(1<<L)-1)+yt[w],l+=L),(R=h[At(e,l)&A])>>>4);if(!R)throw"invalid distance";if(l+=15&R,O=xt[B],3<B&&(L=vt[B],O+=At(e,l)&(1<<L)-1,l+=L),f<l){if(s)throw"unexpected EOF";break}i&&a(c+131072);for(var j=c+I;c<j;c+=4)t[c]=t[c-O],t[c+1]=t[c+1-O],t[c+2]=t[c+2-O],t[c+3]=t[c+3-O];c=j}}r.l=u,r.p=C,r.b=c,u&&(o=1,r.m=d,r.d=h,r.n=p)}while(!o);return c==t.length?t:Rt(t,0,c)}((function(e){if(8!=(15&e[0])||7<e[0]>>>4||(e[0]<<8|e[1])%31)throw"invalid zlib data";if(32&e[1])throw"invalid zlib data: preset dictionaries not supported"}(e),e.subarray(2,-4)),t)}(new Uint8Array(e.getArrayBuffer(a)));var i=new nr(n.buffer);switch(t){case"b":case"c":return i.getBooleanArray(r);case"d":return i.getFloat64Array(r);case"f":return i.getFloat32Array(r);case"i":return i.getInt32Array(r);case"l":return i.getInt64Array(r)}break;default:throw new Error("THREE.FBXLoader: Unknown property type "+t)}}}]),e}(),nr=function(){function e(t,r){Kt(this,e),this.dv=new DataView(t),this.offset=0,this.littleEndian=void 0===r||r,this._textDecoder=new TextDecoder}return Zt(e,[{key:"getOffset",value:function(){return this.offset}},{key:"size",value:function(){return this.dv.buffer.byteLength}},{key:"skip",value:function(e){this.offset+=e}},{key:"getBoolean",value:function(){return 1==(1&this.getUint8())}},{key:"getBooleanArray",value:function(e){for(var t=[],r=0;r<e;r++)t.push(this.getBoolean());return t}},{key:"getUint8",value:function(){var e=this.dv.getUint8(this.offset);return this.offset+=1,e}},{key:"getInt16",value:function(){var e=this.dv.getInt16(this.offset,this.littleEndian);return this.offset+=2,e}},{key:"getInt32",value:function(){var e=this.dv.getInt32(this.offset,this.littleEndian);return this.offset+=4,e}},{key:"getInt32Array",value:function(e){for(var t=[],r=0;r<e;r++)t.push(this.getInt32());return t}},{key:"getUint32",value:function(){var e=this.dv.getUint32(this.offset,this.littleEndian);return this.offset+=4,e}},{key:"getInt64",value:function(){var e,t;return this.littleEndian?(e=this.getUint32(),t=this.getUint32()):(t=this.getUint32(),e=this.getUint32()),2147483648&t?(t=4294967295&~t,-(4294967296*(t=4294967295==(e=4294967295&~e)?t+1&4294967295:t)+(e=e+1&4294967295))):4294967296*t+e}},{key:"getInt64Array",value:function(e){for(var t=[],r=0;r<e;r++)t.push(this.getInt64());return t}},{key:"getUint64",value:function(){var e,t;return this.littleEndian?(e=this.getUint32(),t=this.getUint32()):(t=this.getUint32(),e=this.getUint32()),4294967296*t+e}},{key:"getFloat32",value:function(){var e=this.dv.getFloat32(this.offset,this.littleEndian);return this.offset+=4,e}},{key:"getFloat32Array",value:function(e){for(var t=[],r=0;r<e;r++)t.push(this.getFloat32());return t}},{key:"getFloat64",value:function(){var e=this.dv.getFloat64(this.offset,this.littleEndian);return this.offset+=8,e}},{key:"getFloat64Array",value:function(e){for(var t=[],r=0;r<e;r++)t.push(this.getFloat64());return t}},{key:"getArrayBuffer",value:function(e){var t=this.dv.buffer.slice(this.offset,this.offset+e);return this.offset+=e,t}},{key:"getString",value:function(e){var t=this.offset,r=new Uint8Array(this.dv.buffer,t,e);return 0<=(this.skip(e),e=r.indexOf(0))&&(r=new Uint8Array(this.dv.buffer,t,e)),this._textDecoder.decode(r)}}]),e}(),ar=function(){function e(){Kt(this,e)}return Zt(e,[{key:"add",value:function(e,t){this[e]=t}}]),e}();function ir(e){if(e=e.match(/FBXVersion: (\d+)/))return parseInt(e[1]);throw new Error("THREE.FBXLoader: Cannot find the version number for the file given.")}function sr(e){return e/46186158e3}var or=[];function lr(e,t,r,n){var a;switch(n.mappingType){case"ByPolygonVertex":a=e;break;case"ByPolygon":a=t;break;case"ByVertice":a=r;break;case"AllSame":a=n.indices[0];break;default:console.warn("THREE.FBXLoader: unknown attribute mapping type "+n.mappingType)}for(var i=(a="IndexToDirect"===n.referenceType?n.indices[a]:a)*n.dataSize,s=i+n.dataSize,o=or,l=n.buffer,c=s,u=i,h=0;u<c;u++,h++)o[h]=l[u];return o}var cr=new s.Euler,ur=new s.Vector3;function hr(e){var t=new s.Matrix4,r=new s.Matrix4,n=new s.Matrix4,a=new s.Matrix4,i=new s.Matrix4,o=new s.Matrix4,l=new s.Matrix4,c=new s.Matrix4,u=new s.Matrix4,h=new s.Matrix4,d=new s.Matrix4,p=new s.Matrix4,f=e.inheritType||0,m=(e.translation&&t.setPosition(ur.fromArray(e.translation)),e.preRotation&&((m=e.preRotation.map(s.MathUtils.degToRad)).push(e.eulerOrder||s.Euler.DEFAULT_ORDER),r.makeRotationFromEuler(cr.fromArray(m))),e.rotation&&((m=e.rotation.map(s.MathUtils.degToRad)).push(e.eulerOrder||s.Euler.DEFAULT_ORDER),n.makeRotationFromEuler(cr.fromArray(m))),e.postRotation&&((m=e.postRotation.map(s.MathUtils.degToRad)).push(e.eulerOrder||s.Euler.DEFAULT_ORDER),a.makeRotationFromEuler(cr.fromArray(m)),a.invert()),e.scale&&i.scale(ur.fromArray(e.scale)),e.scalingOffset&&l.setPosition(ur.fromArray(e.scalingOffset)),e.scalingPivot&&o.setPosition(ur.fromArray(e.scalingPivot)),e.rotationOffset&&c.setPosition(ur.fromArray(e.rotationOffset)),e.rotationPivot&&u.setPosition(ur.fromArray(e.rotationPivot)),e.parentMatrixWorld&&(d.copy(e.parentMatrix),h.copy(e.parentMatrixWorld)),r.clone().multiply(n).multiply(a)),g=(((e=new s.Matrix4).extractRotation(h),g=new s.Matrix4).copyPosition(h),g.clone().invert().multiply(h)),v=(g=e.clone().invert().multiply(g),i),b=new s.Matrix4;return 0===f?b.copy(e).multiply(m).multiply(g).multiply(v):1===f?b.copy(e).multiply(g).multiply(m).multiply(v):(f=(new s.Matrix4).scale((new s.Vector3).setFromMatrixScale(d)).clone().invert(),d=g.clone().multiply(f),b.copy(e).multiply(m).multiply(d).multiply(v)),g=u.clone().invert(),f=o.clone().invert(),e=t.clone().multiply(c).multiply(u).multiply(r).multiply(n).multiply(a).multiply(g).multiply(l).multiply(o).multiply(i).multiply(f),m=(new s.Matrix4).copyPosition(e),d=h.clone().multiply(m),p.copyPosition(d),(e=p.clone().multiply(b)).premultiply(h.invert()),e}function dr(e){var t=["ZYX","YZX","XZY","ZXY","YXZ","XYZ"];return 6===(e=e||0)?(console.warn("THREE.FBXLoader: unsupported Euler Order: Spherical XYZ. Animations and rotations may be incorrect."),t[0]):t[e]}function pr(e){return e.split(",").map((function(e){return parseFloat(e)}))}function fr(e,t,r){return void 0===t&&(t=0),void 0===r&&(r=e.byteLength),(new TextDecoder).decode(new Uint8Array(e,t,r))}function mr(e,t,r){return e.slice(0,t).concat(r).concat(e.slice(t))}function gr(e){return(gr="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})(e)}function vr(e,t){return(vr=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function br(e){return(br=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var yr=/^[og]\s*(.+)?/,xr=/^mtllib /,wr=/^usemtl /,Sr=/^usemap /,Mr=/\s+/,Tr=new s.Vector3,_r=new s.Vector3,Er=new s.Vector3,Dr=new s.Vector3,kr=new s.Vector3,Or=new s.Color;function Pr(){var e={objects:[],object:{},vertices:[],normals:[],colors:[],uvs:[],materials:{},materialLibraries:[],startObject:function(e,t){if(this.object&&!1===this.object.fromDeclaration)return this.object.name=e,void(this.object.fromDeclaration=!1!==t);var r=this.object&&"function"==typeof this.object.currentMaterial?this.object.currentMaterial():void 0;this.object&&"function"==typeof this.object._finalize&&this.object._finalize(!0),this.object={name:e||"",fromDeclaration:!1!==t,geometry:{vertices:[],normals:[],colors:[],uvs:[],hasUVIndices:!1},materials:[],smooth:!0,startMaterial:function(e,t){var r=this._finalize(!1);return r&&(r.inherited||r.groupCount<=0)&&this.materials.splice(r.index,1),e={index:this.materials.length,name:e||"",mtllib:Array.isArray(t)&&0<t.length?t[t.length-1]:"",smooth:(void 0!==r?r:this).smooth,groupStart:void 0!==r?r.groupEnd:0,groupEnd:-1,groupCount:-1,inherited:!1,clone:function(e){return(e={index:"number"==typeof e?e:this.index,name:this.name,mtllib:this.mtllib,smooth:this.smooth,groupStart:0,groupEnd:-1,groupCount:-1,inherited:!1}).clone=this.clone.bind(e),e}},this.materials.push(e),e},currentMaterial:function(){if(0<this.materials.length)return this.materials[this.materials.length-1]},_finalize:function(e){var t=this.currentMaterial();if(t&&-1===t.groupEnd&&(t.groupEnd=this.geometry.vertices.length/3,t.groupCount=t.groupEnd-t.groupStart,t.inherited=!1),e&&1<this.materials.length)for(var r=this.materials.length-1;0<=r;r--)this.materials[r].groupCount<=0&&this.materials.splice(r,1);return e&&0===this.materials.length&&this.materials.push({name:"",smooth:this.smooth}),t}},r&&r.name&&"function"==typeof r.clone&&((e=r.clone(0)).inherited=!0,this.object.materials.push(e)),this.objects.push(this.object)},finalize:function(){this.object&&"function"==typeof this.object._finalize&&this.object._finalize(!0)},parseVertexIndex:function(e,t){return 3*(0<=(e=parseInt(e,10))?e-1:e+t/3)},parseNormalIndex:function(e,t){return 3*(0<=(e=parseInt(e,10))?e-1:e+t/3)},parseUVIndex:function(e,t){return 2*(0<=(e=parseInt(e,10))?e-1:e+t/2)},addVertex:function(e,t,r){var n=this.vertices,a=this.object.geometry.vertices;a.push(n[e+0],n[e+1],n[e+2]),a.push(n[t+0],n[t+1],n[t+2]),a.push(n[r+0],n[r+1],n[r+2])},addVertexPoint:function(e){var t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addVertexLine:function(e){var t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addNormal:function(e,t,r){var n=this.normals,a=this.object.geometry.normals;a.push(n[e+0],n[e+1],n[e+2]),a.push(n[t+0],n[t+1],n[t+2]),a.push(n[r+0],n[r+1],n[r+2])},addFaceNormal:function(e,t,r){var n=this.vertices,a=this.object.geometry.normals;Tr.fromArray(n,e),_r.fromArray(n,t),Er.fromArray(n,r),kr.subVectors(Er,_r),Dr.subVectors(Tr,_r),kr.cross(Dr),kr.normalize(),a.push(kr.x,kr.y,kr.z),a.push(kr.x,kr.y,kr.z),a.push(kr.x,kr.y,kr.z)},addColor:function(e,t,r){var n=this.colors,a=this.object.geometry.colors;void 0!==n[e]&&a.push(n[e+0],n[e+1],n[e+2]),void 0!==n[t]&&a.push(n[t+0],n[t+1],n[t+2]),void 0!==n[r]&&a.push(n[r+0],n[r+1],n[r+2])},addUV:function(e,t,r){var n=this.uvs,a=this.object.geometry.uvs;a.push(n[e+0],n[e+1]),a.push(n[t+0],n[t+1]),a.push(n[r+0],n[r+1])},addDefaultUV:function(){var e=this.object.geometry.uvs;e.push(0,0),e.push(0,0),e.push(0,0)},addUVLine:function(e){var t=this.uvs;this.object.geometry.uvs.push(t[e+0],t[e+1])},addFace:function(e,t,r,n,a,i,s,o,l){var c=this.vertices.length;e=this.parseVertexIndex(e,c),t=this.parseVertexIndex(t,c),r=this.parseVertexIndex(r,c),this.addVertex(e,t,r),this.addColor(e,t,r),void 0!==s&&""!==s?(c=this.normals.length,e=this.parseNormalIndex(s,c),t=this.parseNormalIndex(o,c),r=this.parseNormalIndex(l,c),this.addNormal(e,t,r)):this.addFaceNormal(e,t,r),void 0!==n&&""!==n?(s=this.uvs.length,e=this.parseUVIndex(n,s),t=this.parseUVIndex(a,s),r=this.parseUVIndex(i,s),this.addUV(e,t,r),this.object.geometry.hasUVIndices=!0):this.addDefaultUV()},addPointGeometry:function(e){this.object.geometry.type="Points";for(var t=this.vertices.length,r=0,n=e.length;r<n;r++){var a=this.parseVertexIndex(e[r],t);this.addVertexPoint(a),this.addColor(a)}},addLineGeometry:function(e,t){this.object.geometry.type="Line";for(var r=this.vertices.length,n=this.uvs.length,a=0,i=e.length;a<i;a++)this.addVertexLine(this.parseVertexIndex(e[a],r));for(var s=0,o=t.length;s<o;s++)this.addUVLine(this.parseUVIndex(t[s],n))}};return e.startObject("",!1),e}var Ar=function(e){var t=n;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&vr(t,e);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=br(e);if(r=t?(r=br(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===gr(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(e){if(this instanceof n)return(e=r.call(this,e)).materials=null,e;throw new TypeError("Cannot call a class as a function")}return t=n,(e=[{key:"load",value:function(e,t,r,n){var a=this,i=new s.FileLoader(this.manager);i.setPath(this.path),i.setRequestHeader(this.requestHeader),i.setWithCredentials(this.withCredentials),i.load(e,(function(r){try{t(a.parse(r))}catch(r){n?n(r):console.error(r),a.manager.itemError(e)}}),r,n)}},{key:"setMaterials",value:function(e){return this.materials=e,this}},{key:"parse",value:function(e){for(var t=new Pr,r=(e=-1!==(e=-1!==e.indexOf("\r\n")?e.replace(/\r\n/g,"\n"):e).indexOf("\\\n")?e.replace(/\\\n/g,""):e).split("\n"),n=[],a=0,i=r.length;a<i;a++){var o=r[a].trimStart();if(0!==o.length){var l,c=o.charAt(0);if("#"!==c)if("v"===c){var u=o.split(Mr);switch(u[0]){case"v":t.vertices.push(parseFloat(u[1]),parseFloat(u[2]),parseFloat(u[3])),7<=u.length?(Or.setRGB(parseFloat(u[4]),parseFloat(u[5]),parseFloat(u[6])).convertSRGBToLinear(),t.colors.push(Or.r,Or.g,Or.b)):t.colors.push(void 0,void 0,void 0);break;case"vn":t.normals.push(parseFloat(u[1]),parseFloat(u[2]),parseFloat(u[3]));break;case"vt":t.uvs.push(parseFloat(u[1]),parseFloat(u[2]))}}else if("f"===c){for(var h=o.slice(1).trim().split(Mr),d=[],p=0,f=h.length;p<f;p++){var m=h[p];0<m.length&&(m=m.split("/"),d.push(m))}for(var g=d[0],v=1,b=d.length-1;v<b;v++){var y=d[v],x=d[v+1];t.addFace(g[0],y[0],x[0],g[1],y[1],x[1],g[2],y[2],x[2])}}else if("l"===c){var w=o.substring(1).trim().split(" "),S=[],M=[];if(-1===o.indexOf("/"))S=w;else for(var T=0,_=w.length;T<_;T++){var E=w[T].split("/");""!==E[0]&&S.push(E[0]),""!==E[1]&&M.push(E[1])}t.addLineGeometry(S,M)}else"p"===c?(l=o.slice(1).trim().split(" "),t.addPointGeometry(l)):null!==(n=yr.exec(o))?(l=(" "+n[0].slice(1).trim()).slice(1),t.startObject(l)):wr.test(o)?t.object.startMaterial(o.substring(7).trim(),t.materialLibraries):xr.test(o)?t.materialLibraries.push(o.substring(7).trim()):Sr.test(o)?console.warn('THREE.OBJLoader: Rendering identifier "usemap" not supported. Textures must be defined in MTL files.'):"s"===c?(1<(n=o.split(" ")).length?(c=n[1].trim().toLowerCase(),t.object.smooth="0"!==c&&"off"!==c):t.object.smooth=!0,(c=t.object.currentMaterial())&&(c.smooth=t.object.smooth)):"\0"!==o&&console.warn('THREE.OBJLoader: Unexpected line: "'+o+'"')}}t.finalize();var D,k=new s.Group;if(1==(k.materialLibraries=[].concat(t.materialLibraries),e=!(1===t.objects.length&&0===t.objects[0].geometry.vertices.length)))for(var O=0,P=t.objects.length;O<P;O++){var A=t.objects[O],C=A.geometry,R=A.materials,L="Line"===C.type,I="Points"===C.type,B=!1;if(0!==C.vertices.length){for(var j=new s.BufferGeometry,U=(j.setAttribute("position",new s.Float32BufferAttribute(C.vertices,3)),0<C.normals.length&&j.setAttribute("normal",new s.Float32BufferAttribute(C.normals,3)),0<C.colors.length&&(B=!0,j.setAttribute("color",new s.Float32BufferAttribute(C.colors,3))),!0===C.hasUVIndices&&j.setAttribute("uv",new s.Float32BufferAttribute(C.uvs,2)),[]),N=0,z=R.length;N<z;N++){var F,V=R[N],G=V.name+"_"+V.smooth+"_"+B,H=t.materials[G];null!==this.materials&&(H=this.materials.create(V.name),!L||!H||H instanceof s.LineBasicMaterial?!I||!H||H instanceof s.PointsMaterial||(F=new s.PointsMaterial({size:10,sizeAttenuation:!1}),s.Material.prototype.copy.call(F,H),F.color.copy(H.color),F.map=H.map,H=F):(F=new s.LineBasicMaterial,s.Material.prototype.copy.call(F,H),F.color.copy(H.color),H=F)),void 0===H&&((H=L?new s.LineBasicMaterial:I?new s.PointsMaterial({size:1,sizeAttenuation:!1}):new s.MeshPhongMaterial).name=V.name,H.flatShading=!V.smooth,H.vertexColors=B,t.materials[G]=H),U.push(H)}if(C=void 0,1<U.length){for(var W=0,K=R.length;W<K;W++){var q=R[W];j.addGroup(q.groupStart,q.groupCount,W)}C=new(L?s.LineSegments:I?s.Points:s.Mesh)(j,U)}else C=new(L?s.LineSegments:I?s.Points:s.Mesh)(j,U[0]);C.name=A.name,k.add(C)}}else 0<t.vertices.length&&(e=new s.PointsMaterial({size:1,sizeAttenuation:!1}),(D=new s.BufferGeometry).setAttribute("position",new s.Float32BufferAttribute(t.vertices,3)),0<t.colors.length&&void 0!==t.colors[0]&&(D.setAttribute("color",new s.Float32BufferAttribute(t.colors,3)),e.vertexColors=!0),D=new s.Points(D,e),k.add(D));return k}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),n}(s.Loader),Cr=function(e,t,r,n){return new(r=r||Promise)((function(a,i){function s(e){try{l(n.next(e))}catch(e){i(e)}}function o(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?a(e.value):((t=e.value)instanceof r?t:new r((function(e){e(t)}))).then(s,o)}l((n=n.apply(e,t||[])).next())}))};const Rr=t.FBXLoader;class Lr{constructor(e){this.parses={fbx:new Rr,obj:new Ar,object:new s.ObjectLoader},this.runScene=e}getBack(e){return e.name.substring(e.name.lastIndexOf(".")+1).toLowerCase()}parseFiles(e){return Promise.all(e.map((e=>this.parse(e))))}parse(e){return Cr(this,void 0,void 0,(function*(){let t;switch(this.getBack(e).toLowerCase()){case"gltf":case"glb":t=this.glb(e);break;case"fbx":t=this.fbx(e);break;case"obj":t=this.obj(e);break;case"json":t=this.json(e)}return t}))}img(e){console.log(e,"file")}glb(e){return Cr(this,void 0,void 0,(function*(){var t=yield(0,i.parseFile)(e,"arrayBuffer");let r="model";return t=yield this.runScene.loaderer.gltf.parse(t,{triggerCb:!0,callBack:{beforeParse:e=>{"scene"===(e=(e.asset.ex||{}).type)&&this.runScene.clean()},getJSON(e){r=(null==(e=e.asset.ex)?void 0:e.type)||"model"}}}),{type:r,result:t}}))}fbx(e){return Cr(this,void 0,void 0,(function*(){var t=e instanceof ArrayBuffer?e:yield(0,i.parseFile)(e,"arrayBuffer");const r=this.runScene.materialEx.create(),n=this.parses.fbx.parse(t,"");return n.traverse((e=>{e.material&&"Line"!==e.type&&(e.material=r)})),{type:"model",result:[this.runScene.sceneEx.cleanUnlessLevel(n)]}}))}obj(e){return Cr(this,void 0,void 0,(function*(){var t=e instanceof File?yield(0,i.parseFile)(e,"text"):e;const r=this.parses.obj.parse(t),n=this.runScene.materialEx.create();return r.traverse((e=>{e.material&&"Line"!==e.type&&(e.material=n)})),{type:"model",result:[this.runScene.sceneEx.cleanUnlessLevel(r)]}}))}json(e){return Cr(this,void 0,void 0,(function*(){var t=e instanceof File?yield(0,i.parseFile)(e,"text"):e,r=JSON.parse(t);return"timeLine"===r.type?{type:"timeLine",result:r.data}:{type:"model",result:[this.runScene.loaderer.json.parse(t)]}}))}}class Ir extends o{constructor(e){super(e),this._lastRenderMode=null,this.setRenderMode=(()=>{let e=!1;const t=()=>{e||(this.runScene.cb.loaderer.gltf.loaded.add("global-config",(()=>{"controlsChange"===this._lastRenderMode&&this.runScene.render()})),this.runScene.cb.loaderer.gltf.complete.add("global-config",(()=>{"controlsChange"===this._lastRenderMode&&this.runScene.render()})),e=!0)},r=()=>{const e=this.runScene.assetsEx.renderer;"tick"===this._lastRenderMode?e.setAnimationLoop(null):"controlsChange"===this._lastRenderMode&&this.runScene.cb.controlsChange.delete("global-config")},n=e=>{var t=this.runScene.render;const r=this.runScene.assetsEx.renderer;"tick"===e?r.setAnimationLoop(t):"controlsChange"===e&&this.runScene.cb.controlsChange.add("global-config",t)};return e=>{this._lastRenderMode!==e&&(t(),r(),n(e),this._lastRenderMode=e)}})()}setGlow(e){this.runScene.pp.params.glow.isBloom=e}setRender2(e){this.runScene.assetsEx.setRender2(e)}setRender3(e){this.runScene.assetsEx.setRender3(e)}setState(e){L(this.runScene).renderConfig.stop=!e,this.setEventState(e)}setEventState(e){L(this.runScene).renderConfig.triggerEvent=e}}var Br=r(1269);class jr extends r(8624).Ys{constructor(e,t){super(e,t),this.transGizmo=this.children[0],this.scaleCoefficient=new s.Vector3,this.beginScale=new s.Vector3,this.posStart=new s.Vector2,this.posEnd=new s.Vector2,this.deleteRedundantParts()}deleteRedundantParts(){this.transGizmo.gizmo.translate.children.splice(1,1),this.transGizmo.gizmo.translate.children.splice(3,1),this.transGizmo.gizmo.translate.children.splice(5,1),this.transGizmo.gizmo.scale.children.splice(0,1),this.transGizmo.gizmo.scale.children.splice(2,1),this.transGizmo.gizmo.scale.children.splice(4,1)}pointerDown(e){void 0===this.object||null===this.axis||this.dragging||0!==e.button||(this.posStart.set(e.x,e.y),this.beginScale.set(this.object.scale.x,this.object.scale.y,this.object.scale.z),super.pointerDown(e))}pointerMove(e){if(super.pointerMove(e),void 0!==this.object&&null!==this.axis&&this.dragging&&-1===e.button&&"scale"===this.mode&&-1!==this.axis.search("XYZ")){this.posEnd.set(e.x,e.y),e=(Math.abs(this.beginScale.x)+Math.abs(this.beginScale.y)+Math.abs(this.beginScale.z))/3;let t=12*this.pointStart.distanceTo(this.pointEnd)/e;this.posEnd.x>this.posStart.x&&(t*=-1),(t=-1.1<t&&t<1.1?1:t)<0&&(t=-1.1/t),this.scaleCoefficient.set(t,t,t),this.object.scale.copy(this._scaleStart).multiply(this.scaleCoefficient)}}}class Ur extends s.Object3D{constructor(e){super(),this.isViewHelper=!0,this.animating=!1,this.controls=null,this.dummy=new s.Object3D,this.turnRate=2*Math.PI,this.targetPosition=new s.Vector3,this.targetQuaternion=new s.Quaternion,this.q1=new s.Quaternion,this.q2=new s.Quaternion,this.radius=0,this.clock=new s.Clock,this.runScene=e,e=this.runScene.assetsEx.get().controls,this.controls=e,this.runScene.cb.render.add("view-helper",(()=>{this.update(this.clock.getDelta())}))}prepareAnimationData(e){const t=this.runScene.assetsEx.get().camera;var r=this.controls.target;switch(e){case"posX":this.targetPosition.set(1,0,0),this.targetQuaternion.setFromEuler(new s.Euler(0,.5*Math.PI,0));break;case"posY":this.targetPosition.set(0,1,0),this.targetQuaternion.setFromEuler(new s.Euler(.5*-Math.PI,0,0));break;case"posZ":this.targetPosition.set(0,0,1),this.targetQuaternion.setFromEuler(new s.Euler);break;case"negX":this.targetPosition.set(-1,0,0),this.targetQuaternion.setFromEuler(new s.Euler(0,.5*-Math.PI,0));break;case"negY":this.targetPosition.set(0,-1,0),this.targetQuaternion.setFromEuler(new s.Euler(.5*Math.PI,0,0));break;case"negZ":this.targetPosition.set(0,0,-1),this.targetQuaternion.setFromEuler(new s.Euler(0,Math.PI,0));break;default:console.error("ViewHelper: Invalid axis.")}this.radius=t.position.distanceTo(r),this.targetPosition.multiplyScalar(this.radius).add(r),this.dummy.position.copy(r),this.dummy.lookAt(t.position),this.q1.copy(this.dummy.quaternion),this.dummy.lookAt(this.targetPosition),this.q2.copy(this.dummy.quaternion),this.animating=!0}update(e){if(this.animating){const r=this.runScene.assetsEx.get().camera;e*=this.turnRate;var t=this.controls.target;this.q1.rotateTowards(this.q2,e),r.position.set(0,0,1).applyQuaternion(this.q1).multiplyScalar(this.radius).add(t),r.quaternion.rotateTowards(this.targetQuaternion,e),0===this.q1.angleTo(this.q2)&&(this.animating=!1)}}}class Nr{constructor(e){this.grid=null,this.transContro=null,this.boxHelper=null,this.clean=()=>{this.unfocus()},this.deepIsHelper=e=>"Scene"===e.type||!this.isHelper(e)&&!!e.parent&&this.deepIsHelper(e.parent),this.getBoxHelper=e=>(e=new s.BoxHelper(e),this.runScene.assetsEx.get().scene.add(e),this.setHelper(e,!0),e),this.runScene=e,"running"!==this.runScene.optionsEx.options.mode&&(this.runScene.cb.clean.add("EngineHelper",this.clean),this.transContro=new class{constructor(e){this.tansControls=null,this.controlsMode="position",this.isDraggingChange=!1,this.enable=!0,this.modelNewVal=new c.Z.Vector3,this.transControlsStatusMap={position:"translate",rotation:"rotate",scale:"scale"},this.inited=()=>{this.runScene.helperEx.setHelper(this.tansControls,!0),this.runScene.cb.multipSelect.add.add("transContro",(()=>{this.runScene.events.key.ctrl&&(this.close(),this.removeFocus())})),this.runScene.cb.events.key.up.add("transContro",(({key:e})=>{"ctrl"!==e&&"control"!==e||!1!==this.tansControls.enabled||(e=(0,i.lastArrayEle)(this.runScene.multipSelector.getSelectedList("value")||[]),this.open(),e&&this.addObject(e))}))},this.multipObj=null,this.speaceType="world",this.draggingChanged=e=>{var t,r,n;this.tansControls.enabled&&this.enable&&(t=this.runScene.assetsEx.get().controls,r=this.controlsMode,(n=this.runScene.modelEx.select||this.runScene.multipSelector.getLast())&&(this.runScene.multipSelector.draggingchanged(e),t.enabled?(this.modelNewVal=this.runScene.modelEx.cloneV3(n[r]),this.isDraggingChange=!0):(this.runScene.multipSelector.isEmpty()&&this.runScene.modelEx.setV3({model:n,info:r,newV3:this.runScene.modelEx.cloneV3(n[r]),oldV3:this.modelNewVal},!0,!1),this.isDraggingChange=!1),this.runScene.assetsEx.get().controls.enabled=!e.value))},(this.runScene=e).cb.inited.add("transContro",this.inited)}init(){const{camera:e,scene:t,engineDom:r}=this.runScene.assetsEx.get();this.tansControls=new jr(e,r),this.tansControls.addEventListener("dragging-changed",this.draggingChanged),this.tansControls.addEventListener("change",this.transChangeFn.bind(this)),this.tansControls.name="helper",t.add(this.tansControls),this.tansControls.traverse((e=>e.isHelper=!0))}changeMode(e){this.controlsMode=e,this.tansControls.setMode(this.transControlsStatusMap[e])}transControSize(e){this.tansControls.setSize(e?this.tansControls.size+.1:Math.max(this.tansControls.size-.1,.1))}changeState(e){this.tansControls.enabled=e}addObject(e){this.removeFocus(),this.tansControls.attach(e)}removeFocus(){this.tansControls.detach()}changeSpaceState(){this.tansControls.setSpace("local"===this.tansControls.space?"world":"local"),this.tansControls.detach()}setSpeace(e){e=e||("world"===this.speaceType?"local":"world"),this.speaceType=e,this.tansControls.setSpace(e),this.addObject(this.runScene.modelEx.select)}transChangeFn(e){var t;this.tansControls.enabled&&this.enable&&((t=this.runScene.modelEx.select)&&(this.runScene.lightEx.update(t),this.runScene.helperEx.boxHelper.setFromObject(t),this.runScene.cb.model.setVector3.cb({type:"position",model:t})),this.runScene.multipSelector.transChange(),this.runScene.cb.tranControls.changing.cb(t))}close(){this.tansControls.enabled=!1}open(){this.tansControls.enabled=!0}reset(){this.dispose(),this.init()}dispose(){this.tansControls&&(this.tansControls.removeEventListener("dragging-changed",this.draggingChanged),this.tansControls.removeEventListener("change",this.transChangeFn),this.tansControls.dispose(),this.runScene.assetsEx.get().scene.remove(this.tansControls))}}(e),this.viewHelper=new Ur(e),this.grid=this.createGrid(),this.init(),this.setHelper(this.viewHelper,!0),this.setHelper(this.grid,!0),this.boxHelper=this.getBoxHelper(new s.Group))}init(){this.transContro.init(),this.runScene.assetsEx.get().scene.add(this.grid)}createGrid(){const e=new c.Z.GridHelper(20,10);return e.name="helper",e.position.y=0,e.material.opacity=.75,e.material.transparent=!0,e}dispose(){}reset(){"running"!==this.runScene.optionsEx.options.mode&&this.transContro.reset()}isHelper(e){return"GridHelper"===e.type||"CubeCamera"===e.type||e.isTransformControls||e.userData.isHelper}setHelper(e,t=!1,r){return e.userData.isHelper=!0,t&&e.traverse((e=>{e.userData.isHelper=!0,r&&r(e)})),e}focus(e){"running"===this.runScene.optionsEx.options.mode||(0,h.isHelper)(e)||((0,Br.RQ)(e)||(this.boxHelper.visible=!0,this.boxHelper.setFromObject(e)),this.transContro.addObject(e),this.focusModelId=this.runScene.uniqueEx.getId(e))}unfocus(){"running"!==this.runScene.optionsEx.options.mode&&(this.transContro.removeFocus(),this.boxHelper&&(this.boxHelper.visible=!1),this.focusModelId=void 0)}}var zr=r(2510),Fr=r(4380),Vr=r(8089);class Gr{constructor(e){this.selectors={},this.boxHelperMap={},this.savedV3=new M.Z,this.tempOldval=new da.Vector3,this.runScene=e,this.runScene.cb.undo.undo.add("helperEx",(()=>{this.updateBoxHelper()})),this.runScene.cb.undo.redo.add("helperEx",(()=>{this.updateBoxHelper()}))}updateBoxHelper(){(0,i.mapObj)(this.boxHelperMap,((e,t)=>{t.parent&&t.update()}))}add(e,t=!1,r=!0){if("array"===(0,i.getType)(e))return e.map((e=>this.add(e,t,r)));(0,h.isHelper)(e)||(this.runScene.modelEx.select&&this.runScene.modelEx.selectNull(),this.selectors[e.uuid]&&(this.remove(e),this.removeBoxHelper(e),!t)||(this.addBoxHelper(e),this.selectors[e.uuid]=e,this.runScene.cb.model.focus.cb({model:e,status:!0,domActive:!0}),r&&this.runScene.helperEx.focus(e),this.runScene.cb.multipSelect.add.cb({model:e,selectIds:this.selectors})))}setInfo(e,t,r,n,a,i){"position"!==t&&(a=n,i=r);const s=this.getSelectedList("value");var{x:a,y:o,z:l}=a;const c=a-i.x,u=o-i.y,h=l-i.z,d=[new Fr.Z({target:e,info:t,oldV3:this.runScene.modelEx.cloneV3(r),newV3:n,runScene:this.runScene}).execute()];s.map((r=>{if(r!==e){var{x:n,y:a,z:i}=r[t],n=n+=c,a=a+=u,i=i+=h;let e=r[t].clone();e.x=n,e.y=a,e.z=i,n=new Fr.Z({target:r,info:t,oldV3:this.runScene.modelEx.cloneV3(r[t]),newV3:e,runScene:this.runScene}).execute(),d.push(n),this.boxHelperMap[r.uuid].setFromObject(r)}})),this.boxHelperMap[e.uuid].setFromObject(e),this.runScene.undoEx.addUndo(d)}draggingchanged(e){const t=this.runScene.assetsEx.get().controls;var r;this.isEmpty()?this.runScene.events.mouse.enableUp=!0:this.runScene.events.mouse.enableUp=!1,e.value?this.isEmpty()||(t.enabled=!1,e=this.getLast(),r=this.runScene.helperEx.transContro.controlsMode,this.tempOldval="position"===r?(0,Vr.VU)(e,this.runScene.sceneEx.get()):this.runScene.modelEx.cloneV3(e[r]),this.saveV3(r)):t.enabled||this.isEmpty()||(this.runScene.events.mouse.enableUp=!1,this.useV3())}transChange(){if(!this.isEmpty()&&!this.runScene.assetsEx.controls.enabled){var e=this.runScene.helperEx.transContro.controlsMode,t=this.getLast();let r;this.runScene.events.mouse.enableUp=!1,this.runScene.helperEx.boxHelper.setFromObject(this.runScene.assetsEx.get().scene),r="position"===e?(0,Vr.VU)(t,this.runScene.sceneEx.get()):this.runScene.modelEx.cloneV3(t[e]),this.getInfo({model:t,type:e,newV3:r,oldV3:this.tempOldval}),this.tempOldval.copy(r)}}saveV3(e){this.getSelectedList("value").map((t=>{var r=(0,O.Ki)(t);this.savedV3.set(r,{model:t,type:e,val:this.runScene.modelEx.cloneV3(t[e])})}))}useV3(){var e=this.savedV3.map(((e,{type:t,val:r,model:n})=>new Fr.Z({target:n,info:t,newV3:this.runScene.modelEx.cloneV3(n[t]),oldV3:r,runScene:this.runScene})));this.runScene.undoEx.addUndo(e),this.savedV3.clear()}getInfo(e){const{model:t,type:r,newV3:n,oldV3:a}=e,i=this.getSelectedList("value");var{x:e,y:s,z:o}=n;const l=e-a.x,c=s-a.y,u=o-a.z;t[r].copy(n),i.map((e=>{if(e!==t){var{x:n,y:a,z:i}=e[r],n=n+=l,a=a+=c,i=i+=u;let t=e[r].clone();t.x=n,t.y=a,t.z=i,e[r].copy(t),this.boxHelperMap[e.uuid].setFromObject(e)}})),this.boxHelperMap[t.uuid].setFromObject(t)}getLast(){var e=this.getSelectedList("value");return e[e.length-1]}addBoxHelper(e){var t=this.runScene.helperEx.getBoxHelper(e);this.boxHelperMap[e.uuid]=t}removeBoxHelper(e){this.runScene.assetsEx.get().scene.remove(this.boxHelperMap[e.uuid]),delete this.boxHelperMap[e.uuid],delete this.selectors[e.uuid]}remove(e){if(e instanceof Array)return e.map((e=>this.remove(e)));this.runScene.cb.model.unFocus.cb(e),this.selectors[e.uuid]=null,delete this.selectors[e.uuid]}isEmpty(){return 0===this.getSelectedList("key").length}getSelectedList(e){return"key"===e?Object.keys(this.selectors):Object.values(this.selectors)}getSelect(){var e=Object.values(this.selectors);return 0!==e.length?e:void 0}selectedLoop(e){return Object.keys(this.selectors).map((t=>e(t,this.selectors[t])))}delete(){this.setBoxHelperEmpty(),this.setEmpty(),this.runScene.helperEx.unfocus()}setBoxHelperEmpty(){const e=this.runScene.assetsEx.get().scene;Object.values(this.boxHelperMap).map((t=>{e.remove(t)})),this.boxHelperMap={}}setEmpty(){this.isEmpty()||(Object.values(this.boxHelperMap).map((e=>{this.removeBoxHelper(e)})),this.getSelectedList("value").map((e=>{this.runScene.cb.model.unFocus.cb(e)})),this.setBoxHelperEmpty(),this.selectors={},this.runScene.cb.model.multiSelect.setEmpty.cb())}createGroup(){this.runScene.helperEx.unfocus(),this.runScene.modelEx.selectNull();var e=new s.Group;const t=new s.Group;this.runScene.modelEx.add(e,void 0,{addUndo:!1}),this.runScene.modelEx.add(t);var r=[...this.getSelectedList("value")],n=(this.runScene.cb.model.multipDrop.cb({models:this.getSelectedList("value"),dropModel:e}),(0,Vr.qg)(e));t.position.copy(n),this.runScene.cb.model.multipDrop.cb({models:r,dropModel:t}),this.runScene.modelEx.remove(e,!1),this.runScene.modelEx.select=t}getSelectorGroup(){const e=this.getSelectedList("value"),t=new s.Group;return e.forEach((e=>t.add(e.clone()))),this.setEmpty(),t}rename(e){const{prefix:t,rmPrefixLength:r,back:n,rmBackLength:a,fullName:i,step:s}=e,o=this.getSelectedList("value");0!==o.length&&(e=o.map(((e,o)=>{let l=e.name;if(0===i.length){if(0!==r){if(r>l.length)return;l=l.substring(r)}if(0!==a){if(a>l.length)return;l=l.substring(0,l.length-a)}0<t.length&&(l=t+l),0<n.length&&(l+=n)}else l=i+(o+1)*s;return new zr.Z({target:e,info:"name",newVal:l,oldVal:e.name,runScene:this.runScene}).execute()})),this.runScene.undoEx.addUndo(e))}align(e){const t=this.getSelectedList("value");if(0!==t.length){const[n]=t;var r=t.map((t=>{var r=t.position.clone();const a=("all"===e?n:t).position.clone();return"all"!==e&&(a[e]=n.position[e]),new Fr.Z({target:t,info:"position",oldV3:r,newV3:a,runScene:this.runScene}).execute()}));this.runScene.multipSelector.add(t,!0),this.runScene.undoEx.addUndo(r)}}}function Hr(e){return(Hr="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})(e)}function Wr(e,t){return(Wr=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Kr(e){return(Kr=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var qr=function(e){var t=n;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Wr(t,e);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Kr(e);if(r=t?(r=Kr(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===Hr(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(){if(!(this instanceof n))throw new TypeError("Cannot call a class as a function");var e=n.SkyShader;return e=new s.ShaderMaterial({name:"SkyShader",fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:s.UniformsUtils.clone(e.uniforms),side:s.BackSide,depthWrite:!1}),(e=r.call(this,new s.BoxGeometry(1,1,1),e)).isSky=!0,e}return t=n,Object.defineProperty(t,"prototype",{writable:!1}),t}(s.Mesh),Zr=(qr.SkyShader={uniforms:{turbidity:{value:2},rayleigh:{value:1},mieCoefficient:{value:.005},mieDirectionalG:{value:.8},sunPosition:{value:new s.Vector3},up:{value:new s.Vector3(0,1,0)}},vertexShader:"\n\t\tuniform vec3 sunPosition;\n\t\tuniform float rayleigh;\n\t\tuniform float turbidity;\n\t\tuniform float mieCoefficient;\n\t\tuniform vec3 up;\n\n\t\tvarying vec3 vWorldPosition;\n\t\tvarying vec3 vSunDirection;\n\t\tvarying float vSunfade;\n\t\tvarying vec3 vBetaR;\n\t\tvarying vec3 vBetaM;\n\t\tvarying float vSunE;\n\n\t\t// constants for atmospheric scattering\n\t\tconst float e = 2.71828182845904523536028747135266249775724709369995957;\n\t\tconst float pi = 3.141592653589793238462643383279502884197169;\n\n\t\t// wavelength of used primaries, according to preetham\n\t\tconst vec3 lambda = vec3( 680E-9, 550E-9, 450E-9 );\n\t\t// this pre-calcuation replaces older TotalRayleigh(vec3 lambda) function:\n\t\t// (8.0 * pow(pi, 3.0) * pow(pow(n, 2.0) - 1.0, 2.0) * (6.0 + 3.0 * pn)) / (3.0 * N * pow(lambda, vec3(4.0)) * (6.0 - 7.0 * pn))\n\t\tconst vec3 totalRayleigh = vec3( 5.804542996261093E-6, 1.3562911419845635E-5, 3.0265902468824876E-5 );\n\n\t\t// mie stuff\n\t\t// K coefficient for the primaries\n\t\tconst float v = 4.0;\n\t\tconst vec3 K = vec3( 0.686, 0.678, 0.666 );\n\t\t// MieConst = pi * pow( ( 2.0 * pi ) / lambda, vec3( v - 2.0 ) ) * K\n\t\tconst vec3 MieConst = vec3( 1.8399918514433978E14, 2.7798023919660528E14, 4.0790479543861094E14 );\n\n\t\t// earth shadow hack\n\t\t// cutoffAngle = pi / 1.95;\n\t\tconst float cutoffAngle = 1.6110731556870734;\n\t\tconst float steepness = 1.5;\n\t\tconst float EE = 1000.0;\n\n\t\tfloat sunIntensity( float zenithAngleCos ) {\n\t\t\tzenithAngleCos = clamp( zenithAngleCos, -1.0, 1.0 );\n\t\t\treturn EE * max( 0.0, 1.0 - pow( e, -( ( cutoffAngle - acos( zenithAngleCos ) ) / steepness ) ) );\n\t\t}\n\n\t\tvec3 totalMie( float T ) {\n\t\t\tfloat c = ( 0.2 * T ) * 10E-18;\n\t\t\treturn 0.434 * c * MieConst;\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvec4 worldPosition = modelMatrix * vec4( position, 1.0 );\n\t\t\tvWorldPosition = worldPosition.xyz;\n\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\tgl_Position.z = gl_Position.w; // set z to camera.far\n\n\t\t\tvSunDirection = normalize( sunPosition );\n\n\t\t\tvSunE = sunIntensity( dot( vSunDirection, up ) );\n\n\t\t\tvSunfade = 1.0 - clamp( 1.0 - exp( ( sunPosition.y / 450000.0 ) ), 0.0, 1.0 );\n\n\t\t\tfloat rayleighCoefficient = rayleigh - ( 1.0 * ( 1.0 - vSunfade ) );\n\n\t\t\t// extinction (absorbtion + out scattering)\n\t\t\t// rayleigh coefficients\n\t\t\tvBetaR = totalRayleigh * rayleighCoefficient;\n\n\t\t\t// mie coefficients\n\t\t\tvBetaM = totalMie( turbidity ) * mieCoefficient;\n\n\t\t}",fragmentShader:"\n\t\tvarying vec3 vWorldPosition;\n\t\tvarying vec3 vSunDirection;\n\t\tvarying float vSunfade;\n\t\tvarying vec3 vBetaR;\n\t\tvarying vec3 vBetaM;\n\t\tvarying float vSunE;\n\n\t\tuniform float mieDirectionalG;\n\t\tuniform vec3 up;\n\n\t\tconst vec3 cameraPos = vec3( 0.0, 0.0, 0.0 );\n\n\t\t// constants for atmospheric scattering\n\t\tconst float pi = 3.141592653589793238462643383279502884197169;\n\n\t\tconst float n = 1.0003; // refractive index of air\n\t\tconst float N = 2.545E25; // number of molecules per unit volume for air at 288.15K and 1013mb (sea level -45 celsius)\n\n\t\t// optical length at zenith for molecules\n\t\tconst float rayleighZenithLength = 8.4E3;\n\t\tconst float mieZenithLength = 1.25E3;\n\t\t// 66 arc seconds -> degrees, and the cosine of that\n\t\tconst float sunAngularDiameterCos = 0.999956676946448443553574619906976478926848692873900859324;\n\n\t\t// 3.0 / ( 16.0 * pi )\n\t\tconst float THREE_OVER_SIXTEENPI = 0.05968310365946075;\n\t\t// 1.0 / ( 4.0 * pi )\n\t\tconst float ONE_OVER_FOURPI = 0.07957747154594767;\n\n\t\tfloat rayleighPhase( float cosTheta ) {\n\t\t\treturn THREE_OVER_SIXTEENPI * ( 1.0 + pow( cosTheta, 2.0 ) );\n\t\t}\n\n\t\tfloat hgPhase( float cosTheta, float g ) {\n\t\t\tfloat g2 = pow( g, 2.0 );\n\t\t\tfloat inverse = 1.0 / pow( 1.0 - 2.0 * g * cosTheta + g2, 1.5 );\n\t\t\treturn ONE_OVER_FOURPI * ( ( 1.0 - g2 ) * inverse );\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvec3 direction = normalize( vWorldPosition - cameraPos );\n\n\t\t\t// optical length\n\t\t\t// cutoff angle at 90 to avoid singularity in next formula.\n\t\t\tfloat zenithAngle = acos( max( 0.0, dot( up, direction ) ) );\n\t\t\tfloat inverse = 1.0 / ( cos( zenithAngle ) + 0.15 * pow( 93.885 - ( ( zenithAngle * 180.0 ) / pi ), -1.253 ) );\n\t\t\tfloat sR = rayleighZenithLength * inverse;\n\t\t\tfloat sM = mieZenithLength * inverse;\n\n\t\t\t// combined extinction factor\n\t\t\tvec3 Fex = exp( -( vBetaR * sR + vBetaM * sM ) );\n\n\t\t\t// in scattering\n\t\t\tfloat cosTheta = dot( direction, vSunDirection );\n\n\t\t\tfloat rPhase = rayleighPhase( cosTheta * 0.5 + 0.5 );\n\t\t\tvec3 betaRTheta = vBetaR * rPhase;\n\n\t\t\tfloat mPhase = hgPhase( cosTheta, mieDirectionalG );\n\t\t\tvec3 betaMTheta = vBetaM * mPhase;\n\n\t\t\tvec3 Lin = pow( vSunE * ( ( betaRTheta + betaMTheta ) / ( vBetaR + vBetaM ) ) * ( 1.0 - Fex ), vec3( 1.5 ) );\n\t\t\tLin *= mix( vec3( 1.0 ), pow( vSunE * ( ( betaRTheta + betaMTheta ) / ( vBetaR + vBetaM ) ) * Fex, vec3( 1.0 / 2.0 ) ), clamp( pow( 1.0 - dot( up, vSunDirection ), 5.0 ), 0.0, 1.0 ) );\n\n\t\t\t// nightsky\n\t\t\tfloat theta = acos( direction.y ); // elevation --\x3e y-axis, [-pi/2, pi/2]\n\t\t\tfloat phi = atan( direction.z, direction.x ); // azimuth --\x3e x-axis [-pi/2, pi/2]\n\t\t\tvec2 uv = vec2( phi, theta ) / vec2( 2.0 * pi, pi ) + vec2( 0.5, 0.0 );\n\t\t\tvec3 L0 = vec3( 0.1 ) * Fex;\n\n\t\t\t// composition + solar disc\n\t\t\tfloat sundisk = smoothstep( sunAngularDiameterCos, sunAngularDiameterCos + 0.00002, cosTheta );\n\t\t\tL0 += ( vSunE * 19000.0 * Fex ) * sundisk;\n\n\t\t\tvec3 texColor = ( Lin + L0 ) * 0.04 + vec3( 0.0, 0.0003, 0.00075 );\n\n\t\t\tvec3 retColor = pow( texColor, vec3( 1.0 / ( 1.2 + ( 1.2 * vSunfade ) ) ) );\n\n\t\t\tgl_FragColor = vec4( retColor, 1.0 );\n\n\t\t\t#include <tonemapping_fragment>\n\t\t\t#include <encodings_fragment>\n\n\t\t}"},r(7585)),Xr=r(6651);const Qr={color:"#000000",intensity:1};class Yr{diff(e,t){const r={};return(0,i.mapObj)(Qr,(n=>{var a=e[n];(0,E.Xq)(a,t[n])&&(r[n]=a)})),r}setConfig(e,t){var{color:t,intensity:r,shadow:n}=t,{mapSize:n,camera:a}=n||{},{far:a,near:i,scale:s}=a||{};void 0!==s&&(e.shadow.camera.scale.x=s,e.shadow.camera.scale.y=s,e.shadow.camera.scale.z=s),void 0!==i&&(e.shadow.camera.near=i),void 0!==a&&(e.shadow.camera.far=a),void 0!==n&&(e.shadow.mapSize.x=n,e.shadow.mapSize.y=n),void 0!==r&&(e.intensity=r),void 0!==t&&(e.color=(0,Vr.e9)(t)),e.shadow.camera.updateProjectionMatrix(),null!=(s=e.cameraHelper)&&s.update()}}class Jr extends o{constructor(){super(...arguments),this.allState=["morning","noon","evening","night"],this.sun=new da.Vector3,this.light=new Yr,this.sky=new qr,this.baseLightConfig={name:"天空定向光",type:"DirectionalLight",castShadow:!0},this.skyData=this.getData(),this.lastTime={index:0,name:"morning"},this.skyChangeArr=[],this.lightChangeArr=[],this.uniforms=null,this.inied=!1,this.currentLightConfig={},this.backUpSkyData=this.getData(),this.toJSON=()=>{var{currentState:e,effectController:t,isShow:r,lightConfig:n,size:a}=this.skyData,e={currentState:e,effectController:t,isShow:r,lightConfig:n,size:a};if(0!==x.YD.objLength((0,E.ad)(e,this.getData())))return e},this.parseJSON=e=>{var t,r,n;e&&(({isShow:t,currentState:r,size:n}=e),this.skyData.isShow=t,this.initLight(),this.parseLightConfig(e),this.inied||(this.init(),this.inied=!0),this.parseSkyConfig(r,n),this.setOpen(t))},this.currentAnimas=[],this.awaitAnimas=[],this.animaInstance=null,this.animaIndex={begin:0,end:0},this.getNromalFn=()=>{this.playSky()},this.getSpecialFn=()=>{var e=this.allState[0];this.setSkyConfig(e),this.setLightSpecialConfig(e),this.lightAnima(e),0!==this.animaIndex.end&&(this.currentAnimas=this.getAnimasDataByState(this.allState[this.animaIndex.end],e),this.playSky())}}init(){this.addScene(),this.initSnapshot()}initSnapshot(){this.runScene.cb.snapshot.create.add("sky",(e=>{e.data.set("sky",{state:this.skyData.currentState})})),this.runScene.cb.snapshot.set.add("sky",(e=>{(e=e.snapshot.data.get("sky"))&&e.state!==this.skyData.currentState&&this.setState(e.state)}))}initLight(){if(!this.directionalLight){var e=new Zr.Z(this.runScene).get();const[t]=e;this.runScene.lightEx.add(e,{addToTree:!1}),(this.directionalLight=t).name="skyLight"}}addScene(){this.initLight(),rt.materialIgnore.set(this.sky.material,!0),(0,h.setHelper)(this.sky),h.selectableModel.close(this.sky),h.selectableModel.close(this.directionalLight),(0,h.setHelper)(this.directionalLight),this.directionalLight.helper&&(this.directionalLight.helper.visible=!1),this.runScene.modelEx.add(this.sky,void 0,{addToTree:!1})}setOpen(e){const t=this.runScene.assetsEx.get().renderer;this.sky.visible!==e&&this.directionalLight&&(this.directionalLight.visible=e,t.toneMapping=e?4:0,this.skyData.isShow=e,this.sky.visible=e)}parseLightConfig(e){var t,{isShow:r,effectController:n,currentState:a,lightConfig:i,size:s}=e;e&&i&&(e=i.shadow,t=n[a].lightConfig,Zr.Z.setConfig(this.directionalLight,Object.assign(Object.assign({shadow:e},t),this.baseLightConfig)),this.directionalLight.visible=r,this.skyData.lightConfig=i,this.skyData.isShow=r,this.skyData.effectController=n,this.skyData.currentState=a,this.skyData.size=s,this.sky.visible=r,this.setLightSpecialConfig(a),this.lightAnima(a))}parseSkyConfig(e,t){this.setSkyConfig(e),this.setSkyScale(t)}setState(e){var t=this.skyData.currentState;this.doAnimaByState(e,t),this.runScene.cb.objects.sky.setState.cb({state:e}),this.saveLastTimeState({oldState:t,state:e,index:this.allState.findIndex((t=>t===e))})}saveLastTimeState(e){var{oldState:e,state:t,index:r}=e;this.lastTime.name=e,this.lastTime.index=r,this.skyData.currentState=t}getLightDataByState(e){let t=new da.Vector3,r=new da.Vector3;switch(e){case"morning":t.x=0,t.y=0,t.z=-this.skyData.size,r.x=0,r.y=this.skyData.size/2*-1,r.z=this.skyData.size/2;break;case"noon":t.x=0,t.y=this.skyData.size/2,t.z=0,r.x=0,r.y=-1*this.skyData.size,r.z=0;break;case"evening":case"night":t.x=0,t.y=0,t.z=this.skyData.size,r.x=0,r.y=this.skyData.size/2*-1,r.z=this.skyData.size/2*-1}return{position:t,targetPosition:r}}getIdxByState(e){return this.allState.findIndex((t=>t===e))}setSkyConfig(e){const{renderer:t,scene:r,camera:n}=this.runScene.assetsEx.get();this.sky.material.uniforms.turbidity.value=this.skyData.effectController[e].turbidity,this.sky.material.uniforms.mieCoefficient.value=this.skyData.effectController[e].mieCoefficient,this.sky.material.uniforms.mieDirectionalG.value=this.skyData.effectController[e].mieDirectionalG,t.toneMappingExposure=this.skyData.effectController[e].exposure,t.render(r,n);var a=da.MathUtils.degToRad(90-this.skyData.effectController[e].elevation);e=da.MathUtils.degToRad(this.skyData.effectController[e].azimuth),this.sun.setFromSphericalCoords(1,a,e),this.sky.material.uniforms.sunPosition.value.copy(this.sun)}setSkyScale(e){this.sky.scale.setScalar(e),this.skyData.size=e}setSky(e){var{state:e,type:t,val:r}=e;this.skyData.effectController[e][t]=r,this.setSkyConfig(e)}setCurrentState(e){this.skyData.currentState=e}setStateTime(e){var{info:e,time:t}=e;this.skyData.effectController[e].time=t}clean(){this.setOpen(!1),this.skyData=this.getData(),this.directionalLight&&this.runScene.modelEx.remove(this.directionalLight)}setLight(e,t){switch(e){case"mapSize":this.skyData.lightConfig.shadow.mapSize=t,this.directionalLight.shadow.mapSize.x=t,this.directionalLight.shadow.mapSize.y=t;break;case"near":this.skyData.lightConfig.shadow.camera.near=t,this.directionalLight.shadow.camera.near=t;break;case"far":this.skyData.lightConfig.shadow.camera.far=t,this.directionalLight.shadow.camera.far=t;break;case"scale":this.skyData.lightConfig.shadow.camera.scale=t,this.directionalLight.shadow.camera.scale.set(t,t,t);break;case"top":this.skyData.lightConfig.shadow.camera.top=t,this.skyData.lightConfig.shadow.camera.bottom=t,this.skyData.lightConfig.shadow.camera.left=t,this.skyData.lightConfig.shadow.camera.right=t,this.directionalLight.shadow.camera.top=t,this.directionalLight.shadow.camera.bottom=t,this.directionalLight.shadow.camera.left=t,this.directionalLight.shadow.camera.right=t,this.directionalLight.shadow.camera.updateProjectionMatrix(),null!=(r=this.directionalLight.cameraHelper)&&r.update();break;case"color":this.skyData.effectController[this.skyData.currentState].lightConfig.color=t;var r=new da.Color(t);this.directionalLight.color=r;break;case"intensity":this.skyData.effectController[this.skyData.currentState].lightConfig.intensity=t,this.directionalLight.intensity=t}}setLightSpecialConfig(e){var{color:e,intensity:t}=this.skyData.effectController[e].lightConfig;this.directionalLight.color=(0,Vr.e9)(e),this.directionalLight.intensity=t}getAnimasDataByState(e,t){e=this.getIdxByState(e);const r=[];if((t=this.getIdxByState(t))<e){this.animaIndex={begin:e,end:t};var n=e-t;let l=t;for(let e=0;e<n;e++){var{color:a,intensity:i}=this.skyData.effectController[this.allState[l]].lightConfig,{position:s,targetPosition:o}=this.getLightDataByState(this.allState[l]),{color:a,intensity:i}=(r.push({data:this.transDataToAnimaData({sky:this.skyData.effectController[this.allState[l]],color:a,intensity:i,position:s,targetPosition:o})}),l++,this.skyData.effectController[this.allState[l]].lightConfig),{position:s,targetPosition:o}=this.getLightDataByState(this.allState[l]);r.push({data:this.transDataToAnimaData({sky:this.skyData.effectController[this.allState[l]],color:a,intensity:i,position:s,targetPosition:o}),onDone:this.getNromalFn})}}else{var l=3-t;this.animaIndex={begin:t,end:e};let n=t;if(0==l)return r.push({onDone:this.getSpecialFn}),r;for(let e=0;e<l;e++){var{color:c,intensity:u}=this.skyData.effectController[this.allState[n]].lightConfig,{position:h,targetPosition:d}=this.getLightDataByState(this.allState[n]),{position:h,targetPosition:d}=(r.push({data:this.transDataToAnimaData({sky:this.skyData.effectController[this.allState[n]],color:c,intensity:u,position:h,targetPosition:d})}),n++,this.getLightDataByState(this.allState[n]));r.push({data:this.transDataToAnimaData({sky:this.skyData.effectController[this.allState[n]],color:c,intensity:u,position:h,targetPosition:d}),onDone:3===n?this.getSpecialFn:this.getNromalFn})}}return r}playSky(){if(0!==this.currentAnimas.length){const t=this.currentAnimas.shift();var e=this.currentAnimas.shift();if(!e)return t.onDone();this.playAnima(t,e)}}playAnima(e,t){const r=this.runScene.assetsEx.get().renderer;this.animaInstance=u.anima(Object.assign(Object.assign({},e.data),{x:this.directionalLight.position.x,y:this.directionalLight.position.y,z:this.directionalLight.position.z,tx:this.directionalLight.target.position.x,ty:this.directionalLight.target.position.y,tz:this.directionalLight.target.position.z}),Object.assign(Object.assign({},t.data),{ease:"none"}),e.data.time,(e=>{var{r:n,g:a,b:i}=e,s=(this.onUpdated(e),this.sky.material.uniforms.turbidity.value=e.turbidity,this.sky.material.uniforms.mieCoefficient.value=e.mieCoefficient,this.sky.material.uniforms.mieDirectionalG.value=e.mieDirectionalG,r.toneMappingExposure=e.exposure,da.MathUtils.degToRad(90-e.elevation)),o=da.MathUtils.degToRad(t.data.azimuth);this.sun.setFromSphericalCoords(1,s,o),this.sky.material.uniforms.sunPosition.value.copy(this.sun),s=new da.Color(n,a,i),this.directionalLight.color=s,this.directionalLight.intensity=e.intensity,this.directionalLight.position.set(e.x,e.y,e.z),this.directionalLight.target.position.set(e.tx,e.ty,e.tz)}),(()=>{t.onDone(),this.animaInstance=null}))}doAnimaByState(e,t){e=this.getAnimasDataByState(e,t),this.animaInstance?this.awaitAnimas=e:(this.currentAnimas=e,this.playSky())}onUpdated(e){var t;0!==this.awaitAnimas.length&&(this.animaInstance.kill(),this.animaInstance=null,[t]=this.awaitAnimas,this.currentAnimas=[...this.awaitAnimas],this.awaitAnimas=[],null!=t&&t.data&&(this.currentAnimas.unshift({data:t.data,onDone:this.getNromalFn}),this.currentAnimas.unshift({data:e})),this.playSky())}lightAnima(e){var{position:e,targetPosition:t}=this.getLightDataByState(e);this.directionalLight.position.set(e.x,e.y,e.z),this.directionalLight.target.position.set(t.x,t.y,t.z)}transDataToAnimaData(e){var{sky:e,color:t,position:r,targetPosition:n,intensity:a}=e,{x:r,y:i,z:s}=r,{x:n,y:o,z:l}=n,{r:t,g:c,b:u}=(0,E.fh)((0,E.I8)(t));return Object.assign(Object.assign({},e),{r:t,g:c,b:u,x:r,y:i,z:s,tx:n,ty:o,tz:l,intensity:a})}getData(){return{isShow:!1,size:5e3,lightConfig:{shadow:{mapSize:512,camera:{near:.5,far:500,scale:1,top:5,bottom:5,left:5,right:5}}},effectController:{morning:{turbidity:2,rayleigh:1,mieCoefficient:.007,mieDirectionalG:.7,elevation:0,azimuth:180,exposure:.3,lightConfig:Object.assign(Object.assign({},(0,Xr.d9)(Qr)),{color:"#3DC1F1"}),time:1},noon:{turbidity:1,rayleigh:1,mieCoefficient:.005,mieDirectionalG:.7,elevation:90,azimuth:180,exposure:1,time:1,lightConfig:Object.assign(Object.assign({},(0,Xr.d9)(Qr)),{color:"#FFFFFF"})},evening:{turbidity:2,rayleigh:.3,mieCoefficient:.011,mieDirectionalG:.67,elevation:3,azimuth:0,exposure:.3762,lightConfig:Object.assign(Object.assign({},(0,Xr.d9)(Qr)),{color:"#FFFFFF"}),time:1},night:{turbidity:1,rayleigh:1,mieCoefficient:.005,mieDirectionalG:.7,elevation:2,azimuth:0,exposure:.2624,lightConfig:Object.assign(Object.assign({},(0,Xr.d9)(Qr)),{color:"#B8A277"}),time:1}},currentState:"morning"}}}class $r{constructor(e){this.clean=()=>{this.sky.clean()},this.sky=new Jr(e),this.runScene=e,this.runScene.cb.clean.add("Objects",this.clean)}init(){}toJSON(){return{sky:this.sky.toJSON()}}parseJSON(e){this.sky.parseJSON(e.sky)}}class en{constructor(e){this.outlineModelLength=new Set,this.modelMap=new M.Z,this.runScene=e,this.initGlow(),this.initOutline()}initGlow(){const{setLayers:e,add:t,remove:r,change:n}=this.runScene.cb.model;n.add("pp-set-glow",(e=>{const{model:t,type:r,val:n}=e;"visible"===r&&(t.traverse((e=>{(0,h.isGLowModel)(e)&&this.modelMap.set((0,O.Ki)(e),n)})),this.afterGLowModelSet())})),e.add("pp-set-glow",(e=>{var{model:e,val:t}=e;0===t&&0===this.modelMap.size||this[0===t?"glowRemove":"glowAdd"](e)})),t.add("pp-set-glow",(({model:e})=>{1!==e.layers.mask&&this.glowAdd(e)})),r.add("pp-set-glow",(({model:e})=>{1!==e.layers.mask&&this.glowRemove(e)}))}glowAdd(e){this.modelMap.set(e.userData.id,e.visible),this.afterGLowModelSet()}glowRemove(e){this.modelMap.delete(e.userData.id),this.afterGLowModelSet()}afterGLowModelSet(){var e=0<this.modelMap.size&&this.modelMap.find(((e,t)=>!0===t))||!1;this.runScene.pp.params.glow.isBloom!==e&&(this.runScene.cb.pp.glow.setStatus.cb(e),this.runScene.pp.params.glow.isBloom=e)}initOutline(){const{setOutline:e,add:t,remove:r}=this.runScene.cb.model;e.add("pp-set-outline",(e=>{var{model:e,val:t}=e;!t&&0===this.outlineModelLength.size||this[t?"outlineAdd":"outlineRemove"](e)})),t.add("pp-set-outline",(({model:e})=>{e.userData.outline&&this.outlineAdd(e)})),r.add("pp-set-outline",(({model:e})=>{e.userData.outline&&this.outlineRemove(e)}))}outlineAdd(e){this.outlineModelLength.add(e.userData.id),0<this.outlineModelLength.size&&(this.runScene.cb.pp.outline.setStatus.cb(!0),this.runScene.pp.params.outline.isOutline=!0)}outlineRemove(e){this.outlineModelLength.delete(e.userData.id),this.outlineModelLength.size<=0&&(this.runScene.cb.pp.outline.setStatus.cb(!1),this.runScene.pp.params.outline.isOutline=!1)}}var tn=r(6608),rn=r(5180),nn=r(4819),an={shaderID:"luminosityHighPass",uniforms:{tDiffuse:{value:null},luminosityThreshold:{value:1},smoothWidth:{value:1},defaultColor:{value:new s.Color(0)},defaultOpacity:{value:0}},vertexShader:"\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",fragmentShader:"\n\n\t\tuniform sampler2D tDiffuse;\n\t\tuniform vec3 defaultColor;\n\t\tuniform float defaultOpacity;\n\t\tuniform float luminosityThreshold;\n\t\tuniform float smoothWidth;\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvec4 texel = texture2D( tDiffuse, vUv );\n\n\t\t\tvec3 luma = vec3( 0.299, 0.587, 0.114 );\n\n\t\t\tfloat v = dot( texel.xyz, luma );\n\n\t\t\tvec4 outputColor = vec4( defaultColor.rgb, defaultOpacity );\n\n\t\t\tfloat alpha = smoothstep( luminosityThreshold, luminosityThreshold + smoothWidth, v );\n\n\t\t\tgl_FragColor = mix( outputColor, texel, alpha );\n\n\t\t}"};function sn(e){return(sn="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})(e)}function on(e,t){return(on=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ln(e){return(ln=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var cn=function(e){var t=n;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&on(t,e);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=ln(e);if(r=t?(r=ln(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===sn(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(e,t,a,i){var o;if(!(this instanceof n))throw new TypeError("Cannot call a class as a function");(o=r.call(this)).strength=void 0!==t?t:1,o.radius=a,o.threshold=i,o.resolution=void 0!==e?new s.Vector2(e.x,e.y):new s.Vector2(256,256),o.clearColor=new s.Color(0,0,0),o.renderTargetsHorizontal=[],o.renderTargetsVertical=[],o.nMips=5;var l=Math.round(o.resolution.x/2),c=Math.round(o.resolution.y/2);o.renderTargetBright=new s.WebGLRenderTarget(l,c),o.renderTargetBright.texture.name="UnrealBloomPass.bright",o.renderTargetBright.texture.generateMipmaps=!1;for(var u=0;u<o.nMips;u++){var h;((h=new s.WebGLRenderTarget(l,c)).texture.name="UnrealBloomPass.h"+u,h.texture.generateMipmaps=!1,o.renderTargetsHorizontal.push(h),h=new s.WebGLRenderTarget(l,c)).texture.name="UnrealBloomPass.v"+u,h.texture.generateMipmaps=!1,o.renderTargetsVertical.push(h),l=Math.round(l/2),c=Math.round(c/2)}a=an;for(var d=(o.highPassUniforms=s.UniformsUtils.clone(a.uniforms),o.highPassUniforms.luminosityThreshold.value=i,o.highPassUniforms.smoothWidth.value=.01,o.materialHighPassFilter=new s.ShaderMaterial({uniforms:o.highPassUniforms,vertexShader:a.vertexShader,fragmentShader:a.fragmentShader,defines:{}}),o.separableBlurMaterials=[],[3,5,7,9,11]),p=(l=Math.round(o.resolution.x/2),c=Math.round(o.resolution.y/2),0);p<o.nMips;p++)o.separableBlurMaterials.push(o.getSeperableBlurMaterial(d[p])),o.separableBlurMaterials[p].uniforms.texSize.value=new s.Vector2(l,c),l=Math.round(l/2),c=Math.round(c/2);return o.compositeMaterial=o.getCompositeMaterial(o.nMips),o.compositeMaterial.uniforms.blurTexture1.value=o.renderTargetsVertical[0].texture,o.compositeMaterial.uniforms.blurTexture2.value=o.renderTargetsVertical[1].texture,o.compositeMaterial.uniforms.blurTexture3.value=o.renderTargetsVertical[2].texture,o.compositeMaterial.uniforms.blurTexture4.value=o.renderTargetsVertical[3].texture,o.compositeMaterial.uniforms.blurTexture5.value=o.renderTargetsVertical[4].texture,o.compositeMaterial.uniforms.bloomStrength.value=t,o.compositeMaterial.uniforms.bloomRadius.value=.1,o.compositeMaterial.needsUpdate=!0,o.compositeMaterial.uniforms.bloomFactors.value=[1,.8,.6,.4,.2],o.bloomTintColors=[new s.Vector3(1,1,1),new s.Vector3(1,1,1),new s.Vector3(1,1,1),new s.Vector3(1,1,1),new s.Vector3(1,1,1)],o.compositeMaterial.uniforms.bloomTintColors.value=o.bloomTintColors,e=tn.C,o.copyUniforms=s.UniformsUtils.clone(e.uniforms),o.copyUniforms.opacity.value=1,o.materialCopy=new s.ShaderMaterial({uniforms:o.copyUniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader,blending:s.AdditiveBlending,depthTest:!1,depthWrite:!1,transparent:!0}),o.enabled=!0,o.needsSwap=!1,o._oldClearColor=new s.Color,o.oldClearAlpha=1,o.basic=new s.MeshBasicMaterial,o.fsQuad=new nn.T(null),o}return t=n,(e=[{key:"dispose",value:function(){for(var e=0;e<this.renderTargetsHorizontal.length;e++)this.renderTargetsHorizontal[e].dispose();for(var t=0;t<this.renderTargetsVertical.length;t++)this.renderTargetsVertical[t].dispose();this.renderTargetBright.dispose();for(var r=0;r<this.separableBlurMaterials.length;r++)this.separableBlurMaterials[r].dispose();this.compositeMaterial.dispose(),this.materialCopy.dispose(),this.basic.dispose(),this.fsQuad.dispose()}},{key:"setSize",value:function(e,t){var r=Math.round(e/2),n=Math.round(t/2);this.renderTargetBright.setSize(r,n);for(var a=0;a<this.nMips;a++)this.renderTargetsHorizontal[a].setSize(r,n),this.renderTargetsVertical[a].setSize(r,n),this.separableBlurMaterials[a].uniforms.texSize.value=new s.Vector2(r,n),r=Math.round(r/2),n=Math.round(n/2)}},{key:"render",value:function(e,t,r,a,i){e.getClearColor(this._oldClearColor),this.oldClearAlpha=e.getClearAlpha();for(var s=e.autoClear,o=(e.autoClear=!1,e.setClearColor(this.clearColor,0),i&&e.state.buffers.stencil.setTest(!1),this.renderToScreen&&(this.fsQuad.material=this.basic,this.basic.map=r.texture,e.setRenderTarget(null),e.clear(),this.fsQuad.render(e)),this.highPassUniforms.tDiffuse.value=r.texture,this.highPassUniforms.luminosityThreshold.value=this.threshold,this.fsQuad.material=this.materialHighPassFilter,e.setRenderTarget(this.renderTargetBright),e.clear(),this.fsQuad.render(e),this.renderTargetBright),l=0;l<this.nMips;l++)this.fsQuad.material=this.separableBlurMaterials[l],this.separableBlurMaterials[l].uniforms.colorTexture.value=o.texture,this.separableBlurMaterials[l].uniforms.direction.value=n.BlurDirectionX,e.setRenderTarget(this.renderTargetsHorizontal[l]),e.clear(),this.fsQuad.render(e),this.separableBlurMaterials[l].uniforms.colorTexture.value=this.renderTargetsHorizontal[l].texture,this.separableBlurMaterials[l].uniforms.direction.value=n.BlurDirectionY,e.setRenderTarget(this.renderTargetsVertical[l]),e.clear(),this.fsQuad.render(e),o=this.renderTargetsVertical[l];this.fsQuad.material=this.compositeMaterial,this.compositeMaterial.uniforms.bloomStrength.value=this.strength,this.compositeMaterial.uniforms.bloomRadius.value=this.radius,this.compositeMaterial.uniforms.bloomTintColors.value=this.bloomTintColors,e.setRenderTarget(this.renderTargetsHorizontal[0]),e.clear(),this.fsQuad.render(e),this.fsQuad.material=this.materialCopy,this.copyUniforms.tDiffuse.value=this.renderTargetsHorizontal[0].texture,i&&e.state.buffers.stencil.setTest(!0),this.renderToScreen?e.setRenderTarget(null):e.setRenderTarget(r),this.fsQuad.render(e),e.setClearColor(this._oldClearColor,this.oldClearAlpha),e.autoClear=s}},{key:"getSeperableBlurMaterial",value:function(e){return new s.ShaderMaterial({defines:{KERNEL_RADIUS:e,SIGMA:e},uniforms:{colorTexture:{value:null},texSize:{value:new s.Vector2(.5,.5)},direction:{value:new s.Vector2(.5,.5)}},vertexShader:"varying vec2 vUv;\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}",fragmentShader:"#include <common>\n\t\t\t\tvarying vec2 vUv;\n\t\t\t\tuniform sampler2D colorTexture;\n\t\t\t\tuniform vec2 texSize;\n\t\t\t\tuniform vec2 direction;\n\n\t\t\t\tfloat gaussianPdf(in float x, in float sigma) {\n\t\t\t\t\treturn 0.39894 * exp( -0.5 * x * x/( sigma * sigma))/sigma;\n\t\t\t\t}\n\t\t\t\tvoid main() {\n\t\t\t\t\tvec2 invSize = 1.0 / texSize;\n\t\t\t\t\tfloat fSigma = float(SIGMA);\n\t\t\t\t\tfloat weightSum = gaussianPdf(0.0, fSigma);\n\t\t\t\t\tvec3 diffuseSum = texture2D( colorTexture, vUv).rgb * weightSum;\n\t\t\t\t\tfor( int i = 1; i < KERNEL_RADIUS; i ++ ) {\n\t\t\t\t\t\tfloat x = float(i);\n\t\t\t\t\t\tfloat w = gaussianPdf(x, fSigma);\n\t\t\t\t\t\tvec2 uvOffset = direction * invSize * x;\n\t\t\t\t\t\tvec3 sample1 = texture2D( colorTexture, vUv + uvOffset).rgb;\n\t\t\t\t\t\tvec3 sample2 = texture2D( colorTexture, vUv - uvOffset).rgb;\n\t\t\t\t\t\tdiffuseSum += (sample1 + sample2) * w;\n\t\t\t\t\t\tweightSum += 2.0 * w;\n\t\t\t\t\t}\n\t\t\t\t\tgl_FragColor = vec4(diffuseSum/weightSum, 1.0);\n\t\t\t\t}"})}},{key:"getCompositeMaterial",value:function(e){return new s.ShaderMaterial({defines:{NUM_MIPS:e},uniforms:{blurTexture1:{value:null},blurTexture2:{value:null},blurTexture3:{value:null},blurTexture4:{value:null},blurTexture5:{value:null},bloomStrength:{value:1},bloomFactors:{value:null},bloomTintColors:{value:null},bloomRadius:{value:0}},vertexShader:"varying vec2 vUv;\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}",fragmentShader:"varying vec2 vUv;\n\t\t\t\tuniform sampler2D blurTexture1;\n\t\t\t\tuniform sampler2D blurTexture2;\n\t\t\t\tuniform sampler2D blurTexture3;\n\t\t\t\tuniform sampler2D blurTexture4;\n\t\t\t\tuniform sampler2D blurTexture5;\n\t\t\t\tuniform float bloomStrength;\n\t\t\t\tuniform float bloomRadius;\n\t\t\t\tuniform float bloomFactors[NUM_MIPS];\n\t\t\t\tuniform vec3 bloomTintColors[NUM_MIPS];\n\n\t\t\t\tfloat lerpBloomFactor(const in float factor) {\n\t\t\t\t\tfloat mirrorFactor = 1.2 - factor;\n\t\t\t\t\treturn mix(factor, mirrorFactor, bloomRadius);\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\t\t\t\t\tgl_FragColor = bloomStrength * ( lerpBloomFactor(bloomFactors[0]) * vec4(bloomTintColors[0], 1.0) * texture2D(blurTexture1, vUv) +\n\t\t\t\t\t\tlerpBloomFactor(bloomFactors[1]) * vec4(bloomTintColors[1], 1.0) * texture2D(blurTexture2, vUv) +\n\t\t\t\t\t\tlerpBloomFactor(bloomFactors[2]) * vec4(bloomTintColors[2], 1.0) * texture2D(blurTexture3, vUv) +\n\t\t\t\t\t\tlerpBloomFactor(bloomFactors[3]) * vec4(bloomTintColors[3], 1.0) * texture2D(blurTexture4, vUv) +\n\t\t\t\t\t\tlerpBloomFactor(bloomFactors[4]) * vec4(bloomTintColors[4], 1.0) * texture2D(blurTexture5, vUv) );\n\t\t\t\t}"})}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),n}(nn.w);cn.BlurDirectionX=new s.Vector2(1,0),cn.BlurDirectionY=new s.Vector2(0,1);class un extends nn.w{constructor(e,t,r){super(),this.baseTextureID=void 0!==t?t:"tDiffuse",this.effectTextureID=void 0!==r?r:"tDiffuse",e instanceof s.ShaderMaterial?(this.uniforms=e.uniforms,this.material=e):e&&(this.uniforms=s.UniformsUtils.clone(e.uniforms),this.material=new s.ShaderMaterial({defines:Object.assign({},e.defines),uniforms:this.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader})),this.fsQuad=new nn.T(this.material)}render(e,t,r){this.uniforms[this.baseTextureID]&&(this.uniforms[this.baseTextureID].value=t.texture),this.uniforms[this.effectTextureID]&&(this.uniforms[this.effectTextureID].value=r.texture),this.fsQuad.material=this.material,this.renderToScreen?e.setRenderTarget(null):(e.setRenderTarget(t),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil)),this.fsQuad.render(e)}}class hn extends nn.w{constructor(e,t,r,n,a){super(),this.scene=e,this.camera=t,this.layerIndex=0,this.overrideMaterial=r,this.clearColor=n,this.clearAlpha=void 0!==a?a:0,this.clear=!0,this.clearDepth=!1,this.needsSwap=!1,this.oldClearColor=new s.Color,this.oldCameraLayer=t.layers.mask}render(e,t,r){var n=e.autoClear;let a,i;e.autoClear=!1,void 0!==this.overrideMaterial&&(i=this.scene.overrideMaterial,this.scene.overrideMaterial=this.overrideMaterial),this.clearColor&&(e.getClearColor(this.oldClearColor),a=e.getClearAlpha(),e.setClearColor(this.clearColor,this.clearAlpha)),this.sceneBg&&(this.scene.background=null),e.setRenderTarget(this.renderToScreen?null:r),this.clear&&e.clear(e.autoClearColor,this.clearDepth,e.autoClearStencil),this.camera.layers.set(this.layerIndex),e.render(this.scene,this.camera),this.camera.layers.mask=this.oldCameraLayer,this.scene.background=this.sceneBg,this.clearColor&&e.setClearColor(this.oldClearColor,a),void 0!==this.overrideMaterial&&(this.scene.overrideMaterial=i),this.scene.background=this.sceneBg,e.autoClear=n}}const dn={uniforms:{baseTexture:{value:null},bloomTexture:{value:null}},vertexShader:"\n varying vec2 vUv;\n \n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n }\n ",fragmentShader:"\n uniform sampler2D baseTexture;\n uniform sampler2D bloomTexture;\n \n varying vec2 vUv;\n \n void main() {\n vec4 lastColor = texture2D(baseTexture, vUv);\n \n // gl_FragColor = lastColor;\n // gl_FragColor = texture2D(bloomTexture, vUv);\n gl_FragColor = lastColor + texture2D(bloomTexture, vUv);\n }\n "};class pn{constructor(e){this.mtuPP=e,this.mtuPP.renderer&&this.postProcessing()}postProcessing(){this.bloomRenderPass?(this.bloomRenderPass.scene=this.mtuPP.mainScene,this.bloomRenderPass.camera=this.mtuPP.mainCamera):(this.bloomRenderPass=new hn(this.mtuPP.mainScene,this.mtuPP.mainCamera),this.bloomRenderPass.layerIndex=this.mtuPP.BLOOM_SCENE,this.bloomRenderPass.clearDepth=!1),this.bloomPass?this.bloomPass.setSize(this.mtuPP.rtSize.x,this.mtuPP.rtSize.y):this.bloomPass=new cn(this.mtuPP.rtSize,1.5,.4,.85),this.bloomPass.radius=this.mtuPP.params.glow.radius,this.bloomPass.strength=this.mtuPP.params.glow.strength,this.bloomPass.threshold=this.mtuPP.params.glow.threshold,this.mixingPass||(this.mixingPass=new un(dn,"baseTexture","bloomTexture"),this.mixingPass.renderToScreen=!1),this.effectCopy||(this.effectCopy=new rn.T(tn.C),this.effectCopy.clear=!1,this.effectCopy.renderToScreen=!1,this.effectCopy.needsSwap=!1,this.effectCopy.material.depthWrite=!1),this.mtuPP.effectComposer.addPass(this.effectCopy),this.mtuPP.effectComposer.addPass(this.bloomRenderPass),this.mtuPP.effectComposer.addPass(this.bloomPass),this.mtuPP.effectComposer.addPass(this.mixingPass)}setGlowData(e,t){this.bloomPass[e]=t}dispose(){this.bloomRenderPass=null,this.bloomPass&&(this.bloomPass.dispose(),this.bloomPass=null),this.mixingPass=null,this.effectCopy=null}setSceneBg(){this.bloomRenderPass&&(this.bloomRenderPass.sceneBg=this.mtuPP.sceneBackground)}enablePass(e){this.bloomRenderPass&&this.bloomRenderPass.enabled!==e&&(this.bloomRenderPass.enabled=e,this.bloomPass.enabled=e,this.mixingPass.enabled=e,this.effectCopy.enabled=e)}}function fn(e){return(fn="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})(e)}function mn(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function gn(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function vn(e,t,r){t&&gn(e.prototype,t),r&&gn(e,r),Object.defineProperty(e,"prototype",{writable:!1})}function bn(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&&yn(e,t)}function yn(e,t){return(yn=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function xn(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=wn(e);if(r=t?(r=wn(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===fn(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function wn(e){return(wn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Sn=function(){bn(t,nn.w);var e=xn(t);function t(r,n){var a;return mn(this,t),(a=e.call(this)).scene=r,a.camera=n,a.clear=!0,a.needsSwap=!1,a.inverse=!1,a}return vn(t,[{key:"render",value:function(e,t,r){var n,a,i=e.getContext(),s=e.state;s.buffers.color.setMask(!1),s.buffers.depth.setMask(!1),s.buffers.color.setLocked(!0),s.buffers.depth.setLocked(!0),a=this.inverse?(n=0,1):(n=1,0),s.buffers.stencil.setTest(!0),s.buffers.stencil.setOp(i.REPLACE,i.REPLACE,i.REPLACE),s.buffers.stencil.setFunc(i.ALWAYS,n,4294967295),s.buffers.stencil.setClear(a),s.buffers.stencil.setLocked(!0),e.setRenderTarget(r),this.clear&&e.clear(),e.render(this.scene,this.camera),e.setRenderTarget(t),this.clear&&e.clear(),e.render(this.scene,this.camera),s.buffers.color.setLocked(!1),s.buffers.depth.setLocked(!1),s.buffers.stencil.setLocked(!1),s.buffers.stencil.setFunc(i.EQUAL,1,4294967295),s.buffers.stencil.setOp(i.KEEP,i.KEEP,i.KEEP),s.buffers.stencil.setLocked(!0)}}]),t}(),Mn=function(){bn(t,nn.w);var e=xn(t);function t(){var r;return mn(this,t),(r=e.call(this)).needsSwap=!1,r}return vn(t,[{key:"render",value:function(e){e.state.buffers.stencil.setLocked(!1),e.state.buffers.stencil.setTest(!1)}}]),t}();var Tn=function(){function e(t,r){var n;if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");this.renderer=t,void 0===r?(n=t.getSize(new s.Vector2),this._pixelRatio=t.getPixelRatio(),this._width=n.width,this._height=n.height,(r=new s.WebGLRenderTarget(this._width*this._pixelRatio,this._height*this._pixelRatio)).texture.name="EffectComposer.rt1"):(this._pixelRatio=1,this._width=r.width,this._height=r.height),this.renderTarget1=r,this.renderTarget2=r.clone(),this.renderTarget2.texture.name="EffectComposer.rt2",this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2,this.renderToScreen=!0,this.passes=[],this.copyPass=new rn.T(tn.C),this.clock=new s.Clock}var t,r;return t=e,(r=[{key:"swapBuffers",value:function(){var e=this.readBuffer;this.readBuffer=this.writeBuffer,this.writeBuffer=e}},{key:"addPass",value:function(e){this.passes.push(e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}},{key:"insertPass",value:function(e,t){this.passes.splice(t,0,e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}},{key:"removePass",value:function(e){-1!==(e=this.passes.indexOf(e))&&this.passes.splice(e,1)}},{key:"isLastEnabledPass",value:function(e){for(var t=e+1;t<this.passes.length;t++)if(this.passes[t].enabled)return!1;return!0}},{key:"render",value:function(e){void 0===e&&(e=this.clock.getDelta());for(var t=this.renderer.getRenderTarget(),r=!1,n=0,a=this.passes.length;n<a;n++){var i,s,o=this.passes[n];!1!==o.enabled&&(o.renderToScreen=this.renderToScreen&&this.isLastEnabledPass(n),o.render(this.renderer,this.writeBuffer,this.readBuffer,e,r),o.needsSwap&&(r&&(i=this.renderer.getContext(),(s=this.renderer.state.buffers.stencil).setFunc(i.NOTEQUAL,1,4294967295),this.copyPass.render(this.renderer,this.writeBuffer,this.readBuffer,e),s.setFunc(i.EQUAL,1,4294967295)),this.swapBuffers()),void 0!==Sn&&(o instanceof Sn?r=!0:o instanceof Mn&&(r=!1)))}this.renderer.setRenderTarget(t)}},{key:"reset",value:function(e){var t;void 0===e&&(t=this.renderer.getSize(new s.Vector2),this._pixelRatio=this.renderer.getPixelRatio(),this._width=t.width,this._height=t.height,(e=this.renderTarget1.clone()).setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)),this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.renderTarget1=e,this.renderTarget2=e.clone(),this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2}},{key:"setSize",value:function(e,t){this._width=e,this._height=t;var r=this._width*this._pixelRatio,n=this._height*this._pixelRatio;this.renderTarget1.setSize(r,n),this.renderTarget2.setSize(r,n);for(var a=0;a<this.passes.length;a++)this.passes[a].setSize(r,n)}},{key:"setPixelRatio",value:function(e){this._pixelRatio=e,this.setSize(this._width,this._height)}},{key:"dispose",value:function(){this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.copyPass.dispose()}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,r),Object.defineProperty(t,"prototype",{writable:!1}),e}();const _n="\n varying vec2 vUv;\n \n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n }\n ",En="\n uniform sampler2D baseTexture;\n uniform sampler2D bloomTexture;\n \n varying vec2 vUv;\n \n void main() {\n gl_FragColor = (texture2D(baseTexture, vUv) + vec4(1.0) * texture2D(bloomTexture, vUv));\n }\n ";class Dn{constructor(e){this.mtuPP=e,this.bloomLayer=new da.Layers,this.bloomLayer.set(this.mtuPP.BLOOM_SCENE),this.darkMaterial=new da.MeshBasicMaterial({color:"black"}),this.materials={},(e=this.mtuPP.mainScene).fog&&(this.mtuPP.sceneFogColor||(this.mtuPP.sceneFogColor=new da.Color),this.mtuPP.sceneFogColor.copy(e.fog.color)),e.background&&(this.mtuPP.sceneBackground=e.background),this.mtuPP.renderer&&this.postProcessing()}postProcessing(){this.bloomPass=new cn(this.mtuPP.rtSize,1.5,.4,.85),this.bloomPass.radius=this.mtuPP.params.glow.radius,this.bloomPass.strength=this.mtuPP.params.glow.strength,this.bloomPass.threshold=this.mtuPP.params.glow.threshold,this.mtuPP.effectComposer.addPass(this.bloomPass),this.finalPass=new rn.T(new da.ShaderMaterial({uniforms:{baseTexture:{value:null},bloomTexture:{value:this.mtuPP.effectComposer.renderTarget2.texture}},vertexShader:_n,fragmentShader:En,defines:{}}),"baseTexture"),this.finalPass.needsSwap=!0;var e=new da.WebGLRenderTarget(this.mtuPP.rtSize.x,this.mtuPP.rtSize.y,{samples:this.mtuPP.params.pp.samples});this.finalComposer=new Tn(this.mtuPP.renderer,e),this.finalComposer.addPass(this.mtuPP.renderPass),this.finalComposer.addPass(this.finalPass)}renderBloom(e){var t;this.mtuPP.sceneFogColor&&null!=(t=this.mtuPP.mainScene.fog)&&t.color.copy(this.mtuPP.BLACK_COLOR),this.mtuPP.sceneBackground&&(this.mtuPP.mainScene.background=this.mtuPP.BLACK_COLOR),e?(this.mtuPP.mainScene.traverse((e=>{e.isMesh&&!this.bloomLayer.test(e.layers)&&(this.materials[e.uuid]=e.material,e.material=this.darkMaterial)})),this.mtuPP.effectComposer.render(),this.mtuPP.mainScene.traverse((e=>{this.materials[e.uuid]&&(e.material=this.materials[e.uuid],delete this.materials[e.uuid])}))):(this.mtuPP.mainCamera.layers.set(this.mtuPP.BLOOM_SCENE),this.mtuPP.effectComposer.render(),this.mtuPP.mainCamera.layers.set(this.mtuPP.ENTIRE_SCENE)),this.mtuPP.sceneFogColor&&null!=(t=this.mtuPP.mainScene.fog)&&t.color.copy(this.mtuPP.sceneFogColor),this.mtuPP.sceneBackground&&(this.mtuPP.mainScene.background=this.mtuPP.sceneBackground)}render(){this.renderBloom(!0),this.finalComposer.render()}setGlowData(e,t){this.bloomPass[e]=t}setSize(e,t){this.finalComposer&&this.finalComposer.setSize(e,t)}dispose(){this.bloomPass&&(this.bloomPass.dispose(),this.bloomPass=null),this.finalPass=null,this.finalComposer&&(this.finalComposer.renderTarget1&&(this.finalComposer.renderTarget1.dispose(),this.finalComposer.renderTarget1=null),this.finalComposer.renderTarget2&&(this.finalComposer.renderTarget2.dispose(),this.finalComposer.renderTarget2=null),this.finalComposer=null)}enablePass(e){this.bloomPass&&this.bloomPass.enabled!==e&&(this.bloomPass.enabled=e,this.finalPass.enabled=e)}}var kn=r(228);class On extends s.ShaderMaterial{constructor(...e){super(...e),["opacity","map","emissiveMap","roughnessMap","metalnessMap"].forEach((e=>{Object.defineProperty(this,e,{get(){if(e in this.uniforms)return this.uniforms[e].value},set(t){e in this.uniforms&&(this.uniforms[e].value=t)}})}))}}class Pn extends On{constructor(...e){super(...e),this.modifiedDefines={},this.modifiedUniforms={}}setDefine(e,t){const r=this.defines,n=this.modifiedDefines;null==t?e in r&&(e in n||(n[e]=r[e]),delete r[e]):r[e]!==t&&(e in n||(n[e]=e in r?r[e]:void 0),r[e]=t)}setTextureUniform(e,t){const r=this.uniforms,n=this.modifiedUniforms;e in n||(n[e]=r[e].value),r[e].value=t}finalize(){const e=this.modifiedDefines;var t=this.defines;for(const r in e)void 0===e[r]?r in t&&(this.needsUpdate=!0):t[r]!==e[r]&&(this.needsUpdate=!0),delete e[r];const r=this.modifiedUniforms;var n=this.uniforms;for(const e in r)r[e]!==n[e].value&&(this.needsUpdate=!0),delete r[e]}}const An=new WeakMap;class Cn{constructor(e){this._replacementMaterial=new Pn(e),this._replacementMaterials=new WeakMap,this.overrideUniforms={},this.overrideDefines={}}replace(e,t=!1,r=!0){const n=this;function a(e){if(!e.isHelper&&(e.isMesh||e.isSkinnedMesh)){if(!i.has(e)){const t=n.createMaterial(e);i.set(e,t)}const t=i.get(e);if(null!==t){let a=e.material;r?s.set(e,a):a=s.get(e),a||console.error("ShaderReplacement : Material for object was not cached before replacing shader.",e),n.updateUniforms(e,a,t),t.finalize&&t.finalize(),e.material=t}}}const i=this._replacementMaterials,s=An;if(Array.isArray(e))if(t)for(let t=0,r=e.length;t<r;t++)e[t].traverse(a);else for(let t=0,r=e.length;t<r;t++)a(e[t]);else t?e.traverse(a):a(e)}reset(e,t){function r(e){e.isHelper||(n.has(e)?(e.material=n.get(e),n.delete(e)):(e.isSkinnedMesh||e.isMesh)&&console.error("ShaderReplacement : Material for object was not cached before resetting.",e))}const n=An;if(Array.isArray(e))if(t)for(let t=0,n=e.length;t<n;t++)r(e[t]);else for(let t=0,n=e.length;t<n;t++)e[t].traverse(r);else t?e.traverse(r):r(e)}createMaterial(e){return this._replacementMaterial.clone()}updateUniforms(e,t,r){var n=this._replacementMaterial.defines,a=t.defines;const i=r.defines;if(r.side=t.side,r.flatShading=t.flatShading,r.skinning=t.skinning,a){for(const e in a)r.setDefine(e,a[e]);for(const e in i)e in a?r.setDefine(e,a[e]):r.setDefine(e,n[e])}const s=r.uniforms;if(t.isShaderMaterial){var o=t.uniforms;for(const e in s){var l=o[e];const t=s[e];l&&l.value!==t.value&&(t.value&&t.value.isTexture||l.value&&l.value.isTexture?r.setTextureUniform(e,l.value):t.value=l.value)}}else for(const e in s){const n=s[e];e in t&&t[e]!==n.value&&(n.value&&n.value.isTexture||t[e]&&t[e].isTexture?r.setTextureUniform(e,t[e]):n.value=t[e])}var{overrideDefines:c,overrideUniforms:u}=this;for(const e in c)null===c[e]||void 0===c[e]?delete i[e]:i[e]!==c[e]&&(i[e]=c[e],r.needsUpdate=!0);for(const e in u)e in s&&(s[e].value=u[e].value)}dispose(){}}class Rn extends Cn{constructor(){super({extensions:{derivatives:!0},defines:{USE_UV:""},uniforms:Object.assign(Object.assign({},s.ShaderLib.normal.uniforms),{alphaMap:{value:null},alphaTest:{value:0},map:{value:null},opacity:{value:1}}),vertexShader:s.ShaderLib.normal.vertexShader,fragmentShader:"\n\t\t\t\t#define NORMAL\n\t\t\t\tuniform float opacity;\n\t\t\t\t#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\t\t\t\t\tvarying vec3 vViewPosition;\n\t\t\t\t#endif\n\t\t\t\t#ifndef FLAT_SHADED\n\t\t\t\t\tvarying vec3 vNormal;\n\t\t\t\t\t#ifdef USE_TANGENT\n\t\t\t\t\t\tvarying vec3 vTangent;\n\t\t\t\t\t\tvarying vec3 vBitangent;\n\t\t\t\t\t#endif\n\t\t\t\t#endif\n\t\t\t\t#include <packing>\n\t\t\t\t#include <uv_pars_fragment>\n\t\t\t\t#include <map_pars_fragment>\n\t\t\t\t#include <bumpmap_pars_fragment>\n\t\t\t\t#include <normalmap_pars_fragment>\n\t\t\t\t#include <alphamap_pars_fragment>\n\t\t\t\t#include <logdepthbuf_pars_fragment>\n\t\t\t\t#include <clipping_planes_pars_fragment>\n\t\t\t\tvoid main() {\n\t\t\t\t\tvec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );\n\t\t\t\t\t#include <clipping_planes_fragment>\n\t\t\t\t\t#include <logdepthbuf_fragment>\n\t\t\t\t\t#include <map_fragment>\n\t\t\t\t\t#include <alphamap_fragment>\n\t\t\t\t\t#include <alphatest_fragment>\n\t\t\t\t\t#include <normal_fragment_begin>\n\t\t\t\t\t#include <normal_fragment_maps>\n\t\t\t\t\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n\t\t\t\t}\n\t\t\t"}),this.useNormalMaps=!1}createMaterial(...e){return super.createMaterial(...e)}updateUniforms(e,t,r){super.updateUniforms(e,t,r),r.setDefine("USE_NORMALMAP",this.useNormalMaps&&r.uniforms.normalMap.value?"":void 0),r.setDefine("TANGENTSPACE_NORMALMAP",this.useNormalMaps&&r.uniforms.normalMap.value?"":void 0),r.setDefine("ALPHATEST",r.uniforms.alphaTest.value||void 0),r.setDefine("USE_ALPHAMAP",0!==r.defines.ALPHATEST&&r.uniforms.alphaMap.value?"":void 0),r.setDefine("USE_MAP",0!==r.defines.ALPHATEST&&r.uniforms.map.value?"":void 0),r.setDefine("USE_UV","USE_ALPHAMAP"in r.defines||"USE_MAP"in r.defines?"":void 0)}}class Ln extends Cn{constructor(){super({extensions:{derivatives:!0},defines:{USE_UV:""},uniforms:Object.assign(Object.assign({},s.ShaderLib.normal.uniforms),{alphaMap:{value:null},alphaTest:{value:0},map:{value:null},opacity:{value:1}}),vertexShader:"\n\t\t\t\tvarying vec3 vViewPosition;\n\t\t\t\t#include <common>\n\t\t\t\t#include <uv_pars_vertex>\n\t\t\t\t#include <displacementmap_pars_vertex>\n\t\t\t\t#include <morphtarget_pars_vertex>\n\t\t\t\t#include <skinning_pars_vertex>\n\t\t\t\t#include <logdepthbuf_pars_vertex>\n\t\t\t\t#include <clipping_planes_pars_vertex>\n\t\t\t\tvoid main() {\n\t\t\t\t\t#include <uv_vertex>\n\t\t\t\t\t#include <beginnormal_vertex>\n\t\t\t\t\t#include <morphnormal_vertex>\n\t\t\t\t\t#include <skinbase_vertex>\n\t\t\t\t\t#include <skinnormal_vertex>\n\t\t\t\t\t#include <defaultnormal_vertex>\n\t\t\t\t\t#include <begin_vertex>\n\t\t\t\t\t#include <morphtarget_vertex>\n\t\t\t\t\t#include <skinning_vertex>\n\t\t\t\t\t#include <displacementmap_vertex>\n\t\t\t\t\t#include <project_vertex>\n\t\t\t\t\t#include <logdepthbuf_vertex>\n\t\t\t\t\t#include <clipping_planes_vertex>\n\t\t\t\t\tvViewPosition = mvPosition.xyz;\n\t\t\t\t}\n\t\t\t",fragmentShader:"\n\t\t\t\tuniform float opacity;\n\t\t\t\tvarying vec3 vViewPosition;\n\t\t\t\t#include <uv_pars_fragment>\n\t\t\t\t#include <map_pars_fragment>\n\t\t\t\t#include <bumpmap_pars_fragment>\n\t\t\t\t#include <normalmap_pars_fragment>\n\t\t\t\t#include <alphamap_pars_fragment>\n\t\t\t\t#include <logdepthbuf_pars_fragment>\n\t\t\t\t#include <clipping_planes_pars_fragment>\n\t\t\t\tvoid main() {\n\t\t\t\t\tvec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );\n\t\t\t\t\t#include <clipping_planes_fragment>\n\t\t\t\t\t#include <logdepthbuf_fragment>\n\t\t\t\t\t#include <map_fragment>\n\t\t\t\t\t#include <alphamap_fragment>\n\t\t\t\t\t#include <alphatest_fragment>\n\t\t\t\t\tgl_FragColor = vec4( vViewPosition.z );\n\t\t\t\t}\n\t\t\t"}),this.invertSide=!1}updateUniforms(e,t,r){super.updateUniforms(e,t,r),this.invertSide&&(r.side=r.side===s.FrontSide?s.BackSide:s.FrontSide),e=r.defines.ALPHATEST,0===r.uniforms.alphaTest.value?delete r.defines.ALPHATEST:r.defines.ALPHATEST=r.uniforms.alphaTest.value,e!==r.defines.ALPHATEST&&(r.needsUpdate=!0),e=r.defines.USE_ALPHAMAP,0!==r.defines.ALPHATEST&&r.uniforms.alphaMap.value?r.defines.USE_ALPHAMAP="":delete r.defines.USE_ALPHAMAP,e!==r.defines.USE_ALPHAMAP&&(r.needsUpdate=!0),e=r.defines.USE_MAP,0!==r.defines.ALPHATEST&&r.uniforms.map.value?r.defines.USE_MAP="":delete r.defines.USE_MAP,e!==r.defines.USE_MAP&&(r.needsUpdate=!0),e=r.defines.USE_UV,"USE_ALPHAMAP"in r.defines||"USE_MAP"in r.defines?r.defines.USE_UV="":delete r.defines.USE_UV,e!==r.defines.USE_UV&&(r.needsUpdate=!0)}}const In={uniforms:{tex:{value:null},displayRoughness:{value:0}},vertexShader:"\n\t\tvarying vec3 vViewPosition;\n\t\tvarying vec2 vUv;\n\t\tvoid main() {\n\t\t\t#include <begin_vertex>\n\t\t\t#include <project_vertex>\n\t\t\tvViewPosition = mvPosition.xyz;\n\t\t\tvUv = uv;\n\t\t}\n\t",fragmentShader:"\n\t\tvarying vec2 vUv;\n\t\tuniform sampler2D tex;\n\t\tuniform float displayRoughness;\n\t\tvoid main() {\n\t\t\tvec4 texVal = texture2D( tex, vUv );\n\t\t\tfloat roughness = texVal.a;\n\t\t\tvec3 packedNormal = texVal.xyz;\n\t\t\tvec3 unpackedNormal = ( packedNormal - 0.5 ) * 2.0;\n\t\t\tgl_FragColor = mix(\n\t\t\t\tvec4( unpackedNormal, 1.0 ),\n\t\t\t\tvec4( roughness, roughness, roughness, 1.0 ),\n\t\t\t\tdisplayRoughness\n\t\t\t);\n\n\t\t}\n\t"},Bn={uniforms:{tex:{value:null}},vertexShader:"\n\t\tvarying vec3 vViewPosition;\n\t\tvarying vec2 vUv;\n\t\tvoid main() {\n\t\t\t#include <begin_vertex>\n\t\t\t#include <project_vertex>\n\t\t\tvViewPosition = mvPosition.xyz;\n\t\t\tvUv = uv;\n\t\t}\n\t",fragmentShader:"\n\t\tvarying vec2 vUv;\n\t\tuniform sampler2D tex;\n\t\tuniform float divide;\n\t\tvoid main() {\n\t\t\tvec4 texVal = texture2D( tex, vUv );\n\t\t\tfloat depthVal = mod( - texVal.r, 1.0 );\n\t\t\tgl_FragColor = vec4( depthVal );\n\n\t\t}\n\t"},jn={defines:{NUM_DIRECTIONS:32,NUM_STEPS:16,RADIUS:"2.0",ENABLE_FALLOFF:1,FALLOFF_START2:"0.16",FALLOFF_END2:"4.0",ENABLE_ROTATION_JITTER:1,ENABLE_RADIUS_JITTER:1,ENABLE_COLOR_BOUNCE:1,JITTER_TYPE:0},uniforms:{colorBuffer:{value:null},normalBuffer:{value:null},depthBuffer:{value:null},renderSize:{value:new s.Vector2},blueNoiseTex:{value:null},blueNoiseSize:{value:1},clipInfo:{value:new s.Vector4},projInfo:{value:new s.Vector4},params:{value:new s.Vector2},lightBounceIntensity:{value:1}},vertexShader:"\n\t\tvarying vec2 vUv;\n\t\tvoid main() {\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t}\n\t",fragmentShader:"\n\t\t#define TWO_PI\t\t\t6.2831853071795864\n\t\t#define HALF_PI\t\t\t1.5707963267948966\n\t\t#define ONE_OVER_PI\t\t0.3183098861837906\n\n\t\t#include <common>\n\t\t#include <packing>\n\t\tvarying vec2 vUv;\n\n\t\tuniform sampler2D noiseTexture;\n\t\tuniform sampler2D normalBuffer;\n\t\tuniform sampler2D depthBuffer;\n\t\tuniform sampler2D colorBuffer;\n\t\tuniform vec2 renderSize;\n\n\t\tuniform vec4 projInfo;\n\t\tuniform vec4 clipInfo;\n\t\tuniform vec4 params;\n\t\tuniform float lightBounceIntensity;\n\n\t\t#if ENABLE_ROTATION_JITTER == 2 || ENABLE_RADIUS_JITTER == 2\n\t\tuniform float blueNoiseSize;\n\t\tuniform sampler2D blueNoiseTex;\n\t\t#endif\n\n\t\tfloat roundF(float f) {\n\t\t\treturn f < 0.5 ? floor(f) : ceil(f);\n\t\t}\n\n\t\tvec2 roundV2(vec2 v) {\n\t\t\tv.x = roundF(v.x);\n\t\t\tv.y = roundF(v.y);\n\t\t\treturn v;\n\t\t}\n\n\t\tvec3 UnpackNormal(vec4 d) {\n\t\t\treturn d.xyz * 2.0 - 1.0;\n\t\t}\n\n\t\tvec4 GetViewPosition( vec2 uv ) {\n\n\t\t\tfloat near = clipInfo.x;\n\t\t\tfloat far = clipInfo.y;\n\n\t\t\tvec2 basesize = renderSize;\n\t\t\tvec2 coord = ( uv / basesize );\n\n\t\t\t// d is expected to be [ 0.0, 1.0 ]\n\t\t\tfloat d = texture2D( depthBuffer, coord ).r;\n\t\t\td = d == 0.0 ? far : d;\n\t\t\td = ( abs( d ) - near ) / ( far - near );\n\n\t\t\tvec4 ret = vec4( 0.0 );\n\t\t\tret.w = d;\n\t\t\tret.z = near + d * ( far - near );\n\t\t\tret.xy = ( uv * projInfo.xy + projInfo.zw ) * ret.z;\n\n\t\t\treturn ret;\n\n\t\t}\n\n\t\tfloat Falloff( float dist2 ) {\n\n\t\t\treturn 2.0 * clamp(\n\t\t\t\t( dist2 - FALLOFF_START2 ) / ( FALLOFF_END2 - FALLOFF_START2 ),\n\t\t\t\t0.0,\n\t\t\t\t1.0\n\t\t\t);\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvec2 screenCoord = gl_FragCoord.xy;\n\t\t\tvec4 vpos = GetViewPosition( renderSize * vUv );\n\n\t\t\t// if it's the background\n\t\t\tif ( vpos.w == 1.0 ) {\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0);\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t\tvec4 s;\n\t\t\tvec3 vnorm\t= UnpackNormal( texture2D( normalBuffer, vUv ) );\n\t\t\tvec3 vdir\t= normalize( - vpos.xyz );\n\t\t\tvec3 dir, ws;\n\n\t\t\t// calculation uses left handed system\n\t\t\tvnorm.z = - vnorm.z;\n\n\t\t\tvec2 noises\t= vec2( 0.0 );\n\t\t\tvec2 offset;\n\t\t\tvec2 horizons = vec2( - 1.0, - 1.0 );\n\n\t\t\t// scale the search radius by the depth and camera FOV\n\t\t\tfloat radius = ( RADIUS * clipInfo.z ) / vpos.z;\n\t\t\tradius = max( float( NUM_STEPS ), radius );\n\n\t\t\tfloat stepSize\t= radius / float( NUM_STEPS );\n\t\t\tfloat phi\t\t= 0.0;\n\t\t\tfloat ao\t\t= 0.0;\n\t\t\tfloat division\t= noises.y * stepSize;\n\t\t\tfloat currStep\t= 1.0 + division + 0.25 * stepSize * params.y;\n\t\t\tfloat dist2, invdist, falloff, cosh;\n\n\t\t\t#if ENABLE_COLOR_BOUNCE\n\t\t\tvec3 color = vec3( 0.0 );\n\t\t\t#endif\n\n\t\t\t#if ENABLE_ROTATION_JITTER == 1\n\n\t\t\t// Rotation jitter approach from\n\t\t\t// https://github.com/MaxwellGengYF/Unity-Ground-Truth-Ambient-Occlusion/blob/9cc30e0f31eb950a994c71866d79b2798d1c508e/Shaders/GTAO_Common.cginc#L152-L155\n\t\t\tfloat rotJitterOffset = PI * fract( 52.9829189 * fract( dot( screenCoord, vec2( 0.06711056, 0.00583715 ) ) ) );\n\n\t\t\t#elif ENABLE_ROTATION_JITTER == 2\n\n\t\t\tfloat rotJitterOffset = PI * texture2D( blueNoiseTex, gl_FragCoord.xy / blueNoiseSize ).r;\n\n\t\t\t#endif\n\n\t\t\t#if ENABLE_RADIUS_JITTER == 1\n\n\t\t\tfloat jitterMod = ( gl_FragCoord.x + gl_FragCoord.y ) * 0.25;\n\t\t\tfloat radiusJitterOffset = mod( jitterMod, 1.0 ) * stepSize * 0.25;\n\n\t\t\t#elif ENABLE_RADIUS_JITTER == 2\n\n\t\t\tfloat radiusJitterOffset = PI * texture2D( blueNoiseTex, gl_FragCoord.xy / blueNoiseSize ).g;\n\n\t\t\t#endif\n\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = 0; i < NUM_DIRECTIONS; i ++ ) {\n\n\t\t\t\tphi = float( i ) * ( PI / float( NUM_DIRECTIONS ) ) + params.x * PI;\n\n\t\t\t\t#if ENABLE_ROTATION_JITTER != 0\n\n\t\t\t\tphi += rotJitterOffset;\n\n\t\t\t\t#endif\n\n\t\t\t\tcurrStep = 1.0 + 0.25 * stepSize * params.y;\n\n\n\t\t\t\t#if ENABLE_RADIUS_JITTER != 0\n\n\t\t\t\tcurrStep += radiusJitterOffset;\n\n\t\t\t\t#endif\n\n\t\t\t\tdir = vec3( cos( phi ), sin( phi ), 0.0 );\n\t\t\t\thorizons = vec2( - 1.0 );\n\n\t\t\t\t// calculate horizon angles\n\t\t\t\tfor ( int j = 0; j < NUM_STEPS; ++ j ) {\n\n\t\t\t\t\toffset = roundV2(dir.xy * currStep);\n\n\t\t\t\t\t// h1\n\t\t\t\t\ts = GetViewPosition( screenCoord + offset );\n\t\t\t\t\tws = s.xyz - vpos.xyz;\n\n\t\t\t\t\tdist2 = dot( ws, ws );\n\t\t\t\t\tinvdist = inversesqrt( dist2 );\n\t\t\t\t\tcosh = invdist * dot( ws, vdir );\n\n\t\t\t\t\t#if ENABLE_FALLOFF\n\n\t\t\t\t\tfalloff = Falloff( dist2 );\n\n\t\t\t\t\t#endif\n\n\t\t\t\t\thorizons.x = max( horizons.x, cosh - falloff );\n\n\t\t\t\t\t#if ENABLE_COLOR_BOUNCE\n\n\t\t\t\t\tvec3 ptColor, ptDir;\n\t\t\t\t\tfloat alpha;\n\t\t\t\t\tptColor = texture2D( colorBuffer, ( screenCoord + offset ) / renderSize ).rgb;\n\t\t\t\t\tptDir = normalize( ws );\n\t\t\t\t\talpha = saturate( length( ws ) / float( RADIUS ) );\n\t\t\t\t\tcolor += ptColor * saturate( dot( ptDir, vnorm ) ) * pow( ( 1.0 - alpha ), 2.0 );\n\n\t\t\t\t\t#endif\n\n\t\t\t\t\t// h2\n\t\t\t\t\ts = GetViewPosition( screenCoord - offset );\n\t\t\t\t\tws = s.xyz - vpos.xyz;\n\n\t\t\t\t\tdist2 = dot( ws, ws );\n\t\t\t\t\tinvdist = inversesqrt( dist2 );\n\t\t\t\t\tcosh = invdist * dot( ws, vdir );\n\n\t\t\t\t\t#if ENABLE_FALLOFF\n\n\t\t\t\t\tfalloff = Falloff( dist2 );\n\n\t\t\t\t\t#endif\n\n\t\t\t\t\thorizons.y = max( horizons.y, cosh - falloff );\n\n\t\t\t\t\t// increment\n\t\t\t\t\tcurrStep += stepSize;\n\n\t\t\t\t\t#if ENABLE_COLOR_BOUNCE\n\n\t\t\t\t\tptColor = texture2D( colorBuffer, ( screenCoord - offset ) / renderSize ).rgb;\n\t\t\t\t\tptDir = normalize( ws );\n\t\t\t\t\talpha = saturate( length( ws ) / float( RADIUS ) );\n\t\t\t\t\tcolor += ptColor * saturate( dot( ptDir, vnorm ) ) * pow( ( 1.0 - alpha ), 2.0 );\n\n\t\t\t\t\t#endif\n\n\t\t\t\t}\n\n\t\t\t\thorizons = acos( horizons );\n\n\t\t\t\t// calculate gamma\n\t\t\t\tvec3 bitangent\t= normalize( cross( dir, vdir ) );\n\t\t\t\tvec3 tangent\t= cross( vdir, bitangent );\n\t\t\t\tvec3 nx\t\t\t= vnorm - bitangent * dot( vnorm, bitangent );\n\n\t\t\t\tfloat nnx\t\t= length( nx );\n\t\t\t\tfloat invnnx\t= 1.0 / ( nnx + 1e-6 );\t\t\t// to avoid division with zero\n\t\t\t\tfloat cosxi\t\t= dot( nx, tangent ) * invnnx;\t// xi = gamma + HALF_PI\n\t\t\t\tfloat gamma\t\t= acos( cosxi ) - HALF_PI;\n\t\t\t\tfloat cosgamma\t= dot( nx, vdir ) * invnnx;\n\t\t\t\tfloat singamma2\t= - 2.0 * cosxi;\t\t\t\t\t// cos(x + HALF_PI) = -sin(x)\n\n\t\t\t\t// clamp to normal hemisphere\n\t\t\t\thorizons.x = gamma + max( - horizons.x - gamma, - HALF_PI );\n\t\t\t\thorizons.y = gamma + min( horizons.y - gamma, HALF_PI );\n\n\t\t\t\t// Riemann integral is additive\n\t\t\t\tao += nnx * 0.25 * (\n\t\t\t\t\t( horizons.x * singamma2 + cosgamma - cos( 2.0 * horizons.x - gamma ) ) +\n\t\t\t\t\t( horizons.y * singamma2 + cosgamma - cos( 2.0 * horizons.y - gamma ) ) );\n\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\n\t\t\t// PDF = 1 / pi and must normalize with pi because of Lambert\n\t\t\tao = ao / float( NUM_DIRECTIONS );\n\n\t\t\t#if ENABLE_COLOR_BOUNCE\n\n\t\t\tcolor /= float( NUM_STEPS * NUM_DIRECTIONS ) * 2.0 / lightBounceIntensity;\n\t\t\tgl_FragColor = vec4( color, ao );\n\n\t\t\t#else\n\n\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, ao );\n\n\t\t\t#endif\n\t\t}\n\t"},Un={defines:{BLUR_ITERATIONS:5,BLUR_MODE:0,AO_ONLY:0,COLOR_ONLY:0,DEPTH_THRESHOLD:"5e-1"},uniforms:{fullSize:{value:new s.Vector2},aoSize:{value:new s.Vector2},normalBuffer:{value:null},depthBuffer:{value:null},colorBuffer:{value:null},gtaoBuffer:{value:null},intensity:{value:1},blurStride:{value:1},ambientColor:{value:new s.Color},ambientIntensity:{value:0}},vertexShader:"\n\t\tvarying vec2 vUv;\n\t\tvoid main() {\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t}\n\t",fragmentShader:"\n\t\tvarying vec2 vUv;\n\t\tuniform vec3 ambientColor;\n\t\tuniform float ambientIntensity;\n\t\tuniform vec2 aoSize;\n\t\tuniform vec2 fullSize;\n\t\tuniform sampler2D colorBuffer;\n\t\tuniform sampler2D depthBuffer;\n\t\tuniform sampler2D normalBuffer;\n\t\tuniform sampler2D gtaoBuffer;\n\t\tuniform float intensity;\n\t\tuniform int blurStride;\n\n\t\tvec3 UnpackNormal( vec4 d ) {\n\t\t\treturn d.xyz * 2.0 - 1.0;\n\t\t}\n\n\t\tvec3 MultiBounce( float ao, vec3 albedo ) {\n\t\t\tvec3 x = vec3( ao );\n\t\t\tvec3 a = 2.0404 * albedo - vec3( 0.3324 );\n\t\t\tvec3 b = -4.7951 * albedo + vec3( 0.6417 );\n\t\t\tvec3 c = 2.7552 * albedo + vec3( 0.6903 );\n\t\t\treturn max( x, ( ( x * a + b ) * x + c ) * x );\n\t\t}\n\n\t\tvoid main() {\n\t\t\tvec4 color = texture2D( colorBuffer, vUv );\n\t\t\t// NO_BLUR\n\t\t\t#if BLUR_MODE == 0\n\t\t\t\tvec4 accumSample = texture2D( gtaoBuffer, vUv );\n\t\t\t#else\n\t\t\tvec2 currTexel = vUv * fullSize;\n\t\t\tvec2 currAoTexel = vUv * aoSize;\n\n\t\t\t// aoPixels per full size ones. Should be 1/2 at\n\t\t\tvec2 texelRatio = aoSize / fullSize;\n\n\t\t\tvec3 currNormal = UnpackNormal( texture2D( normalBuffer, vUv ) );\n\t\t\tfloat currDepth = texture2D( depthBuffer, vUv ).r;\n\n\t\t\t// TODO: pull this sampling out into a function\n\t\t\tvec4 accumSample = vec4( 0.0 );\n\t\t\tfloat totalWeight = 1e-10;\n\t\t\tfloat pixelOffset = - float( BLUR_ITERATIONS ) / 2.0;\n\t\t\tpixelOffset += mod( float( BLUR_ITERATIONS ), 2.0 ) == 0.0 ? 0.0 : 0.5;\n\t\t\tpixelOffset *= float( blurStride );\n\n\t\t\t// BOX_BLUR\n\t\t\t#if BLUR_MODE == 1\n\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int x = 0; x < BLUR_ITERATIONS; x ++ ) {\n\n\t\t\t\t#pragma unroll_loop_start\n\t\t\t\tfor ( int y = 0; y < BLUR_ITERATIONS; y ++ ) {\n\n\t\t\t\t\tvec2 step = vec2( float( x ), float( y ) ) * float( blurStride );\n\n\t\t\t\t\t// iterate over full res pixels\n\t\t\t\t\tvec2 offsetUv = currTexel + ( pixelOffset + step ) / texelRatio;\n\t\t\t\t\toffsetUv /= fullSize;\n\n\t\t\t\t\t// get the associated pixel in the AO buffer\n\t\t\t\t\tvec2 aoUv = currAoTexel + pixelOffset + step;\n\t\t\t\t\taoUv /= aoSize;\n\n\t\t\t\t\t// if the pixels are close enough in space then blur them together\n\t\t\t\t\tfloat offsetDepth = texture2D( depthBuffer, offsetUv ).r;\n\t\t\t\t\tif ( abs( offsetDepth - currDepth ) <= DEPTH_THRESHOLD ) {\n\n\t\t\t\t\t\t// Weigh the sample based on normal similarity\n\t\t\t\t\t\tvec3 offsetNormal = UnpackNormal( texture2D( normalBuffer, offsetUv ) );\n\t\t\t\t\t\tfloat weight = max( 0.0, dot( offsetNormal, currNormal ) );\n\n\t\t\t\t\t\t// square the weight to give pixels with a closer normal even higher priority\n\t\t\t\t\t\tweight *= weight;\n\n\t\t\t\t\t\t// accumulate\n\t\t\t\t\t\tvec4 val = texture2D( gtaoBuffer, aoUv );\n\t\t\t\t\t\taccumSample += val * weight;\n\t\t\t\t\t\ttotalWeight += weight;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t\t#pragma unroll_loop_end\n\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\n\t\t\t// CROSS_BLUR\n\t\t\t#elif BLUR_MODE == 2\n\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = 0; i < BLUR_ITERATIONS; i ++ ) {\n\n\t\t\t\tvec2 offsetUv, aoUv;\n\t\t\t\tfloat offsetDepth;\n\n\t\t\t\t// X sample\n\t\t\t\t// iterate over full res pixels\n\t\t\t\toffsetUv = currTexel + vec2( pixelOffset + float( i * blurStride ), 0.0 ) / texelRatio;\n\t\t\t\toffsetUv /= fullSize;\n\n\t\t\t\taoUv = currAoTexel + vec2( pixelOffset + float( i * blurStride ), 0.0 );\n\t\t\t\taoUv /= aoSize;\n\n\t\t\t\t// further more negative\n\t\t\t\toffsetDepth = texture2D( depthBuffer, offsetUv ).r;\n\t\t\t\tif ( abs(offsetDepth - currDepth) <= DEPTH_THRESHOLD ) {\n\n\t\t\t\t\tvec3 offsetNormal = UnpackNormal( texture2D( normalBuffer, offsetUv ) );\n\t\t\t\t\tfloat weight = max(0.0, dot( offsetNormal, currNormal ) );\n\t\t\t\t\tweight *= weight;\n\n\t\t\t\t\tvec4 val = texture2D( gtaoBuffer, aoUv );\n\t\t\t\t\taccumSample += val * weight;\n\t\t\t\t\ttotalWeight += weight;\n\n\t\t\t\t}\n\n\t\t\t\t// TODO: this should not be here if on the center pixel\n\t\t\t\t// Y sample\n\t\t\t\t// iterate over full res pixels\n\t\t\t\toffsetUv = currTexel + vec2( 0.0, pixelOffset + float( i * blurStride ) ) / texelRatio;\n\t\t\t\toffsetUv /= fullSize;\n\n\t\t\t\taoUv = currAoTexel + vec2( 0.0, pixelOffset + float( i * blurStride ) );\n\t\t\t\taoUv /= aoSize;\n\n\t\t\t\t// further more negative\n\t\t\t\toffsetDepth = texture2D( depthBuffer, offsetUv ).r;\n\t\t\t\tif ( abs(offsetDepth - currDepth) <= DEPTH_THRESHOLD ) {\n\n\t\t\t\t\tvec3 offsetNormal = UnpackNormal( texture2D( normalBuffer, offsetUv ) );\n\t\t\t\t\tfloat weight = max(0.0, dot( offsetNormal, currNormal ) );\n\t\t\t\t\tweight *= weight;\n\n\t\t\t\t\tvec4 val = texture2D( gtaoBuffer, aoUv );\n\t\t\t\t\taccumSample += val * weight;\n\t\t\t\t\ttotalWeight += weight;\n\n\t\t\t\t}\n\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\n\t\t\t// DIAGONAL_BLUR\n\t\t\t#elif BLUR_MODE == 3\n\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = 0; i < BLUR_ITERATIONS; i ++ ) {\n\n\t\t\t\tvec2 offsetUv, aoUv;\n\t\t\t\tfloat offsetDepth;\n\n\t\t\t\t// X sample\n\t\t\t\t// iterate over full res pixels\n\t\t\t\toffsetUv = currTexel + vec2( pixelOffset + float( i * blurStride ), pixelOffset + float( i * blurStride ) ) / texelRatio;\n\t\t\t\toffsetUv /= fullSize;\n\n\t\t\t\taoUv = currAoTexel + vec2( pixelOffset + float( i * blurStride ), pixelOffset + float( i * blurStride ) );\n\t\t\t\taoUv /= aoSize;\n\n\t\t\t\t// further more negative\n\t\t\t\toffsetDepth = texture2D( depthBuffer, offsetUv ).r;\n\t\t\t\tif ( abs(offsetDepth - currDepth) <= DEPTH_THRESHOLD ) {\n\n\t\t\t\t\tvec3 offsetNormal = UnpackNormal( texture2D( normalBuffer, offsetUv ) );\n\t\t\t\t\tfloat weight = max(0.0, dot( offsetNormal, currNormal ) );\n\t\t\t\t\tweight *= weight;\n\n\t\t\t\t\tvec4 val = texture2D( gtaoBuffer, aoUv );\n\t\t\t\t\taccumSample += val * weight;\n\t\t\t\t\ttotalWeight += weight;\n\n\t\t\t\t}\n\n\t\t\t\t// TODO: this should not be here if on the center pixel\n\t\t\t\t// Y sample\n\t\t\t\t// iterate over full res pixels\n\t\t\t\toffsetUv = currTexel + vec2( - pixelOffset - float( i * blurStride ), pixelOffset + float( i * blurStride ) ) / texelRatio;\n\t\t\t\toffsetUv /= fullSize;\n\n\t\t\t\taoUv = currAoTexel + vec2( - pixelOffset - float( i * blurStride ), pixelOffset + float( i * blurStride ) );\n\t\t\t\taoUv /= aoSize;\n\n\t\t\t\t// further more negative\n\t\t\t\toffsetDepth = texture2D( depthBuffer, offsetUv ).r;\n\t\t\t\tif ( abs(offsetDepth - currDepth) <= DEPTH_THRESHOLD ) {\n\n\t\t\t\t\tvec3 offsetNormal = UnpackNormal( texture2D( normalBuffer, offsetUv ) );\n\t\t\t\t\tfloat weight = max(0.0, dot( offsetNormal, currNormal ) );\n\t\t\t\t\tweight *= weight;\n\n\t\t\t\t\tvec4 val = texture2D( gtaoBuffer, aoUv );\n\t\t\t\t\taccumSample += val * weight;\n\t\t\t\t\ttotalWeight += weight;\n\n\t\t\t\t}\n\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\n\t\t\t#endif\n\n\t\t\taccumSample /= totalWeight;\n\n\t\t\t#endif\n\n\t\t\tfloat gtao = accumSample.a;\n\n\t\t\t#if COLOR_ONLY\n\n\t\t\tgl_FragColor = vec4( accumSample.rgb, 1.0 );\n\n\t\t\t#elif AO_ONLY\n\n\t\t\tvec3 rgb = mix( vec3( 1.0 ), vec3( accumSample.a ), intensity );\n\t\t\tgl_FragColor = vec4( rgb, 1.0 );\n\n\t\t\t#else\n\n\t\t\tvec3 rgb = mix( color.rgb, color.rgb * MultiBounce( gtao, color.rgb ), intensity );\n\t\t\tvec3 delta = color.rgb - rgb;\n\t\t\tvec3 ambient = ambientColor * delta * ambientIntensity;\n\n\t\t\tfloat colorFade = ( 1.0 - pow( 1.0 - gtao, 2.0 ) );\n\t\t\tgl_FragColor = vec4( rgb + ambient + accumSample.rgb * ( 0.75 + colorFade * 0.25 ), color.a );\n\n\t\t\t#endif\n\n\t\t}\n\t\t"};class Nn{constructor(e){this.count=0,this.size=-1,this.sigma=-1,this.radius=-1,this.lookupTable=null,this.score=null,this.binaryPattern=null,this.resize(e),this.setSigma(1.5)}findVoid(){var e,{score:t,binaryPattern:r}=this;let n=1/0,a=-1;for(let i=0,s=r.length;i<s;i++)0===r[i]&&(e=t[i])<n&&(n=e,a=i);return a}findCluster(){var e,{score:t,binaryPattern:r}=this;let n=-1/0,a=-1;for(let i=0,s=r.length;i<s;i++)1===r[i]&&(e=t[i])>n&&(n=e,a=i);return a}setSigma(e){if(e!==this.sigma){var t=~~(Math.sqrt(20*Math.pow(e,2))+1),r=2*t+1;const s=new Float32Array(r*r);var n=e*e;for(let e=-t;e<=t;e++)for(let o=-t;o<=t;o++){var a=(t+o)*r+e+t,i=e*e+o*o;s[a]=Math.pow(Math.E,-i/(2*n))}this.lookupTable=s,this.sigma=e,this.radius=t}}resize(e){this.size!==e&&(this.size=e,this.score=new Float32Array(e*e),this.binaryPattern=new Uint8Array(e*e))}invert(){const{binaryPattern:e,score:t,size:r}=this;t.fill(0);for(let t=0,i=e.length;t<i;t++){var n,a;0===e[t]?(n=~~(t/r),a=t-n*r,this.updateScore(a,n,1),e[t]=1):e[t]=0}}updateScore(e,t,r){const{size:n,score:a,lookupTable:i}=this;var s=this.radius,o=2*s+1;for(let u=-s;u<=s;u++)for(let h=-s;h<=s;h++){var l=i[(s+h)*o+u+s];let d=e+u,p=(d=d<0?n+d:d%n,t+h);var c=(p=p<0?n+p:p%n)*n+d;a[c]+=r*l}}addPointIndex(e){this.binaryPattern[e]=1;var t=this.size,r=~~(e/t);this.updateScore(e-r*t,r,1),this.count++}removePointIndex(e){this.binaryPattern[e]=0;var t=this.size,r=~~(e/t);this.updateScore(e-r*t,r,-1),this.count--}copy(e){this.resize(e.size),this.score.set(e.score),this.binaryPattern.set(e.binaryPattern),this.setSigma(e.sigma),this.count=e.count}}class zn{constructor(){this.random=Math.random,this.sigma=1.5,this.size=64,this.majorityPointsRatio=.1,this.samples=new Nn(1),this.savedSamples=new Nn(1)}generate(){const{samples:e,savedSamples:t,sigma:r,majorityPointsRatio:n,size:a}=this;e.resize(a),e.setSigma(r);var i=Math.floor(a*a*n),s=e.binaryPattern,o=s,l=i;o.fill(0);for(let e=0;e<l;e++)o[e]=1;var[c,u=Math.random]=[s,this.random];for(let e=c.length-1;0<e;e--){var h=~~((u()-1e-6)*e),d=c[e];c[e]=c[h],c[h]=d}for(let t=0,r=s.length;t<r;t++)1===s[t]&&e.addPointIndex(t);for(;;){var p=e.findCluster(),f=(e.removePointIndex(p),e.findVoid());if(p===f){e.addPointIndex(p);break}e.addPointIndex(f)}const m=new Uint32Array(a*a);let g;for(t.copy(e),g=e.count-1;0<=g;){var v=e.findCluster();e.removePointIndex(v),m[v]=g,g--}var b=a*a;for(g=t.count;g<b/2;){var y=t.findVoid();t.addPointIndex(y),m[y]=g,g++}for(t.invert();g<b;){var x=t.findCluster();t.removePointIndex(x),m[x]=g,g++}return{data:m,maxValue:b}}}class Fn extends nn.w{constructor(e,t){super(),this.enabled=!0,this.needsSwap=!0,this.scene=e,this.camera=t,this.debug={display:Fn.DEFAULT},this.renderTargetScale=1,this.enableJitter=!0,this.radiusJitter=0,this.rotationJitter=0,this.numSteps=8,this.numDirections=8,this.intensity=1,this.radius=2,this.directionOffset=0,this.stepOffset=0,this.blurMode=Fn.BOX_BLUR,this.blurIterations=4,this.blurStride=1,this.enableFalloff=!0,this.falloffStart=.4,this.falloffEnd=2,this.ambientColor=new s.Color,this.ambientIntensity=0,this.lightBounceIntensity=1,this._gtaoBuffer=new s.WebGLRenderTarget(1,1,{format:s.RGBAFormat}),this._depthBuffer=new s.WebGLRenderTarget(1,1,{minFilter:s.NearestFilter,magFilter:s.NearestFilter,format:s.RGBAFormat,type:s.HalfFloatType}),this._depthReplacement=new Ln,this._normalBuffer=new s.WebGLRenderTarget(1,1,{minFilter:s.NearestFilter,magFilter:s.NearestFilter,format:s.RGBAFormat}),this._normalReplacement=new Rn,this.gtaoQuad=new nn.T(new s.ShaderMaterial(jn)),this.debugPackedQuad=new nn.T(new s.ShaderMaterial(In)),this.debugDepthQuad=new nn.T(new s.ShaderMaterial(Bn)),this.compositeQuad=new nn.T(new s.ShaderMaterial(Un));const r=new zn,n=(r.size=32,new Uint8Array(4*Math.pow(32,2)));for(let e=0;e<4;e++){var a=r.generate(),i=a.data,o=a.maxValue;for(let t=0,r=i.length;t<r;t++)n[4*t+e]=i[t]/o*255}this.blueNoiseTex=new s.DataTexture(n,r.size,r.size,s.RGBAFormat),this.blueNoiseTex.wrapS=s.RepeatWrapping,this.blueNoiseTex.wrapT=s.RepeatWrapping,this.blueNoiseTex.minFilter=s.LinearFilter,this.blueNoiseTex.needsUpdate=!0}dispose(){}setSize(e,t){var r=this.renderTargetScale,n=Math.floor(e*r);r=Math.floor(t*r),this._depthBuffer.setSize(e,t),this._normalBuffer.setSize(e,t),this._gtaoBuffer.setSize(n,r)}render(e,t,r){t=this.renderToScreen?null:t;const{scene:n,camera:a,debug:i,debugPackedQuad:o,debugDepthQuad:l,compositeQuad:c,gtaoQuad:u}=this,h=u.material;Fn.RendererState.copy(e,n);var d=()=>{Fn.RendererState.restore(e,n),f.reset(n,!0)},p=this._depthBuffer;const f=this._depthReplacement;if(n.background=null,f.replace(n,!0,!0),e.setRenderTarget(p),e.setClearColor(Fn.BlackColor,0),e.clear(),e.render(n,a),i.display===Fn.DEPTH)return e.setRenderTarget(t),l.material.uniforms.texture.value=p.texture,l.render(e),void d();const m=this._normalReplacement;var g=this._normalBuffer;if(m.replace(n,!0,!1),e.setRenderTarget(g),e.clear(),e.render(n,a),i.display===Fn.NORMAL)return e.setRenderTarget(t),e.clear(),o.material.uniforms.displayRoughness.value=0,o.material.uniforms.texture.value=g.texture,o.render(e),void d();this.numSteps!==h.defines.NUM_STEPS&&(h.defines.NUM_STEPS=this.numSteps,h.needsUpdate=!0),this.numDirections!==h.defines.NUM_DIRECTIONS&&(h.defines.NUM_DIRECTIONS=this.numDirections,h.needsUpdate=!0),this.radius.toFixed(16)!==h.defines.RADIUS&&(h.defines.RADIUS=this.radius.toFixed(16),h.needsUpdate=!0),Math.pow(this.falloffStart,2).toFixed(16)===h.defines.FALLOFF_START2&&Math.pow(this.falloffEnd,2).toFixed(16)===h.defines.FALLOFF_END2&&this.enableFalloff===Boolean(h.defines.ENABLE_FALLOFF)||(h.defines.FALLOFF_START2=Math.pow(this.falloffStart,2).toFixed(16),h.defines.FALLOFF_END2=Math.pow(this.falloffEnd,2).toFixed(16),h.defines.ENABLE_FALLOFF=this.enableFalloff?1:0,h.needsUpdate=!0),this.rotationJitter!==h.defines.ENABLE_ROTATION_JITTER&&(h.defines.ENABLE_ROTATION_JITTER=this.rotationJitter,h.needsUpdate=!0),this.radiusJitter!==h.defines.ENABLE_RADIUS_JITTER&&(h.defines.ENABLE_RADIUS_JITTER=this.radiusJitter,h.needsUpdate=!0),0!==this.lightBounceIntensity!==Boolean(h.defines.ENABLE_COLOR_BOUNCE)&&(h.defines.ENABLE_COLOR_BOUNCE=0!==this.lightBounceIntensity?1:0,h.needsUpdate=!0);var v=this._gtaoBuffer,b=Math.floor(v.texture.image.width),y=Math.floor(v.texture.image.height),x=a.projectionMatrix,w=s.MathUtils.DEG2RAD*a.fov;h.uniforms.params.value.set(this.directionOffset,this.stepOffset),h.uniforms.projInfo.value.set(2/(b*x.elements[0]),2/(y*x.elements[5]),-1/x.elements[0],-1/x.elements[5]),h.uniforms.clipInfo.value.set(a.near,a.far,y/(2*Math.tan(.5*w))*.5,0),h.uniforms.normalBuffer.value=g.texture,h.uniforms.depthBuffer.value=p.texture,h.uniforms.colorBuffer.value=r.texture,h.uniforms.lightBounceIntensity.value=this.lightBounceIntensity,h.uniforms.renderSize.value.set(Math.floor(v.texture.image.width),Math.floor(v.texture.image.height)),h.uniforms.blueNoiseTex.value=this.blueNoiseTex,h.uniforms.blueNoiseSize.value=this.blueNoiseTex.image.width,e.setRenderTarget(v),e.clear(),u.render(e);const S=c.material;S.uniforms.depthBuffer.value=p.texture,S.uniforms.normalBuffer.value=g.texture,S.uniforms.colorBuffer.value=r.texture,S.uniforms.gtaoBuffer.value=v.texture,S.uniforms.intensity.value=this.intensity,S.uniforms.aoSize.value.set(v.width,v.height),S.uniforms.fullSize.value.set(r.width,r.height),S.uniforms.blurStride.value=this.blurStride,S.uniforms.ambientColor.value.copy(this.ambientColor),S.uniforms.ambientIntensity.value=this.ambientIntensity,this.blurIterations!==S.defines.BLUR_ITERATIONS&&(S.defines.BLUR_ITERATIONS=this.blurIterations,S.needsUpdate=!0),this.blurMode!==S.defines.BLUR_MODE&&(S.defines.BLUR_MODE=this.blurMode,S.needsUpdate=!0),i.display===Fn.AO_SAMPLE?1!==S.defines.AO_ONLY&&(S.defines.AO_ONLY=1,S.needsUpdate=!0):0!==S.defines.AO_ONLY&&(S.defines.AO_ONLY=0,S.needsUpdate=!0),i.display===Fn.COLOR_SAMPLE?1!==S.defines.COLOR_ONLY&&(S.defines.COLOR_ONLY=1,S.needsUpdate=!0):0!==S.defines.COLOR_ONLY&&(S.defines.COLOR_ONLY=0,S.needsUpdate=!0),e.setRenderTarget(t),e.clear(),c.render(e),d()}}Fn.NO_JITTER=0,Fn.RANDOM_JITTER=1,Fn.BLUENOISE_JITTER=2,Fn.DEFAULT=0,Fn.DEPTH=1,Fn.NORMAL=2,Fn.AO_SAMPLE=3,Fn.COLOR_SAMPLE=4,Fn.NO_BLUR=0,Fn.BOX_BLUR=1,Fn.CROSS_BLUR=2,Fn.DIAGONAL_BLUR=3,Fn.BlackColor=new s.Color(0),Fn.RendererState=new class{constructor(){this.clearAlpha=0,this.clearColor=new s.Color,this.renderTarget=null,this.outputEncoding=s.LinearEncoding,this.overrideMaterial=null,this.shadowsEnabled=!1,this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.background=null,this.autoUpdate=!0}copy(e,t){e&&(this.clearAlpha=e.getClearAlpha(),this.clearColor=e.getClearColor(this.clearColor),this.renderTarget=e.getRenderTarget(),this.shadowsEnabled=e.shadowMap.enabled,this.outputEncoding=e.outputEncoding,this.autoClear=e.autoClear,this.autoClearColor=e.autoClearColor,this.autoClearDepth=e.autoClearDepth,this.autoClearStencil=e.autoClearStencil),t&&(this.overrideMaterial=t.overrideMaterial,this.background=t.background,this.autoUpdate=t.autoUpdate)}restore(e,t){e&&(e.setClearAlpha(this.clearAlpha),e.setClearColor(this.clearColor),e.setRenderTarget(this.renderTarget),e.shadowMap.enabled=this.shadowsEnabled,e.outputEncoding=this.outputEncoding,e.autoClear=this.autoClear,e.autoClearColor=this.autoClearColor,e.autoClearDepth=this.autoClearDepth,e.autoClearStencil=this.autoClearStencil),t&&(t.overrideMaterial=this.overrideMaterial,t.background=this.background,t.autoUpdate=this.autoUpdate),this.renderTarget=null,this.overrideMaterial=null}};class Vn{constructor(e){this.mtuPP=e,this.mtuPP.renderer&&this.postProcessing()}postProcessing(){this.gtaoPass||(this.gtaoPass=new Fn(this.mtuPP.mainScene,this.mtuPP.mainCamera)),this.mtuPP.effectComposer.addPass(this.gtaoPass)}setAOData(e,t){"rotationJitter"===e||"radiusJitter"===e?"NONE"===t?this.gtaoPass[e]=0:"RANDOM"===t?this.gtaoPass[e]=1:"BLUE_NOISE"===t&&(this.gtaoPass[e]=2):"blurMode"===e?"NO_BLUR"===t?this.gtaoPass[e]=0:"BOX_BLUR"===t?this.gtaoPass[e]=1:"CROSS_BLUR"===t?this.gtaoPass[e]=2:"DIAGONAL_BLUR"===t&&(this.gtaoPass[e]=3):this.gtaoPass[e]="ambientColor"===e?new da.Color(t):t}dispose(){this.gtaoPass&&(this.gtaoPass.dispose(),this.gtaoPass=null)}enablePass(e){this.gtaoPass&&this.gtaoPass.enabled!==e&&(this.gtaoPass.enabled=e)}}function Gn(e){return(Gn="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})(e)}function Hn(e,t){return(Hn=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Wn(e){return(Wn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Kn=function(e){var t=n;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Hn(t,e);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Wn(e);if(r=t?(r=Wn(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===Gn(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(e,t,a,i,o){var l;if(this instanceof n)return(l=r.call(this)).scene=e,l.camera=t,l.overrideMaterial=a,l.clearColor=i,l.clearAlpha=void 0!==o?o:0,l.clear=!0,l.clearDepth=!1,l.needsSwap=!1,l._oldClearColor=new s.Color,l;throw new TypeError("Cannot call a class as a function")}return t=n,(e=[{key:"render",value:function(e,t,r){var n,a,i=e.autoClear;e.autoClear=!1,void 0!==this.overrideMaterial&&(a=this.scene.overrideMaterial,this.scene.overrideMaterial=this.overrideMaterial),this.clearColor&&(e.getClearColor(this._oldClearColor),n=e.getClearAlpha(),e.setClearColor(this.clearColor,this.clearAlpha)),this.clearDepth&&e.clearDepth(),e.setRenderTarget(this.renderToScreen?null:r),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),e.render(this.scene,this.camera),this.clearColor&&e.setClearColor(this._oldClearColor,n),void 0!==this.overrideMaterial&&(this.scene.overrideMaterial=a),e.autoClear=i}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),n}(nn.w),qn={uniforms:{tDiffuse:{value:null},resolution:{value:new s.Vector2(1/1024,1/512)}},vertexShader:"\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",fragmentShader:"\n\tprecision highp float;\n\n\tuniform sampler2D tDiffuse;\n\n\tuniform vec2 resolution;\n\n\tvarying vec2 vUv;\n\n\t// FXAA 3.11 implementation by NVIDIA, ported to WebGL by Agost Biro (biro@archilogic.com)\n\n\t//----------------------------------------------------------------------------------\n\t// File: es3-keplerFXAAassetsshaders/FXAA_DefaultES.frag\n\t// SDK Version: v3.00\n\t// Email: gameworks@nvidia.com\n\t// Site: http://developer.nvidia.com/\n\t//\n\t// Copyright (c) 2014-2015, NVIDIA CORPORATION. All rights reserved.\n\t//\n\t// Redistribution and use in source and binary forms, with or without\n\t// modification, are permitted provided that the following conditions\n\t// are met:\n\t// * Redistributions of source code must retain the above copyright\n\t// notice, this list of conditions and the following disclaimer.\n\t// * Redistributions in binary form must reproduce the above copyright\n\t// notice, this list of conditions and the following disclaimer in the\n\t// documentation and/or other materials provided with the distribution.\n\t// * Neither the name of NVIDIA CORPORATION nor the names of its\n\t// contributors may be used to endorse or promote products derived\n\t// from this software without specific prior written permission.\n\t//\n\t// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY\n\t// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n\t// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n\t// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR\n\t// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\n\t// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\n\t// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n\t// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY\n\t// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n\t// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n\t// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\t//\n\t//----------------------------------------------------------------------------------\n\n\t#ifndef FXAA_DISCARD\n\t\t\t//\n\t\t\t// Only valid for PC OpenGL currently.\n\t\t\t// Probably will not work when FXAA_GREEN_AS_LUMA = 1.\n\t\t\t//\n\t\t\t// 1 = Use discard on pixels which don't need AA.\n\t\t\t// For APIs which enable concurrent TEX+ROP from same surface.\n\t\t\t// 0 = Return unchanged color on pixels which don't need AA.\n\t\t\t//\n\t\t\t#define FXAA_DISCARD 0\n\t#endif\n\n\t/*--------------------------------------------------------------------------*/\n\t#define FxaaTexTop(t, p) texture2D(t, p, -100.0)\n\t#define FxaaTexOff(t, p, o, r) texture2D(t, p + (o * r), -100.0)\n\t/*--------------------------------------------------------------------------*/\n\n\t#define NUM_SAMPLES 5\n\n\t// assumes colors have premultipliedAlpha, so that the calculated color contrast is scaled by alpha\n\tfloat contrast( vec4 a, vec4 b ) {\n\t\t\tvec4 diff = abs( a - b );\n\t\t\treturn max( max( max( diff.r, diff.g ), diff.b ), diff.a );\n\t}\n\n\t/*============================================================================\n\n\t\t\t\t\t\t\t\t\tFXAA3 QUALITY - PC\n\n\t============================================================================*/\n\n\t/*--------------------------------------------------------------------------*/\n\tvec4 FxaaPixelShader(\n\t\t\tvec2 posM,\n\t\t\tsampler2D tex,\n\t\t\tvec2 fxaaQualityRcpFrame,\n\t\t\tfloat fxaaQualityEdgeThreshold,\n\t\t\tfloat fxaaQualityinvEdgeThreshold\n\t) {\n\t\t\tvec4 rgbaM = FxaaTexTop(tex, posM);\n\t\t\tvec4 rgbaS = FxaaTexOff(tex, posM, vec2( 0.0, 1.0), fxaaQualityRcpFrame.xy);\n\t\t\tvec4 rgbaE = FxaaTexOff(tex, posM, vec2( 1.0, 0.0), fxaaQualityRcpFrame.xy);\n\t\t\tvec4 rgbaN = FxaaTexOff(tex, posM, vec2( 0.0,-1.0), fxaaQualityRcpFrame.xy);\n\t\t\tvec4 rgbaW = FxaaTexOff(tex, posM, vec2(-1.0, 0.0), fxaaQualityRcpFrame.xy);\n\t\t\t// . S .\n\t\t\t// W M E\n\t\t\t// . N .\n\n\t\t\tbool earlyExit = max( max( max(\n\t\t\t\t\tcontrast( rgbaM, rgbaN ),\n\t\t\t\t\tcontrast( rgbaM, rgbaS ) ),\n\t\t\t\t\tcontrast( rgbaM, rgbaE ) ),\n\t\t\t\t\tcontrast( rgbaM, rgbaW ) )\n\t\t\t\t\t< fxaaQualityEdgeThreshold;\n\t\t\t// . 0 .\n\t\t\t// 0 0 0\n\t\t\t// . 0 .\n\n\t\t\t#if (FXAA_DISCARD == 1)\n\t\t\t\t\tif(earlyExit) FxaaDiscard;\n\t\t\t#else\n\t\t\t\t\tif(earlyExit) return rgbaM;\n\t\t\t#endif\n\n\t\t\tfloat contrastN = contrast( rgbaM, rgbaN );\n\t\t\tfloat contrastS = contrast( rgbaM, rgbaS );\n\t\t\tfloat contrastE = contrast( rgbaM, rgbaE );\n\t\t\tfloat contrastW = contrast( rgbaM, rgbaW );\n\n\t\t\tfloat relativeVContrast = ( contrastN + contrastS ) - ( contrastE + contrastW );\n\t\t\trelativeVContrast *= fxaaQualityinvEdgeThreshold;\n\n\t\t\tbool horzSpan = relativeVContrast > 0.;\n\t\t\t// . 1 .\n\t\t\t// 0 0 0\n\t\t\t// . 1 .\n\n\t\t\t// 45 deg edge detection and corners of objects, aka V/H contrast is too similar\n\t\t\tif( abs( relativeVContrast ) < .3 ) {\n\t\t\t\t\t// locate the edge\n\t\t\t\t\tvec2 dirToEdge;\n\t\t\t\t\tdirToEdge.x = contrastE > contrastW ? 1. : -1.;\n\t\t\t\t\tdirToEdge.y = contrastS > contrastN ? 1. : -1.;\n\t\t\t\t\t// . 2 . . 1 .\n\t\t\t\t\t// 1 0 2 ~= 0 0 1\n\t\t\t\t\t// . 1 . . 0 .\n\n\t\t\t\t\t// tap 2 pixels and see which ones are \"outside\" the edge, to\n\t\t\t\t\t// determine if the edge is vertical or horizontal\n\n\t\t\t\t\tvec4 rgbaAlongH = FxaaTexOff(tex, posM, vec2( dirToEdge.x, -dirToEdge.y ), fxaaQualityRcpFrame.xy);\n\t\t\t\t\tfloat matchAlongH = contrast( rgbaM, rgbaAlongH );\n\t\t\t\t\t// . 1 .\n\t\t\t\t\t// 0 0 1\n\t\t\t\t\t// . 0 H\n\n\t\t\t\t\tvec4 rgbaAlongV = FxaaTexOff(tex, posM, vec2( -dirToEdge.x, dirToEdge.y ), fxaaQualityRcpFrame.xy);\n\t\t\t\t\tfloat matchAlongV = contrast( rgbaM, rgbaAlongV );\n\t\t\t\t\t// V 1 .\n\t\t\t\t\t// 0 0 1\n\t\t\t\t\t// . 0 .\n\n\t\t\t\t\trelativeVContrast = matchAlongV - matchAlongH;\n\t\t\t\t\trelativeVContrast *= fxaaQualityinvEdgeThreshold;\n\n\t\t\t\t\tif( abs( relativeVContrast ) < .3 ) { // 45 deg edge\n\t\t\t\t\t\t\t// 1 1 .\n\t\t\t\t\t\t\t// 0 0 1\n\t\t\t\t\t\t\t// . 0 1\n\n\t\t\t\t\t\t\t// do a simple blur\n\t\t\t\t\t\t\treturn mix(\n\t\t\t\t\t\t\t\t\trgbaM,\n\t\t\t\t\t\t\t\t\t(rgbaN + rgbaS + rgbaE + rgbaW) * .25,\n\t\t\t\t\t\t\t\t\t.4\n\t\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\thorzSpan = relativeVContrast > 0.;\n\t\t\t}\n\n\t\t\tif(!horzSpan) rgbaN = rgbaW;\n\t\t\tif(!horzSpan) rgbaS = rgbaE;\n\t\t\t// . 0 . 1\n\t\t\t// 1 0 1 -> 0\n\t\t\t// . 0 . 1\n\n\t\t\tbool pairN = contrast( rgbaM, rgbaN ) > contrast( rgbaM, rgbaS );\n\t\t\tif(!pairN) rgbaN = rgbaS;\n\n\t\t\tvec2 offNP;\n\t\t\toffNP.x = (!horzSpan) ? 0.0 : fxaaQualityRcpFrame.x;\n\t\t\toffNP.y = ( horzSpan) ? 0.0 : fxaaQualityRcpFrame.y;\n\n\t\t\tbool doneN = false;\n\t\t\tbool doneP = false;\n\n\t\t\tfloat nDist = 0.;\n\t\t\tfloat pDist = 0.;\n\n\t\t\tvec2 posN = posM;\n\t\t\tvec2 posP = posM;\n\n\t\t\tint iterationsUsed = 0;\n\t\t\tint iterationsUsedN = 0;\n\t\t\tint iterationsUsedP = 0;\n\t\t\tfor( int i = 0; i < NUM_SAMPLES; i++ ) {\n\t\t\t\t\titerationsUsed = i;\n\n\t\t\t\t\tfloat increment = float(i + 1);\n\n\t\t\t\t\tif(!doneN) {\n\t\t\t\t\t\t\tnDist += increment;\n\t\t\t\t\t\t\tposN = posM + offNP * nDist;\n\t\t\t\t\t\t\tvec4 rgbaEndN = FxaaTexTop(tex, posN.xy);\n\t\t\t\t\t\t\tdoneN = contrast( rgbaEndN, rgbaM ) > contrast( rgbaEndN, rgbaN );\n\t\t\t\t\t\t\titerationsUsedN = i;\n\t\t\t\t\t}\n\n\t\t\t\t\tif(!doneP) {\n\t\t\t\t\t\t\tpDist += increment;\n\t\t\t\t\t\t\tposP = posM - offNP * pDist;\n\t\t\t\t\t\t\tvec4 rgbaEndP = FxaaTexTop(tex, posP.xy);\n\t\t\t\t\t\t\tdoneP = contrast( rgbaEndP, rgbaM ) > contrast( rgbaEndP, rgbaN );\n\t\t\t\t\t\t\titerationsUsedP = i;\n\t\t\t\t\t}\n\n\t\t\t\t\tif(doneN || doneP) break;\n\t\t\t}\n\n\n\t\t\tif ( !doneP && !doneN ) return rgbaM; // failed to find end of edge\n\n\t\t\tfloat dist = min(\n\t\t\t\t\tdoneN ? float( iterationsUsedN ) / float( NUM_SAMPLES - 1 ) : 1.,\n\t\t\t\t\tdoneP ? float( iterationsUsedP ) / float( NUM_SAMPLES - 1 ) : 1.\n\t\t\t);\n\n\t\t\t// hacky way of reduces blurriness of mostly diagonal edges\n\t\t\t// but reduces AA quality\n\t\t\tdist = pow(dist, .5);\n\n\t\t\tdist = 1. - dist;\n\n\t\t\treturn mix(\n\t\t\t\t\trgbaM,\n\t\t\t\t\trgbaN,\n\t\t\t\t\tdist * .5\n\t\t\t);\n\t}\n\n\tvoid main() {\n\t\t\tconst float edgeDetectionQuality = .2;\n\t\t\tconst float invEdgeDetectionQuality = 1. / edgeDetectionQuality;\n\n\t\t\tgl_FragColor = FxaaPixelShader(\n\t\t\t\t\tvUv,\n\t\t\t\t\ttDiffuse,\n\t\t\t\t\tresolution,\n\t\t\t\t\tedgeDetectionQuality, // [0,1] contrast needed, otherwise early discard\n\t\t\t\t\tinvEdgeDetectionQuality\n\t\t\t);\n\n\t}\n\t"},Zn={uniforms:{tDiffuse:{value:null},offset:{value:1},darkness:{value:1}},vertexShader:"\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",fragmentShader:"\n\n\t\tuniform float offset;\n\t\tuniform float darkness;\n\n\t\tuniform sampler2D tDiffuse;\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\t// Eskil's vignette\n\n\t\t\tvec4 texel = texture2D( tDiffuse, vUv );\n\t\t\tvec2 uv = ( vUv - vec2( 0.5 ) ) * vec2( offset );\n\t\t\tgl_FragColor = vec4( mix( texel.rgb, vec3( 1.0 - darkness ), dot( uv, uv ) ), texel.a );\n\n\t\t}"};const Xn={radius:{type:"number",val:.6,shortKey:"r",onUpdate({type:e,data:t,runScene:r}){r.pp.setGlowData(e,t)}},strength:{type:"number",val:1.5,shortKey:"s",onUpdate({type:e,data:t,runScene:r}){r.pp.setGlowData(e,t)}},threshold:{type:"number",val:0,shortKey:"t",onUpdate({type:e,data:t,runScene:r}){r.pp.setGlowData(e,t)}}},Qn={edgeStrength:{type:"number",val:3,shortKey:"es",onUpdate({type:e,data:t,runScene:r}){r.pp.setOutlineData(e,t)}},edgeGlow:{type:"number",val:0,shortKey:"eg",onUpdate({type:e,data:t,runScene:r}){r.pp.setOutlineData(e,t)}},edgeThickness:{type:"number",val:1,shortKey:"et",onUpdate({type:e,data:t,runScene:r}){r.pp.setOutlineData(e,t)}},pulsePeriod:{type:"number",val:0,shortKey:"pp",onUpdate({type:e,data:t,runScene:r}){r.pp.setOutlineData(e,t)}},visibleEdgeColor:{type:"color_str",val:"#FFFFFF",shortKey:"vec",onUpdate({type:e,data:t,runScene:r}){r.pp.setOutlineData(e,t)}},hiddenEdgeColor:{type:"color_str",val:"#190A05",shortKey:"hec",onUpdate({type:e,data:t,runScene:r}){r.pp.setOutlineData(e,t)}}},Yn={directionOffset:{type:"number",val:0,shortKey:"do",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},stepOffset:{type:"number",val:0,shortKey:"so",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},rotationJitter:{type:"other",val:"NONE",shortKey:"roj",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},radiusJitter:{type:"other",val:"NONE",shortKey:"raj",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},numSteps:{type:"number",val:8,shortKey:"ns",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},numDirections:{type:"number",val:1,shortKey:"nd",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},intensity:{type:"number",val:1,shortKey:"i",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},radius:{type:"number",val:2,shortKey:"r",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},enableFalloff:{type:"other",val:!0,shortKey:"ef",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},falloffStart:{type:"number",val:.4,shortKey:"fs",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},falloffEnd:{type:"number",val:2,shortKey:"fe",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},renderTargetScale:{type:"number",val:.5,shortKey:"rts",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},blurMode:{type:"other",val:"NO_BLUR",shortKey:"bm",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},blurIterations:{type:"number",val:5,shortKey:"bi",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},blurStride:{type:"number",val:1,shortKey:"bs",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},ambientColor:{type:"color_str",val:"#FFFFFF",shortKey:"ac",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},ambientIntensity:{type:"number",val:0,shortKey:"ai",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},lightBounceIntensity:{type:"number",val:0,shortKey:"lbi",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}}};var Jn=r(1398);class $n{constructor(e){this.params=this.getDefaultParams(),this.clean=()=>{this.resetParams(),this.reset()},this.ENTIRE_SCENE=0,this.BLOOM_SCENE=1,this.BLACK_COLOR=new da.Color(0),this.runScene=e,this.info=new en(this.runScene),this.isSafari=-1<navigator.userAgent.indexOf("Safari"),this.isChrome=-1<navigator.userAgent.indexOf("Chrome"),this.rtSize=new da.Vector2,this.sceneFogColor=null,this.sceneBackground=null,this.isUpdate=!0,this.runScene.exporter.gltf.options.addOption({type:"post-processing",process:e=>this.toJSON(),parse:e=>{e=JSON.parse(e),this.fromJSON(e)}}),this.runScene.cb.clean.add("pp",this.clean),this.runScene.cb.setScene.add("post-processing",(({type:e,val:t})=>{"fog"===e&&t&&t.show&&(this.sceneFogColor?this.sceneFogColor.copy(t.color):this.sceneFogColor=new da.Color(t.color)),"background"===e&&(this.sceneBackground&&(0,et.isTexture)(this.sceneBackground)&&this.sceneBackground.dispose(),this.sceneBackground=t,this.isChrome&&this.mtuGlow?this.mtuGlow.setSceneBg():this.isSafari)})),this.runScene.snapshot.bind({name:"glow",target:this.params.glow,def:Xn}),this.runScene.snapshot.bind({name:"outline",target:this.params.outline,def:Qn}),this.runScene.snapshot.bind({name:"ao",target:this.params.ao,def:Yn,set:e=>{const t=e.snapshot.data.get("ao");t&&(Jn.LV.set({def:Yn,runScene:this.runScene,data:t,target:this.params.ao,map:e}),e.data.completedCbs.push((()=>{(0,i.mapObj)(Yn,((e,r)=>{var{type:r,val:n,shortKey:a}=r;"other"===r&&this.setAOData(e,void 0!==t[a]?t[a]:n)}))})))}})}getDefaultParams(){return{pp:{samples:2},glow:{isBloom:!1,radius:.6,strength:1.5,threshold:0},outline:{isOutline:!1,edgeStrength:3,edgeGlow:0,edgeThickness:1,pulsePeriod:0,visibleEdgeColor:"#FFFFFF",hiddenEdgeColor:"#190A05"},ao:{isAO:!1,directionOffset:0,stepOffset:0,rotationJitter:"NONE",radiusJitter:"NONE",numSteps:8,numDirections:1,intensity:1,radius:2,enableFalloff:!0,falloffStart:.4,falloffEnd:2,renderTargetScale:.5,blurMode:"NO_BLUR",blurIterations:5,blurStride:1,ambientColor:"#FFFFFF",ambientIntensity:0,lightBounceIntensity:0},vignette:{isVignette:!1,offset:1,darkness:1}}}resetParams(){(0,E.U)(this.params,this.getDefaultParams())}init(){try{var{camera:e,scene:t,renderer:r}=this.runScene.assetsEx.get();this.mainScene=t,this.mainCamera=e,this.renderer=r,this.renderer&&(this.renderer.getSize(this.rtSize),this.postProcessing())}catch(e){console.log("Error: ",e)}this.runScene.cb.loaderer.gltf.loadNode.add("outline-objects",(({node:e,nodeDef:t})=>{t.extras&&t.extras.outline&&this.mtOutline.addSelectedObject(e)}))}postProcessing(){this.effectComposer=new Tn(this.renderer,this.getNewRenderTarget(this.params.pp.samples)),this.renderPass=new Kn(this.mainScene,this.mainCamera),this.fxaaPass=new rn.T(qn),this.fxaaPass.uniforms.resolution.value.set(1/window.innerWidth,1/window.innerHeight),this.vignettePass=new rn.T(Zn),this.effectComposer.addPass(this.renderPass),this.ppOutline(),this.ppGlow(),this.ppAO(),this.effectComposer.addPass(this.vignettePass)}getNewRenderTarget(e){const t=new da.WebGLRenderTarget(this.rtSize.x,this.rtSize.y,{samples:e});return t.depthTexture=new da.DepthTexture(this.rtSize.x,this.rtSize.y),t.depthTexture.type=da.UnsignedIntType,t.depthTexture.format=da.DepthFormat,t.texture.format=da.RGBAFormat,t.texture.encoding=da.sRGBEncoding,t}ppOutline(){this.mtOutline=new kn.Q(this)}ppGlow(){this.isChrome?(this.effectComposer.renderToScreen=!0,this.mtuGlow=new pn(this)):this.isSafari&&(this.effectComposer.renderToScreen=!1,this.threeGlow=new Dn(this))}ppAO(){this.mtAO=new Vn(this)}toJSON(){const e={};var{pp:t,glow:r,outline:n,ao:a,vignette:i}=this.params;return e.ppParams=Object.assign({},t),e.bloomParams=Object.assign({},r),e.outlineParams=Object.assign({},n),e.aoParams=Object.assign({},a),e.vignetteParams=Object.assign({},i),JSON.stringify(e)}fromJSON(e){var{ppParams:e,bloomParams:t,outlineParams:r,aoParams:n,vignetteParams:a}=e;e&&(e=e.samples,this.params.pp.samples=e,this.effectComposer&&this.effectComposer.reset(this.getNewRenderTarget(this.params.pp.samples))),t&&(this.params.glow.isBloom=t.isBloom,this.setGlowData("radius",t.radius),this.setGlowData("strength",t.strength),this.setGlowData("threshold",t.threshold),this.runScene.cb.pp.glow.setData.cb(this.params.glow)),r&&this.mtOutline&&(this.params.outline.isOutline=r.isOutline,this.setOutlineData("edgeStrength",r.edgeStrength),this.setOutlineData("edgeGlow",r.edgeGlow),this.setOutlineData("edgeThickness",r.edgeThickness),this.setOutlineData("pulsePeriod",r.pulsePeriod),this.setOutlineData("visibleEdgeColor",r.visibleEdgeColor),this.setOutlineData("hiddenEdgeColor",r.hiddenEdgeColor),this.runScene.cb.pp.outline.setData.cb(this.params.outline)),n&&this.mtAO&&(this.params.ao.isAO=n.isAO,this.setAOData("directionOffset",n.directionOffset),this.setAOData("stepOffset",n.stepOffset),this.setAOData("rotationJitter",n.rotationJitter),this.setAOData("radiusJitter",n.radiusJitter),this.setAOData("numSteps",n.numSteps),this.setAOData("numDirections",n.numDirections),this.setAOData("intensity",n.intensity),this.setAOData("radius",n.radius),this.setAOData("enableFalloff",n.enableFalloff),this.setAOData("falloffStart",n.falloffStart),this.setAOData("falloffEnd",n.falloffEnd),this.setAOData("renderTargetScale",n.renderTargetScale),this.setAOData("blurMode",n.blurMode),this.setAOData("blurIterations",n.blurIterations),this.setAOData("blurStride",n.blurStride),this.setAOData("ambientColor",n.ambientColor),this.setAOData("ambientIntensity",n.ambientIntensity),this.setAOData("lightBounceIntensity",n.lightBounceIntensity),this.runScene.cb.pp.ao.setData.cb(this.params.ao)),a&&this.vignettePass&&(this.params.vignette.isVignette=a.isVignette,this.setVignetteData("offset",a.offset),this.setVignetteData("darkness",a.darkness),this.runScene.cb.pp.vignette.setData.cb(this.params.vignette))}setUpdate(e){this.isUpdate=e}clearAllOutlineObj(){this.mtOutline.clearAllOutlineObj()}update(){var e;this.isUpdate&&this.mainScene&&this.mainCamera&&this.renderer&&!0!==(null==(e=L(this.runScene).renderConfig)?void 0:e.stop)&&(this.params.glow.isBloom||this.params.outline.isOutline||this.params.ao.isAO||this.params.vignette.isVignette?(this.vignettePass.enabled=this.params.vignette.isVignette,this.mtAO&&this.mtAO.enablePass(this.params.ao.isAO),this.mtOutline&&this.mtOutline.enablePass(this.params.outline.isOutline),this.isChrome&&this.mtuGlow?(this.mtuGlow.enablePass(this.params.glow.isBloom),this.effectComposer.render()):this.isSafari&&this.threeGlow&&(this.threeGlow.enablePass(this.params.glow.isBloom),this.threeGlow.render())):this.renderer.render(this.mainScene,this.mainCamera))}setSize(e,t){this.rtSize.x=e,this.rtSize.y=t,this.effectComposer&&this.effectComposer.setSize(e,t),this.isChrome&&this.mtuGlow||this.isSafari&&this.threeGlow&&this.threeGlow.setSize(e,t)}reset(){this.runScene.pp.dispose(),this.runScene.pp.init()}dispose(){this.isChrome&&this.mtuGlow?this.mtuGlow.dispose():this.isSafari&&this.threeGlow&&this.threeGlow.dispose(),this.mtOutline&&this.mtOutline.dispose(),this.renderPass=null,this.effectComposer&&(this.effectComposer.renderTarget1&&(this.effectComposer.renderTarget1.dispose(),this.effectComposer.renderTarget1=null),this.effectComposer.renderTarget2&&(this.effectComposer.renderTarget2.dispose(),this.effectComposer.renderTarget2=null),this.effectComposer=null)}setPPData(e,t){this.params.pp[e]=t,"samples"===e&&this.effectComposer&&this.effectComposer.reset(this.getNewRenderTarget(this.params.pp.samples))}setGlowData(e,t){this.params.glow[e]=t,this.isChrome&&this.mtuGlow?this.mtuGlow.setGlowData(e,t):this.isSafari&&this.threeGlow&&this.threeGlow.setGlowData(e,t)}setOutlineData(e,t){this.params.outline[e]=t,this.mtOutline&&this.mtOutline.setOutlineData(e,t)}addOutlineObj(e,t=!0){this.mtOutline.addSelectedObject(e,t)}setAOData(e,t){this.params.ao[e]=t,this.mtAO&&this.mtAO.setAOData(e,t)}setVignetteData(e,t){this.params.vignette[e]=t,this.vignettePass&&(this.vignettePass.uniforms[e].value=t)}}var ea=r(7738);class ta extends o{constructor(e){super(e),this.map=new M.Z,this.playLimit=new E.cM,this.renderName="script-texture-render",this._clock=new s.Clock,this.bindEvent()}parse(e,t){var r=(0,O.Ki)(t);0===Object.keys(e||{}).length?this.map.has(r)&&this.map.delete(r):this.map.set(r,{texture:t,uvScript:e})}bindEvent(){this.runScene.cb.texture.setAnima.add("script-texture-set-anima",(({uvScript:e,texture:t})=>this.parse(e,t))),this.runScene.cb.texture.add.add("script-texture-add-texture",(e=>{var t=e.userData.uvScript;t&&this.parse(t,e)}))}_playAll(){this.map.forEach((e=>{const{texture:t,uvScript:r}=e;var{moveX:e,moveY:n,rotate:a}=r;t.userData.scriptTextre||(t.userData.scriptTextre={offsetX:t.offset.x,offsetY:t.offset.y,rotation:t.rotation}),e&&(t.offset.x+=e),n&&(t.offset.y+=n),a&&(t.rotation+=a)}))}playAll(){const{scriptFrame:e,mode:t}=this.runScene.optionsEx.options.renderConfig;-1===e&&"tick"===t?this.runScene.cb.render.add(this.renderName,(()=>{this._playAll()})):this.runScene.cb.render.add(this.renderName,(()=>{this.playLimit.update({cb:()=>{this._playAll()},cbRate:1/e,now:this._clock.getDelta()})}))}closeAll(){this.map.forEach((e=>{const t=e.texture;let r=0,n=0,a=0;t.userData.scriptTextre&&(r=(e=t.userData.scriptTextre).offsetX,n=e.offsetY,a=e.rotation,delete t.userData.scriptTextre),t.offset.x=r,t.offset.y=n,t.rotation=a})),this.runScene.cb.render.delete(this.renderName)}has(e){return void 0!==e.userData.uvScript}get(e){return e.userData.uvScript}set(e,t){t.userData.uvScript=e}}class ra{constructor(e){this.map=new M.Z,this.parse=e=>{const t=e.model;this.getState(t)?this.map.set((0,O.Ki)(t),{model:t,oldRotate:t.rotation.toArray()}):(this.close(t),this.map.delete((0,O.Ki)(t)))},this.render=()=>{var e=this.runScene.assetsEx.get().camera;const{x:t,y:r,z:n}=e.position;this.map.map(((e,{model:a})=>{a.lookAt(t,r,n)}))},this.runScene=e,this.bindEvent()}bindEvent(){this.runScene.cb.unique.model.add.add("script-lookat",this.parse),this.runScene.cb.render.add("script-lookat",this.render),this.runScene.cb.exporter.gltf.before.add("script-lookAt",(()=>{this.closeAll()}))}setState(e,t){t?(0,nt.M)(e,"lookAt",!0):delete e.userData.lookAt,this.parse({model:e})}getState(e){return!0===(0,nt.is)(e,"lookAt")}close(e){var t=this.map.get((0,O.Ki)(e));t&&e.rotation.fromArray(t.oldRotate)}closeAll(){this.map.map(((e,{model:t,oldRotate:r})=>{t.rotation.fromArray(r)}))}}class na{constructor(e){this.map=new M.Z,this.dataMap=new M.Z,this.parseModel=e=>{var t=(0,O.Ki)(e);if(t){const r=this.awaitMap.get(t);r&&(r.map((t=>{let r=this.dataMap.get(t);r&&r.models.push({model:e})})),this.awaitMap.delete(t))}},this.loadedComplete=()=>{this.parseModel(this.runScene.assetsEx.camera)},this.clean=()=>{this.map.clear(),this.awaitMap.clear(),this.dataMap.clear()},this.awaitMap=new M.Z,this.parseJSON=e=>{(0,i.mapObj)(e,((e,t)=>{t.locals=t.locals.map((e=>new s.Vector3(e.x,e.y,e.z)));const r=t.modelIds;t.modelIds=new k.Z,this.map.set(e,t),r.map((e=>{t.modelIds.add(e);let r=this.awaitMap.get(e);var n;r||(n=new k.Z,this.awaitMap.set(e,n),r=n),r.add(t.id)})),this.addDataByMap(t)}))},this.render=()=>{this.dataMap.map(((e,t)=>{const{models:r,curve:n,speed:a,delayed:i,progress:s,loop:o,run:l}=t;if(l&&i){if(1<=s)return o?(t.delayed=!1,void this.onPlayBefore(t)):void this.close(e);r.map((e=>{const{model:r,oldPostion:i}=e;var s;e=t.progress<1?n.getPointAt(t.progress):i,r.position.copy(e),e=t.progress+a<1?n.getPointAt(t.progress+a):i,(0,b.N)(r)?(s=this.runScene.modelEx.select,r.lookAt(s?(0,Vr.VU)(s,this.runScene.assetsEx.scene):this.runScene.assetsEx.controls.target)):r.lookAt(e)})),t.progress+=a}}))},this.runScene=e,this.bindEvent()}bindEvent(){this.runScene.cb.unique.model.add.add("script-lineAnima",(({model:e})=>{this.parseModel(e)})),this.runScene.cb.render.add("script-lookat",this.render),this.runScene.cb.exporter.gltf.before.add("script-lookat",(()=>{this.closeAll()})),this.runScene.cb.clean.add("script-lookat",this.clean),this.runScene.cb.loaderer.gltf.complete.add("script-lookat",this.loadedComplete),this.runScene.cb.load.complete.add("script-lookat",this.loadedComplete)}addDataByMap(e){e.loadTrigger&&this.dataMap.set(e.id,this.getData(e))}add(e){this.map.set(e.id,e),this.addDataByMap(e)}toJSON(){return this.map}getData(e){return{models:[],curve:(0,Vr.kG)(e.locals,{closed:e.closed}).curve,run:!1,timer:void 0,delay:e.delay,delayed:!1,speed:e.speed,loop:e.loop,progress:0}}getOldLocal(e){return{oldPostion:e.position.clone(),oldRotation:e.rotation.clone()}}del(e){this.map.delete(e)}set(e,t){const r=this.dataMap.get(e);var n,a,i,s,o;r&&(n=this.map.get(e),({speed:a,loop:i,delay:s,closed:o}=t),this.map.set(e,t),r.speed=a,r.loop=i,r.delay=s,o!==n.closed&&(r.curve=(0,Vr.kG)(t.locals,{closed:o}).curve))}use(e,t){const r=this.map.get(e);if(r&&r.modelIds.size!==(r.modelIds.add((0,O.Ki)(t)),r.modelIds.size)){const r=this.dataMap.get(e);r&&r.models.push(Object.assign({model:t},this.getOldLocal(t)))}}unUse(e,t){const r=(0,O.Ki)(t);if(r){e.modelIds.delete(r);const n=this.dataMap.get(e.id);!n||-1!==(t=n.models.findIndex((e=>(0,O.Ki)(e.model)===r)))&&n.models.splice(t,1)}}playAll(){this.dataMap.map(((e,t)=>{this.playByData(t)}))}playByData(e){e.run=!0,e.progress=0,e.models.map((e=>{var t=e.model,{oldPostion:t,oldRotation:r}=this.getOldLocal(t);e.oldPostion=t,e.oldRotation=r})),this.onPlayBefore(e)}play(e){!this.map.get(e)||(e=this.dataMap.get(e))&&this.playByData(e)}onPlayBefore(e){var{delayed:t,delay:r}=e;t||(e.timer&&clearTimeout(e.timer),e.timer=setTimeout((()=>{e.progress=0,e.delayed=!0}),1e3*r))}closeByData(e){const t=e.models;e.run&&(e.progress=0,e.run=!1,t.map((e=>{const{model:t,oldPostion:r,oldRotation:n}=e;void 0!==r&&t.position.copy(r),void 0!==n&&t.rotation.copy(n)})))}close(e){(e=this.dataMap.get(e))&&this.closeByData(e)}closeAll(){this.dataMap.map((e=>{this.close(e)}))}getLocalsByModels(e){const[t]=e;var r;return"Line"===t.type?(t.matrixWorldNeedsUpdate=!0,r=t.geometry.attributes.position.applyMatrix4(t.matrixWorld),(0,Vr.F)(r.array)):e.map((e=>(0,Vr.VU)(e,this.runScene.assetsEx.scene)))}}class aa{constructor(e){this.map=new M.Z,this.allAnima=[],this.runScene=e}play(e,t){var r;0!==e.children.length&&(r=(0,O.Ki)(e))&&(this.map.set(r,{model:e}),this.bindChildMap(e),this.render(e,t))}bindChildMap(e){if(0!==e.children.length){var t=(0,O.Ki)(e);const r=this.map.get(t),n=(r.yMap={},new M.Z);r.childMap=n,e.children.map((e=>{var t,a=(0,O.Ki)(e);a&&(t=e.position.y,r.yMap||(r.yMap={}),r.yMap[t]||(r.yMap[t]=[]),r.yMap[t].push(e),n.set(a,{child:e,oldPosition:e.position.clone()}))}))}}render(e,t){e=(0,O.Ki)(e);const r=this.map.get(e),{size:n,time:a}=t;Object.keys(r.yMap).sort(((e,t)=>Number.parseInt(e)-Number.parseInt(t))).map(((e,t)=>{r.yMap[e].map((e=>{var{x:i,y:s,z:o}=(0,Vr.VU)(e,this.runScene.assetsEx.scene),l=0<i?1:-1,c=0<o?1:-1,i=(l=Math.random()*n*l,c=Math.random()*n*c,e.position.set(i+l,s,o+c),{x:e.position.x,y:e.position.y,z:e.position.z}),s={x:(l=r.childMap.get((0,O.Ki)(e)).oldPosition).x,y:l.y,z:l.z},o=(0,E.gY)(i,Object.assign(Object.assign({},s),{delay:t*a,onStart:()=>{e.visible=!0}}),2,(t=>{var{x:t,y:r,z:n}=t;e.position.set(t,r,n)}));this.allAnima.push(o)}))}))}}class ia extends o{constructor(e){super(e),this.runAll=!1,this.inited=()=>{this.runScene.cb.exporter.gltf.before.add("script",(()=>{this.closeAll()})),this.runScene.exporter.gltf.options.addOption({type:"script",parse:e=>{e&&(e=JSON.parse(e).lineAnima,this.lineAnima.parseJSON(e))},process:()=>JSON.stringify({lineAnima:this.lineAnima.toJSON()})})},this.texture=new ta(e),this.lookAt=new ra(e),this.lineAnima=new na(e),this.boom=new aa(e),e.cb.inited.add("texture",this.inited)}playAll(){this.runAll||(this.runAll=!0,this.texture.playAll(),this.lineAnima.playAll())}closeAll(){this.runAll&&(this.runAll=!1,this.texture.closeAll(),this.lineAnima.closeAll())}}class sa{constructor(e){this.map=new M.Z,this.clean=()=>{this.clear()},this.runScene=e,this.runScene.cb.clean.add("Tags",this.clean),this.runScene.cb.model.remove.add("Tags",(({model:e})=>{const t=(0,O.Ki)(e);t&&this.map.map(((e,r)=>{r.delete(t)}))}))}get(e){return this.map.get(e)}add(e){this.get(e)||this.map.set(e,new k.Z)}rename(e,t){const r=this.get(e);r&&(this.addId(t,r.toArray()),this.remove(e))}addId(e,t){this.map.has(e)||this.add(e),this.map.get(e).add(t)}addModel(e,t){if(this.map.has(e)||this.add(e),(0,E.lG)(t,"array"))return t.map((t=>{this.addModel(e,t)}));this.map.get(e).add((0,O.Ki)(t))}reflash(e){const t=this.map.get(e);if(t){let e=[];t.forEach((t=>{this.runScene.modelEx.getById(t)||e.push(t)})),e.map((e=>t.remove(e)))}}removeModel(e,t){if(this.map.has(e))return(0,E.lG)(t,"array")?t.map((t=>{this.removeModel(e,t)})):void this.map.get(e).remove((0,O.Ki)(t))}remove(e){this.map.delete(e)}clear(){this.map.clear(),this.runScene.cb.tags.clear.cb()}toJSON(){const e={};return this.map.map(((t,r)=>{e[t]=[...r.filter((e=>this.runScene.modelEx.getById(e)))]})),e}parseJSON(e){let t={};(0,i.mapObj)(e,((e,r)=>{t[e]=new k.Z(r)})),this.map=M.Z.formJSON(t),this.runScene.cb.tags.parseJSON.cb(e)}}class oa{constructor(e,t){this.showTransform=!1,this.data={},this.uuid="",this.usedIds=new k.Z,this.getAnimaByModelData=(()=>{const e=(e,t,r,n)=>{const a={},s={};if(e=oa.isNotNow(e)?this.getAllData():e,(0,i.mapObj)(n,((r,n)=>{void 0!==e[r]&&("number"===(n=n.type)?(a[r]=t[r],s[r]=e[r]):"color"===n&&(0,i.mapObj)(e[r],((e,n)=>{var i=r+e;a[i]=t[r][e],s[i]=n})))})),!(0,i.emptyObj)(a))return{begin:a,end:s}};return(t,r,n,a=!1,s)=>{let o=a?n.time:0;const l=Object.keys(t).sort(((e,t)=>a?Number(t)-Number(e):Number(e)-Number(t)));return l.map((l=>{var c=t[String(l)];l=.001*((l=a?o-l:l-o)<=0?.001:l)*n.speed;{var h=r,d=c,p=l,f=s;const t={color(e){const{animaData:t,defType:r}=e,n={};return(0,i.mapObj)(t,(e=>{var a;-1!==e.indexOf(r)&&r.includes(r)&&(a=e.substring(r.length),n[a]=t[e])})),n}};return()=>{let r;return{promise:new Promise((n=>{var a;if(!(a=e(d,h,0,f)))return n(0);var{begin:a,end:s}=a;return r=(0,u.anima)(a,s,p,(e=>{(0,i.mapObj)(f,((r,n)=>{n=n.type;var a,i=e[r];"number"===n?h[r]=i:"color"===n&&(i=t.color({animaData:e,defType:r}))&&(({r:n,g:i,b:a}=i),h[r].setRGB(n,i,a))}))}),n)})),anima:r}}}}))}})(),this.runScene=t,this.target=e,this.target.userData.isTimeLineUsed=!0,this.uuid=this.getId(e)}toJSON(){var{data:e,type:t,copyId:r}=this;return r?{copyId:r,type:t}:{data:e,type:t}}addData(e,t,r=!1){return 1e3<Number(e)&&(e="1000.00"),r?this.data[e]=this.getAllData():(this.data[e]||(this.data[e]={}),this.data[e][t]=this.getData(t)),this.data[e]}addTriggerNowData(e){return this.data[e]=this.getAllData(!0)}removeData(e){delete this.data[e]}static isNotNow(e){return"notNow"===Object.values(e)[0]}static getAllDefValByType(e,t,r=!1){const n={};return(0,i.mapObj)(e,(a=>{n[a]=r?"notNow":oa.getValByType(t,a,e)})),n}static getValByType(e,t,r){var n,a;return r=r[t].type,e=e[t],"number"===r?e:"color"===r?(({r:t,g:n,b:a}=e),{r:t,g:n,b:a}):"V3"===r?(0,u.v3ToMap)(e):""}static SetTargetByData(e){const{baseType:t,data:r,defType:n,target:a}=e;var i,s;"number"===t?a[n]=r:"color"===t&&(({r:e,g:i,b:s}=r),a[n].setRGB(e,i,s))}getAllData(e=!1){return oa.getAllDefValByType(this.defOptions,this.target,e)}getData(e){return oa.getValByType(this.target,e,this.defOptions)}static getTarget(e,t){}getAnima(e,t){return this.getAnimaByModelData(this.data,this.target,e,t,this.defOptions)}setTargetByBetween(e,t,r){oa.setTargetByBetween(e,t,r,this.defOptions,this.target)}clone(e){var{data:t,type:r}=this;const n=new(0,ua[r])(e);return n.data=t,n}reset(){(0,i.mapObj)(this.defOptions,((e,t)=>{oa.SetTargetByData({baseType:t.type,data:oa.getValByType(this.beginData,e,this.defOptions),target:this.target,defType:e})}))}remove(){if(0!==this.usedIds.size){let e;this.usedIds.map((t=>{const r=this.runScene.timeLineEx.getInsByUuid(t);r&&(e?(r.copyId=e.uuid,e.usedIds.add(r.uuid)):delete(e=r).copyId)}))}delete this.target.userData.isTimeLineUsed}}oa.setTargetByBetween=(()=>{const e=(e,t,r)=>e!==t?(t-e)*r+e:e;return(t,r,n,a,s)=>{(0,i.mapObj)(a,((a,i)=>{var o,l,c,u,h,d;i=i.type,void 0!==t[a]&&void 0!==r[a]&&oa.SetTargetByData({baseType:i,data:(o=t[a],l=r[a],c=n,"number"===i?e(o,l,c):"color"===i?(({r:i,g:o,b:u}=o),({r:l,g:h,b:d}=l),{r:e(i,l,c),g:e(o,h,c),b:e(u,d,c)}):void 0),defType:a,target:s})}))}})();const la=oa;class ca extends o{constructor(){super(...arguments),this.mount=e=>{e.core.module.set("timeline",this)},this.after=e=>{var t,{json:e,config:r}=e;"scene"===(null==(t=null==(t=e.asset)?void 0:t.ex)?void 0:t.type)&&r.module.timeline&&this.runScene.timeLineEx.parseSavedGroupMap((null==(t=e.asset.ex)?void 0:t.timeLine)||{})}}init(){var e={name:"timeline",loadCallBacks:new M.Z({afterParse:this.after,mountModule:this.mount}),exportCallBacks:new M.Z};this.runScene.exporter.gltf.module.bind(e)}}const ua={model:class extends la{constructor(e,t){super(e,t),this.type="model",this.defOptions={position:{type:"V3"},scale:{type:"V3"},rotation:{type:"V3"}},this.setTargetByBetween=(()=>{const e=(e,t,r)=>{var{x:e,y:n,z:a}=e,{x:t,y:i,z:s}=t;return{x:e!==t?(t-e)*r+e:e,y:n!==i?(i-n)*r+n:n,z:a!==s?(s-a)*r+a:a}};return(t,r,n)=>{var a,{position:t,scale:i,rotation:s}=t,{position:r,scale:o,rotation:l}=r;t&&r&&(({x:t,y:r,z:a}=e(t,r,n)),this.target.position.set(t,r,a)),i&&o&&(({x:t,y:r,z:a}=e(i,o,n)),this.target.scale.set(t,r,a)),s&&l&&(({x:i,y:o,z:t}=e(s,l,n)),this.target.rotation.set(i,o,t))}})(),this.getAnimaByModelData=(()=>{const e=(e,t,r)=>{var{position:t,scale:n,rotation:a}=t,{position:e,scale:i,rotation:s}=la.isNotNow(e)?this.getAllData():e;return{begin:Object.assign({},e?{px:t.x,py:t.y,pz:t.z}:{},i?{sx:n.x,sy:n.y,sz:n.z}:{},s?{rx:a.x,ry:a.y,rz:a.z}:{}),end:Object.assign({},r.curve?{ease:"none"}:{},e?{px:e.x,py:e.y,pz:e.z}:{},i?{sx:i.x,sy:i.y,sz:i.z}:{},s?{rx:s.x,ry:s.y,rz:s.z}:{})}};return(t,r,n,a=!1)=>{let i=a?n.time:0;const s=Object.keys(t).sort(((e,t)=>a?Number(t)-Number(e):Number(e)-Number(t)));return s.map((s=>{var o,l,c,h,d=t[String(s)],p=.001*((p=a?i-s:s-i)<=0?.001:p)*n.speed;return i=s,o=r,l=d,c=p,h=n,()=>{let t;return{promise:new Promise((r=>{var{begin:n,end:a}=e(l,o,h);return t=(0,u.anima)(n,a,c,(e=>{var{px:e,py:t,pz:r,sx:n,sy:a,sz:i,rx:s,ry:c,rz:u}=e;l.position&&o.position.set(e,t,r),l.scale&&o.scale.set(n,a,i),l.rotation&&o.rotation.set(s,c,u)}),r)})),anima:t}}}))}})(),this.beginData=this.getAllData()}static getTarget(e,t){return t.uniqueEx.model.get(e)}isRemoved(){return!(this.target&&this.target.parent)}getAnima(e,t=!1){return this.getAnimaByModelData(this.data,this.target,e,t)}getId(){return this.runScene.uniqueEx.getId(this.target)}reset(){var{position:e,scale:t,rotation:r}=this.beginData;this.target.position.set(e.x,e.y,e.z),this.target.scale.set(t.x,t.y,t.z),this.target.rotation.set(r.x,r.y,r.z)}},camera:class extends la{constructor(e,t){super(e,t),this.type="camera",this.defOptions={position:{type:"V3"},scale:{type:"V3"},rotation:{type:"V3"},target:{type:"V3"}},this.setTargetByBetween=(()=>{const e=(e,t,r)=>{var{x:e,y:n,z:a}=e,{x:t,y:i,z:s}=t;return{x:e!==t?(t-e)*r+e:e,y:n!==i?(i-n)*r+n:n,z:a!==s?(s-a)*r+a:a}};return(t,r,n)=>{var a,{position:t,scale:i,rotation:s,target:o}=t,{position:r,scale:l,rotation:c,target:u}=r;t&&r&&(({x:t,y:r,z:a}=e(t,r,n)),this.target.position.set(t,r,a)),i&&l&&(({x:t,y:r,z:a}=e(i,l,n)),this.target.scale.set(t,r,a)),s&&c&&(({x:i,y:l,z:t}=e(s,c,n)),this.target.rotation.set(i,l,t)),o&&u&&(({x:r,y:a,z:s}=e(o,u,n)),this.controls.target.set(r,a,s))}})(),this.getAnimaByModelData=(()=>{const e=(e,t,r)=>{var{position:t,scale:n,rotation:a}=t,{position:e,scale:i,rotation:s,target:o}=la.isNotNow(e)?this.getAllData():e;return{begin:Object.assign({},e?{px:t.x,py:t.y,pz:t.z}:{},i?{sx:n.x,sy:n.y,sz:n.z}:{},s?{rx:a.x,ry:a.y,rz:a.z}:{},o?{tx:this.controls.target.x,ty:this.controls.target.y,tz:this.controls.target.z}:{}),end:Object.assign({},r.curve?{ease:"none"}:{},e?{px:e.x,py:e.y,pz:e.z}:{},i?{sx:i.x,sy:i.y,sz:i.z}:{},s?{rx:s.x,ry:s.y,rz:s.z}:{},o?{tx:o.x,ty:o.y,tz:o.z}:{})}},t=(t,r,n,a)=>()=>{let i;return{promise:new Promise((s=>{var{begin:o,end:l}=e(r,t,a);return i=(0,u.anima)(o,l,n,(e=>{var{px:e,py:n,pz:a,sx:i,sy:s,sz:o,rx:l,ry:c,rz:u,tx:h,ty:d,tz:p}=e;r.position&&t.position.set(e,n,a),r.scale&&t.scale.set(i,s,o),r.rotation&&t.rotation.set(l,c,u),r.target&&this.controls.target.set(h,d,p)}),s)})),anima:u.anima}};return(e,r,n,a=!1)=>{let s=a?n.time:0;const o=Object.keys(e).sort(((e,t)=>a?Number(t)-Number(e):Number(e)-Number(t)));var l=(0,i.lastArrayEle)(o),c=a?"0.00":String(n.time);return l!==c&&(e[c]=Object.assign({},l),o.push(c)),o.map((i=>{var o=e[String(i)],l=.001*((l=a?s-i:i-s)<=0?.001:l)*n.speed;return s=i,t(r,o,l,n)}))}})(),this.controls=this.runScene.assetsEx.get().controls,this.beginData=this.getAllData()}static getTarget(e,t){return t.uniqueEx.model.get(e)}getBeginData(e){return this.getAllData()}isRemoved(){return!this.target}getAllData(e=!1){var{position:t,scale:r,rotation:n}=this.target;return{position:e?"notNow":(0,u.v3ToMap)(t),scale:e?"notNow":(0,u.v3ToMap)(r),rotation:e?"notNow":(0,u.v3ToMap)(n),target:e?"notNow":(0,u.v3ToMap)(this.controls.target)}}getData(e){var{position:t,scale:r,rotation:n}=this.target;let a;if("position"===e)a=(0,u.v3ToMap)(t);else if("scale"===e)a=(0,u.v3ToMap)(r);else if("rotation"===e)a=(0,u.v3ToMap)(n);else{if("target"!==e)throw TypeError("输入值不存在");a=(0,u.v3ToMap)(this.controls.target)}return a}getAnima(e,t=!1){return this.getAnimaByModelData(this.data,this.target,e,t)}getId(){return this.runScene.uniqueEx.getId(this.target)}reset(){var{position:e,scale:t,rotation:r,target:n}=this.beginData;this.target.position.set(e.x,e.y,e.z),this.target.scale.set(t.x,t.y,t.z),this.target.rotation.set(r.x,r.y,r.z),this.controls.target.set(n.x,n.y,n.z)}},material:class extends la{constructor(e,t){super(e,t),this.type="material",this.defOptions={roughness:{type:"number"},metalness:{type:"number"},opacity:{type:"number"},emissive:{type:"color"},color:{type:"color"}},this.beginData=this.getAllData()}static getTarget(e,t){return t.uniqueEx.material.get(e)}isRemoved(){return!0}getId(){return this.runScene.uniqueEx.getId(this.target)}}};class ha{constructor(){this.list={}}on(e,t){this.list[e]=t}emit(...e){if(void 0===this.list[e[0]])throw Error("请先挂载在使用---"+[e[0]]);return this.list[e[0]](...[...e].filter(((e,t)=>0!==t)))}off(e){this.list[e]&&delete this.list[e]}}const da=c.Z,pa=class{constructor(e){this._clock=new s.Clock,this.cb=new v,this.script=new ia(this),this.uniqueEx=new O.ZP(this),this.fileEx=new Lr(this),this.snapshot=new Jn.ZP(this),this.undoEx=new Xr.ZP(this),this.textureEx=new et.default(this),this.controlsEx=new S(this),this.assetsEx=new m(this),this.renderEx=new ea.ZP(this),this.events=new class{constructor(e){this.key=new T(this),this.mouse=new D(this),this.model=new P(this),this.addEvent=e=>{const{dom:t,name:r,fn:n}=e,a=L(this.runScene).renderConfig;t.addEventListener(r,(e=>{a.triggerEvent&&n(e)}))},this.runScene=e}init(e){this.key.init(e),this.mouse.init(e),this.model.init(),this.addEvent({dom:window,name:"resize",fn:()=>{this.runScene.cb.resize.cb(this.runScene.renderEx.getDomSize())}})}}(this),this.multipSelector=new Gr(this),this.helperEx=null,this.materialEx=new rt.default(this),this.cameraEx=new b.Z(this),this.sceneEx=new nt.ZP(this),this.modelEx=new h.default(this),this.loaderer=new l.Z(this),this.exporter=new dt(this),this.lightEx=new Br.ZP(this),this.timeLineEx=new class{constructor(e){this.timerMap={},this.idMap=new M.Z,this.animaMap={},this.groupMap={},this.clean=()=>{this.reset()},this.setModelLocal=(e,t)=>{Object.values(e.data).map((e=>{var r,n,a=((e,t)=>{let r=-1,n=1e3;const a=Object.keys(e).sort(((e,t)=>Number(e)-Number(t)));if(1!==a.length&&(a.map(((e,a)=>{e=Number(e),0<(e=t-e)&&e<n&&(n=e,r=a)})),-1!==r)){var i=a[r],s=a[r+1],o=e[i];if(e=e[s],o&&e){var l=Object.values(o)[0],c=Object.values(e)[0];if("notNow"!==l&&"notNow"!==c)return{left:o,right:e,progress:(t-Number(i))/(Number(s)-Number(i))}}}})(e.data,t);a&&(({left:a,right:r,progress:n}=a),e.setTargetByBetween(a,r,n))}))},this.runScene=e,this.runScene.cb.clean.add("TimeLine",this.clean),this.exportAndImport=new ca(e)}init(){this.exportAndImport.init()}reset(){this.timerMap={},this.animaMap={},this.groupMap={},this.runScene.cb.timeLine.reset.cb("")}pause(e){var t,r;if(this.groupMap[e]){this.timerMap[e]&&(({setProgressTime:t,awaitRuned:r}=this.timerMap[e]),t&&clearInterval(t),r&&clearInterval(r)),this.groupMap[e].run=!1;const n=this.animaMap[e];n&&n.length&&n.map((e=>{e.controls.run=!1}))}}resume(e){const t=this.groupMap[e];if(t){this.groupMap[e].run=!0;const r=this.animaMap[e];r&&r.length&&r.map((r=>{const{controls:n,promise:a}=r;n.run=!0,a.then((()=>{if(t.run)return t.run=!1,t.loop?this.playGroup(e):void 0}))}))}}closeGroup(e){var t,r;this.timerMap[e]&&(({setProgressTime:t,awaitRuned:r}=this.timerMap[e]),t&&clearInterval(t),r&&clearInterval(r)),this.groupMap[e].run=!1,this.runScene.cb.timeLine.closeGroup.cb(e);const n=this.animaMap[e];n&&n.length&&n.map((e=>{e.controls.clean=!0}))}resetGroup(e){var t=this.groupMap[e];t&&(this.closeGroup(e),this.runScene.cb.timeLine.setProgress.cb(0),Object.values(t.data).map((e=>e.reset())))}getSavedData(){return(0,i.mapObj)(this.groupMap,((e,t)=>{t.run=!1})),this.groupMap}parseSavedGroupMap(e){const t=[];Object.keys(e).map((r=>{const n=e[r],a={};(0,i.mapObj)(n.data,((e,r)=>{var{type:r,data:n,copyId:i}=r;const s=ua[r];if(r=s.getTarget(e,this.runScene)){const o=new s(r,this.runScene);o.data=n,a[e]=o,i&&t.push({ins:o,id:i}),this.idMap.set(e,o)}})),n.data=a,this.groupMap[r]=n,this.runScene.cb.timeLine.setGroupMap.cb({group:n,groupName:r})})),t.map((({ins:e,id:t})=>{const r=this.idMap.get(t);r&&(e.data=r.data,e.copyId=t,r.usedIds.add(e.uuid))}))}playGroup(e,t){const r=(0,E.Gm)({onlyReverse:!1},t).onlyReverse,n=(this.runScene.helperEx.unfocus(),this.groupMap[e]);if(n&&!n.run){n.run=!0;const s=Object.keys(n.data).map((e=>{const t=n.data[e];if(r)return t.getAnima(n,!0);const a=t.getAnima(n);return n.reverse&&(e=t.getAnima(n,!0),a.push(...e)),a}));this.animaMap[e]||(this.animaMap[e]=[]),this.animaMap[e]=s.map((e=>(0,i.eachTriggerArrGetControls)(e)));let o=0;o=r?n.time*n.speed:n.time*n.speed*(n.reverse?2:1);const l=(new Date).valueOf(),c=o;var a=setInterval((()=>{var t=((new Date).valueOf()-l)/c;this.runScene.cb.timeLine.playGroup.cb({groupName:e,progress:t})}),16.6);let u;const h=new Promise((e=>u=setTimeout(e,o)));return this.timerMap[e]={setProgressTime:a,awaitRuned:u},h.then((()=>{if(clearInterval(this.timerMap[e].setProgressTime),n.run){if(n.run=!1,n.loop)return this.playGroup(e);null!=t&&t.onDone()}}))}}setInsForIdMap(e){this.idMap.set(e.uuid,e)}getInsByUuid(e){return this.idMap.get(e)}}(this),this.anima=new d(this),this.tags=new sa(this),this.globalConfig=new Ir(this),this.pp=new $n(this),this.objects=new $r(this),this.inited=!1,this._renderLimit=new E.cM,this._render=()=>{const{render2:e,render3:t}=this.assetsEx,{scene:r,camera:n,controls:a}=this.assetsEx.get();this.cb.render.cb(""),this.pp.update(),null!=t&&t.render(r,n),null!=e&&e.render(r,n),"tick"===this.optionsEx.options.renderConfig.mode&&a.update()},this.render=()=>{if(null!=(e=this.optionsEx.options)&&e.run){const r=this._render;var{frame:e,mode:t}=this.optionsEx.options.renderConfig;-1!==e&&"tick"===t?(t=this._clock.getDelta(),this._renderLimit.update({cb(){r()},cbRate:1/e,now:t})):this._render()}},this.optionsEx=new R(this,e)}initLibs(e){if(!this.inited){this.inited=!0,this.snapshot.init(),this.materialEx.init(),this.modelEx.init(),this.sceneEx.init(),this.timeLineEx.init(),this.loaderer.init(),this.assetsEx.init(e),this.events.init(e),this.globalConfig.setRenderMode(this.optionsEx.options.renderConfig.mode),this.helperEx=new Nr(this);const{camera:t,controls:r}=this.assetsEx.get();this.uniqueEx.model.add(t),this.renderEx.setSize(),r.update(),this.pp.init(),this.cameraEx.reset(t),this.cb.inited.cb(0)}}init(e){return this.initLibs(e),this}load(e){var{path:e,dom:t,loadConfig:r}=e;return this.init(t),this.loadScene(e,r).then((e=>{0!==(null==e?void 0:e.length)&&this.modelEx.add(e)})),this}loadScene(e,t){return function(e,t,r,n){return new(r=r||Promise)((function(t,a){function i(e){try{o(n.next(e))}catch(e){a(e)}}function s(e){try{o(n.throw(e))}catch(e){a(e)}}function o(e){var n;e.done?t(e.value):((n=e.value)instanceof r?n:new r((function(e){e(n)}))).then(i,s)}o((n=n.apply(e,[])).next())}))}(this,0,void 0,(function*(){const{getJSON:r,progress:n,complete:i}=this.cb.load;t=t||{};var s=Object.assign(Object.assign({},t),{callBack:Object.assign(Object.assign({},t.callBack),{getJSON:e=>{var n,a;null!=(a=null==(n=null==t?void 0:t.callBack)?void 0:n.getJSON)&&a.call(n,e),r.cb(e)},progress:e=>{var r,a;null!=(a=null==(r=null==t?void 0:t.callBack)?void 0:r.progress)&&a.call(r,e),n.cb(e)},complete:e=>{var r,n;null!=(n=null==(r=null==t?void 0:t.callBack)?void 0:r.complete)&&n.call(r,e),i.cb(e),this.render()}}),triggerCb:!1});if(e instanceof ArrayBuffer)return this.optionsEx.log("正在解析二进制文件","base","info"),this.loaderer.gltf.parse(e,s);this.optionsEx.log("正在拉取场景","base","info");var o=yield a().get(e,{responseType:"arraybuffer",onDownloadProgress:e=>{var{total:e,loaded:t}=e;let r=t/e;1<(r=r<0?0:r)&&(r=1),t=Number(r.toFixed(2)),e=Math.floor(100*t),this.optionsEx.log("下载场景进度:"+e,"detail"),this.cb.load.progress.cb(e)}}).then((e=>e.data)).catch((e=>{this.sceneEx.clean(),this.optionsEx.log("下载场景失败:",e)}));return o?(this.optionsEx.log("拉取场景成功、正在解析","base","success"),this.loaderer.gltf.parse(o,s)):void 0}))}dispose(){this.assetsEx.dispose(),this.sceneEx.clean()}on(e,t){return null!=(e=this.cb.load[e])&&e.add("load-callback"+(0,i.getId)(),t),this}setSize(e,t){const{render2:r,render3:n}=this.assetsEx,a=this.assetsEx.get().renderer;this.cameraEx.setSize(),null!=n&&n.setSize(e,t),null!=r&&r.setSize(e,t),a.setSize(e,t,!0),this.pp.setSize(e,t)}clean(){this.cb.clean.cb(0)}}},3736:(e,t,r)=>{r.d(t,{ZP:()=>y,bv:()=>T,is:()=>M,UE:()=>S,M:()=>x});var n=r(6001),a=r(8881),i=r(932),s=r(6756),o=r(7738),l=r(1794),c=r(898);class u{constructor(e){this.mount=e=>{e.core.module.set("scene",this)},this.parse={before:e=>{var t,r,n,a,i,s,{json:e,config:o,core:l}=e;"scene"===(null==(t=null==(t=e.asset)?void 0:t.ex)?void 0:t.type)&&(({camera:t,lights:e,options:r,controls:n,tags:a,envStrength:i,objects:s}=e.asset.ex),void 0!==i&&this.runScene.sceneEx.setEnvStrength(i),this.parse.camera(t,o),e&&this.parse.light(e,o,l),this.parse.controls(n,o),o.module.tags&&this.runScene.tags.parseJSON(a||{}),this.parse.options(r),s&&this.runScene.objects.parseJSON(s))},after:e=>{const{core:t,json:r,data:n,config:a}=e;if("scene"===(null==(e=null==(e=r.asset)?void 0:e.ex)?void 0:e.type)){var{options:e,json:i}=n;if(e=e.models,!t.loadConfig.module.model)return[];const s=e[0];if(t.module.get("model").data.map.map(((e,t)=>{this.runScene.uniqueEx.model.add(t)})),e=s.children.filter((e=>this.runScene.modelEx.isUnless(e)?void 0:e)),1===e.length){const[t]=e;t.animations=[...t.animations,...i.animations]}t.callback("loaded",""),this.runScene.optionsEx.sceneOptions.loaded=!0,this.parse.scene(r,a,t),t.models.push(...e)}},controls:(e,t)=>{var r;t.module.controls&&e&&(({x:t,y:e,z:r}=e),this.runScene.assetsEx.controls.target.set(t,e,r),this.runScene.assetsEx.controls.update())},camera:(e,t)=>{if(t.module.camera){let o=e;e.temp&&(o=e.camera,this.runScene.cameraEx.temp=l.Z.formJSON(e.temp));var{position:t,far:e,near:r,fov:n,name:a,userData:i,rotation:s}=this.runScene.loaderer.object.parse(o);const c=this.runScene.assetsEx.get().camera;c.position.copy(t),c.far=e,c.near=r,c.fov=n,c.name=a,c.updateProjectionMatrix(),c.userData.id=i.id,this.runScene.uniqueEx.model.add(c),c.rotation.copy(s),this.runScene.assetsEx.get().controls.update()}},light:(e,t,r)=>{if(t.module.light){const t=[];e.map((e=>{var r=e.type;t.push(...this.runScene.lightEx.lightExMap[r].parseJSON(e))})),r.models.push(...t)}},scene:(e,t,r)=>{if(t.module.sceneConfig){const u=this.runScene.sceneEx.get();t=r.module.get("material").data.materialIns;var{materialId:r,backgroundMapping:e,backgroundColor:n,fog:i,backgroundIntensity:s,backgroundBlurriness:o,cssBgc:l}=e.asset.ex.sceneEx;if(r&&(r=null==(t=t[r])?void 0:t.material)){const{map:t,envMap:n}=r;t&&(t.mapping=e||300,t.needsUpdate=!0,this.runScene.sceneEx.setBackground(t,!1),t.userData.isBackgroud=!0,void 0!==o&&(u.backgroundIntensity=o),void 0!==s&&(u.backgroundIntensity=s)),n&&(u.environment=(0,c.setTextureMapping)(n))}if(l&&this.runScene.sceneEx.setCssBgc(l),n&&this.runScene.sceneEx.setBackground(new a.Color("#"+n)),i){const{color:e,far:t,near:r,show:n}=i,s=new a.Fog(e.includes("#")?e:"#"+e,r,t);!1===n?this.runScene.sceneEx.oldFog=s:u.fog=s,s.show=n,this.runScene.cb.setScene.cb({scene:u,type:"fog",val:s})}this.runScene.cb.setScene.cb({scene:u,type:"any",val:"any"})}},options:e=>{e.map((e=>{var{type:e,data:t}=e;const r=this.runScene.exporter.gltf.options.getParse(e);null!=r&&r.parse(t)}))}},this.toJSON=()=>{},this.runScene=e}init(){this.bindEvent()}bindEvent(){var e={name:"sceneConfig",loadCallBacks:new l.Z({beforeParse:this.parse.before,afterParse:this.parse.after,mountModule:this.mount}),exportCallBacks:new l.Z};this.runScene.exporter.gltf.module.bind(e)}}var h=r(8089),d=r(7201);class p{constructor(e){this.create=e=>{var t=this.getDiff();0!==(0,d.objLength)(t)&&e.data.set("scene",t)},this.set=e=>{const t=e.snapshot.data.get("scene");if(t){const{fog:u,bgc:d,env:p,bgcm:f,envS:m}=t,g=this.runScene.assetsEx.get().scene,{animas:v,completedCbs:b}=e.data;let y=g.background;if(this.runScene.sceneEx.setEnvStrength(void 0!==m?m:1),d){const{type:t,data:r}=d;if("color"===t)(0,i.isColor)(y)||null===y?(e=null===y?"#000000":(0,h.J6)(y),null===y&&this.runScene.sceneEx.setBackground(new a.Color("#000000")),e!==d.data&&v.push({target:g,label:"background",type:"color",isUpdate:!0,begin:e,end:r})):(0,c.isTexture)(y)&&b.push((()=>{this.runScene.sceneEx.setBackground(new a.Color(r))}));else if("texture"===t){const e=this.runScene.uniqueEx.texture.get(d.data);e&&(0,c.setTextureMapping)(e,303===f?"repeat":"normal"),b.push((()=>{this.runScene.sceneEx.setBackground(e)}))}}else(0,i.isColor)(y)&&(y||(y=new a.Color,this.runScene.sceneEx.setBackground(y)),v.push({target:g,label:"background",type:"color",isUpdate:!0,begin:(0,h.J6)(y),end:"#000000"})),b.push((()=>{this.runScene.sceneEx.setBackground(null)}));var r,n,s,o,l;b.push((()=>{g.environment=this.runScene.uniqueEx.texture.get(null==p?void 0:p.data)})),g.fog&&u?(({color:e,near:r,far:n}=u),({color:l,near:s,far:o}=g.fog),e!==(l=(0,h.J6)(l))&&v.push({target:g,label:["fog","color"],begin:l,end:e,type:"color",isUpdate:!0}),s!==r&&v.push({target:g,label:["fog","near"],begin:s,end:r,type:"number",isUpdate:!0}),o!==n&&v.push({target:g,label:["fog","far"],begin:o,end:n,type:"number",isUpdate:!0})):b.push((()=>{g.fog=u?S(u):null})),b.push((()=>{this.runScene.cb.setScene.cb({scene:this.runScene.assetsEx.get().scene,type:"any",val:"any"})}))}},this.runScene=e,this.runScene.cb.snapshot.create.add("scene",this.create),this.runScene.cb.snapshot.set.add("scene",this.set)}getDiff(){let e={};var t=((t=this.runScene.sceneEx.getJson("fog"))&&(e.fog=t),this.runScene.sceneEx.getJson("background")),r=this.runScene.assetsEx.scene;return void 0!==(t&&"texture"===(e.bgc=t).type&&303===r.background.mapping&&(e.bgcm=303),(t=this.runScene.sceneEx.getJson("environment"))&&(e.env=t),r=this.runScene.sceneEx.getEnvStrength())&&1!==r&&(e.envS=r),e}}var f=r(3735),m=r(2510),g=r(7169),v=r(3729),b=function(e,t,r,n){return new(r=r||Promise)((function(a,i){function s(e){try{l(n.next(e))}catch(e){i(e)}}function o(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?a(e.value):((t=e.value)instanceof r?t:new r((function(e){e(t)}))).then(s,o)}l((n=n.apply(e,t||[])).next())}))};class y{constructor(e){this.oldFog=null,this.removeMap={light:{valid:e=>this.runScene.lightEx.isLight(e),remove:e=>this.runScene.lightEx.remove(e)}},this.clean=()=>{this.cleanSceneInfo(this.get()),this.cleanNormal()},this.envStrength=1,this.runScene=e,this.exportAndImport=new u(e),this.snapshot=new p(e),this.runScene.cb.clean.add("EngineScene",this.clean)}init(){this.exportAndImport.init()}each(e){return this.runScene.assetsEx.get().scene.traverseAncestors(e)}get(){return this.runScene.assetsEx.get().scene}getNromal(){return this.get().children.filter((e=>!this.runScene.helperEx.isHelper(e)))}getEnvStrength(){return this.envStrength}remove(e){if(e){if(e instanceof Array){const t=[];return e.map((e=>{for(const r in this.removeMap){const{valid:a,remove:i}=this.removeMap[r];if(a(e))return t.push(...(0,n.multiArrToArr)(i(e)))}t.push(new g.Z({model:e,runScene:this.runScene,parent:e.parent}).execute())})),this.runScene.undoEx.addUndo(t),t}for(const t in this.removeMap){const{valid:r,remove:n}=this.removeMap[t];if(r(e))return n(e)}this.runScene.modelEx.remove(e),this.runScene.helperEx.unfocus()}}cleanUnlessLevel(e){return this.runScene.modelEx.isUnlessLevel(e)&&!this.runScene.helperEx.isHelper(e)&&0!==e.children.length&&1===e.children.length?this.cleanUnlessLevel(e.children[0]):e}searchModel(e){return this.runScene.uniqueEx.model.findModelWithName(e)}getClearModels(){return this.get().children.filter((e=>!this.runScene.helperEx.isHelper(e)&&!this.runScene.lightEx.isLight(e)))}getClear(){const e=this.get(),t=new a.Group;return e.children.filter((e=>!this.runScene.helperEx.isHelper(e)&&s.normalModel.is(e))).map((e=>{const r=e.clone();(0,s.withAnima)(e)&&(r.animations=[...e.animations]),t.add(r)})),this.runScene.helperEx.setHelper(t),this.cleanUnlessLevel(t)}cleanNormal(){this.getNromal().map((e=>this.remove(e)))}cleanSceneInfo(e){this.setBackground(null).then(),this.setEnv(null).then(),e.fog=null,this.runScene.cb.setScene.cb({scene:e,type:"any",val:null})}setBackground(e,t=!0){return b(this,void 0,void 0,(function*(){e instanceof String&&(e=yield this.runScene.textureEx.load(e)),(0,c.isTexture)(e)&&(e.userData.isBackgroud=!0);var r=this.get(),n=new m.Z({target:r,info:"background",newVal:e,oldVal:r.background,runScene:this.runScene,cb:e=>{}}).execute();return t&&this.runScene.undoEx.addUndo(n),this.runScene.cb.setScene.cb({scene:r,type:"background",val:r.background}),e}))}isBackground(e){return e.userData.isBackgroud}dispose(){const{renderer:e,controls:t}=this.runScene.assetsEx.get();this.clean(),(0,o.sH)(e),t.dispose(),this.runScene.pp.dispose(),a.Cache.clear()}render(){}create(){return new a.Scene}setEnv(e){return b(this,void 0,void 0,(function*(){var t=this.runScene.assetsEx.scene;let r;return e instanceof String&&(r=yield this.runScene.textureEx.load(e)),e instanceof File&&(r=yield this.runScene.textureEx.parse(e)),r=(r=null!=e&&e.isTexture?this.runScene.textureEx.clone(e):r)&&(0,c.setTextureMapping)(r),this.setNormal({model:t,info:"environment",val:r}),this.runScene.cb.setScene.cb({scene:t,type:"environment",val:r}),r}))}setNormal(e,t=!0){var{model:e,info:r,val:n}=e;e=new m.Z({target:e,info:r,oldVal:e[r],newVal:n,runScene:this.runScene}).execute(),t&&this.runScene.undoEx.addUndo(e)}setRealReflection(){const{scene:e,renderer:t}=this.runScene.assetsEx;this.cubeRT||(this.cubeRT=new a.WebGLCubeRenderTarget(1024)),this.realReflectionCamera||(this.realReflectionCamera=new a.CubeCamera(.1,5e3,this.cubeRT),e.add(this.realReflectionCamera),this.runScene.cb.render.add("RealReflection-update",(()=>{this.realReflectionCamera.update(t,e)}))),this.isRealReflection?(this.preEnvMap=e.environment,this.setEnv(null).then(),this.setNormal({model:e,info:"environment",val:this.cubeRT.texture})):this.preEnvMap&&this.setEnv(this.preEnvMap).then(),this.testSphere||(this.testSphere=new a.Mesh(new a.SphereGeometry(15,32,16),new a.MeshStandardMaterial),e.add(this.testSphere),this.testSphere.scale.set(10,10,10),this.testSphere.position.set(0,600,0),this.testSphere.getWorldPosition(this.realReflectionCamera.position),this.testSphere.material.roughness=0,this.testSphere.material.metalness=1)}setFogShow(e){var t=this.runScene.assetsEx.scene,{show:e,color:r}=e;if(e){let e=this.oldFog||new a.Fog(r||"#ffffff");e.show=!0,this.setNormal({model:t,info:"fog",val:e})}else this.oldFog=t.fog,this.setNormal({model:t,info:"fog",val:null}),this.oldFog.show=!1;this.runScene.cb.setScene.cb({scene:t,type:"fog",val:t.fog})}setFog(e){var t=this.runScene.assetsEx.scene,{type:e,val:r,cb:n}=e;t=new f.Z({target:t,typeList:["fog",e],newVal:r,cb:n}).execute(),this.runScene.undoEx.addUndo(t)}sreenShotDefFile(e,t){e=e||Number(prompt("请输入截图的宽"))||1920,t=t||Number(prompt("请输入截图的高"))||1080;var{width:r,height:a}=(this.runScene.helperEx.unfocus(),this.runScene.renderEx.getDomSize());const i=this.runScene.assetsEx.get().renderer.domElement;return this.runScene.pp.setSize(e,t),this.runScene.renderEx.setSize(e,t),this.runScene.pp.update(),e=i.toDataURL("image/png",1),t=(0,n.base64ToFile)(e,"screenShot.png"),this.runScene.pp.setSize(r,a),this.runScene.renderEx.setSize(),this.runScene.pp.update(),t}getJson(e){let t;var r=this.runScene.assetsEx.scene;if("fog"===e){var n=r.fog;n&&(t=w(n,null!==r.fog))}else if("background"===e){if(!r.background)return;t={type:(n=(0,i.isColor)(r.background))?"color":"texture",data:(n?h.J6:v.Ki)(r.background)}}else if("environment"===e){if(!r.environment)return;t={type:"texture",data:(0,v.Ki)(r.environment)}}return t}static toJSON(e,t){const r={};let n=!1,a=e.fog;return a?n=!0:a=t.sceneEx.oldFog,a&&(r.fog=w(a,n)),(0,i.isColor)(e.background)?r.backgroundColor=e.background.getHexString():(0,c.isTexture)(e.background)&&(e.backgroundIntensity&&(r.backgroundIntensity=e.backgroundIntensity),e.backgroundBlurriness&&(r.backgroundBlurriness=e.backgroundBlurriness)),t.sceneEx.cssBgc&&(r.cssBgc=t.sceneEx.cssBgc),r}setEnvStrength(e){this.runScene.cb.scene.setEnvStrength.cb({val:e}),this.runScene.uniqueEx.material.each((t=>this.runScene.materialEx.setEnvStrength(t,e))),this.envStrength=e}setCssBgc(e){this.setBackground(null);var{color1:e,color2:t,deg:r,percent:n}=e,a=`linear-gradient(${r}deg,${e}, ${n}%,${t} )`;this.cssBgc={color1:e,color2:t,percent:n,deg:r},this.runScene.assetsEx.renderer.domElement.style.background=a}}const x=(e,t,r)=>{e.userData[t]=r},w=(e,t)=>{var{color:e,far:r,near:n}=e;return{color:(0,h.J6)(e),show:t,far:r,near:n}},S=e=>{var{color:e,far:t,near:r}=e;return new a.Fog(e,r,t)},M=(e,t)=>(null==(e=null==e?void 0:e.userData)?void 0:e[t])||"",T=(e,t)=>{delete e.userData[t]}},1398:(e,t,r)=>{r.d(t,{LV:()=>p,ZP:()=>d});var n=r(6001),a=r(3263),i=r(1794),s=r(7201),o=r(898),l=r(3729),c=r(5317),u=r(8089);const h=["number","color","color_obj","color_str","v2","v3"];class d{constructor(e){this.map=new i.Z,this.onInited=()=>{this.runScene.cb.events.model.addOptions.cb({name:"snapshot",map:{parse:e=>Promise.all(e.childs.map((e=>new Promise((t=>{this.set(e,{onDone:()=>{t(0)}})})))))}})},this.playing=new i.Z,this.unique={set:()=>{},get:()=>{}},this.toJSON=()=>JSON.stringify(this.map.toJSON()),this.parseJSON=e=>{const t=i.Z.formJSON(JSON.parse(e));t.map(((e,t)=>{t.data=i.Z.formJSON(t.data)})),this.map=t},this.clean=()=>{this.map.clear()},this.trans={set:(e,t)=>{var r,n,a,i,s,o=e.label instanceof Array?e.label.join("."):e.label;const l={begin:[],end:[]};return"color"===e.type||"color_obj"===e.type||"color_str"===e.type?(a=(0,u.sS)(e.begin),r=(0,u.sS)(e.end),i=o+"_"+t+"_r",s=o+"_"+t+"_g",n=o+"_"+t+"_b",l.begin.push({type:i,data:a.r}),l.begin.push({type:s,data:a.g}),l.begin.push({type:n,data:a.b}),l.end.push({type:i,data:r.r}),l.end.push({type:s,data:r.g}),l.end.push({type:n,data:r.b})):"number"===e.type?(l.begin.push({type:o+"_"+t,data:e.begin}),l.end.push({type:o+"_"+t,data:e.end})):"v2"!==e.type&&"v3"!==e.type||(a=o+"_"+t+"_x",i=o+"_"+t+"_y",s=o+"_"+t+"_z",l.begin.push({type:a,data:e.begin.x}),l.begin.push({type:i,data:e.begin.y}),"v3"===e.type&&(l.begin.push({type:s,data:e.begin.z}),l.end.push({type:s,data:e.end.z})),l.end.push({type:a,data:e.end.x}),l.end.push({type:i,data:e.end.y})),l},getKey(e){let t=[];var{unique:r,type:n}=e;return e=e.label instanceof Array?e.label.join("."):e.label,"v2"===n||"v3"===n?(t.push(e+"_"+r+"_x"),t.push(e+"_"+r+"_y"),t.push(e+"_"+r+"_z")):"color"===n||"color_obj"===n||"color_str"===n?(t.push(e+"_"+r+"_r"),t.push(e+"_"+r+"_g"),t.push(e+"_"+r+"_b")):"number"===n&&t.push(e+"_"+r),t},update:(e,t)=>{var r;const a=this.trans.getKey(e);let i=e.target,s=e.label,o=(e.label instanceof Array&&(s=(0,n.lastArrayEle)(e.label),i=(0,n.objLastMap)(e.target,e.label)),t[a[0]]),l=s;"color"===e.type||"color_obj"===e.type?(o={r:0,g:0,b:0},a.map((e=>{var[,,r]=e.split("_");e=t[e]/255,o[r]=e}))):"color_str"===e.type?o="#"+a.map((e=>Number(Number(t[e]).toFixed(0)).toString(16).padStart(2,"0"))).join(""):"v2"!==e.type&&"v3"!==e.type||(o={x:0,y:0,z:0},a.map((e=>{var[,,r]=e.split("_");o[r]=t[e]}))),null!=(r=e.onUpdate)&&r.call(e,{target:i,data:o,type:l,runScene:this.runScene})},exec:(e,t)=>{const r=this.trans.getKey(e);let a=e.target,i=e.label;e.label instanceof Array&&(i=(0,n.lastArrayEle)(e.label),a=(0,n.objLastMap)(e.target,e.label)),"color"===e.type||"color_str"===e.type||"color_obj"===e.type?r.map((e=>{var[,,r]=e.split("_");e=1<t[e]?t[e]/255:t[e],a[i][r]=e})):"number"===e.type?a[i]=t[r[0]]:"v2"!==e.type&&"v3"!==e.type||r.map((e=>{var[,,r]=e.split("_");a[i][r]=t[e]}))}},this.getLengthByName=e=>{var t;if(e=this.map.get(e))return t={},this.runScene.cb.snapshot.getLength.cb({data:e,inputData:t}),t},this.runScene=e}init(){this.runScene.exporter.gltf.options.addOption({type:"snapshot",process:this.toJSON,parse:this.parseJSON}),this.runScene.cb.clean.add("snapshrot",this.clean),this.runScene.cb.inited.add("snapshot",this.onInited)}create(e){var{name:e,time:t}=e;return e={name:e,time:t,data:new i.Z},this.runScene.cb.snapshot.create.cb(e),e}resetItem(e){const{targets:t,names:r,type:n}=e;e=r.map((e=>this.map.get(e))).filter((e=>e)),this.runScene.cb.snapshot.resetItem.cb({targets:t,datas:e,type:n})}add(e){var t=this.create(e);return this.map.set(e.name,t),t}addByType(e){var{name:t,time:r,targets:n,type:a}=e,t={name:t,time:r,data:new i.Z};return this.runScene.cb.snapshot.getByType.cb({type:a,data:t,targets:n}),this.map.set(e.name,t),t}set(e,t){var r=this.map.get(e);const{animaTime:n,isLinear:a,onDone:i}=Object.assign({animaTime:-1},t);if(r){const t={animas:[],completedCbs:[]};if(this.runScene.cb.snapshot.set.cb({snapshot:r,data:t}),0===t.animas.length){if(0===t.completedCbs.length)return null==i?void 0:i();t.completedCbs.map((e=>e())),null!=i&&i()}else this.anima(e,t,{animaTime:-1===n?r.time:n,isLinear:a,onDone:i})}}del(e){var t=this.map.get(e);t&&this.runScene.cb.snapshot.delete.cb({name:e,data:t})}anima(e,t,r){var a;if(this.runScene.modelEx.selectNull(),null==(a=this.playing.get(e))||!a.animaIns){const a=new i.Z,s={},o={},{animaTime:l,isLinear:u,onDone:h}=r,d={data:t,animaIns:null};t.animas.map(((e,t)=>{t=String(t);const{begin:r,end:n}=this.trans.set(e,t);r.map((e=>s[e.type]=e.data)),n.map((e=>o[e.type]=e.data)),a.set(t,Object.assign({unique:t},e))})),d.animaIns=(0,c.anima)(s,Object.assign(Object.assign({},o),{ease:u?"none":"easeOut"}),l,(e=>{(0,n.mapObj)(e,(t=>{var[,t]=t.split("_");(t=a.get(t))&&(t.isUpdate?this.trans.exec(t,e):this.trans.update(t,e))}))}),(()=>{var e;null!=(e=d.animaIns)&&e.kill(),d.animaIns=null,d.data.completedCbs.map((e=>e())),null!=h&&h()})),this.playing.set(e,d)}}close(e){const t=this.playing.get(e);return!(!t||(null!=(e=t.animaIns)&&e.kill(),t.animaIns=null))}closeAll(){this.playing.map(((e,t)=>{var r;t&&null!=(r=t.animaIns)&&r.kill(),t.animaIns=null}))}parseNromal(e,t){const{animas:r,completedCbs:a}=t.data,{target:i,type:s,begin:o,end:l,set:u,label:d,onUpdate:p}=e;if((0,c.isDef)(o,l))if(h.includes(s))r.push({target:i,type:s,begin:o,end:l,label:d,isUpdate:void 0===p,onUpdate:p});else if(u)u({target:i,begin:o,end:l});else{let e=i,t=d;d instanceof Array&&(e=(0,n.objLastMap)(i,d),t=(0,n.lastArrayEle)(d)),"texture"===s?e[t]=l:a.push((()=>{e[t]=l}))}}bind(e){const{name:t,def:r,target:n,create:a,set:i}=e;this.runScene.cb.snapshot.create.add(t,a||(e=>{var a=p.getDiff(r,n);0!==(0,s.objLength)(a)&&e.data.set(t,a)})),this.runScene.cb.snapshot.set.add(t,i||(e=>{var a=e.snapshot.data.get(t);a&&p.set({def:r,runScene:this.runScene,data:a,target:n,map:e})}))}}const p={toNormal(e){var t,{type:e,val:r}=e;let n=r;return"color"===e?n=(0,u.Lv)(r):"color_obj"===e?n=r:"color_str"===e?n=(0,c.MyHextoRgb)(r,!0):"texture"===e?(0,o.isTexture)(r)&&(n=(0,l.Ki)(r)):"v3"!==e&&"v2"!==e||(({x:e,y:r,z:t}=r),n={x:e,y:r,z:t}),n},parse(e){const{type:t,val:r,runScene:n}=e;let i=r;return"color"===t?i=a.YD.is(r)?r:(0,c.HextoRgb)(r,!0):"color_obj"===t?i=r:"color_str"===t&&(i=a.YD.is(r)?r:(0,c.HextoRgb)(r,!0)),"texture"===t&&null!==r?n.uniqueEx.texture.get(r):i},getDiff(e,t){let r={};return(0,n.mapObj)(e,((e,a)=>{const{label:i,get:s}=a;let o=t[e];s?o=s(t):i&&(o=(0,n.objLastMap)(t,i)[(0,n.lastArrayEle)(i)]),r[e]=o})),(0,s.replaceKVForObj)((0,c.getDiff)((0,s.replaceValForObj)(e,((e,t)=>t.val)),r),((t,r)=>{var{shortKey:t,type:n}=e[t];return{k:t,v:p.toNormal({type:n,val:r})}}))},set(e){const{def:t,data:r,target:a,runScene:i,map:s}=e;(0,n.mapObj)(t,((e,t)=>{const{type:o,val:l,shortKey:u,before:h,label:d,onUpdate:f,get:m,set:g}=t;let v=a,b=e;d&&(v=(0,n.objLastMap)(a,d),b=(0,n.lastArrayEle)(d)),t=p.toNormal({type:o,val:m?m(v):v[b]}),e=p.parse({type:o,val:void 0!==r[u]?r[u]:l,runScene:i}),(0,c.isDef)(t,e)&&(null!=h&&h({target:v,begin:t,end:e}),i.snapshot.parseNromal({target:v,label:b,type:o,set:g,begin:t,end:e,onUpdate:f},s))}))}}},898:(e,t,r)=>{r.r(t),r.d(t,{bindTextureBaseData:()=>A,cubeTextureStrs:()=>$,defExportTextureUserData:()=>M,default:()=>_,disposeTexture:()=>P,getBlobByTexture:()=>C,getCloneIdFromTexture:()=>F,getImageDomByUrl:()=>X,getMd5ForTexture:()=>J,getMimeByTexture:()=>k,getSizeByTexture:()=>U,getTextureGpuMemory:()=>O,getTextureMinFilter:()=>W,getTextureType:()=>te,getUrlByTexture:()=>B,initTexture:()=>R,isClonedTexture:()=>z,isCubeTexture:()=>Y,isInvalidTexture:()=>Q,isTexture:()=>N,loadTexture:()=>I,mergeDefUserData:()=>T,parseImageBitMapByBlob:()=>L,setMimeForTexture:()=>D,setTextureCloneId:()=>V,setTextureEncodeing:()=>ee,setTextureMapping:()=>j,setTextureMinFilter:()=>H,textureNameMap:()=>E,unDelAbleTexture:()=>Z,updateTexture:()=>G});var n=r(6001),a=r(8881),i=r(6422),s=r(5247),o=r(932),l=r(3736);class c extends r(4616).Z{constructor(e){super(),this.info="函数修改",this.map=e}_execute(e,t){throw new Error("Method not implemented.")}execute(){return this.map.redo(),this}undo(){this.map.undo()}redo(){this.map.redo()}}const u=c;var h=r(8024),d=r(2510),p=r(3729);function f(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var m=function(){function e(){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function")}var t,r;return t=e,r=[{key:"fromCubeTexture",value:function(e){for(var t=0,r=new a.Vector3,n=new a.Vector3,i=new a.Color,s=[0,0,0,0,0,0,0,0,0],o=new a.SphericalHarmonics3,l=o.coefficients,c=0;c<6;c++)for(var u,h,d=(h=e.image[c]).width,p=h.height,f=(((u=document.createElement("canvas")).width=d,u.height=p,u=u.getContext("2d")).drawImage(h,0,0,d,p),h=u.getImageData(0,0,d,p)).data,m=h.width,v=2/m,b=0,y=f.length;b<y;b+=4){i.setRGB(f[b]/255,f[b+1]/255,f[b+2]/255),g(i,e.encoding);var x=((S=b/4)%m+.5)*v-1,w=1-(Math.floor(S/m)+.5)*v;switch(c){case 0:r.set(-1,w,-x);break;case 1:r.set(1,w,x);break;case 2:r.set(-x,1,-w);break;case 3:r.set(-x,-1,w);break;case 4:r.set(-x,w,1);break;case 5:r.set(x,w,-1)}var S=r.lengthSq(),M=4/(Math.sqrt(S)*S);t+=M,n.copy(r).normalize(),a.SphericalHarmonics3.getBasisAt(n,s);for(var T=0;T<9;T++)l[T].x+=s[T]*i.r*M,l[T].y+=s[T]*i.g*M,l[T].z+=s[T]*i.b*M}for(var _=4*Math.PI/t,E=0;E<9;E++)l[E].x*=_,l[E].y*=_,l[E].z*=_;return new a.LightProbe(o)}},{key:"fromCubeRenderTarget",value:function(e,t){for(var r=0,n=new a.Vector3,i=new a.Vector3,s=new a.Color,o=[0,0,0,0,0,0,0,0,0],l=new a.SphericalHarmonics3,c=l.coefficients,u=0;u<6;u++)for(var h=t.width,d=new Uint8Array(h*h*4),p=(e.readRenderTargetPixels(t,0,0,h,h,d,u),2/h),f=0,m=d.length;f<m;f+=4){s.setRGB(d[f]/255,d[f+1]/255,d[f+2]/255),g(s,t.texture.encoding);var v=((y=f/4)%h+.5)*p-1,b=1-(Math.floor(y/h)+.5)*p;switch(u){case 0:n.set(1,b,-v);break;case 1:n.set(-1,b,v);break;case 2:n.set(v,1,-b);break;case 3:n.set(v,-1,b);break;case 4:n.set(v,b,1);break;case 5:n.set(-v,b,-1)}var y=n.lengthSq(),x=4/(Math.sqrt(y)*y);r+=x,i.copy(n).normalize(),a.SphericalHarmonics3.getBasisAt(i,o);for(var w=0;w<9;w++)c[w].x+=o[w]*s.r*x,c[w].y+=o[w]*s.g*x,c[w].z+=o[w]*s.b*x}for(var S=4*Math.PI/r,M=0;M<9;M++)c[M].x*=S,c[M].y*=S,c[M].z*=S;return new a.LightProbe(l)}}],r&&f(t,r),Object.defineProperty(t,"prototype",{writable:!1}),e}();function g(e,t){switch(t){case a.sRGBEncoding:e.convertSRGBToLinear();break;case a.LinearEncoding:break;default:console.warn("WARNING: LightProbeGenerator convertColorToLinear() encountered an unsupported encoding.")}}var v=r(5317),b=r(1398),y=r(7201);const x={repeat:{type:"v2",val:{x:1,y:1},shortKey:"re"},offset:{type:"v2",val:{x:0,y:0},shortKey:"of"},rotation:{type:"number",val:0,shortKey:"ro"},center:{type:"v2",val:{x:0,y:0},shortKey:"ce"}};class w{constructor(e){this.onDeleteSnapshot=e=>{const{data:t,name:r}=e;(e=t.data.get("texture"))&&(0,n.mapObj)(e,(e=>{(e=this.runScene.uniqueEx.texture.get(e))&&this.setUnDel(e,!1,r)}))},this.resetItem=e=>{"texture"===e.type&&e.datas.map((t=>{const{data:r,name:n}=t;let a=r.get("texture");a||(a={},r.set("texture",a)),e.targets.map((e=>{var t=(0,p.Ki)(e);t&&(a[t]=this.getItem(e,n))}))}))},this.setUnDel=(e,t,r)=>{if(t){if(Z.is(e))return}else if(Z.getRef(e)!=="snapshot_"+r)return;Z.set(e,t,"snapshot_"+r)},this.getItem=(e,t)=>{this.setUnDel(e,!0,t);const r=b.LV.getDiff(x,e);return(t=this.runScene.script.texture.get(e))&&(r.uvScript=Object.assign({},t)),r},this.getDiff=e=>{let t={};return this.runScene.uniqueEx.texture.getAll().map((({texture:r})=>{var n=(0,p.Ki)(r);n&&(t[n]=this.getItem(r,e))})),t},this.create=e=>{var t=this.getDiff(e.name);0!==(0,y.objLength)(t)&&e.data.set("texture",t)},this.set=e=>{var t=e.snapshot.data.get("texture");t&&(0,n.mapObj)(t,((t,r)=>{(t=this.runScene.uniqueEx.texture.get(t))&&(b.LV.set({def:x,data:r,runScene:this.runScene,map:e,target:t}),this.runScene.script.texture.parse(r.uvScript,t),this.runScene.script.texture.set(r.uvScript,t))}))},this.runScene=e,this.runScene.cb.snapshot.create.add("texture",this.create),this.runScene.cb.snapshot.set.add("texture",this.set),this.runScene.cb.snapshot.getLength.add("texture",(e=>{var t=e.data.data.get("texture");t&&(e.inputData.texture=Object.keys(t).length)})),this.runScene.cb.snapshot.delete.add("texture",this.onDeleteSnapshot),this.runScene.cb.snapshot.resetItem.add("texture",this.resetItem)}}var S=function(e,t,r,n){return new(r=r||Promise)((function(a,i){function s(e){try{l(n.next(e))}catch(e){i(e)}}function o(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?a(e.value):((t=e.value)instanceof r?t:new r((function(e){e(t)}))).then(s,o)}l((n=n.apply(e,t||[])).next())}))};const M={md5:void 0,format:void 0,size:void 0,uvScript:void 0,unDelAble:void 0,unDelAbleRef:void 0,id:void 0,cloneSourceId:void 0,minFilter:void 0,isHdr:void 0,cubeMap:void 0,isHelper:void 0,blobMap:void 0,lightProbeIntensity:void 0},T=(e,t)=>{(0,n.mapObj)(M,((r,n)=>{var a=e[r];a!==n&&(t[r]=a)}))};class _{constructor(e){this.allTextures=new Set,this.rgbeLoader=new i.x,this.spcielBack=["hdr","pic"],this.cubeLoader=new a.CubeTextureLoader,this.setAnima=e=>{const{texture:t,type:r,val:n}=e,a=t.userData.uvScript||{};t.userData.uvScript||(t.userData.uvScript=a),0===n?delete a[r]:a[r]=n,this.runScene.cb.texture.setAnima.cb({texture:t,uvScript:a})},this.createScreenForTexture=(()=>{const e=new a.Scene,t=new a.PerspectiveCamera,r=new a.WebGLRenderer;return new s.z(t,r.domElement),e.add(t),n=>{var{width:a,height:i}=n.source.data;return r.setSize(a,i),e.background=n,r.render(e,t),r.domElement.toDataURL("image/webp")}})(),this.runScene=e,this.snapshot=new w(e)}load(e,t){return S(this,void 0,void 0,(function*(){var r=yield(0,v.urlToBlob)(e);return this.parse(r,t)}))}parse(e,t){return S(this,void 0,void 0,(function*(){let r,n;if(t=(0,v.mergeObject)({flipY:!0},t),N(e))return e;if(e instanceof Array)if(6===e.length)r=yield this.praseCubeByFiles(e),n=yield(0,v.fileToBlob)(e[0]);else{const a=e[0];n=yield(0,v.fileToBlob)(a),this.spcielBack.includes(a.name.substring(a.name.lastIndexOf(".")+1))?(r=yield this.parseHdr(n)).userData.isHdr=!0:r=yield I(n,t)}else e instanceof File?(n=yield(0,v.fileToBlob)(e),this.spcielBack.includes(e.name.substring(e.name.lastIndexOf(".")+1))?(r=yield this.parseHdr(n)).userData.isHdr=!0:r=yield I(n,t)):r=r||(yield I(e,t));return this.afterLoad(r,n)}))}praseCubeByFiles(e){return S(this,void 0,void 0,(function*(){const t={};if(6!==e.length)throw TypeError("立方体纹理加载时,必须包含六张贴图");const r=[];var n=e.map((e=>S(this,void 0,void 0,(function*(){var n=$.findIndex((t=>e.name.includes(t)));if(-1===n)throw TypeError("立方体纹理加载时,文件名必须包含方位信息");var a=URL.createObjectURL(e);t[$[n]]=yield(0,v.fileToBlob)(e),r[n]=a}))));yield Promise.all(n);const a=yield this.cubeLoader.loadAsync(r);return a.encoding=s.Z.sRGBEncoding,a.userData.blobMap=t,a}))}praseCubeByBlobMap(e){return S(this,void 0,void 0,(function*(){const t=yield this.cubeLoader.loadAsync($.map((t=>URL.createObjectURL(e[t]))));return t.encoding=s.Z.sRGBEncoding,t.userData.blobMap=e,t}))}createLightProbe(){}setLightProbeForCube(e,t,r){var n=e.userData.lightProbe;if(t){if(!n){const t=new a.LightProbe;return t.copy(m.fromCubeTexture(e)),void 0!==r&&(t.intensity=r),e.userData.lightProbe=t,this.runScene.helperEx.setHelper(t,!0),this.runScene.modelEx.add(t,void 0,{addToTree:!1,addUndo:!1,isClone:!1}),t}}else n&&(this.runScene.modelEx.remove(e.userData.lightProbe,!1),delete e.userData.lightProbe)}parseHdr(e){return S(this,void 0,void 0,(function*(){const t=yield this.rgbeLoader.loadAsync(URL.createObjectURL(e));return t.userData.md5=(0,v.getMd5)(t.source.data.data),t.encoding=s.Z.LinearEncoding,t}))}clone(e){const t=e.clone();return t.userData=Object.assign(Object.assign({},e.userData),{id:(0,n.getId)(),cloneSourceId:(0,p.Ki)(e)}),(0,l.bv)(t,"minFilter"),A(t,this.runScene),this.getSameAndAddtoAll(t)}getDef(e){return e=new a.Texture(e),A(e,this.runScene),this.getSameAndAddtoAll(e)}getSameAndAddtoAll(e){var t=e.userData.md5;return(t=this.getSameTexture(t,e))?(P(e),t):(this.initTextureAndAddtoAll(e),e)}afterLoad(e,t){return S(this,void 0,void 0,(function*(){return this.getSameAndAddtoAll(yield A(e,this.runScene,t))}))}getSameTexture(e,t){if(!z(t))for(const n in this.runScene.uniqueEx.texture.map){var r=this.runScene.uniqueEx.texture.get(n);if(r.userData.md5===e&&r.mapping===t.mapping)return r}}initTextureAndAddtoAll(e){return S(this,void 0,void 0,(function*(){return R(e),A(e,this.runScene),this.addTextureToAll(e),e}))}addTextureToAll(e){var t=this.runScene.uniqueEx.texture.getLength();this.runScene.uniqueEx.texture.add(e),this.runScene.uniqueEx.texture.getLength()!==t&&this.runScene.cb.texture.add.cb(e)}getBlobAndBase64(e){return e.userData.blob?e.userData:(0,v.imgBitMapToBlobAndBase64)(e)}coverByImage(e,t){return S(this,void 0,void 0,(function*(){let r;r=N(t)?t:t?yield this.parse(t):null;var a=this.runScene.uniqueEx.texture.getMaterials(this.runScene.uniqueEx.getId(e));if(a){const t=[];(0,n.mapObj)(a,((n,a)=>{const i=this.runScene.uniqueEx.material.get(n);i&&a.forEach((n=>{t.push(new h.Z({target:i,info:n,newVal:r,oldVal:e,runScene:this.runScene}).execute())}))})),this.runScene.undoEx.addUndo(t)}}))}remove(e){const t=(0,p.Ki)(e);var r=this.runScene.uniqueEx.texture.map[t];if(r){const a=[];r=r.materialMap,(0,n.mapObj)(r,((e,t)=>{const r=this.runScene.uniqueEx.material.get(e);r&&(t.forEach((e=>{a.push(new d.Z({target:r,info:e,oldVal:r[e],newVal:null,runScene:this.runScene,cb(){(0,o.updateMaterial)(r)}}).execute())})),(0,o.updateMaterial)(r))}));const i=this.runScene.uniqueEx.texture.map[t];a.push(new u({undo:()=>{this.runScene.cb.texture.add.cb(e),this.runScene.uniqueEx.texture.add(e)},redo:()=>{this.runScene.cb.texture.remove.cb(e),this.runScene.uniqueEx.texture.remove(e)}}).execute(),new u({undo:()=>{this.runScene.uniqueEx.texture.map[t]=i},redo:()=>{delete this.runScene.uniqueEx.texture.map[t]}}).execute()),this.runScene.undoEx.addUndo(a)}}delete(e){this.runScene.cb.texture.remove.cb(e),this.runScene.uniqueEx.texture.remove(e),Y(e)&&this.setLightProbeForCube(e,!1),P(e)}reverseImageBitMapTexture(e){return S(this,void 0,void 0,(function*(){var{canvas:t,imageBitMap:r}=yield(0,v.reverseImageBitMap)(e.image);const i=new a.Texture(r);return i.needsUpdate=!0,r=this.runScene.uniqueEx.texture.map[e.userData.id],(0,n.mapObj)(r.materialMap,((e,t)=>{const r=this.runScene.uniqueEx.material.get(e);t.forEach((e=>{r[e]=i,this.runScene.uniqueEx.texture.addMaterial(i,{material:r,type:e})}))})),R(i),yield A(i,this.runScene),this.runScene.cb.texture.add.cb(i),this.delete(e),(0,v.disposeCanvas)(t),i}))}setUnDelAble(e,t,r="custom",n){Z.set(e,t,r,n),this.runScene.cb.texture.set.cb({type:"unDelAble",texture:e,data:t})}getUsedModel(e,t=!0){if(e=(0,p.Ki)(e)){const r=[];if((e=this.runScene.uniqueEx.texture.map[e])&&((0,n.mapObj)(e.materialMap,(e=>{const t=this.runScene.uniqueEx.material.map[e];t&&r.push(...t.models.toArray())})),0!==r.length))return t&&this.runScene.multipSelector.add(r,!0),r}}getUsedMaterial(e){if((e=(0,p.Ki)(e))&&(e=this.runScene.uniqueEx.texture.map[e]))return(0,n.mapObj)(e.materialMap,(e=>null==(e=this.runScene.uniqueEx.material.map[e])?void 0:e.material)).filter((e=>e))}setMinFilter(e){this.runScene.uniqueEx.texture.getAll().map((({texture:t})=>{H(t,e)}))}getSize(e){let t=0;return e.userData.blobMap?(0,n.mapObj)(e.userData.blobMap,((e,r)=>t+=r.size)):t+=e.userData.blob.size,t}setEncoding(e){this.runScene.uniqueEx.texture.getAll().map((t=>{const r=t.texture;r.encoding="def"===e?s.Z.LinearEncoding:s.Z.sRGBEncoding,r.needsUpdate=!0}))}}const E={环境遮蔽:"aoMap",法线:"normalMap",金属度:"metalnessMap",粗糙度:"roughnessMap",自发光:"emissiveMap",颜色:"map",置换:"displacementMap",光照贴图:"lightMap",环境:"envMap",透明度:"alphaMap"},D=(e,t)=>{let r="image/jpeg"===t?1022:1023;return e.format=r,e},k=e=>1023===e.format?"image/png":"image/jpeg",O=e=>{if(e.userData.gm)return e.userData.gm;let t=0,r=e.source.data;return(r=e.source.data instanceof Array?r:[e.source.data]).map((e=>{var{width:e,height:r}=e||{width:0,height:0};t+=e*r*4*1.33})),t},P=e=>{var t,r;e&&(t=e.image,r=e.userData.url,t instanceof ImageBitmap?(0,v.disposeImageBitMap)(t):t instanceof HTMLCanvasElement&&(0,v.disposeCanvas)(t),URL.revokeObjectURL(r),e.dispose())},A=(e,t,r)=>S(void 0,void 0,void 0,(function*(){if("editor"!==t.optionsEx.options.mode)return e;var n=(0,v.isBlob)(e.userData.blob)?e.userData.blob:null,{md5:a,url:i}=(n=r||n||(yield C(e)),e.userData.blob=n,e.userData.mimeType=n.type,e.userData);return a||(e.userData.md5=yield J(e)),e.userData.isHdr&&(e.flipY=!0),i||(e.userData.isHdr?e.userData.url=t.textureEx.createScreenForTexture(e):e.userData.url=URL.createObjectURL(n)),e.userData.gm=O(e),e.needsUpdate=!0,e})),C=e=>(0,v.isBlob)(e.userData.blob)?e.userData.blob:(0,v.imgBitMapToBlob)(e.image),R=e=>{if(!e.userData.isHdr&&!e.isCubeTexture)return e.magFilter=1006,e.wrapS=s.Z.RepeatWrapping,e.wrapT=s.Z.RepeatWrapping,3001!==e.encoding&&(e.encoding=3e3),e.version=3,e.userData.flipY?e.flipY=!0:e.flipY=!1,"nearest"!==W(e)&&(e.minFilter=s.Z.LinearMipmapLinearFilter),e.needsUpdate=!0,e},L=(e,t)=>{let r={resizeQuality:"pixelated"};return null!=t&&t.flipY&&(r.imageOrientation="flipY"),createImageBitmap(e,r)},I=(e,t)=>S(void 0,void 0,void 0,(function*(){var r=yield L(yield X(e instanceof Blob?URL.createObjectURL(e):e),t);const n=new a.Texture(r);return n.needsUpdate=!0,n})),B=e=>null==(e=e.userData)?void 0:e.url,j=(e,t="repeat")=>(e.mapping="repeat"===t?s.Z.EquirectangularReflectionMapping:300,e.needsUpdate=!0,e),U=e=>{var{width:e,height:t}=e.image;return{width:e,height:t}},N=e=>null==e?void 0:e.isTexture,z=e=>0<(null==(e=e.userData.cloneSourceId)?void 0:e.length),F=e=>e.userData.cloneSourceId,V=(e,t)=>{e.userData.cloneSourceId=t},G=e=>{e.needsUpdate=!0},H=(e,t)=>{e.minFilter=s.Z["linear"===t?"LinearMipmapLinearFilter":"NearestFilter"],(0,l.M)(e,"minFilter",t),G(e)},W=e=>(0,l.is)(e,"minFilter"),K="unDelAble",q="unDelAbleRef",Z={is:e=>(0,l.is)(e,K),getRef:e=>(0,l.is)(e,q),set(e,t,r="custom",n){if(t)(0,l.M)(e,K,t),(0,l.M)(e,q,r);else{let t=!1;(t=!(!n&&(0,l.is)(e,q)!==r)||t)&&(delete e.userData[K],delete e.userData[q])}}},X=e=>{const t=document.createElement("img");return t.src=e,new Promise((e=>{t.addEventListener("load",(()=>{e(t)}))}))},Q=e=>{var t;return 0===(null==(t=e.userData.blob)?void 0:t.size)||void 0!==(null==(t=e.source)?void 0:t.data.width)&&(0===(null==(t=e.source)?void 0:t.data.width)||0===e.source.data.height)},Y=e=>e.isCubeTexture||!1,J=e=>S(void 0,void 0,void 0,(function*(){var t;return Y(e)?(t=(yield Promise.all($.map((t=>S(void 0,void 0,void 0,(function*(){return(0,v.getMd5)(yield e.userData.blobMap[t].arrayBuffer())})))))).reduce(((e,t)=>e+t)),(0,v.getMd5)(t)):(0,v.getMd5)(yield e.userData.blob.arrayBuffer())})),$=["px","nx","py","ny","pz","nz"],ee=(e,t)=>{e.encoding="def"===t?s.Z.LinearEncoding:s.Z.sRGBEncoding,e.needsUpdate=!0},te=e=>e.userData.isHdr?"hdr":e.isCubeTexture?"cube":void 0},6651:(e,t,r)=>{r.d(t,{ZP:()=>n,d9:()=>a});class n{constructor(e){this.undos=[],this.redos=[],this.dataMap={history:[],index:0},this.clean=()=>{this.reset()},this.runScene=e,this.runScene.cb.clean.add("Undo",this.clean)}undo(){if(0!==this.undos.length){const e=this.removeUndos(-1)[0];e&&(e instanceof Array?e.reverse().map((e=>e.undo())):e.undo(),this.redos.push(e),this.runScene.cb.undo.undo.cb({data:e}))}}addUndos(e){var t;return this.undos.push(e),t=this.dataMap.history.push(e),this.dataMap.index=this.undos.length-1,this.runScene.cb.undo.addUndos.cb({undoVal:e,undos:this.undos}),t}removeUndos(e){var t;return this.undos.splice(e),t=this.dataMap.history.splice(e),this.dataMap.index=this.undos.length-1,this.runScene.cb.undo.removeUndos.cb({index:e}),t}undoByIndex(e){e>this.dataMap.index?this.undos.slice(this.dataMap.index+1,e+1).map((e=>{e instanceof Array?e.map((e=>e.redo())):e.redo()})):e<this.dataMap.index&&this.undos.slice(e+1,this.dataMap.index+1).reverse().map((e=>{e instanceof Array?e.map((e=>e.undo())):e.undo()})),this.dataMap.index=e,this.runScene.cb.undo.undoByIndex.cb(e)}addUndo(e){this.dataMap.index!==this.undos.length&&this.removeUndos(this.dataMap.index+1),this.addUndos(e)}addRedo(e){this.redos.push(e)}redo(){if(0!==this.redos.length){const e=this.redos.splice(-1)[0];e&&(e instanceof Array?e.reverse().map((e=>e.redo())):e.redo(),this.addUndo(e),this.runScene.cb.undo.redo.cb({data:e}))}}reset(){this.undos=[],this.redos=[],this.dataMap.history=[],this.dataMap.index=0,this.runScene.cb.undo.reset.cb("")}}var a=function(e){if("object"!=typeof e)return e;if(null===e)return null;if(e){var t,r,n=new e.constructor;for(t in e)e.hasOwnProperty(t)&&(r=a(e[t]),n[t]=r);return n}}},4773:(e,t,r)=>{r.d(t,{Z:()=>a});var n=r(1269);class a{constructor(e){this.addTree=!0,this.isClone=!1,this.cb=(e,t)=>{};var{model:e,parent:t,cb:r,addTree:n,isClone:a,runScene:i}=e;this.runScene=i,this.model=e,this.parent=t,!1===n&&(this.addTree=n),!0===a&&(this.isClone=a),r&&(this.cb=r)}remove(e){const{model:t,parent:r,addTree:n,runScene:a}=e;a.modelEx.select===t&&a.modelEx.selectNull(),r.remove(t),n&&a.uniqueEx.model.remove(t),n&&a.cb.model.remove.cb({model:t,parent:r}),this.cb(t,"remove"),a.uniqueEx.material.addModel(t,void 0,t.material)}add(e){const{model:t,parent:r,addTree:a,isClone:i,runScene:s}=e;r.add(t),a&&s.uniqueEx.model.add(t),a&&s.cb.model.add.cb({model:t,parent:r,isClone:i}),this.cb(t,"add"),s.uniqueEx.material.addModel(t,t.material),(0,n.RQ)(t)&&setTimeout((()=>{this.runScene.lightEx.update(t)}))}}},4616:(e,t,r)=>{r.d(t,{Z:()=>n});class n{}},8024:(e,t,r)=>{r.d(t,{Z:()=>i});var n=r(4330);class a extends r(4616).Z{constructor(e){super(),this.isUndoMaterial=!0,this.type="修改材质";var{target:e,info:t,newVal:r,oldVal:n,runScene:a,cb:i}=e;this.runScene=a,this.target=e,this.info=t,this.newVal=r,this.oldVal=n,this.cb=i}_execute(e,t){if(this.target[this.info]=e,this.target.needsUpdate=!0,n.zX.includes(this.info)){if(!e)return;this.runScene.uniqueEx.texture.addMaterial(e,{material:this.target,type:this.info})}"depthWrite"===this.info&&!0===e&&delete this.target.userData[this.info],null!=(e=this.cb)&&e.call(this,this)}execute(){return this.redo(),this}undo(){this._execute(this.oldVal,this.newVal)}redo(){this._execute(this.newVal,this.oldVal)}}const i=a},3735:(e,t,r)=>{r.d(t,{Z:()=>i});var n=r(6001);class a extends r(4616).Z{constructor(e){super(),this.type="多层级修改",this.isUndoMultipLevel=!0,this.target=e.target,this.typeList=e.typeList,this.new=e.newVal,this.cb=e.cb,this.old=(0,n.objLastMap)(e.target,this.typeList)[(0,n.lastArrayEle)(e.typeList)]}execute(){return this.redo(),this}_execute(e){const t=(0,n.objLastMap)(this.target,this.typeList);t[(0,n.lastArrayEle)(this.typeList)]=e,this.cb&&this.cb(t),"shadow"!==this.typeList[0]&&this.typeList[1]}undo(){this._execute(this.old)}redo(){this._execute(this.new)}}const i=a},2510:(e,t,r)=>{r.d(t,{Z:()=>a});class n extends r(4616).Z{constructor(e){super(),this.type="修改属性",this.isUndoNormal=!0,this.cb=e=>{};var{target:e,info:t,oldVal:r,newVal:n,runScene:a,cb:i,executeCb:s}=e;this.runScene=a,this.target=e,this.info=t,this.newVal=n,this.oldVal=r,i&&(this.cb=i),s&&(this.executeCb=s)}_execute(e){var{target:t,info:r}=this;if(this.executeCb)return this.executeCb({target:t,info:r,val:e});this.target[this.info]=e,"name"===this.info&&this.target.isObject3D?(t=this.runScene.uniqueEx.model.parseName(this.target),r=e,this.runScene.cb.model.changeName.cb({model:this.target,name:e=t||e,oldName:r})):"material"===this.info?this.runScene.uniqueEx.material.addModel(this.target,e,e===this.newVal?this.oldVal:this.newVal):"visible"===this.info&&this.runScene.cb.model.setVisible.cb({model:this.target,visible:e}),this.runScene.cb.model.change.cb({type:this.info,model:this.target,val:e}),this.cb(this.target)}execute(){return this.redo(),this}undo(){this._execute(this.oldVal)}redo(){this._execute(this.newVal)}}const a=n},7169:(e,t,r)=>{r.d(t,{Z:()=>n});class n extends r(4773).Z{constructor(e){super(e),this.type="移除模型",this.isUndoRemove=!0}undo(){this.add({model:this.model,parent:this.parent,addTree:this.addTree,runScene:this.runScene})}redo(){this.remove({model:this.model,parent:this.parent,addTree:this.addTree,runScene:this.runScene})}_execute(e){return Promise.reject()}execute(){return this.redo(),this}}},4380:(e,t,r)=>{r.d(t,{Z:()=>a});class n extends r(4616).Z{constructor(e){super(),this.isUndoV3=!0,this.type="三维矩阵修改";var{target:e,info:t,newV3:r,oldV3:n,runScene:a}=e;this.target=e,this.info=t,this.runScene=a,this.newV3=r,this.oldV3=n,this.target.uuid===(null==(e=this.runScene.modelEx.select)?void 0:e.uuid)&&(this.runScene.cb.model.setSelect.cb(null),this.runScene.cb.model.setSelect.cb(this.target))}_execute(e){this.runScene.cb.model.setVector3.cb({type:this.info,model:this.target}),this.target[this.info].copy(e),this.target.uuid===(null==(e=this.runScene.modelEx.select)?void 0:e.uuid)&&this.runScene.helperEx.focus(this.target)}execute(e=!0){return e&&this.redo(),this}undo(){this._execute(this.oldV3)}redo(){this._execute(this.newV3)}}const a=n},3729:(e,t,r)=>{r.d(t,{ZP:()=>d,Ki:()=>p,x:()=>f});var n=r(6001),a=r(272),i=r(932);class s{constructor(e){this.map={},this.removes=[],this.unique=e}add(e,t,r){if(null!=e&&e.userData&&!i.materialIgnore.is(e)){let i=e.userData.id;if(i||(i=(0,n.getId)(),e.userData.id=i),this.map[i]){if(this.map[i].material.name!==e.name){const t=(0,n.getId)();e.userData.id=t,this.map[t]={material:e,models:new a.Z},this.unique.runScene.cb.unique.material.add.cb(e)}}else this.map[i]={material:e,models:new a.Z},this.unique.runScene.cb.unique.material.add.cb(e);t&&this.addModel(t,e,r)}}addModel(e,t,r){r&&t&&p(r)===p(t)||(null!=t&&t.userData&&(t=p(t),null!=(t=this.map[t])&&t.models.add(e)),r&&null!=(t=this.map[p(r)])&&t.models.delete(e))}each(e){return this.getAll("values").map((({material:t})=>e(t)))}getAll(e){return Object[e](this.map)}get(e){return null==(e=this.map[e])?void 0:e.material}getModels(e){return null==(e=this.map[e])?void 0:e.models}remove(e){delete this.map[e]}addRemoved(e){this.map[e.uuid]&&this.removes.push(e.uuid)}dispose(){(0,n.mapObj)(this.map,((e,t)=>{t.material.dispose()})),this.map={}}}var o=r(1269),l=r(6756),c=r(158);class u extends class{constructor(e){this.map={},this.unique=e}add(e){if(e instanceof Array)return e.map((e=>this.add(e)));let t=e.userData.id;return t||(t=(0,n.getId)(),e.userData.id=t),this.map[t]?void 0:(this.map[t]=e,t)}get(e){return this.map[e]}remove(e){if(e instanceof Array)return e.map((e=>this.remove(e)));delete this.map[e.userData.id]}}{constructor(){super(...arguments),this.nameMap={},this.parseName=(()=>{const e=e=>{var t=e.lastIndexOf("_");return-1===t?-1:(e=e.slice(t+1),n.type.isNumber(e)?Number.parseInt(e):-1)},t=(r,n)=>{var a=(t=>{if(-1===e(t))return t;var r=t.lastIndexOf("_");return-1===r?t:t.slice(0,r)})(r)+"_"+n++;return this.nameMap[a]?t(r,n):a},r=e=>Object.keys(this.nameMap).find((t=>this.nameMap[t]===e)),a=["PerspectiveCamera"];return n=>{if(a.includes(n.type))return n.name=n.type;let i=n.name;if(i=i||n.type,!this.nameMap[i])return s=this.unique.getId(n),(o=r(s))&&delete this.nameMap[o],void(this.nameMap[i]=s);var s,o=this.nameMap[i];return this.unique.model.get(o)!==n?(s=e(i),s=t(i,o=-1===s?0:s),this.nameMap[s]=this.unique.getId(n),n.name=s):void 0}})()}add(e,t){var{reset:r,hasReset:a}=t||{ignoreMaterial:!1};if(e instanceof Array)return e.map((e=>this.add(e,t)));if(e&&!(0,l.isHelper)(e)){let i=e.userData.id;if(i&&!r||(i=(0,n.getId)(),e.userData.id=i),this.map[i]){if(!(a||(0,c.An)(this.unique.runScene)&&(0,c.FW)(this.unique.runScene).coverSameId))return void(e.name!==this.map[i].name&&this.unique.runScene.optionsEx.log(`解析模型出错,${e.name} 与 ${this.map[i].name} 拥有相同的id,请选择任意一个模型导出并删除,并重新导入。`,"base","error"));i=(0,n.getId)(),e.userData.id=i}return this.unique.runScene.cb.unique.model.add.cb({model:e}),this.map[i]=e,this.parseName(e),e.material&&(this.unique.runScene.materialEx.parse(e.material),this.unique.material.add(e.material,e)),!e.children.length||(0,o.RQ)(e)||(0,l.isHelper)(e)?i:this.add(e.children,t)}}get(e){return this.map[e]}getModelsWithIds(e){return e.map((e=>this.get(e))).filter((e=>e))}getByName(e){return this.nameMap[e]}getIdByNames(e){return e.map((e=>this.getByName(e))).filter((e=>e))}remove(e){if(e instanceof Array)return e.map((e=>this.remove(e)));e.traverse((e=>{delete this.nameMap[e.name]})),delete this.map[e.userData.id]}dispose(){this.map={},this.nameMap={}}findModelWithName(e){var t=Object.keys(this.nameMap).filter((t=>{const r=t.toLowerCase();return r===(t=e.toLowerCase())||-1!==r.indexOf(t)}));return t=this.getIdByNames(t),this.getModelsWithIds(t)}}class h{constructor(e){this.map={},this.unique=e}add(e){if(e&&e.userData){if(e instanceof Array)return e.map((e=>this.add(e)));let t=e.userData.id;return t||(t=(0,n.getId)(),e.userData.id=t),this.map[t]?void 0:(this.map[t]={texture:e,materialMap:{}},t)}}getLength(){return Object.keys(this.map).length}addMaterial(e,t,r){var n,a=e.userData.id||this.add(e);t&&(({material:t,type:n}=t),this.map[a]||(this.map[a]={materialMap:{},texture:e}),this.map[a].materialMap[t.userData.id]||(this.map[a].materialMap[t.userData.id]=new Set),this.map[a].materialMap[t.userData.id].add(n)),r&&(({material:e,type:t}=r),this.map[a].materialMap[e.userData.id]&&this.map[a].materialMap[e.userData.id].delete(t))}get(e){return null==(e=this.map[e])?void 0:e.texture}getMaterials(e){return null==(e=this.map[e])?void 0:e.materialMap}remove(e){if(e instanceof Array)return e.map((e=>this.remove(e)));var t=this.map[e.userData.id];t&&((0,n.mapObj)(t.materialMap,((e,t)=>{const r=this.unique.runScene.uniqueEx.material.get(e);r&&t.forEach((e=>{r[e]=null}))})),delete this.map[e.userData.id])}dispose(){(0,n.mapObj)(this.map,((e,t)=>{t.texture.dispose()})),this.map={}}getAll(){return Object.values(this.map)}}class d{constructor(e){this.clean=()=>{this.dispose()},this.runScene=e,this.model=new u(this),this.material=new s(this),this.texture=new h(this),this.runScene.cb.clean.add("EngineModel",this.clean)}getId(e){return e.userData.id}dispose(){this.material.dispose(),this.model.dispose(),this.texture.dispose()}}const p=e=>(null==(e=null==e?void 0:e.userData)?void 0:e.id)||"",f=(e,t)=>{e.userData&&(e.userData.id=t)}},5317:(e,t,r)=>{r.r(t),r.d(t,{HextoRgb:()=>a.I8,LimitCb:()=>a.cM,MyHextoRgb:()=>a.Dn,addElesFromIndexToArr:()=>a.Rn,angleToNum:()=>i.Zv,anima:()=>a.gY,arrayBufferToBase64:()=>a.sM,arrayBufferToBlobUr:()=>a.oo,arrayToVector3:()=>i.F,base64ToArrayBuffer:()=>a.RG,base64ToBlob:()=>a.Jr,bitMapToCanvas:()=>n.Rd,blobToFile:()=>a.hl,bufferToArrayBuffer:()=>a.cO,canvasToBlob:()=>a._c,changeModelOpc:()=>i.Hg,changeModelOpcs:()=>i.Z7,clone:()=>a.d9,closeNum:()=>a.nx,colorToRgb:()=>i.sS,compressImgToUrl:()=>n.jH,deepFindParentByUuid:()=>i.Q3,deepMergeObject:()=>a.U,disposeCanvas:()=>n.eZ,disposeImageBitMap:()=>n.oZ,domTo2Dui:()=>i.UZ,domTo3DSprite:()=>i.YG,domTo3Dui:()=>i.ol,fileAndBlobToCanvas:()=>a.OE,fileToBlob:()=>a.a_,filterFiles:()=>a.Rz,fromCode:()=>a.Ne,getArrIndexByItem:()=>a.B1,getBetweenByV3:()=>i.A2,getBetweenDomByIdx:()=>l,getCamAnimaData:()=>i.Gm,getCenter:()=>i.qg,getClock:()=>i.aM,getColorByHex:()=>i.e9,getColorByHexStr:()=>i.ZD,getCurve:()=>i.kG,getDate:()=>a._3,getDiff:()=>a.ad,getDistance:()=>i.Sp,getDomChildrenByDom:()=>d,getEmptyImageData:()=>n.mH,getFilesByDataTransfer:()=>a.xl,getFilesFromFileList:()=>a.kk,getHexByColor:()=>i.J6,getIdxInParent:()=>o,getImg:()=>n.Pk,getImgByHdrTexture:()=>i.p1,getImgPixels:()=>n.BW,getImgPixels1:()=>n.Cm,getLine2:()=>i.SI,getMacro:()=>a.Ls,getMapByRgb:()=>a.fh,getMd5:()=>a.ZM,getModelByType:()=>i.Py,getModelMap:()=>i.yT,getNamesByNum:()=>a.nR,getOptions:()=>s.FW,getProgress:()=>a.xC,getRGBByHex:()=>i.OR,getRandomColor:()=>a.mr,getRes:()=>a.sR,getResultFromCanvas:()=>n.xK,getTime:()=>a.hK,getTruthBase64:()=>a.Mh,getType:()=>a.oL,getTypeByBase64:()=>a.Op,getTypeFromGlb:()=>s.te,getVideoTexture:()=>i.hX,getWorldLocal:()=>i.VU,hslToRgb:()=>n.ve,imageToBlob:()=>n.$N,imgArrayBufferToBlobUrl:()=>n.lU,imgBitMapToBase64:()=>n.s4,imgBitMapToBlob:()=>n.gW,imgBitMapToBlobAndBase64:()=>n.v1,isBlob:()=>a.Lj,isDef:()=>a.Xq,isEditor:()=>s.hz,isEmpty:()=>a.xb,isRunning:()=>s.An,isVisible:()=>i.pn,longestCommonPrefix:()=>a.GG,mapDom:()=>h,mergeObject:()=>a.Gm,percentageStrToNum:()=>a.zz,removeUnLess:()=>i.hs,resetCenter:()=>i.cm,reverseImageBitMap:()=>n.Fs,reverseImg:()=>n.rx,rgbToHex:()=>i.vq,rgbToHsl:()=>n.lC,rgbToStr:()=>i.$W,rgbaToRgb:()=>i.Di,rmArrEle:()=>a.J9,rmPartOfString:()=>a.h3,sameArr:()=>a.F1,sameV3:()=>i.x$,setDisplayForDom:()=>p,setParentVisible:()=>i.FT,strToNum:()=>a.LC,tColorToRgb:()=>i.Lv,textureToThreeD:()=>i.vp,toCode:()=>a.Ni,toInt:()=>a.Hq,toTimeString:()=>a.U9,transByte:()=>a.iM,typeAnima:()=>u,urlToBlob:()=>a.pX,urlToCanvas:()=>a.o4,v3ToMap:()=>i.ln,validType:()=>a.lG,vector:()=>i.xr});var n=r(5137),a=r(6272),i=r(8089),s=r(158);const o=e=>[...e.parentElement.children].findIndex((t=>t===e)),l=e=>{var{dom:e,beginIdx:t,endIdx:r}=e;return[...e.children].slice(t,r+1)};var c=r(8881);const u=(e,t,r)=>{const{}=r||{},n={},i={};e.map(((e,t)=>{const{begin:r,end:s,type:o,label:l}=e,u="_"+o+"_"+l+"_"+String(t);if("color"===o&&r instanceof c.Color&&s instanceof c.Color){const e=(0,a.I8)("#"+r.getHexString(),!0),t=(0,a.I8)("#"+s.getHexString(),!0);["r","g","b"].map((r=>{var a=r+u;n[a]=e[r],i[a]=t[r]}))}"number"===o&&(n[e=l+u]=r,i[e]=s),"vector3"===o&&["x","y","z"].map((e=>{var t=e+u;n[t]=r[e],i[t]=s[e]})),"vector2"===o&&["x","y"].map((e=>{var t=e+u;n[t]=r[e],i[t]=s[e]}))}))},h=(u([{begin:new c.Color(.5,.5,.5),end:new c.Color(0,0,0),label:"color",type:"color"},{begin:1,end:2,label:"a",type:"number"},{begin:new c.Vector3(1,1,1),end:new c.Vector3(2,2,2),label:"b",type:"vector3"},{begin:new c.Vector2(1,1),end:new c.Vector2(2,2),label:"c",type:"vector2"}],1),(e,t)=>[...e.childNodes].map((e=>t(e)))),d=(e,t)=>t?[...e.childNodes]:[...e.children],p=(e,t)=>{var r;t=t?"block":"none",(null==(r=e.style)?void 0:r.display)!==t&&(console.log(t,"str"),e.style.display=t)}},5137:(e,t,r)=>{r.d(t,{$N:()=>c,BW:()=>m,Cm:()=>f,Fs:()=>w,Pk:()=>y,Rd:()=>g,eZ:()=>S,gW:()=>l,jH:()=>p,lC:()=>v,lU:()=>d,mH:()=>T,oZ:()=>M,rx:()=>u,s4:()=>o,v1:()=>h,ve:()=>b,xK:()=>x});var n=r(5247),a=r(898),i=r(6272),s=function(e,t,r,n){return new(r=r||Promise)((function(a,i){function s(e){try{l(n.next(e))}catch(e){i(e)}}function o(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?a(e.value):((t=e.value)instanceof r?t:new r((function(e){e(t)}))).then(s,o)}l((n=n.apply(e,t||[])).next())}))};const o=e=>{const t=document.createElement("canvas");return(t.width=e.width,t.height=e.height,t.getContext("2d")).drawImage(e,0,0,t.width,t.height),t.toDataURL()},l=e=>s(void 0,void 0,void 0,(function*(){const t=document.createElement("canvas");return(t.width=e.width,t.height=e.height,t.getContext("2d")).drawImage(e,0,0,t.width,t.height),new Promise((e=>{t.toBlob((t=>{e(t)}))}))})),c=e=>s(void 0,void 0,void 0,(function*(){const t=document.createElement("canvas");return(t.width=e.width,t.height=e.height,t.getContext("2d")).drawImage(e,0,0,t.width,t.height),new Promise((e=>{t.toBlob((t=>{e(t)}))}))})),u=e=>{const t=document.createElement("canvas"),r=(t.width=e.width,t.height=e.height,t.getContext("2d"));r.translate(0,t.height),r.scale(1,-1),r.drawImage(e,0,0,t.width,t.height)},h=e=>s(void 0,void 0,void 0,(function*(){var t=e.image;const r=document.createElement("canvas"),n=(r.width=t.width,r.height=t.height,r.getContext("2d")),i=(0,a.getMimeByTexture)(e);return n.drawImage(t,0,0,r.width,r.height),new Promise((e=>{r.toBlob((t=>{e({blob:t,base64:r.toDataURL(i)})}),i)}))})),d=(e,t)=>URL.createObjectURL(new Blob([e],t)),p=(e,t)=>{const r=document.createElement("canvas"),n=r.getContext("2d");return r.width=e.width,r.height=e.height,n.drawImage(e,0,0,e.width,e.height),new Promise((e=>{r.toBlob((t=>{t&&e(URL.createObjectURL(t))}),"image/webp",t)}))},f=e=>s(void 0,void 0,void 0,(function*(){var{bitmap:t,texture:r}=e;const{ctx:a,canvas:s}=yield(0,i.OE)(URL.createObjectURL(r.userData.blob),{width:t.width,height:t.height});for(var o=a.getImageData(0,0,t.width,t.height,{colorSpace:"srgb"}),l=0,c=o.data.length;l<c;l+=4){var u=(d=v(o.data[l],o.data[l+1],o.data[l+2]))[0]/100,h=d[1]/100,d=d[2]/100;u=b(u,h,d),o.data[l]=u[0],o.data[l+1]=u[1],o.data[l+2]=u[2]}return a.putImageData(o,0,0),new n.Z.Texture(s)})),m=e=>{for(var t=(e=e.bitmap).width,r=e.height,n=g(e).ctx.getImageData(0,0,t,r).data,a=[],i=0;i<n/4;i+=1)a.push(n.slice(4*i,4*(i+1)))},g=e=>{const t=document.createElement("canvas"),r=t.getContext("2d");return r.drawImage(e,0,0,e.width,e.height),{ctx:r,canvas:t}},v=(e,t,r)=>{e/=255,t/=255,r/=255;var n,a=Math.max(e,t,r),i=Math.min(e,t,r),s=(a+i)/2;if(a==i)n=l=0;else{var o=a-i,l=.5<s?o/(2-a-i):o/(a+i);switch(a){case e:n=(t-r)/o+(t<r?6:0);break;case t:n=(r-e)/o+2;break;case r:n=(e-t)/o+4}n/=6}return[100*n,100*l,100*s]},b=(e,t,r)=>{var n,a,i,s;return 0==t?a=i=s=r:(a=(n=function(e,t,r){return r<0&&(r+=1),1<r&&--r,r<1/6?e+6*(t-e)*r:r<.5?t:r<2/3?e+(t-e)*(2/3-r)*6:e})(t=2*r-(r=r<.5?r*(1+t):r+t-r*t),r,e+1/3),i=n(t,r,e),s=n(t,r,e-1/3)),[255*a,255*i,255*s]},y=e=>{const t=new Image;return t.src=e,new Promise((e=>{t.onload=()=>{e(t)}}))},x=(e,t,r)=>{const n=(0,i.Gm)({base64Type:"webp"},r).base64Type;return new Promise(((r,a)=>{"blob"===t?e.toBlob((e=>{(e?r:a)(e)})):"base64"===t&&r(e.toDataURL("image/"+n))}))},w=e=>s(void 0,void 0,void 0,(function*(){var{width:t,height:r}=e;const n=document.createElement("canvas"),a=(n.width=t,n.height=r,n.getContext("2d"));if(a)return a.translate(0,r),a.scale(1,-1),a.drawImage(e,0,0,t,r),{imageBitMap:yield createImageBitmap(a.getImageData(0,0,t,r)),canvas:n}})),S=e=>{e.remove()},M=e=>{e.close()},T=e=>{var{width:e,height:t}=e;const r=document.createElement("canvas");return(r.width=e,r.height=t,r.getContext("2d")).drawImage(new Image,0,0),r}},6272:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{B1:()=>getArrIndexByItem,Dn:()=>MyHextoRgb,F1:()=>sameArr,GG:()=>longestCommonPrefix,Gm:()=>mergeObject,Hq:()=>toInt,I8:()=>HextoRgb,J9:()=>rmArrEle,Jr:()=>base64ToBlob,LC:()=>strToNum,Lj:()=>isBlob,Ls:()=>getMacro,Mh:()=>getTruthBase64,Ne:()=>fromCode,Ni:()=>toCode,OE:()=>fileAndBlobToCanvas,Op:()=>getTypeByBase64,RG:()=>base64ToArrayBuffer,Rn:()=>addElesFromIndexToArr,Rz:()=>filterFiles,U:()=>deepMergeObject,U9:()=>toTimeString,Xq:()=>isDef,ZM:()=>getMd5,_3:()=>getDate,_c:()=>canvasToBlob,a_:()=>fileToBlob,ad:()=>getDiff,cM:()=>LimitCb,cO:()=>bufferToArrayBuffer,d9:()=>clone,fh:()=>getMapByRgb,gY:()=>anima,h3:()=>rmPartOfString,hK:()=>getTime,hl:()=>blobToFile,iM:()=>transByte,kk:()=>getFilesFromFileList,lG:()=>validType,mr:()=>getRandomColor,nR:()=>getNamesByNum,nx:()=>closeNum,o4:()=>urlToCanvas,oL:()=>getType,oo:()=>arrayBufferToBlobUr,pX:()=>urlToBlob,sM:()=>arrayBufferToBase64,sR:()=>getRes,xC:()=>getProgress,xb:()=>isEmpty,xl:()=>getFilesByDataTransfer,zz:()=>percentageStrToNum});var _allex_md5__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(1129),_allex_md5__WEBPACK_IMPORTED_MODULE_0___default=__webpack_require__.n(_allex_md5__WEBPACK_IMPORTED_MODULE_0__),axios__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(3300),axios__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(axios__WEBPACK_IMPORTED_MODULE_1__),js_funcs__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(6001),js_funcs__WEBPACK_IMPORTED_MODULE_2___default=__webpack_require__.n(js_funcs__WEBPACK_IMPORTED_MODULE_2__),_libs_Anima__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(2958),_Ex_Ex__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__(3263),_UtilsImage__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__(5137),__awaiter=function(e,t,r,n){return new(r=r||Promise)((function(a,i){function s(e){try{l(n.next(e))}catch(e){i(e)}}function o(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?a(e.value):((t=e.value)instanceof r?t:new r((function(e){e(t)}))).then(s,o)}l((n=n.apply(e,t||[])).next())}))};const anima=(e,t,r,n,a)=>{let i=Object.assign({},e),s=new _libs_Anima__WEBPACK_IMPORTED_MODULE_3__.Q3(i,r,t).eventCallback("onUpdate",(e=>n&&n(i))).eventCallback("onComplete",(e=>{a&&a(),_libs_Anima__WEBPACK_IMPORTED_MODULE_3__.Q3.killTweensOf(s)}));return s},base64ToArrayBuffer=e=>__awaiter(void 0,void 0,void 0,(function*(){-1!==e.indexOf(",")&&(e=getTruthBase64(e));const t=window.atob(e);var r=t.length;const n=new Uint8Array(r);for(let e=0;e<r;e++)n[e]=t.charCodeAt(e);return n.buffer})),getTruthBase64=e=>e.substring(e.indexOf(",")+1),arrayBufferToBlobUr=e=>URL.createObjectURL(new Blob([e])),arrayBufferToBase64=e=>{let t="";var r=new Uint8Array(e);for(let e=0,n=r.byteLength;e<n;e++)t+=String.fromCharCode(r[e]);return"data:image/jpg;base64,"+window.btoa(t)},urlToBlob=e=>__awaiter(void 0,void 0,void 0,(function*(){return(yield axios__WEBPACK_IMPORTED_MODULE_1___default().get(e,{responseType:"blob"})).data})),base64ToBlob=e=>{let t=e.split(","),r=t[0].match(/:(.*?);/)[1],n=atob(t[1]),a=n.length,i=new Uint8Array(a);for(;a--;)i[a]=n.charCodeAt(a);return new Blob([i],{type:r})},fileToBlob=e=>__awaiter(void 0,void 0,void 0,(function*(){return base64ToBlob(yield(0,js_funcs__WEBPACK_IMPORTED_MODULE_2__.parseFile)(e,"base64"))})),blobToFile=(e,t)=>new File([e],t),getTypeByBase64=e=>e.substring(e.indexOf(":")+1,e.indexOf(";")),transByte=e=>{let t="";const r=t=e<102.4?e.toFixed(2)+"B":e<1048576?(e/1024).toFixed(2)+"KB":e<1073741824?(e/1048576).toFixed(2)+"M":(e/1073741824).toFixed(2)+"G";return e=r.indexOf("."),"00"==r.substr(e+1,2)?r.substring(0,e)+r.substr(e+3,2):t},getMd5=e=>(0,_allex_md5__WEBPACK_IMPORTED_MODULE_0__.md5)(e),fileAndBlobToCanvas=(e,t)=>{var{width:t,height:r}=t;let n=new Image,a=(n.src=e,n.width=t,n.height=r,document.createElement("canvas")),i=(a.width=t,a.height=r,a.getContext("2d"));return new Promise((e=>{n.onload=function(){i.drawImage(n,0,0,a.width,a.height),e({canvas:a,ctx:i})}}))},getFilesByDataTransfer=e=>new Array(e.files.length).fill(0).map(((t,r)=>e.files.item(r))).filter((e=>null!==e)),canvasToBlob=e=>new Promise((t=>{e.toBlob((e=>{t(e)}))})),getRes=(e,t)=>axios__WEBPACK_IMPORTED_MODULE_1___default().get(e,{responseType:t||"arraybuffer"}).then((e=>e.data)).catch((e=>{console.log(e,"加载出错")})),mergeObject=(e,t)=>Object.assign(e,t||{}),getMacro=(e,t=0)=>{let r=setTimeout((()=>(null!==r&&clearTimeout(r),r=null,e())),t)},clone=e=>{if(null===e)return null;if("object"!=typeof e)return e;var t,r,n=new e.constructor;for(t in e)e.hasOwnProperty(t)&&(r=e[t],n[t]=r);return n},getNamesByNum=(e,t,r=1,n)=>new Array(t).fill("").map(((t,a)=>e+(a+r)+(n||""))),getType=e=>null==e?void 0:e.toString().replace(/(\[object )([a-zA-Z]+)(])/,"$2"),deepMergeObject=(e,t)=>((0,js_funcs__WEBPACK_IMPORTED_MODULE_2__.mapObj)(e,((r,n)=>{let a=t[r];void 0!==a&&("Object"===getType(n)&&"Object"===getType(a)&&(a=deepMergeObject(n,a)),e[r]=a)})),e),getArrIndexByItem=(e,t)=>e.find((e=>e===t)),getProgress=(e,t,r=!1)=>{let n=e/t;return r&&(n*=100),Number(n.toFixed(2))},urlToCanvas=e=>__awaiter(void 0,void 0,void 0,(function*(){if(!e)throw TypeError("该参数为空");var t=yield(0,_UtilsImage__WEBPACK_IMPORTED_MODULE_5__.Pk)(e);const r=document.createElement("canvas"),n=(r.width=t.width,r.height=t.height,r.getContext("2d"));return n.drawImage(t,0,0),{img:t,canvas:r,ctx:n}})),bufferToArrayBuffer=e=>{for(var t=new ArrayBuffer(e.length),r=new Uint8Array(t),n=0;n<e.length;++n)r[n]=e[n];return t},isEmpty=e=>null==e||(Array.isArray(e)||"string"==typeof e?0===e.length:"number"==typeof e?0===e:"object"==typeof e?0===Object.keys(e).length:void 0),isBlob=e=>e&&e instanceof Blob,getTime=e=>{const t=new Date;return t.setTime(t.getTime()+864e5*e),t.getTime()},key="gltf-version-2.0",toCode=e=>{for(var t,r,n=key.length,a=key.split(""),i="",s=0;s<e.length;s++)i+=a[((r=((r=e.charCodeAt(s))-(t=r%n))/n)-(r%=n))/n%n]+a[r]+a[t];return i},fromCode=str=>{for(var st=key.length,b,b1,b2,b3,d=0,s,s=new Array(Math.floor(str.length/3)),b=s.length,i=0;i<b;i++)b1=key.indexOf(str.charAt(d)),d++,b2=key.indexOf(str.charAt(d)),d++,b3=key.indexOf(str.charAt(d)),d++,s[i]=b1*st*st+b2*st+b3;return b=eval("String.fromCharCode("+s.join(",")+")"),b},getFilesFromFileList=e=>{const t=[];for(let n=0;n<e.length;n++){var r=e.item(n);t.push(r)}return t},filterFiles=(e,t)=>"any"===t?e:e.filter((e=>-1!==e.type.indexOf(t))),toTimeString=e=>{if(e)return e.getFullYear()+"/"+(e.getMonth()+1)+"/"+e.getDate()},rmPartOfString=(e,t)=>e.replace(new RegExp(t),""),rmArrEle=(e,t)=>{var r=e.findIndex((e=>e===t));if(-1!==r)return e.splice(r,1),r},addElesFromIndexToArr=(e,t,r)=>(t=Array.isArray(t)?t:[t],e.splice(r,0,...t)),sameArr=(e,t,r)=>{if("fill"===r){for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}var n=e.length;const a=Math.floor(n/r),i=new Array(r).fill("").map(((e,t)=>(t+1)*a));i.push(0),i.push(n-1);for(const r of i)if(e[r]!==t[r])return!1;return!0};class LimitCb{constructor(){this.timer=0}update(e){const{cb:t,now:r,cbRate:n}=e;this.timer+=r,this.timer>n&&(t(),this.timer=0)}}const longestCommonPrefix=e=>{if(0==e.length)return"";for(var t=e[0],r="",n=1;n<e.length;n++){for(var a=0;a<=e[n].length;a++){if(t[a]!=e[n][a]){t=r;break}r+=t[a]}r=""}return t},getRandomColor=()=>{let e=[];for(let t=0;t<3;++t){let t=Math.floor(256*Math.random()).toString(16);t=1==t.length?"0"+t:t,e.push(t)}return"#"+e.join("")},validType=(e,t)=>{var r;return"number"===t?(r=Number(e),!isNaN(r)):"array"===t?Array.isArray(e):void 0},isDef=(e,t)=>e instanceof Array?_Ex_Ex__WEBPACK_IMPORTED_MODULE_4__.F6.isDef(e,t):_Ex_Ex__WEBPACK_IMPORTED_MODULE_4__.YD.is(e)&&_Ex_Ex__WEBPACK_IMPORTED_MODULE_4__.YD.is(t)?_Ex_Ex__WEBPACK_IMPORTED_MODULE_4__.YD.isDef(e,t):e!==t,strToNum=e=>{if(e=e.replace(/[^\d]/g,""),e=Number(e),isNaN(e))throw TypeError("类型错误");return e},rgbArr=["r","g","b"],getMapByRgb=e=>{var t=e.split(",");const r={r:0,g:0,b:0};for(let e=0;e<rgbArr.length;e++){var n=rgbArr[e],a=t[e];if(!a)return;a=strToNum(a),r[n]=a}return r};function HextoRgb(e,t){if(-1!==e.toLocaleLowerCase().indexOf("rgb"))return e;if(/^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/.test(e)){if(4===e.length){for(var r="#",n=1;n<4;n+=1)r+=e.slice(n,n+1).concat(e.slice(n,n+1));e=r}var a,i,s=[];for(n=1;n<7;n+=2)s.push(parseInt("0x"+e.slice(n,n+2)));return t?([t,a,i]=s,{r:t,g:a,b:i}):"RGB("+s.join(",")+")"}return e}const getDiff=(e,t,r=0)=>{const n={};return t?((0,js_funcs__WEBPACK_IMPORTED_MODULE_2__.mapObj)(e,((e,r)=>{var a=t[e];isDef(r,a)&&(n[e]=a)})),n):e};function MyHextoRgb(e,t){if(-1!==(e=e.toLocaleLowerCase().slice(1)).indexOf("rgb"))return e;var[e,r,n,a,i,s]=e.split(""),r=(e=parseInt("0x"+e+r),parseInt("0x"+n+a)),n=parseInt("0x"+i+s);return t?{r:e,g:r,b:n}:"RGB("+e+","+r+","+n+")"}const getDate=e=>{const t=new Date(e);return t.getFullYear()+"/"+String(t.getMonth()+1).padStart(2,"0")+"/"+String(t.getDate()).padStart(2,"0")},percentageStrToNum=e=>(e=Number(e.replace(/%/,"")),isNaN(e)?-1:.01*e),toInt=e=>parseInt(String(e)),closeNum=(e,t,r)=>e<t+r&&t-r<e},158:(e,t,r)=>{r.d(t,{An:()=>i,FW:()=>s,hz:()=>a,te:()=>n});const n=e=>{},a=e=>"editor"===e.optionsEx.options.mode,i=e=>"running"===e.optionsEx.options.mode,s=e=>e.optionsEx.options},8089:(e,t,r)=>{r.d(t,{Zv:()=>he,F:()=>ce,Hg:()=>ne,Z7:()=>ae,sS:()=>Me,Q3:()=>Pe,UZ:()=>te,YG:()=>re,ol:()=>ee,A2:()=>fe,Gm:()=>pe,qg:()=>De,aM:()=>me,e9:()=>ge,ZD:()=>ve,kG:()=>le,Sp:()=>$,J6:()=>be,p1:()=>je,SI:()=>ue,Py:()=>Oe,yT:()=>de,OR:()=>ye,hX:()=>oe,VU:()=>Y,pn:()=>Ce,hs:()=>se,cm:()=>Re,vq:()=>_e,$W:()=>we,Di:()=>Te,x$:()=>xe,FT:()=>Ae,Lv:()=>Se,vp:()=>ie,ln:()=>Ee,xr:()=>J});var n=r(8881);function a(e){return(a="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})(e)}function i(e,t){return(i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function s(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=o(e);if(r=t?(r=o(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===a(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function o(e){return(o=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var l=new n.Box3,c=new n.Vector3,u=function(e){var t=a;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&i(t,e);var r=s(a);function a(){var e;if(!(this instanceof a))throw new TypeError("Cannot call a class as a function");return(e=r.call(this)).isLineSegmentsGeometry=!0,e.type="LineSegmentsGeometry",e.setIndex([0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5]),e.setAttribute("position",new n.Float32BufferAttribute([-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],3)),e.setAttribute("uv",new n.Float32BufferAttribute([-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],2)),e}return t=a,(e=[{key:"applyMatrix4",value:function(e){var t=this.attributes.instanceStart,r=this.attributes.instanceEnd;return void 0!==t&&(t.applyMatrix4(e),r.applyMatrix4(e),t.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}},{key:"setPositions",value:function(e){var t;return e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e)),e=new n.InstancedInterleavedBuffer(t,6,1),this.setAttribute("instanceStart",new n.InterleavedBufferAttribute(e,3,0)),this.setAttribute("instanceEnd",new n.InterleavedBufferAttribute(e,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this}},{key:"setColors",value:function(e){var t;return e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e)),e=new n.InstancedInterleavedBuffer(t,6,1),this.setAttribute("instanceColorStart",new n.InterleavedBufferAttribute(e,3,0)),this.setAttribute("instanceColorEnd",new n.InterleavedBufferAttribute(e,3,3)),this}},{key:"fromWireframeGeometry",value:function(e){return this.setPositions(e.attributes.position.array),this}},{key:"fromEdgesGeometry",value:function(e){return this.setPositions(e.attributes.position.array),this}},{key:"fromMesh",value:function(e){return this.fromWireframeGeometry(new n.WireframeGeometry(e.geometry)),this}},{key:"fromLineSegments",value:function(e){return e=e.geometry,this.setPositions(e.attributes.position.array),this}},{key:"computeBoundingBox",value:function(){null===this.boundingBox&&(this.boundingBox=new n.Box3);var e=this.attributes.instanceStart,t=this.attributes.instanceEnd;void 0!==e&&void 0!==t&&(this.boundingBox.setFromBufferAttribute(e),l.setFromBufferAttribute(t),this.boundingBox.union(l))}},{key:"computeBoundingSphere",value:function(){null===this.boundingSphere&&(this.boundingSphere=new n.Sphere),null===this.boundingBox&&this.computeBoundingBox();var e=this.attributes.instanceStart,t=this.attributes.instanceEnd;if(void 0!==e&&void 0!==t){for(var r=this.boundingSphere.center,a=(this.boundingBox.getCenter(r),0),i=0,s=e.count;i<s;i++)c.fromBufferAttribute(e,i),a=Math.max(a,r.distanceToSquared(c)),c.fromBufferAttribute(t,i),a=Math.max(a,r.distanceToSquared(c));this.boundingSphere.radius=Math.sqrt(a),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}},{key:"toJSON",value:function(){}},{key:"applyMatrix",value:function(e){return console.warn("THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4()."),this.applyMatrix4(e)}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),a}(n.InstancedBufferGeometry);function h(e){return(h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function d(e,t){return(d=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function p(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function f(e){return(f=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}n.UniformsLib.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new n.Vector2(1,1)},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}},n.ShaderLib.line={uniforms:n.UniformsUtils.merge([n.UniformsLib.common,n.UniformsLib.fog,n.UniformsLib.line]),vertexShader:"\n\t\t#include <common>\n\t\t#include <color_pars_vertex>\n\t\t#include <fog_pars_vertex>\n\t\t#include <logdepthbuf_pars_vertex>\n\t\t#include <clipping_planes_pars_vertex>\n\n\t\tuniform float linewidth;\n\t\tuniform vec2 resolution;\n\n\t\tattribute vec3 instanceStart;\n\t\tattribute vec3 instanceEnd;\n\n\t\tattribute vec3 instanceColorStart;\n\t\tattribute vec3 instanceColorEnd;\n\n\t\t#ifdef WORLD_UNITS\n\n\t\t\tvarying vec4 worldPos;\n\t\t\tvarying vec3 worldStart;\n\t\t\tvarying vec3 worldEnd;\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvarying vec2 vUv;\n\n\t\t\t#endif\n\n\t\t#else\n\n\t\t\tvarying vec2 vUv;\n\n\t\t#endif\n\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashScale;\n\t\t\tattribute float instanceDistanceStart;\n\t\t\tattribute float instanceDistanceEnd;\n\t\t\tvarying float vLineDistance;\n\n\t\t#endif\n\n\t\tvoid trimSegment( const in vec4 start, inout vec4 end ) {\n\n\t\t\t// trim end segment so it terminates between the camera plane and the near plane\n\n\t\t\t// conservative estimate of the near plane\n\t\t\tfloat a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column\n\t\t\tfloat b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column\n\t\t\tfloat nearEstimate = - 0.5 * b / a;\n\n\t\t\tfloat alpha = ( nearEstimate - start.z ) / ( end.z - start.z );\n\n\t\t\tend.xyz = mix( start.xyz, end.xyz, alpha );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\t#ifdef USE_COLOR\n\n\t\t\t\tvColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd;\n\n\t\t\t#endif\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd;\n\t\t\t\tvUv = uv;\n\n\t\t\t#endif\n\n\t\t\tfloat aspect = resolution.x / resolution.y;\n\n\t\t\t// camera space\n\t\t\tvec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );\n\t\t\tvec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\tworldStart = start.xyz;\n\t\t\t\tworldEnd = end.xyz;\n\n\t\t\t#else\n\n\t\t\t\tvUv = uv;\n\n\t\t\t#endif\n\n\t\t\t// special case for perspective projection, and segments that terminate either in, or behind, the camera plane\n\t\t\t// clearly the gpu firmware has a way of addressing this issue when projecting into ndc space\n\t\t\t// but we need to perform ndc-space calculations in the shader, so we must address this issue directly\n\t\t\t// perhaps there is a more elegant solution -- WestLangley\n\n\t\t\tbool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column\n\n\t\t\tif ( perspective ) {\n\n\t\t\t\tif ( start.z < 0.0 && end.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( start, end );\n\n\t\t\t\t} else if ( end.z < 0.0 && start.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( end, start );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// clip space\n\t\t\tvec4 clipStart = projectionMatrix * start;\n\t\t\tvec4 clipEnd = projectionMatrix * end;\n\n\t\t\t// ndc space\n\t\t\tvec3 ndcStart = clipStart.xyz / clipStart.w;\n\t\t\tvec3 ndcEnd = clipEnd.xyz / clipEnd.w;\n\n\t\t\t// direction\n\t\t\tvec2 dir = ndcEnd.xy - ndcStart.xy;\n\n\t\t\t// account for clip-space aspect ratio\n\t\t\tdir.x *= aspect;\n\t\t\tdir = normalize( dir );\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\t// get the offset direction as perpendicular to the view vector\n\t\t\t\tvec3 worldDir = normalize( end.xyz - start.xyz );\n\t\t\t\tvec3 offset;\n\t\t\t\tif ( position.y < 0.5 ) {\n\n\t\t\t\t\toffset = normalize( cross( start.xyz, worldDir ) );\n\n\t\t\t\t} else {\n\n\t\t\t\t\toffset = normalize( cross( end.xyz, worldDir ) );\n\n\t\t\t\t}\n\n\t\t\t\t// sign flip\n\t\t\t\tif ( position.x < 0.0 ) offset *= - 1.0;\n\n\t\t\t\tfloat forwardOffset = dot( worldDir, vec3( 0.0, 0.0, 1.0 ) );\n\n\t\t\t\t// don't extend the line if we're rendering dashes because we\n\t\t\t\t// won't be rendering the endcaps\n\t\t\t\t#ifndef USE_DASH\n\n\t\t\t\t\t// extend the line bounds to encompass endcaps\n\t\t\t\t\tstart.xyz += - worldDir * linewidth * 0.5;\n\t\t\t\t\tend.xyz += worldDir * linewidth * 0.5;\n\n\t\t\t\t\t// shift the position of the quad so it hugs the forward edge of the line\n\t\t\t\t\toffset.xy -= dir * forwardOffset;\n\t\t\t\t\toffset.z += 0.5;\n\n\t\t\t\t#endif\n\n\t\t\t\t// endcaps\n\t\t\t\tif ( position.y > 1.0 || position.y < 0.0 ) {\n\n\t\t\t\t\toffset.xy += dir * 2.0 * forwardOffset;\n\n\t\t\t\t}\n\n\t\t\t\t// adjust for linewidth\n\t\t\t\toffset *= linewidth * 0.5;\n\n\t\t\t\t// set the world position\n\t\t\t\tworldPos = ( position.y < 0.5 ) ? start : end;\n\t\t\t\tworldPos.xyz += offset;\n\n\t\t\t\t// project the worldpos\n\t\t\t\tvec4 clip = projectionMatrix * worldPos;\n\n\t\t\t\t// shift the depth of the projected points so the line\n\t\t\t\t// segments overlap neatly\n\t\t\t\tvec3 clipPose = ( position.y < 0.5 ) ? ndcStart : ndcEnd;\n\t\t\t\tclip.z = clipPose.z * clip.w;\n\n\t\t\t#else\n\n\t\t\t\tvec2 offset = vec2( dir.y, - dir.x );\n\t\t\t\t// undo aspect ratio adjustment\n\t\t\t\tdir.x /= aspect;\n\t\t\t\toffset.x /= aspect;\n\n\t\t\t\t// sign flip\n\t\t\t\tif ( position.x < 0.0 ) offset *= - 1.0;\n\n\t\t\t\t// endcaps\n\t\t\t\tif ( position.y < 0.0 ) {\n\n\t\t\t\t\toffset += - dir;\n\n\t\t\t\t} else if ( position.y > 1.0 ) {\n\n\t\t\t\t\toffset += dir;\n\n\t\t\t\t}\n\n\t\t\t\t// adjust for linewidth\n\t\t\t\toffset *= linewidth;\n\n\t\t\t\t// adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...\n\t\t\t\toffset /= resolution.y;\n\n\t\t\t\t// select end\n\t\t\t\tvec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;\n\n\t\t\t\t// back to clip space\n\t\t\t\toffset *= clip.w;\n\n\t\t\t\tclip.xy += offset;\n\n\t\t\t#endif\n\n\t\t\tgl_Position = clip;\n\n\t\t\tvec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation\n\n\t\t\t#include <logdepthbuf_vertex>\n\t\t\t#include <clipping_planes_vertex>\n\t\t\t#include <fog_vertex>\n\n\t\t}\n\t\t",fragmentShader:"\n\t\tuniform vec3 diffuse;\n\t\tuniform float opacity;\n\t\tuniform float linewidth;\n\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashOffset;\n\t\t\tuniform float dashSize;\n\t\t\tuniform float gapSize;\n\n\t\t#endif\n\n\t\tvarying float vLineDistance;\n\n\t\t#ifdef WORLD_UNITS\n\n\t\t\tvarying vec4 worldPos;\n\t\t\tvarying vec3 worldStart;\n\t\t\tvarying vec3 worldEnd;\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvarying vec2 vUv;\n\n\t\t\t#endif\n\n\t\t#else\n\n\t\t\tvarying vec2 vUv;\n\n\t\t#endif\n\n\t\t#include <common>\n\t\t#include <color_pars_fragment>\n\t\t#include <fog_pars_fragment>\n\t\t#include <logdepthbuf_pars_fragment>\n\t\t#include <clipping_planes_pars_fragment>\n\n\t\tvec2 closestLineToLine(vec3 p1, vec3 p2, vec3 p3, vec3 p4) {\n\n\t\t\tfloat mua;\n\t\t\tfloat mub;\n\n\t\t\tvec3 p13 = p1 - p3;\n\t\t\tvec3 p43 = p4 - p3;\n\n\t\t\tvec3 p21 = p2 - p1;\n\n\t\t\tfloat d1343 = dot( p13, p43 );\n\t\t\tfloat d4321 = dot( p43, p21 );\n\t\t\tfloat d1321 = dot( p13, p21 );\n\t\t\tfloat d4343 = dot( p43, p43 );\n\t\t\tfloat d2121 = dot( p21, p21 );\n\n\t\t\tfloat denom = d2121 * d4343 - d4321 * d4321;\n\n\t\t\tfloat numer = d1343 * d4321 - d1321 * d4343;\n\n\t\t\tmua = numer / denom;\n\t\t\tmua = clamp( mua, 0.0, 1.0 );\n\t\t\tmub = ( d1343 + d4321 * ( mua ) ) / d4343;\n\t\t\tmub = clamp( mub, 0.0, 1.0 );\n\n\t\t\treturn vec2( mua, mub );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\t#include <clipping_planes_fragment>\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tif ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps\n\n\t\t\t\tif ( mod( vLineDistance + dashOffset, dashSize + gapSize ) > dashSize ) discard; // todo - FIX\n\n\t\t\t#endif\n\n\t\t\tfloat alpha = opacity;\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\t// Find the closest points on the view ray and the line segment\n\t\t\t\tvec3 rayEnd = normalize( worldPos.xyz ) * 1e5;\n\t\t\t\tvec3 lineDir = worldEnd - worldStart;\n\t\t\t\tvec2 params = closestLineToLine( worldStart, worldEnd, vec3( 0.0, 0.0, 0.0 ), rayEnd );\n\n\t\t\t\tvec3 p1 = worldStart + lineDir * params.x;\n\t\t\t\tvec3 p2 = rayEnd * params.y;\n\t\t\t\tvec3 delta = p1 - p2;\n\t\t\t\tfloat len = length( delta );\n\t\t\t\tfloat norm = len / linewidth;\n\n\t\t\t\t#ifndef USE_DASH\n\n\t\t\t\t\t#ifdef USE_ALPHA_TO_COVERAGE\n\n\t\t\t\t\t\tfloat dnorm = fwidth( norm );\n\t\t\t\t\t\talpha = 1.0 - smoothstep( 0.5 - dnorm, 0.5 + dnorm, norm );\n\n\t\t\t\t\t#else\n\n\t\t\t\t\t\tif ( norm > 0.5 ) {\n\n\t\t\t\t\t\t\tdiscard;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t#endif\n\n\t\t\t\t#endif\n\n\t\t\t#else\n\n\t\t\t\t#ifdef USE_ALPHA_TO_COVERAGE\n\n\t\t\t\t\t// artifacts appear on some hardware if a derivative is taken within a conditional\n\t\t\t\t\tfloat a = vUv.x;\n\t\t\t\t\tfloat b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n\t\t\t\t\tfloat len2 = a * a + b * b;\n\t\t\t\t\tfloat dlen = fwidth( len2 );\n\n\t\t\t\t\tif ( abs( vUv.y ) > 1.0 ) {\n\n\t\t\t\t\t\talpha = 1.0 - smoothstep( 1.0 - dlen, 1.0 + dlen, len2 );\n\n\t\t\t\t\t}\n\n\t\t\t\t#else\n\n\t\t\t\t\tif ( abs( vUv.y ) > 1.0 ) {\n\n\t\t\t\t\t\tfloat a = vUv.x;\n\t\t\t\t\t\tfloat b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n\t\t\t\t\t\tfloat len2 = a * a + b * b;\n\n\t\t\t\t\t\tif ( len2 > 1.0 ) discard;\n\n\t\t\t\t\t}\n\n\t\t\t\t#endif\n\n\t\t\t#endif\n\n\t\t\tvec4 diffuseColor = vec4( diffuse, alpha );\n\n\t\t\t#include <logdepthbuf_fragment>\n\t\t\t#include <color_fragment>\n\n\t\t\tgl_FragColor = vec4( diffuseColor.rgb, alpha );\n\n\t\t\t#include <tonemapping_fragment>\n\t\t\t#include <encodings_fragment>\n\t\t\t#include <fog_fragment>\n\t\t\t#include <premultiplied_alpha_fragment>\n\n\t\t}\n\t\t"};var m=function(e){var t=a;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&d(t,e);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=f(e);if(r=t?(r=f(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===h(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return p(n)}}(a);function a(e){var t;if(this instanceof a)return(t=r.call(this,{type:"LineMaterial",uniforms:n.UniformsUtils.clone(n.ShaderLib.line.uniforms),vertexShader:n.ShaderLib.line.vertexShader,fragmentShader:n.ShaderLib.line.fragmentShader,clipping:!0})).isLineMaterial=!0,Object.defineProperties(p(t),{color:{enumerable:!0,get:function(){return this.uniforms.diffuse.value},set:function(e){this.uniforms.diffuse.value=e}},worldUnits:{enumerable:!0,get:function(){return"WORLD_UNITS"in this.defines},set:function(e){!0===e?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}},linewidth:{enumerable:!0,get:function(){return this.uniforms.linewidth.value},set:function(e){this.uniforms.linewidth.value=e}},dashed:{enumerable:!0,get:function(){return Boolean("USE_DASH"in this.defines)},set:function(e){Boolean(e)!==Boolean("USE_DASH"in this.defines)&&(this.needsUpdate=!0),!0===e?this.defines.USE_DASH="":delete this.defines.USE_DASH}},dashScale:{enumerable:!0,get:function(){return this.uniforms.dashScale.value},set:function(e){this.uniforms.dashScale.value=e}},dashSize:{enumerable:!0,get:function(){return this.uniforms.dashSize.value},set:function(e){this.uniforms.dashSize.value=e}},dashOffset:{enumerable:!0,get:function(){return this.uniforms.dashOffset.value},set:function(e){this.uniforms.dashOffset.value=e}},gapSize:{enumerable:!0,get:function(){return this.uniforms.gapSize.value},set:function(e){this.uniforms.gapSize.value=e}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(e){this.uniforms.opacity.value=e}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(e){this.uniforms.resolution.value.copy(e)}},alphaToCoverage:{enumerable:!0,get:function(){return Boolean("USE_ALPHA_TO_COVERAGE"in this.defines)},set:function(e){Boolean(e)!==Boolean("USE_ALPHA_TO_COVERAGE"in this.defines)&&(this.needsUpdate=!0),!0===e?(this.defines.USE_ALPHA_TO_COVERAGE="",this.extensions.derivatives=!0):(delete this.defines.USE_ALPHA_TO_COVERAGE,this.extensions.derivatives=!1)}}}),t.setValues(e),t;throw new TypeError("Cannot call a class as a function")}return t=a,Object.defineProperty(t,"prototype",{writable:!1}),t}(n.ShaderMaterial);function g(e){return(g="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})(e)}function v(e,t){return(v=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function b(e){return(b=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var y,x,w=new n.Vector3,S=new n.Vector3,M=new n.Vector4,T=new n.Vector4,_=new n.Vector4,E=new n.Vector3,D=new n.Matrix4,k=new n.Line3,O=new n.Vector3,P=new n.Box3,A=new n.Sphere,C=new n.Vector4;function R(e,t,r){return C.set(0,0,-t,1).applyMatrix4(e.projectionMatrix),C.multiplyScalar(1/C.w),C.x=x/r.width,C.y=x/r.height,C.applyMatrix4(e.projectionMatrixInverse),C.multiplyScalar(1/C.w),Math.abs(Math.max(C.x,C.y))}var L=function(e){var t=a;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&v(t,e);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=b(e);if(r=t?(r=b(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===g(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(a);function a(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:new u,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new m({color:16777215*Math.random()}),n=this,i=a;if(n instanceof i)return(n=r.call(this,e,t)).isLineSegments2=!0,n.type="LineSegments2",n;throw new TypeError("Cannot call a class as a function")}return t=a,(e=[{key:"computeLineDistances",value:function(){for(var e=this.geometry,t=e.attributes.instanceStart,r=e.attributes.instanceEnd,a=new Float32Array(2*t.count),i=0,s=0,o=t.count;i<o;i++,s+=2)w.fromBufferAttribute(t,i),S.fromBufferAttribute(r,i),a[s]=0===s?0:a[s-1],a[s+1]=a[s]+w.distanceTo(S);var l=new n.InstancedInterleavedBuffer(a,2,1);return e.setAttribute("instanceDistanceStart",new n.InterleavedBufferAttribute(l,1,0)),e.setAttribute("instanceDistanceEnd",new n.InterleavedBufferAttribute(l,1,1)),this}},{key:"raycast",value:function(e,t){var r=this.material.worldUnits,a=e.camera,i=(null!==a||r||console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.'),void 0!==e.params.Line2&&e.params.Line2.threshold||0),s=(y=e.ray,e=this.matrixWorld,this.geometry),o=this.material;if(x=o.linewidth+i,null===s.boundingSphere&&s.computeBoundingSphere(),A.copy(s.boundingSphere).applyMatrix4(e),i=r?.5*x:R(a,Math.max(a.near,A.distanceToPoint(y.origin)),o.resolution),A.radius+=i,!1!==y.intersectsSphere(A)&&(null===s.boundingBox&&s.computeBoundingBox(),P.copy(s.boundingBox).applyMatrix4(e),i=r?.5*x:R(a,Math.max(a.near,P.distanceToPoint(y.origin)),o.resolution),P.expandByScalar(i),!1!==y.intersectsBox(P)))if(r)for(var l=this,c=t,u=l.matrixWorld,h=(s=l.geometry).attributes.instanceStart,d=s.attributes.instanceEnd,p=0,f=Math.min(s.instanceCount,h.count);p<f;p++){k.start.fromBufferAttribute(h,p),k.end.fromBufferAttribute(d,p),k.applyMatrix4(u);var m=new n.Vector3,g=new n.Vector3;y.distanceSqToSegment(k.start,k.end,g,m),g.distanceTo(m)<.5*x&&c.push({point:g,pointOnLine:m,distance:y.origin.distanceTo(g),object:l,face:null,faceIndex:p,uv:null,uv2:null})}else{var v=this,b=t,w=(e=a).projectionMatrix,S=v.material.resolution,C=v.matrixWorld,L=(o=v.geometry).attributes.instanceStart,I=o.attributes.instanceEnd,B=(o=Math.min(o.instanceCount,L.count),-e.near);y.at(1,_),_.w=1,_.applyMatrix4(e.matrixWorldInverse),_.applyMatrix4(w),_.multiplyScalar(1/_.w),_.x*=S.x/2,_.y*=S.y/2,_.z=0,E.copy(_),D.multiplyMatrices(e.matrixWorldInverse,C);for(var j,U,N,z,F=0,V=o;F<V;F++)M.fromBufferAttribute(L,F),T.fromBufferAttribute(I,F),M.w=1,T.w=1,M.applyMatrix4(D),T.applyMatrix4(D),M.z>B&&T.z>B||(M.z>B?(j=M.z-T.z,j=(M.z-B)/j,M.lerp(T,j)):T.z>B&&(j=T.z-M.z,U=(T.z-B)/j,T.lerp(M,U)),M.applyMatrix4(w),T.applyMatrix4(w),M.multiplyScalar(1/M.w),T.multiplyScalar(1/T.w),M.x*=S.x/2,M.y*=S.y/2,T.x*=S.x/2,T.y*=S.y/2,k.start.copy(M),k.start.z=0,k.end.copy(T),k.end.z=0,U=k.closestPointToPointParameter(E,!0),k.at(U,O),N=-1<=(N=n.MathUtils.lerp(M.z,T.z,U))&&N<=1,z=E.distanceTo(O)<.5*x,N&&z&&(k.start.fromBufferAttribute(L,F),k.end.fromBufferAttribute(I,F),k.start.applyMatrix4(C),k.end.applyMatrix4(C),N=new n.Vector3,z=new n.Vector3,y.distanceSqToSegment(k.start,k.end,z,N),b.push({point:z,pointOnLine:N,distance:y.origin.distanceTo(z),object:v,face:null,faceIndex:F,uv:null,uv2:null})))}}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),a}(n.Mesh);function I(e){return(I="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})(e)}function B(){return(B="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=U(e)););return e}(e,t);if(n)return(n=Object.getOwnPropertyDescriptor(n,t)).get?n.get.call(arguments.length<3?e:r):n.value}).apply(this,arguments)}function j(e,t){return(j=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function U(e){return(U=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var N=function(){var e=n,t=u;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&&j(e,t);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=U(e);if(r=t?(r=U(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===I(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(){var e;if(this instanceof n)return(e=r.call(this)).isLineGeometry=!0,e.type="LineGeometry",e;throw new TypeError("Cannot call a class as a function")}return e=n,(t=[{key:"setPositions",value:function(e){for(var t=e.length-3,r=new Float32Array(2*t),a=0;a<t;a+=3)r[2*a]=e[a],r[2*a+1]=e[a+1],r[2*a+2]=e[a+2],r[2*a+3]=e[a+3],r[2*a+4]=e[a+4],r[2*a+5]=e[a+5];return B(U(n.prototype),"setPositions",this).call(this,r),this}},{key:"setColors",value:function(e){for(var t=e.length-3,r=new Float32Array(2*t),a=0;a<t;a+=3)r[2*a]=e[a],r[2*a+1]=e[a+1],r[2*a+2]=e[a+2],r[2*a+3]=e[a+3],r[2*a+4]=e[a+4],r[2*a+5]=e[a+5];return B(U(n.prototype),"setColors",this).call(this,r),this}},{key:"fromLine",value:function(e){return e=e.geometry,this.setPositions(e.attributes.position.array),this}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),n}();function z(e){return(z="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})(e)}function F(e,t){return(F=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function V(e){return(V=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var G=function(){var e=n,t=L;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&&F(e,t);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=V(e);if(r=t?(r=V(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===z(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:new N,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new m({color:16777215*Math.random()}),a=this,i=n;if(a instanceof i)return(a=r.call(this,e,t)).isLine2=!0,a.type="Line2",a;throw new TypeError("Cannot call a class as a function")}return e=n,Object.defineProperty(e,"prototype",{writable:!1}),e}(),H=r(699),W=r(3693),K=r(3263),q=(t=r(5247),r(932)),Z=r(6272);const X={uniforms:{uSeaFreq:{value:.16},uSeaHeight:{value:.6},uSeaChoppy:{value:4},uTime:{value:0},uCamPosition:{value:new n.Vector3(0,0,0)},uDirection:{value:null}},vertexShader:"\n const mat2 octave_m = mat2(1.6, 1.2, -1.2, 1.6);\n \n uniform float uSeaFreq;\n uniform float uSeaHeight;\n uniform float uSeaChoppy;\n uniform float uTime;\n \n varying vec2 vUv;\n varying vec3 vPosition;\n varying vec3 vWorldPos;\n \n float hash(vec2 p) {\n float h = dot(p, vec2(127.1, 311.7));\n return fract(sin(h) * 43758.5453123);\n }\n float noise(in vec2 p) {\n vec2 i = floor(p);\n vec2 f = fract(p);\n vec2 u = f * f * (3.0 - 2.0 * f);\n float xMix1 = mix(hash(i + vec2(0.0)), hash(i + vec2(1.0, 0.0)), u.x);\n float xMix2 = mix(hash(i + vec2(0.0, 1.0)), hash(i + vec2(1.0)), u.x);\n return -1.0 + 2.0 * mix(xMix1, xMix2, u.y);\n }\n \n float sea_octave(vec2 uv, float choppy) {\n uv += noise(uv);\n vec2 wv = 1.0 - abs(sin(uv));\n vec2 swv = abs(cos(uv));\n wv = mix(wv, swv, wv);\n return pow(1.0 - pow(wv.x * wv.y, 0.65), choppy);\n }\n float getWave(vec2 uv) {\n float freq = uSeaFreq;\n float amp = uSeaHeight;\n float choppy = uSeaChoppy;\n float d, h = 0.0;\n \n for(int i = 0; i < 5; i++) {\n d = sea_octave((uv + uTime) * freq, choppy);\n d += sea_octave((uv - uTime) * freq, choppy);\n h += d * amp;\n uv *= octave_m;\n freq *= 1.9;\n amp *= 0.22;\n choppy = mix(choppy, 1.0, 0.2);\n }\n \n return h;\n }\n \n void main() {\n vec4 pos = vec4(position, 1.0);\n //模型空间坐标,z轴是高度,xy轴是平面\n vUv = pos.xy * 1.0;\n pos.z += getWave(vUv) * 1.0;\n vPosition = vec3(pos.x, pos.z, pos.y);\n vWorldPos = (modelMatrix * pos).xyz;\n \n gl_Position = projectionMatrix * modelViewMatrix * pos;\n }\n ",fragmentShader:"\n #define PI 3.14159265359\n #define invPI 0.3183098861837697\n #define invTWO_PI 0.15915494309\n \n const vec3 SEA_BASE = vec3(0.1, 0.19, 0.22);\n const vec3 SEA_WATER_COLOR = vec3(0.8, 0.9, 0.6);\n const mat2 octave_m = mat2(1.6, 1.2, -1.2, 1.6);\n \n uniform float uSeaFreq;\n uniform float uSeaHeight;\n uniform float uSeaChoppy;\n uniform float uTime;\n uniform vec3 uCamPosition;\n uniform vec3 uDirection;\n \n varying vec2 vUv;\n varying vec3 vPosition;\n varying vec3 vWorldPos;\n \n // Math\n float hash(vec2 p) {\n float h = dot(p, vec2(127.1, 311.7));\n return fract(sin(h) * 43758.5453123);\n }\n float noise(in vec2 p) {\n vec2 i = floor(p);\n vec2 f = fract(p);\n vec2 u = f * f * (3.0 - 2.0 * f);\n float xMix1 = mix(hash(i + vec2(0.0)), hash(i + vec2(1.0, 0.0)), u.x);\n float xMix2 = mix(hash(i + vec2(0.0, 1.0)), hash(i + vec2(1.0)), u.x);\n return -1.0 + 2.0 * mix(xMix1, xMix2, u.y);\n }\n \n // Lighting\n float diffuse(vec3 n, vec3 l, float p) {\n return pow(dot(n, l) * 0.4 + 0.6, p);\n }\n float specular(vec3 n,vec3 l,vec3 e,float s) {\n float nrm = (s + 8.0) / (PI * 8.0);\n return pow(max(dot(reflect(e, n), l), 0.0), s) * nrm;\n }\n \n // Sky\n vec3 getSkyColor(vec3 e) {\n e.y = (max(e.y, 0.0) * 0.8 + 0.2) * 0.8;\n return vec3(pow(1.0 - e.y, 2.0), 1.0 - e.y, 0.6 + (1.0 - e.y) * 0.45) * 0.45;\n }\n \n // Sea\n float sea_octave(vec2 uv, float choppy) {\n uv += noise(uv);\n vec2 wv = 1.0 - abs(sin(uv));\n vec2 swv = abs(cos(uv));\n wv = mix(wv, swv, wv);\n return pow(1.0 - pow(wv.x * wv.y, 0.65), choppy);\n }\n float map_detailed(vec3 p) {\n float freq = uSeaFreq;\n float amp = uSeaHeight;\n float choppy = uSeaChoppy;\n vec2 uv = p.xz;\n uv.x *= 0.75;\n \n float d, h = 0.0;\n for(int i = 0; i < 5; i++) {\n d = sea_octave((uv + uTime) * freq, choppy);\n d += sea_octave((uv - uTime) * freq, choppy);\n h += d * amp;\n uv *= octave_m;\n freq *= 1.9;\n amp *= 0.22;\n choppy = mix(choppy, 1.0, 0.2);\n }\n return p.y - h;\n }\n vec3 getSeaColor(vec3 p, vec3 n, vec3 l, vec3 eye, vec3 dist) {\n float fresnel = clamp(1.0 - dot(n, -eye), 0.0, 1.0);\n fresnel = pow(fresnel, 3.0) * 0.5;\n \n vec3 reflected = getSkyColor(reflect(eye, n));\n vec3 refracted = SEA_BASE + diffuse(n, l, 80.0) * SEA_WATER_COLOR * 0.12;\n \n vec3 color = mix(refracted, reflected, fresnel);\n \n float attenuation = max(1.0 - dot(dist, dist) * 0.001, 0.0);\n color += SEA_WATER_COLOR * (p.y - uSeaHeight) * 0.18 * attenuation;\n color += vec3(specular(n, l, eye, 60.0));\n \n return color;\n }\n \n // Sea Wave\n float getWave(vec2 uv) {\n float freq = uSeaFreq;\n float amp = uSeaHeight;\n float choppy = uSeaChoppy;\n float d, h = 0.0;\n \n for(int i = 0; i < 5; i++) {\n d = sea_octave((uv + uTime) * freq, choppy);\n d += sea_octave((uv - uTime) * freq, choppy);\n h += d * amp;\n uv *= octave_m;\n freq *= 1.9;\n amp *= 0.22;\n choppy = mix(choppy, 1.0, 0.2);\n }\n \n return h;\n }\n \n // Tracing\n vec3 getNormal(vec3 p, float eps) {\n vec3 n;\n n.y = map_detailed(p);\n n.x = map_detailed(vec3(p.x + eps, p.y, p.z)) - n.y;\n n.z = map_detailed(vec3(p.x, p.y, p.z + eps)) - n.y;\n n.y = eps;\n return normalize(n);\n }\n \n void main() {\n vec3 light = normalize(vec3(0.0, 1.0, 0.8));\n vec3 dist = vWorldPos - uCamPosition;\n vec3 dir = normalize(dist);\n \n // 此数值控制生成水面法线的范围, 数值与范围成反比\n float EPSILON_NRM = 0.00003;\n vec3 N = getNormal(vWorldPos, dot(dist, dist) * EPSILON_NRM);\n vec3 color = getSeaColor(vWorldPos, N, light, dir, dist);\n \n // gl_FragColor = vec4(vPosition, 1.0);\n // gl_FragColor = vec4(vWorldPos, 1.0);\n // gl_FragColor = vec4(normalize(N), 1.0);\n gl_FragColor = vec4(pow(color, vec3(0.75)), 1.0);\n }\n "},Q=t.Z,Y=(e,t)=>(t.updateMatrixWorld(!0),t=new Q.Vector3,e.getWorldPosition(t),t),J={parse(e){var{x:e,y:t,z:r}=e;return void 0===r?new n.Vector2(e,t):new n.Vector3(e,t,r)},toJSON(e){var{x:e,y:t,z:r}=e;return null==r?{x:e,y:t}:{x:e,y:t,z:r}}},$=(e,t)=>e.distanceTo(t),ee=e=>new W.cp(e),te=e=>new H.j(e),re=e=>new W.P7(e),ne=(e,t=.5,r=!1)=>{if("Group"===e.type)throw TypeError("该模型为Group类型");if(!e.material)throw TypeError("该模型没有材质");if(void 0===e.material.oldOpc&&(e.material.oldOpc=e.material.opacity,e.material.oldTransparent=e.material.transparent),r)return e.material.opacity=e.material.oldOpc,void(e.material.transparent=e.material.oldTransparent);1===t?(e.material.transparent=!1,e.material.opacity=1):(e.material.transparent=!0,e.material.opacity=t)},ae=(e,t,r)=>{"Group"===e.type||"Object3D"===e.type?e.children.forEach((e=>ae(e,t,r))):ne(e,t,r)},ie=e=>(e.mapping=n.EquirectangularReflectionMapping,e),se=e=>{let t=e=>"Group"!==e.type&&"Object3D"!==e.type||1!==e.children.length?e:t(e.children[0]);return t(e)},oe=(e,t)=>{let r=document.createElement("video");return r.style="position:absolute;top:0;left:0;z-index:1000000;",r.src=e,r.loop="loop",r.muted="muted",r.play(),t.appendChild(r),new n.VideoTexture(r)},le=(e,t)=>{let r=new n.CatmullRomCurve3(e,(null==t?void 0:t.closed)||!1),a=new n.BufferGeometry;e=r.getSpacedPoints(100),a.setFromPoints(e),e=new n.LineBasicMaterial({color:26214});let i=new n.Line(a,e);return i.visible=(null==t?void 0:t.showLine)||!1,{line:i,curve:r}},ce=e=>{let t=0;const r=[],a={},i={0:"x",1:"y",2:"z"};return e.map((e=>{var s,o,l;3===t&&(t=0,({x:s,y:o,z:l}=a),r.push(new n.Vector3(s,o,l))),a[i[t]]=e,t++})),r},ue=e=>{var{pointArray:e,material:t,lineWidth:r,colorArray:a}=e;const i=new N,s=(i.setPositions(e),t||new m({transparent:!0,side:n.DoubleSide,linewidth:r||5,vertexColors:!0})),o=(i.setColors(a||[1,1,1]),s.resolution.set(window.innerWidth,window.innerHeight),new G(i,s));return o.name="gw",o.computeLineDistances(),o},he=e=>3.1415926*e/180,de=(e,t="name",r)=>{const n={};return e.traverse((e=>{"id"===t?n[e.userData.id]=e:n[e[t]]=e,null!=r&&r(e)})),n},pe=(e,t,r,n,a,i)=>({cx:e,cy:t,cz:r,tx:n,ty:a,tz:i}),fe=(e,t)=>{var{x:e,y:r,z:n}=e,{x:t,y:a,z:i}=t;return{x:e-t,y:r-a,z:n-i}},me=()=>new Q.Clock,ge=e=>{var{r:e,g:t,b:r}=(0,Z.fh)((0,Z.I8)(e.includes("#")?e:"#"+e));return new Q.Color(e,t,r)},ve=e=>new Q.Color(e.includes("#")?e:"#"+e),be=e=>"#"+e.getHexString(),ye=e=>e.r?e:(0,Z.fh)((0,Z.I8)(e.includes("#")?e:"#"+e)),xe=(e,t)=>e.x===t.x&&e.y===t.y&&e.z===t.z,we=e=>{const{r:t,g:r,b:n}=e;return"rgb("+[t,r,n].map((e=>1<e?e:255*e)).join(",")+")"},Se=e=>{var{r:e,g:t,b:r}=e;return{r:e,g:t,b:r}},Me=e=>{let t=e;return(0,q.isColor)(e)?t=Se(e):K.YD.is(e)||(t=(0,Z.I8)(e,!0)),t},Te=e=>-1===e.toLocaleLowerCase().indexOf("rgba")?e:e.replace(/[a]/,"").split(",").slice(0,-1)+")",_e=e=>{if(-1!==(e=e.toLocaleLowerCase()).indexOf("#"))return e;if(e=Te(e),/^(rgb|RGB)/.test(e)){for(var t="#",r=e.replace(/(?:\(|\)|rgb|RGB)*/g,"").split(","),n=0;n<r.length;n++){var a=Number(r[n]).toString(16);"0"===a&&(a+=a),t+=a}return t}return String(e)},Ee=e=>{var{x:e,y:t,z:r}=e;return{x:e,y:t,z:r}},De=e=>(new n.Box3).expandByObject(e).getCenter(e),ke={water(e){var t=new Q.PlaneBufferGeometry(256,256,127,127);const r=new n.ShaderMaterial({name:"WaterMaterial",uniforms:X.uniforms,vertexShader:X.vertexShader,fragmentShader:X.fragmentShader}),a=new n.Mesh(t,r),i=(a.rotateX(-.5*Math.PI),new n.Clock);return setInterval((()=>{r.uniforms.uTime.value+=i.getDelta(),r.uniforms.uCamPosition.value=e.position}),16.6),a}},Oe=(e,t)=>{let r,a;switch(e){case"Group":r=new Q.Group;break;case"Box":a=new Q.BoxBufferGeometry(1,1,1,1,1,1),r=new Q.Mesh(a,new Q.MeshStandardMaterial);break;case"Circle":a=new Q.CircleBufferGeometry(1,8,0,2*Math.PI),r=new Q.Mesh(a,new Q.MeshStandardMaterial);break;case"Cylinder":a=new Q.CylinderBufferGeometry(1,1,1,8,1,!1,0,2*Math.PI),r=new Q.Mesh(a,new Q.MeshStandardMaterial);break;case"Dodecahedron":a=new Q.DodecahedronBufferGeometry(1,0),r=new Q.Mesh(a,new Q.MeshStandardMaterial);break;case"Icosahedron":a=new Q.IcosahedronBufferGeometry(1,0),r=new Q.Mesh(a,new Q.MeshStandardMaterial);break;case"Lathe":var i=[new Q.Vector2(0,0),new Q.Vector2(.4,0),new Q.Vector2(.35,.05),new Q.Vector2(.1,.075),new Q.Vector2(.08,.1),new Q.Vector2(.08,.4),new Q.Vector2(.1,.42),new Q.Vector2(.14,.48),new Q.Vector2(.2,.5),new Q.Vector2(.25,.54),new Q.Vector2(.3,1.2)];a=new Q.LatheBufferGeometry(i,12,0,2*Math.PI),r=new Q.Mesh(a,new Q.MeshStandardMaterial({side:Q.DoubleSide}));break;case"Octahedron":a=new Q.OctahedronBufferGeometry(1,0),r=new Q.Mesh(a,new Q.MeshStandardMaterial);break;case"Plane":a=new Q.PlaneBufferGeometry(1,1,1,1),r=new Q.Mesh(a,new Q.MeshStandardMaterial);break;case"Ring":a=new Q.RingBufferGeometry(.5,1,8,1,0,2*Math.PI),r=new Q.Mesh(a,new Q.MeshStandardMaterial);break;case"Sphere":a=new Q.SphereBufferGeometry(1,8,6,0,2*Math.PI,0,Math.PI),r=new Q.Mesh(a,new Q.MeshStandardMaterial);break;case"Sprite":r=new Q.Sprite(new Q.SpriteMaterial);break;case"Tetrahedron":a=new Q.TetrahedronBufferGeometry(1,0),r=new Q.Mesh(a,new Q.MeshStandardMaterial);break;case"Torus":a=new Q.TorusBufferGeometry(1,.4,8,6,2*Math.PI),r=new Q.Mesh(a,new Q.MeshStandardMaterial);break;case"TorusKnot":a=new Q.TorusKnotBufferGeometry(1,.4,64,8,2,3),r=new Q.Mesh(a,new Q.MeshStandardMaterial);break;case"Tube":i=new Q.CatmullRomCurve3([new Q.Vector3(2,2,-2),new Q.Vector3(2,-2,-.6666666666666667),new Q.Vector3(-2,-2,.6666666666666667),new Q.Vector3(-2,2,2)]),a=new Q.TubeBufferGeometry(i,64,1,8,!1),r=new Q.Mesh(a,new Q.MeshStandardMaterial);break;case"water":r=ke.water(t?t.camera:{position:new n.Vector3})}if(r)return r.name=e,r},Pe=(()=>{const e=(t,r)=>!!(t=t.parent)&&"Scene"!==t.type&&(t.uuid===r?t:e(t,r));return(t,r)=>{if(t&&r)return e(t,r)}})(),Ae=(()=>{const e=(t,r)=>t.parent&&"Scene"!==t.parent.type?(t.parent.visible!==r&&(t.parent.visible=r),e(t.parent,r)):null;return(t,r)=>t?e(t,r):null})(),Ce=e=>"Scene"===e.type||!!e.visible&&!!e.parent&&Ce(e.parent),Re=(e,t=!1)=>{var[r,a,i]=e.geometry.attributes.position.array,[s,o,l]=(e.geometry.center(),e.geometry.attributes.position.array),{x:c,y:u,z:h}=e.position,c=new n.Vector3(c-(s-r),u-(o-a),h-(l-i));return t&&e.position.copy(c),c};let Le,Ie,Be;const je=e=>{void 0===Le&&((Le=new Q.WebGLRenderer).outputEncoding=Q.sRGBEncoding,Ie=new Q.Scene,Be=new Q.OrthographicCamera(-1,1,1,-1,0,1));var t=e.image,r=new Q.PlaneGeometry(2,2);return e=new Q.MeshBasicMaterial({map:e}),r=new Q.Mesh(r,e),Ie.add(r),Le.setSize(t.width,t.height,!1),Le.render(Ie,Be),Le.domElement}},1129:e=>{e.exports=__WEBPACK_EXTERNAL_MODULE__1129__},3300:e=>{e.exports=__WEBPACK_EXTERNAL_MODULE__3300__},6001:e=>{e.exports=__WEBPACK_EXTERNAL_MODULE__6001__},8881:e=>{e.exports=__WEBPACK_EXTERNAL_MODULE__8881__},3151:(e,t,r)=>{r.d(t,{z:()=>d});var n=r(8881);function a(e){return(a="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})(e)}function i(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||function(e,t){return e.__proto__=t,e})(e,t)}function o(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function l(e){return(l=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var c={type:"change"},u={type:"start"},h={type:"end"},d=function(){i(t,n.EventDispatcher);var e=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=l(e);if(r=t?(r=l(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===a(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return o(n)}}(t);function t(r,a){(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")})(this,t),(i=e.call(this)).object=r,i.domElement=a,i.domElement.style.touchAction="none",i.enabled=!0,i.target=new n.Vector3,i.minDistance=0,i.maxDistance=1/0,i.minZoom=0,i.maxZoom=1/0,i.minPolarAngle=0,i.maxPolarAngle=Math.PI,i.minAzimuthAngle=-1/0,i.maxAzimuthAngle=1/0,i.enableDamping=!1,i.dampingFactor=.05,i.enableZoom=!0,i.zoomSpeed=1,i.enableRotate=!0,i.rotateSpeed=1,i.enablePan=!0,i.panSpeed=1,i.screenSpacePanning=!0,i.keyPanSpeed=7,i.autoRotate=!1,i.autoRotateSpeed=2,i.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},i.mouseButtons={LEFT:n.MOUSE.ROTATE,MIDDLE:n.MOUSE.DOLLY,RIGHT:n.MOUSE.PAN},i.touches={ONE:n.TOUCH.ROTATE,TWO:n.TOUCH.DOLLY_PAN},i.target0=i.target.clone(),i.position0=i.object.position.clone(),i.zoom0=i.object.zoom,i._domElementKeyEvents=null,i.getPolarAngle=function(){return x.phi},i.getAzimuthalAngle=function(){return x.theta},i.getDistance=function(){return this.object.position.distanceTo(this.target)},i.listenToKeyEvents=function(e){e.addEventListener("keydown",se),this._domElementKeyEvents=e},i.saveState=function(){g.target0.copy(g.target),g.position0.copy(g.object.position),g.zoom0=g.object.zoom},i.reset=function(){g.target.copy(g.target0),g.object.position.copy(g.position0),g.object.zoom=g.zoom0,g.object.updateProjectionMatrix(),g.dispatchEvent(c),g.update(),b=v.NONE},i.update=(s=new n.Vector3,l=(new n.Quaternion).setFromUnitVectors(r.up,new n.Vector3(0,1,0)),d=l.clone().invert(),p=new n.Vector3,f=new n.Quaternion,m=2*Math.PI,function(){var e=g.object.position,t=(s.copy(e).sub(g.target),s.applyQuaternion(l),x.setFromVector3(s),g.autoRotate&&b===v.NONE&&j(2*Math.PI/60/60*g.autoRotateSpeed),g.enableDamping?(x.theta+=w.theta*g.dampingFactor,x.phi+=w.phi*g.dampingFactor):(x.theta+=w.theta,x.phi+=w.phi),g.minAzimuthAngle),r=g.maxAzimuthAngle;return isFinite(t)&&isFinite(r)&&(t<-Math.PI?t+=m:t>Math.PI&&(t-=m),r<-Math.PI?r+=m:r>Math.PI&&(r-=m),x.theta=t<=r?Math.max(t,Math.min(r,x.theta)):x.theta>(t+r)/2?Math.max(t,x.theta):Math.min(r,x.theta)),x.phi=Math.max(g.minPolarAngle,Math.min(g.maxPolarAngle,x.phi)),x.makeSafe(),x.radius*=S,x.radius=Math.max(g.minDistance,Math.min(g.maxDistance,x.radius)),!0===g.enableDamping?g.target.addScaledVector(M,g.dampingFactor):g.target.add(M),s.setFromSpherical(x),s.applyQuaternion(d),e.copy(g.target).add(s),g.object.lookAt(g.target),!0===g.enableDamping?(w.theta*=1-g.dampingFactor,w.phi*=1-g.dampingFactor,M.multiplyScalar(1-g.dampingFactor)):(w.set(0,0,0),M.set(0,0,0)),S=1,!(!(T||p.distanceToSquared(g.object.position)>y||8*(1-f.dot(g.object.quaternion))>y)||(g.dispatchEvent(c),p.copy(g.object.position),f.copy(g.object.quaternion),T=!1))}),i.dispose=function(){g.domElement.removeEventListener("contextmenu",oe),g.domElement.removeEventListener("pointerdown",te),g.domElement.removeEventListener("pointercancel",ae),g.domElement.removeEventListener("wheel",ie),g.domElement.removeEventListener("pointermove",re),g.domElement.removeEventListener("pointerup",ne),null!==g._domElementKeyEvents&&g._domElementKeyEvents.removeEventListener("keydown",se)};var i,s,l,d,p,f,m,g=o(i),v={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},b=v.NONE,y=1e-6,x=new n.Spherical,w=new n.Spherical,S=1,M=new n.Vector3,T=!1,_=new n.Vector2,E=new n.Vector2,D=new n.Vector2,k=new n.Vector2,O=new n.Vector2,P=new n.Vector2,A=new n.Vector2,C=new n.Vector2,R=new n.Vector2,L=[],I={};function B(){return Math.pow(.95,g.zoomSpeed)}function j(e){w.theta-=e}function U(e){w.phi-=e}N=new n.Vector3;var N,z,F,V=function(e,t){N.setFromMatrixColumn(t,0),N.multiplyScalar(-e),M.add(N)},G=(z=new n.Vector3,function(e,t){!0===g.screenSpacePanning?z.setFromMatrixColumn(t,1):(z.setFromMatrixColumn(t,0),z.crossVectors(g.object.up,z)),z.multiplyScalar(e),M.add(z)}),H=(F=new n.Vector3,function(e,t){var r,n=g.domElement;g.object.isPerspectiveCamera?(r=g.object.position,F.copy(r).sub(g.target),r=F.length(),r*=Math.tan(g.object.fov/2*Math.PI/180),V(2*e*r/n.clientHeight,g.object.matrix),G(2*t*r/n.clientHeight,g.object.matrix)):g.object.isOrthographicCamera?(V(e*(g.object.right-g.object.left)/g.object.zoom/n.clientWidth,g.object.matrix),G(t*(g.object.top-g.object.bottom)/g.object.zoom/n.clientHeight,g.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),g.enablePan=!1)});function W(e){g.object.isPerspectiveCamera?S/=e:g.object.isOrthographicCamera?(g.object.zoom=Math.max(g.minZoom,Math.min(g.maxZoom,g.object.zoom*e)),g.object.updateProjectionMatrix(),T=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),g.enableZoom=!1)}function K(e){g.object.isPerspectiveCamera?S*=e:g.object.isOrthographicCamera?(g.object.zoom=Math.max(g.minZoom,Math.min(g.maxZoom,g.object.zoom/e)),g.object.updateProjectionMatrix(),T=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),g.enableZoom=!1)}function q(e){_.set(e.clientX,e.clientY)}function Z(e){k.set(e.clientX,e.clientY)}function X(){var e,t;1===L.length?_.set(L[0].pageX,L[0].pageY):(e=.5*(L[0].pageX+L[1].pageX),t=.5*(L[0].pageY+L[1].pageY),_.set(e,t))}function Q(){var e,t;1===L.length?k.set(L[0].pageX,L[0].pageY):(e=.5*(L[0].pageX+L[1].pageX),t=.5*(L[0].pageY+L[1].pageY),k.set(e,t))}function Y(){var e=L[0].pageX-L[1].pageX,t=L[0].pageY-L[1].pageY;e=Math.sqrt(e*e+t*t),A.set(0,e)}function J(e){1==L.length?E.set(e.pageX,e.pageY):(r=ue(e),t=.5*(e.pageX+r.x),e=.5*(e.pageY+r.y),E.set(t,e)),D.subVectors(E,_).multiplyScalar(g.rotateSpeed);var t,r=g.domElement;j(2*Math.PI*D.x/r.clientHeight),U(2*Math.PI*D.y/r.clientHeight),_.copy(E)}function $(e){var t,r;1===L.length?O.set(e.pageX,e.pageY):(t=ue(e),r=.5*(e.pageX+t.x),e=.5*(e.pageY+t.y),O.set(r,e)),P.subVectors(O,k).multiplyScalar(g.panSpeed),H(P.x,P.y),k.copy(O)}function ee(e){var t=ue(e),r=e.pageX-t.x;e=e.pageY-t.y,t=Math.sqrt(r*r+e*e),C.set(0,t),R.set(0,Math.pow(C.y/A.y,g.zoomSpeed)),W(R.y),A.copy(C)}function te(e){if(!1!==g.enabled)if(0===L.length&&(g.domElement.setPointerCapture(e.pointerId),g.domElement.addEventListener("pointermove",re),g.domElement.addEventListener("pointerup",ne)),L.push(e),"touch"===e.pointerType){switch(ce(e),L.length){case 1:switch(g.touches.ONE){case n.TOUCH.ROTATE:if(!1===g.enableRotate)return;X(),b=v.TOUCH_ROTATE;break;case n.TOUCH.PAN:if(!1===g.enablePan)return;Q(),b=v.TOUCH_PAN;break;default:b=v.NONE}break;case 2:switch(g.touches.TWO){case n.TOUCH.DOLLY_PAN:if(!1===g.enableZoom&&!1===g.enablePan)return;g.enableZoom&&Y(),g.enablePan&&Q(),b=v.TOUCH_DOLLY_PAN;break;case n.TOUCH.DOLLY_ROTATE:if(!1===g.enableZoom&&!1===g.enableRotate)return;g.enableZoom&&Y(),g.enableRotate&&X(),b=v.TOUCH_DOLLY_ROTATE;break;default:b=v.NONE}break;default:b=v.NONE}b!==v.NONE&&g.dispatchEvent(u)}else{var t,r=e;switch(r.button){case 0:t=g.mouseButtons.LEFT;break;case 1:t=g.mouseButtons.MIDDLE;break;case 2:t=g.mouseButtons.RIGHT;break;default:t=-1}switch(t){case n.MOUSE.DOLLY:if(!1===g.enableZoom)return;!function(e){A.set(e.clientX,e.clientY)}(r),b=v.DOLLY;break;case n.MOUSE.ROTATE:if(r.ctrlKey||r.metaKey||r.shiftKey){if(!1===g.enablePan)return;Z(r),b=v.PAN}else{if(!1===g.enableRotate)return;q(r),b=v.ROTATE}break;case n.MOUSE.PAN:if(r.ctrlKey||r.metaKey||r.shiftKey){if(!1===g.enableRotate)return;q(r),b=v.ROTATE}else{if(!1===g.enablePan)return;Z(r),b=v.PAN}break;default:b=v.NONE}b!==v.NONE&&g.dispatchEvent(u)}}function re(e){if(!1!==g.enabled)if("touch"===e.pointerType){var t=e;switch(ce(t),b){case v.TOUCH_ROTATE:if(!1===g.enableRotate)return;J(t),g.update();break;case v.TOUCH_PAN:if(!1===g.enablePan)return;$(t),g.update();break;case v.TOUCH_DOLLY_PAN:if(!1===g.enableZoom&&!1===g.enablePan)return;!function(e){g.enableZoom&&ee(e),g.enablePan&&$(e)}(t),g.update();break;case v.TOUCH_DOLLY_ROTATE:if(!1===g.enableZoom&&!1===g.enableRotate)return;!function(e){g.enableZoom&&ee(e),g.enableRotate&&J(e)}(t),g.update();break;default:b=v.NONE}}else{var r=e;switch(b){case v.ROTATE:if(!1===g.enableRotate)return;!function(e){E.set(e.clientX,e.clientY),D.subVectors(E,_).multiplyScalar(g.rotateSpeed),e=g.domElement,j(2*Math.PI*D.x/e.clientHeight),U(2*Math.PI*D.y/e.clientHeight),_.copy(E),g.update()}(r);break;case v.DOLLY:if(!1===g.enableZoom)return;!function(e){C.set(e.clientX,e.clientY),R.subVectors(C,A),0<R.y?W(B()):R.y<0&&K(B()),A.copy(C),g.update()}(r);break;case v.PAN:if(!1===g.enablePan)return;!function(e){O.set(e.clientX,e.clientY),P.subVectors(O,k).multiplyScalar(g.panSpeed),H(P.x,P.y),k.copy(O),g.update()}(r)}}}function ne(e){le(e),0===L.length&&(g.domElement.releasePointerCapture(e.pointerId),g.domElement.removeEventListener("pointermove",re),g.domElement.removeEventListener("pointerup",ne)),g.dispatchEvent(h),b=v.NONE}function ae(e){le(e)}function ie(e){!1!==g.enabled&&!1!==g.enableZoom&&b===v.NONE&&(e.preventDefault(),g.dispatchEvent(u),e.deltaY<0?K(B()):0<e.deltaY&&W(B()),g.update(),g.dispatchEvent(h))}function se(e){if(!1!==g.enabled&&!1!==g.enablePan){var t=e,r=!1;switch(t.code){case g.keys.UP:t.ctrlKey||t.metaKey||t.shiftKey?U(2*Math.PI*g.rotateSpeed/g.domElement.clientHeight):H(0,g.keyPanSpeed),r=!0;break;case g.keys.BOTTOM:t.ctrlKey||t.metaKey||t.shiftKey?U(-2*Math.PI*g.rotateSpeed/g.domElement.clientHeight):H(0,-g.keyPanSpeed),r=!0;break;case g.keys.LEFT:t.ctrlKey||t.metaKey||t.shiftKey?j(2*Math.PI*g.rotateSpeed/g.domElement.clientHeight):H(g.keyPanSpeed,0),r=!0;break;case g.keys.RIGHT:t.ctrlKey||t.metaKey||t.shiftKey?j(-2*Math.PI*g.rotateSpeed/g.domElement.clientHeight):H(-g.keyPanSpeed,0),r=!0}r&&(t.preventDefault(),g.update())}}function oe(e){!1!==g.enabled&&e.preventDefault()}function le(e){delete I[e.pointerId];for(var t=0;t<L.length;t++)if(L[t].pointerId==e.pointerId)return void L.splice(t,1)}function ce(e){var t=I[e.pointerId];void 0===t&&(t=new n.Vector2,I[e.pointerId]=t),t.set(e.pageX,e.pageY)}function ue(e){return e=e.pointerId===L[0].pointerId?L[1]:L[0],I[e.pointerId]}return g.domElement.addEventListener("contextmenu",oe),g.domElement.addEventListener("pointerdown",te),g.domElement.addEventListener("pointercancel",ae),g.domElement.addEventListener("wheel",ie,{passive:!1}),i.update(),i}return function(e,t,r){return Object.defineProperty(e,"prototype",{writable:!1}),e}(t)}()},8624:(e,t,r)=>{r.d(t,{Ys:()=>M});var n=r(8881);function a(e){return(a="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})(e)}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function o(e,t,r){t&&s(e.prototype,t),r&&s(e,r),Object.defineProperty(e,"prototype",{writable:!1})}function l(){return(l="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=p(e)););return e}(e,t);if(n)return(n=Object.getOwnPropertyDescriptor(n,t)).get?n.get.call(arguments.length<3?e:r):n.value}).apply(this,arguments)}function c(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&&u(e,t)}function u(e,t){return(u=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function h(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=p(e);if(r=t?(r=p(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===a(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return d(n)}}function d(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function p(e){return(p=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var f=new n.Raycaster,m=new n.Vector3,g=new n.Vector3,v=new n.Quaternion,b={X:new n.Vector3(1,0,0),Y:new n.Vector3(0,1,0),Z:new n.Vector3(0,0,1)},y={type:"change"},x={type:"mouseDown"},w={type:"mouseUp",mode:null},S={type:"objectChange"},M=function(){c(t,n.Object3D);var e=h(t);function t(r,a){i(this,t),s=e.call(this),void 0===a&&(console.warn('THREE.TransformControls: The second parameter "domElement" is now mandatory.'),a=document),s.isTransformControls=!0,s.visible=!1,s.domElement=a,s.domElement.style.touchAction="none";var s,o=new N,l=(s._gizmo=o,s.add(o),new z),c=(s._plane=l,s.add(l),d(s));function u(e,t){var r=t;Object.defineProperty(c,e,{get:function(){return void 0!==r?r:t},set:function(t){r!==t&&(r=t,l[e]=t,o[e]=t,c.dispatchEvent({type:e+"-changed",value:t}),c.dispatchEvent(y))}}),c[e]=t,l[e]=t,o[e]=t}u("camera",r),u("object",void 0),u("enabled",!0),u("axis",null),u("mode","translate"),u("translationSnap",null),u("rotationSnap",null),u("scaleSnap",null),u("space","world"),u("size",1),u("dragging",!1),u("showX",!0),u("showY",!0),u("showZ",!0),a=new n.Vector3,r=new n.Vector3;var h=new n.Quaternion,p=new n.Quaternion,f=new n.Vector3,m=new n.Quaternion,g=new n.Vector3,v=new n.Vector3,b=new n.Vector3,x=new n.Vector3;return u("worldPosition",a),u("worldPositionStart",r),u("worldQuaternion",h),u("worldQuaternionStart",p),u("cameraPosition",f),u("cameraQuaternion",m),u("pointStart",g),u("pointEnd",v),u("rotationAxis",b),u("rotationAngle",0),u("eye",x),s._offset=new n.Vector3,s._startNorm=new n.Vector3,s._endNorm=new n.Vector3,s._cameraScale=new n.Vector3,s._parentPosition=new n.Vector3,s._parentQuaternion=new n.Quaternion,s._parentQuaternionInv=new n.Quaternion,s._parentScale=new n.Vector3,s._worldScaleStart=new n.Vector3,s._worldQuaternionInv=new n.Quaternion,s._worldScale=new n.Vector3,s._positionStart=new n.Vector3,s._quaternionStart=new n.Quaternion,s._scaleStart=new n.Vector3,s._getPointer=function(e){var t;return this.domElement.ownerDocument.pointerLockElement?{x:0,y:0,button:e.button}:(t=this.domElement.getBoundingClientRect(),{x:(e.clientX-t.left)/t.width*2-1,y:-(e.clientY-t.top)/t.height*2+1,button:e.button})}.bind(d(s)),s._onPointerDown=function(e){this.enabled&&(document.pointerLockElement||this.domElement.setPointerCapture(e.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.pointerHover(this._getPointer(e)),this.pointerDown(this._getPointer(e)))}.bind(d(s)),s._onPointerHover=function(e){if(this.enabled)switch(e.pointerType){case"mouse":case"pen":this.pointerHover(this._getPointer(e))}}.bind(d(s)),s._onPointerMove=function(e){this.enabled&&this.pointerMove(this._getPointer(e))}.bind(d(s)),s._onPointerUp=function(e){this.enabled&&(this.domElement.releasePointerCapture(e.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.pointerUp(this._getPointer(e)))}.bind(d(s)),s.domElement.addEventListener("pointerdown",s._onPointerDown),s.domElement.addEventListener("pointermove",s._onPointerHover),s.domElement.addEventListener("pointerup",s._onPointerUp),s}return o(t,[{key:"updateMatrixWorld",value:function(){void 0!==this.object&&(this.object.updateMatrixWorld(),null===this.object.parent?console.error("TransformControls: The attached 3D object must be a part of the scene graph."):this.object.parent.matrixWorld.decompose(this._parentPosition,this._parentQuaternion,this._parentScale),this.object.matrixWorld.decompose(this.worldPosition,this.worldQuaternion,this._worldScale),this._parentQuaternionInv.copy(this._parentQuaternion).invert(),this._worldQuaternionInv.copy(this.worldQuaternion).invert()),this.camera.updateMatrixWorld(),this.camera.matrixWorld.decompose(this.cameraPosition,this.cameraQuaternion,this._cameraScale),this.camera.isOrthographicCamera?this.camera.getWorldDirection(this.eye).negate():this.eye.copy(this.cameraPosition).sub(this.worldPosition).normalize(),l(p(t.prototype),"updateMatrixWorld",this).call(this,this)}},{key:"pointerHover",value:function(e){void 0!==this.object&&!0!==this.dragging&&(f.setFromCamera(e,this.camera),e=T(this._gizmo.picker[this.mode],f),this.axis=e?e.object.name:null)}},{key:"pointerDown",value:function(e){void 0!==this.object&&!0!==this.dragging&&0===e.button&&null!==this.axis&&(f.setFromCamera(e,this.camera),(e=T(this._plane,f,!0))&&(this.object.updateMatrixWorld(),this.object.parent.updateMatrixWorld(),this._positionStart.copy(this.object.position),this._quaternionStart.copy(this.object.quaternion),this._scaleStart.copy(this.object.scale),this.object.matrixWorld.decompose(this.worldPositionStart,this.worldQuaternionStart,this._worldScaleStart),this.pointStart.copy(e.point).sub(this.worldPositionStart)),this.dragging=!0,x.mode=this.mode,this.dispatchEvent(x))}},{key:"pointerMove",value:function(e){var t=this.axis,r=this.mode,n=this.object,a=this.space;"scale"===r?a="local":"E"!==t&&"XYZE"!==t&&"XYZ"!==t||(a="world"),void 0!==n&&null!==t&&!1!==this.dragging&&-1===e.button&&(f.setFromCamera(e,this.camera),(e=T(this._plane,f,!0))&&(this.pointEnd.copy(e.point).sub(this.worldPositionStart),"translate"===r?(this._offset.copy(this.pointEnd).sub(this.pointStart),"local"===a&&"XYZ"!==t&&this._offset.applyQuaternion(this._worldQuaternionInv),-1===t.indexOf("X")&&(this._offset.x=0),-1===t.indexOf("Y")&&(this._offset.y=0),-1===t.indexOf("Z")&&(this._offset.z=0),("local"===a&&"XYZ"!==t?this._offset.applyQuaternion(this._quaternionStart):this._offset.applyQuaternion(this._parentQuaternionInv)).divide(this._parentScale),n.position.copy(this._offset).add(this._positionStart),this.translationSnap&&("local"===a&&(n.position.applyQuaternion(v.copy(this._quaternionStart).invert()),-1!==t.search("X")&&(n.position.x=Math.round(n.position.x/this.translationSnap)*this.translationSnap),-1!==t.search("Y")&&(n.position.y=Math.round(n.position.y/this.translationSnap)*this.translationSnap),-1!==t.search("Z")&&(n.position.z=Math.round(n.position.z/this.translationSnap)*this.translationSnap),n.position.applyQuaternion(this._quaternionStart)),"world"===a&&(n.parent&&n.position.add(m.setFromMatrixPosition(n.parent.matrixWorld)),-1!==t.search("X")&&(n.position.x=Math.round(n.position.x/this.translationSnap)*this.translationSnap),-1!==t.search("Y")&&(n.position.y=Math.round(n.position.y/this.translationSnap)*this.translationSnap),-1!==t.search("Z")&&(n.position.z=Math.round(n.position.z/this.translationSnap)*this.translationSnap),n.parent&&n.position.sub(m.setFromMatrixPosition(n.parent.matrixWorld))))):"scale"===r?(-1!==t.search("XYZ")?(e=this.pointEnd.length()/this.pointStart.length(),this.pointEnd.dot(this.pointStart)<0&&(e*=-1),g.set(e,e,e)):(m.copy(this.pointStart),g.copy(this.pointEnd),m.applyQuaternion(this._worldQuaternionInv),g.applyQuaternion(this._worldQuaternionInv),g.divide(m),-1===t.search("X")&&(g.x=1),-1===t.search("Y")&&(g.y=1),-1===t.search("Z")&&(g.z=1)),n.scale.copy(this._scaleStart).multiply(g),this.scaleSnap&&(-1!==t.search("X")&&(n.scale.x=Math.round(n.scale.x/this.scaleSnap)*this.scaleSnap||this.scaleSnap),-1!==t.search("Y")&&(n.scale.y=Math.round(n.scale.y/this.scaleSnap)*this.scaleSnap||this.scaleSnap),-1!==t.search("Z")&&(n.scale.z=Math.round(n.scale.z/this.scaleSnap)*this.scaleSnap||this.scaleSnap))):"rotate"===r&&(this._offset.copy(this.pointEnd).sub(this.pointStart),e=20/this.worldPosition.distanceTo(m.setFromMatrixPosition(this.camera.matrixWorld)),"E"===t?(this.rotationAxis.copy(this.eye),this.rotationAngle=this.pointEnd.angleTo(this.pointStart),this._startNorm.copy(this.pointStart).normalize(),this._endNorm.copy(this.pointEnd).normalize(),this.rotationAngle*=this._endNorm.cross(this._startNorm).dot(this.eye)<0?1:-1):"XYZE"===t?(this.rotationAxis.copy(this._offset).cross(this.eye).normalize(),this.rotationAngle=this._offset.dot(m.copy(this.rotationAxis).cross(this.eye))*e):"X"!==t&&"Y"!==t&&"Z"!==t||(this.rotationAxis.copy(b[t]),m.copy(b[t]),"local"===a&&m.applyQuaternion(this.worldQuaternion),this.rotationAngle=this._offset.dot(m.cross(this.eye).normalize())*e),this.rotationSnap&&(this.rotationAngle=Math.round(this.rotationAngle/this.rotationSnap)*this.rotationSnap),"local"===a&&"E"!==t&&"XYZE"!==t?(n.quaternion.copy(this._quaternionStart),n.quaternion.multiply(v.setFromAxisAngle(this.rotationAxis,this.rotationAngle)).normalize()):(this.rotationAxis.applyQuaternion(this._parentQuaternionInv),n.quaternion.copy(v.setFromAxisAngle(this.rotationAxis,this.rotationAngle)),n.quaternion.multiply(this._quaternionStart).normalize())),this.dispatchEvent(y),this.dispatchEvent(S)))}},{key:"pointerUp",value:function(e){0===e.button&&(this.dragging&&null!==this.axis&&(w.mode=this.mode,this.dispatchEvent(w)),this.dragging=!1,this.axis=null)}},{key:"dispose",value:function(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointermove",this._onPointerHover),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.traverse((function(e){e.geometry&&e.geometry.dispose(),e.material&&e.material.dispose()}))}},{key:"attach",value:function(e){return this.object=e,this.visible=!0,this}},{key:"detach",value:function(){return this.object=void 0,this.visible=!1,this.axis=null,this}},{key:"reset",value:function(){this.enabled&&this.dragging&&(this.object.position.copy(this._positionStart),this.object.quaternion.copy(this._quaternionStart),this.object.scale.copy(this._scaleStart),this.dispatchEvent(y),this.dispatchEvent(S),this.pointStart.copy(this.pointEnd))}},{key:"getRaycaster",value:function(){return f}},{key:"getMode",value:function(){return this.mode}},{key:"setMode",value:function(e){this.mode=e}},{key:"setTranslationSnap",value:function(e){this.translationSnap=e}},{key:"setRotationSnap",value:function(e){this.rotationSnap=e}},{key:"setScaleSnap",value:function(e){this.scaleSnap=e}},{key:"setSize",value:function(e){this.size=e}},{key:"setSpace",value:function(e){this.space=e}}]),t}();function T(e,t,r){for(var n=t.intersectObject(e,!0),a=0;a<n.length;a++)if(n[a].object.visible||r)return n[a];return!1}var _=new n.Euler,E=new n.Vector3(0,1,0),D=new n.Vector3(0,0,0),k=new n.Matrix4,O=new n.Quaternion,P=new n.Quaternion,A=new n.Vector3,C=new n.Matrix4,R=new n.Vector3(1,0,0),L=new n.Vector3(0,1,0),I=new n.Vector3(0,0,1),B=new n.Vector3,j=new n.Vector3,U=new n.Vector3,N=function(){c(t,n.Object3D);var e=h(t);function t(){i(this,t),(r=e.call(this)).isTransformControlsGizmo=!0,r.type="TransformControlsGizmo";var r,a=new n.MeshBasicMaterial({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),s=new n.LineBasicMaterial({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),o=a.clone(),l=((((o.opacity=.15,s=s.clone()).opacity=.5,w=a.clone()).color.setHex(16711680),S=a.clone()).color.setHex(65280),a.clone()),c=(l.color.setHex(255),a.clone()),u=(c.color.setHex(16711680),c.opacity=.5,a.clone()),h=(u.color.setHex(65280),u.opacity=.5,a.clone()),d=(h.color.setHex(255),h.opacity=.5,a.clone());(d.opacity=.25,y=a.clone()).color.setHex(16776960),y.opacity=.25,a.clone().color.setHex(16776960);var p=(((a=a.clone()).color.setHex(7895160),g=new n.CylinderGeometry(0,.04,.1,12)).translate(0,.05,0),new n.BoxGeometry(.08,.08,.08)),f=(p.translate(0,.04,0),new n.BufferGeometry);function m(e,t){return(e=new n.TorusGeometry(e,.0075,3,64,t*Math.PI*2)).rotateY(Math.PI/2),e.rotateX(Math.PI/2),e}(f.setAttribute("position",new n.Float32BufferAttribute([0,0,0,1,0,0],3)),M=new n.CylinderGeometry(.0075,.0075,.5,3)).translate(0,.25,0);var g={X:[[new n.Mesh(g,w),[.5,0,0],[0,0,-Math.PI/2]],[new n.Mesh(g,w),[-.5,0,0],[0,0,Math.PI/2]],[new n.Mesh(M,w),[0,0,0],[0,0,-Math.PI/2]]],Y:[[new n.Mesh(g,S),[0,.5,0]],[new n.Mesh(g,S),[0,-.5,0],[Math.PI,0,0]],[new n.Mesh(M,S)]],Z:[[new n.Mesh(g,l),[0,0,.5],[Math.PI/2,0,0]],[new n.Mesh(g,l),[0,0,-.5],[-Math.PI/2,0,0]],[new n.Mesh(M,l),null,[Math.PI/2,0,0]]],XYZ:[[new n.Mesh(new n.OctahedronGeometry(.1,0),d.clone()),[0,0,0]]],XY:[[new n.Mesh(new n.BoxGeometry(.15,.15,.01),h.clone()),[.15,.15,0]]],YZ:[[new n.Mesh(new n.BoxGeometry(.15,.15,.01),c.clone()),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new n.Mesh(new n.BoxGeometry(.15,.15,.01),u.clone()),[.15,0,.15],[-Math.PI/2,0,0]]]},v={X:[[new n.Mesh(new n.CylinderGeometry(.2,0,.6,4),o),[.3,0,0],[0,0,-Math.PI/2]],[new n.Mesh(new n.CylinderGeometry(.2,0,.6,4),o),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new n.Mesh(new n.CylinderGeometry(.2,0,.6,4),o),[0,.3,0]],[new n.Mesh(new n.CylinderGeometry(.2,0,.6,4),o),[0,-.3,0],[0,0,Math.PI]]],Z:[[new n.Mesh(new n.CylinderGeometry(.2,0,.6,4),o),[0,0,.3],[Math.PI/2,0,0]],[new n.Mesh(new n.CylinderGeometry(.2,0,.6,4),o),[0,0,-.3],[-Math.PI/2,0,0]]],XYZ:[[new n.Mesh(new n.OctahedronGeometry(.2,0),o)]],XY:[[new n.Mesh(new n.BoxGeometry(.2,.2,.01),o),[.15,.15,0]]],YZ:[[new n.Mesh(new n.BoxGeometry(.2,.2,.01),o),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new n.Mesh(new n.BoxGeometry(.2,.2,.01),o),[.15,0,.15],[-Math.PI/2,0,0]]]},b={START:[[new n.Mesh(new n.OctahedronGeometry(.01,2),s),null,null,null,"helper"]],END:[[new n.Mesh(new n.OctahedronGeometry(.01,2),s),null,null,null,"helper"]],DELTA:[[new n.Line(((b=new n.BufferGeometry).setAttribute("position",new n.Float32BufferAttribute([0,0,0,1,1,1],3)),b),s),null,null,null,"helper"]],X:[[new n.Line(f,s.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new n.Line(f,s.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new n.Line(f,s.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]},y=(a={XYZE:[[new n.Mesh(m(.5,1),a),null,[0,Math.PI/2,0]]],X:[[new n.Mesh(m(.5,.5),w)]],Y:[[new n.Mesh(m(.5,.5),S),null,[0,0,-Math.PI/2]]],Z:[[new n.Mesh(m(.5,.5),l),null,[0,Math.PI/2,0]]],E:[[new n.Mesh(m(.75,1),y),null,[0,Math.PI/2,0]]]},{AXIS:[[new n.Line(f,s.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]]}),x={XYZE:[[new n.Mesh(new n.SphereGeometry(.25,10,8),o)]],X:[[new n.Mesh(new n.TorusGeometry(.5,.1,4,24),o),[0,0,0],[0,-Math.PI/2,-Math.PI/2]]],Y:[[new n.Mesh(new n.TorusGeometry(.5,.1,4,24),o),[0,0,0],[Math.PI/2,0,0]]],Z:[[new n.Mesh(new n.TorusGeometry(.5,.1,4,24),o),[0,0,0],[0,0,-Math.PI/2]]],E:[[new n.Mesh(new n.TorusGeometry(.75,.1,2,24),o)]]},w={X:[[new n.Mesh(p,w),[.5,0,0],[0,0,-Math.PI/2]],[new n.Mesh(M,w),[0,0,0],[0,0,-Math.PI/2]],[new n.Mesh(p,w),[-.5,0,0],[0,0,Math.PI/2]]],Y:[[new n.Mesh(p,S),[0,.5,0]],[new n.Mesh(M,S)],[new n.Mesh(p,S),[0,-.5,0],[0,0,Math.PI]]],Z:[[new n.Mesh(p,l),[0,0,.5],[Math.PI/2,0,0]],[new n.Mesh(M,l),[0,0,0],[Math.PI/2,0,0]],[new n.Mesh(p,l),[0,0,-.5],[-Math.PI/2,0,0]]],XY:[[new n.Mesh(new n.BoxGeometry(.15,.15,.01),h),[.15,.15,0]]],YZ:[[new n.Mesh(new n.BoxGeometry(.15,.15,.01),c),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new n.Mesh(new n.BoxGeometry(.15,.15,.01),u),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new n.Mesh(new n.BoxGeometry(.1,.1,.1),d.clone())]]},S={X:[[new n.Mesh(new n.CylinderGeometry(.2,0,.6,4),o),[.3,0,0],[0,0,-Math.PI/2]],[new n.Mesh(new n.CylinderGeometry(.2,0,.6,4),o),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new n.Mesh(new n.CylinderGeometry(.2,0,.6,4),o),[0,.3,0]],[new n.Mesh(new n.CylinderGeometry(.2,0,.6,4),o),[0,-.3,0],[0,0,Math.PI]]],Z:[[new n.Mesh(new n.CylinderGeometry(.2,0,.6,4),o),[0,0,.3],[Math.PI/2,0,0]],[new n.Mesh(new n.CylinderGeometry(.2,0,.6,4),o),[0,0,-.3],[-Math.PI/2,0,0]]],XY:[[new n.Mesh(new n.BoxGeometry(.2,.2,.01),o),[.15,.15,0]]],YZ:[[new n.Mesh(new n.BoxGeometry(.2,.2,.01),o),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new n.Mesh(new n.BoxGeometry(.2,.2,.01),o),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new n.Mesh(new n.BoxGeometry(.2,.2,.2),o),[0,0,0]]]},M={X:[[new n.Line(f,s.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new n.Line(f,s.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new n.Line(f,s.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]};function T(e){var t,r=new n.Object3D;for(t in e)for(var a=e[t].length;a--;){var i=e[t][a][0].clone(),s=e[t][a][1],o=e[t][a][2],l=e[t][a][3],c=e[t][a][4];(i.name=t,i.tag=c,s&&i.position.set(s[0],s[1],s[2]),o&&i.rotation.set(o[0],o[1],o[2]),l&&i.scale.set(l[0],l[1],l[2]),i.updateMatrix(),c=i.geometry.clone()).applyMatrix4(i.matrix),i.geometry=c,i.renderOrder=1/0,i.position.set(0,0,0),i.rotation.set(0,0,0),i.scale.set(1,1,1),r.add(i)}return r}return r.gizmo={},r.picker={},r.helper={},r.add(r.gizmo.translate=T(g)),r.add(r.gizmo.rotate=T(a)),r.add(r.gizmo.scale=T(w)),r.add(r.picker.translate=T(v)),r.add(r.picker.rotate=T(x)),r.add(r.picker.scale=T(S)),r.add(r.helper.translate=T(b)),r.add(r.helper.rotate=T(y)),r.add(r.helper.scale=T(M)),r.picker.translate.visible=!1,r.picker.rotate.visible=!1,r.picker.scale.visible=!1,r}return o(t,[{key:"updateMatrixWorld",value:function(e){var r=this,n="local"===("scale"===this.mode?"local":this.space)?this.worldQuaternion:P,a=(this.gizmo.translate.visible="translate"===this.mode,this.gizmo.rotate.visible="rotate"===this.mode,this.gizmo.scale.visible="scale"===this.mode,this.helper.translate.visible="translate"===this.mode,this.helper.rotate.visible="rotate"===this.mode,this.helper.scale.visible="scale"===this.mode,[]);a=(a=(a=a.concat(this.picker[this.mode].children)).concat(this.gizmo[this.mode].children)).concat(this.helper[this.mode].children);for(var i=0;i<a.length;i++)!function(e){var t=a[e];if(t.visible=!0,t.rotation.set(0,0,0),e=void t.position.copy(r.worldPosition),e=r.camera.isOrthographicCamera?(r.camera.top-r.camera.bottom)/r.camera.zoom:r.worldPosition.distanceTo(r.cameraPosition)*Math.min(1.9*Math.tan(Math.PI*r.camera.fov/360)/r.camera.zoom,7),t.scale.set(1,1,1).multiplyScalar(e*r.size/4),"helper"===t.tag)return t.visible=!1,"AXIS"===t.name?(t.visible=!!r.axis,"X"===r.axis&&(v.setFromEuler(_.set(0,0,0)),t.quaternion.copy(n).multiply(v),.9<Math.abs(E.copy(R).applyQuaternion(n).dot(r.eye))&&(t.visible=!1)),"Y"===r.axis&&(v.setFromEuler(_.set(0,0,Math.PI/2)),t.quaternion.copy(n).multiply(v),.9<Math.abs(E.copy(L).applyQuaternion(n).dot(r.eye))&&(t.visible=!1)),"Z"===r.axis&&(v.setFromEuler(_.set(0,Math.PI/2,0)),t.quaternion.copy(n).multiply(v),.9<Math.abs(E.copy(I).applyQuaternion(n).dot(r.eye))&&(t.visible=!1)),"XYZE"===r.axis&&(v.setFromEuler(_.set(0,Math.PI/2,0)),E.copy(r.rotationAxis),t.quaternion.setFromRotationMatrix(k.lookAt(D,E,L)),t.quaternion.multiply(v),t.visible=r.dragging),"E"===r.axis&&(t.visible=!1)):"START"===t.name?(t.position.copy(r.worldPositionStart),t.visible=r.dragging):"END"===t.name?(t.position.copy(r.worldPosition),t.visible=r.dragging):"DELTA"===t.name?(t.position.copy(r.worldPositionStart),t.quaternion.copy(r.worldQuaternionStart),m.set(1e-10,1e-10,1e-10).add(r.worldPositionStart).sub(r.worldPosition).multiplyScalar(-1),m.applyQuaternion(r.worldQuaternionStart.clone().invert()),t.scale.copy(m),t.visible=r.dragging):(t.quaternion.copy(n),r.dragging?t.position.copy(r.worldPositionStart):t.position.copy(r.worldPosition),r.axis&&(t.visible=-1!==r.axis.search(t.name)));t.quaternion.copy(n),"translate"===r.mode||"scale"===r.mode?("X"===t.name&&.99<Math.abs(E.copy(R).applyQuaternion(n).dot(r.eye))&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1),"Y"===t.name&&.99<Math.abs(E.copy(L).applyQuaternion(n).dot(r.eye))&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1),"Z"===t.name&&.99<Math.abs(E.copy(I).applyQuaternion(n).dot(r.eye))&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1),"XY"===t.name&&Math.abs(E.copy(I).applyQuaternion(n).dot(r.eye))<.2&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1),"YZ"===t.name&&Math.abs(E.copy(R).applyQuaternion(n).dot(r.eye))<.2&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1),"XZ"===t.name&&Math.abs(E.copy(L).applyQuaternion(n).dot(r.eye))<.2&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1)):"rotate"===r.mode&&(O.copy(n),E.copy(r.eye).applyQuaternion(v.copy(n).invert()),-1!==t.name.search("E")&&t.quaternion.setFromRotationMatrix(k.lookAt(r.eye,D,L)),"X"===t.name&&(v.setFromAxisAngle(R,Math.atan2(-E.y,E.z)),v.multiplyQuaternions(O,v),t.quaternion.copy(v)),"Y"===t.name&&(v.setFromAxisAngle(L,Math.atan2(E.x,E.z)),v.multiplyQuaternions(O,v),t.quaternion.copy(v)),"Z"===t.name&&(v.setFromAxisAngle(I,Math.atan2(E.y,E.x)),v.multiplyQuaternions(O,v),t.quaternion.copy(v))),t.visible=t.visible&&(-1===t.name.indexOf("X")||r.showX),t.visible=t.visible&&(-1===t.name.indexOf("Y")||r.showY),t.visible=t.visible&&(-1===t.name.indexOf("Z")||r.showZ),t.visible=t.visible&&(-1===t.name.indexOf("E")||r.showX&&r.showY&&r.showZ),t.material._color=t.material._color||t.material.color.clone(),t.material._opacity=t.material._opacity||t.material.opacity,t.material.color.copy(t.material._color),t.material.opacity=t.material._opacity,r.enabled&&r.axis&&(t.name===r.axis||r.axis.split("").some((function(e){return t.name===e})))&&(t.material.color.setHex(16776960),t.material.opacity=1)}(i);l(p(t.prototype),"updateMatrixWorld",this).call(this,e)}}]),t}(),z=function(){c(t,n.Mesh);var e=h(t);function t(){var r;return i(this,t),(r=e.call(this,new n.PlaneGeometry(1e5,1e5,2,2),new n.MeshBasicMaterial({visible:!1,wireframe:!0,side:n.DoubleSide,transparent:!0,opacity:.1,toneMapped:!1}))).isTransformControlsPlane=!0,r.type="TransformControlsPlane",r}return o(t,[{key:"updateMatrixWorld",value:function(e){var r=this.space;switch(this.position.copy(this.worldPosition),"scale"===this.mode&&(r="local"),B.copy(R).applyQuaternion("local"===r?this.worldQuaternion:P),j.copy(L).applyQuaternion("local"===r?this.worldQuaternion:P),U.copy(I).applyQuaternion("local"===r?this.worldQuaternion:P),E.copy(j),this.mode){case"translate":case"scale":switch(this.axis){case"X":E.copy(this.eye).cross(B),A.copy(B).cross(E);break;case"Y":E.copy(this.eye).cross(j),A.copy(j).cross(E);break;case"Z":E.copy(this.eye).cross(U),A.copy(U).cross(E);break;case"XY":A.copy(U);break;case"YZ":A.copy(B);break;case"XZ":E.copy(U),A.copy(j);break;case"XYZ":case"E":A.set(0,0,0)}break;default:A.set(0,0,0)}0===A.length()?this.quaternion.copy(this.cameraQuaternion):(C.lookAt(m.set(0,0,0),A,E),this.quaternion.setFromRotationMatrix(C)),l(p(t.prototype),"updateMatrixWorld",this).call(this,e)}}]),t}()},6422:(e,t,r)=>{r.d(t,{x:()=>c});var n=r(8881);function a(e){return(a="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})(e)}function i(){return(i="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=l(e)););return e}(e,t);if(n)return(n=Object.getOwnPropertyDescriptor(n,t)).get?n.get.call(arguments.length<3?e:r):n.value}).apply(this,arguments)}function s(e,t){return(s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function o(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=l(e);if(r=t?(r=l(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===a(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function l(e){return(l=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var c=function(e){var t=a;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&s(t,e);var r=o(a);function a(e){if(this instanceof a)return(e=r.call(this,e)).type=n.HalfFloatType,e;throw new TypeError("Cannot call a class as a function")}return t=a,(e=[{key:"parse",value:function(e){var t,r,a,i,s,o,l,c,u,h,d=function(e,t){switch(e){case 1:console.error("THREE.RGBELoader Read Error: "+(t||""));break;case 2:console.error("THREE.RGBELoader Write Error: "+(t||""));break;case 3:console.error("THREE.RGBELoader Bad File Format: "+(t||""));break;default:console.error("THREE.RGBELoader: Error: "+(t||""))}return-1},p=function(e,t,r){t=t||1024;for(var n=e.pos,a=-1,i=0,s="",o=String.fromCharCode.apply(null,new Uint16Array(e.subarray(n,n+128)));(a=o.indexOf("\n"))<0&&i<t&&n<e.byteLength;)s+=o,i+=o.length,n+=128,o+=String.fromCharCode.apply(null,new Uint16Array(e.subarray(n,n+128)));return-1<a&&(!1!==r&&(e.pos+=i+a+1),s+o.slice(0,a))},f=((e=new Uint8Array(e)).pos=0,function(e){var t,r,n=/^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,a=/^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/,i=/^\s*FORMAT=(\S+)\s*$/,s=/^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/,o={valid:0,string:"",comments:"",programtype:"RGBE",format:"",gamma:1,exposure:1,width:0,height:0};if(e.pos>=e.byteLength||!(t=p(e)))return d(1,"no header found");if(!(r=t.match(/^#\?(\S+)/)))return d(3,"bad initial token");for(o.valid|=1,o.programtype=r[1],o.string+=t+"\n";!1!==(t=p(e));)if(o.string+=t+"\n","#"===t.charAt(0))o.comments+=t+"\n";else if((r=t.match(n))&&(o.gamma=parseFloat(r[1])),(r=t.match(a))&&(o.exposure=parseFloat(r[1])),(r=t.match(i))&&(o.valid|=2,o.format=r[1]),(r=t.match(s))&&(o.valid|=4,o.height=parseInt(r[1],10),o.width=parseInt(r[2],10)),2&o.valid&&4&o.valid)break;return 2&o.valid?4&o.valid?o:d(3,"missing image size specifier"):d(3,"missing format specifier")}(e));if(-1!==f){var m,g,v=f.width,b=f.height,y=function(e,t,r){var n=t;if(n<8||32767<n||2!==e[0]||2!==e[1]||128&e[2])return new Uint8Array(e);if(n!==(e[2]<<8|e[3]))return d(3,"wrong scanline width");var a=new Uint8Array(4*t*r);if(!a.length)return d(4,"unable to allocate buffer space");for(var i=0,s=0,o=4*n,l=new Uint8Array(4),c=new Uint8Array(o),u=r;0<u&&s<e.byteLength;){if(s+4>e.byteLength)return d(1);if(l[0]=e[s++],l[1]=e[s++],l[2]=e[s++],l[3]=e[s++],2!=l[0]||2!=l[1]||(l[2]<<8|l[3])!=n)return d(3,"bad rgbe scanline format");for(var h=0,p=void 0;h<o&&s<e.byteLength;){var f=128<(p=e[s++]);if(f&&(p-=128),0===p||o<h+p)return d(3,"bad scanline data");if(f)for(var m=e[s++],g=0;g<p;g++)c[h++]=m;else c.set(e.subarray(s,s+p),h),h+=p,s+=p}for(var v=n,b=0;b<v;b++){var y=0;a[i]=c[b+0],y+=n,a[i+1]=c[b+y],y+=n,a[i+2]=c[b+y],y+=n,a[i+3]=c[b+y],i+=4}u--}return a}(e.subarray(e.pos),v,b);if(-1!==y){switch(this.type){case n.FloatType:for(var x=y.length/4,w=new Float32Array(4*x),S=0;S<x;S++)c=w,u=l=4*S,h=void 0,h=(o=y)[l+3],h=Math.pow(2,h-128)/255,c[u+0]=o[l+0]*h,c[u+1]=o[l+1]*h,c[u+2]=o[l+2]*h,c[u+3]=1;m=w,g=n.FloatType;break;case n.HalfFloatType:x=y.length/4;for(var M=new Uint16Array(4*x),T=0;T<x;T++)a=M,i=r=4*T,s=void 0,s=(t=y)[r+3],s=Math.pow(2,s-128)/255,a[i+0]=n.DataUtils.toHalfFloat(Math.min(t[r+0]*s,65504)),a[i+1]=n.DataUtils.toHalfFloat(Math.min(t[r+1]*s,65504)),a[i+2]=n.DataUtils.toHalfFloat(Math.min(t[r+2]*s,65504)),a[i+3]=n.DataUtils.toHalfFloat(1);m=M,g=n.HalfFloatType;break;default:console.error("THREE.RGBELoader: unsupported type: ",this.type)}return{width:v,height:b,data:m,header:f.string,gamma:f.gamma,exposure:f.exposure,type:g}}}return null}},{key:"setDataType",value:function(e){return this.type=e,this}},{key:"load",value:function(e,t,r,s){return i(l(a.prototype),"load",this).call(this,e,(function(e,r){switch(e.type){case n.FloatType:case n.HalfFloatType:e.encoding=n.LinearEncoding,e.minFilter=n.LinearFilter,e.magFilter=n.LinearFilter,e.generateMipmaps=!1,e.flipY=!0}t&&t(e,r)}),r,s)}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),a}(n.DataTextureLoader)},4819:(e,t,r)=>{r.d(t,{T:()=>u,w:()=>o});var n=r(8881);function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function s(e,t,r){t&&i(e.prototype,t),r&&i(e,r),Object.defineProperty(e,"prototype",{writable:!1})}var o=function(){function e(){a(this,e),this.enabled=!0,this.needsSwap=!0,this.clear=!1,this.renderToScreen=!1}return s(e,[{key:"setSize",value:function(){}},{key:"render",value:function(){console.error("THREE.Pass: .render() must be implemented in derived pass.")}},{key:"dispose",value:function(){}}]),e}(),l=new n.OrthographicCamera(-1,1,1,-1,0,1),c=new n.BufferGeometry,u=(c.setAttribute("position",new n.Float32BufferAttribute([-1,3,0,-1,-1,0,3,-1,0],3)),c.setAttribute("uv",new n.Float32BufferAttribute([0,2,0,0,2,0],2)),function(){function e(t){a(this,e),this._mesh=new n.Mesh(c,t)}return s(e,[{key:"dispose",value:function(){this._mesh.geometry.dispose()}},{key:"render",value:function(e){e.render(this._mesh,l)}},{key:"material",get:function(){return this._mesh.material},set:function(e){this._mesh.material=e}}]),e}())},5180:(e,t,r)=>{r.d(t,{T:()=>c});var n=r(8881),a=r(4819);function i(e){return(i="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})(e)}function s(e,t){return(s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function o(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=l(e);if(r=t?(r=l(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===i(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function l(e){return(l=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var c=function(e){var t=i;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&s(t,e);var r=o(i);function i(e,t){var s;if(this instanceof i)return(s=r.call(this)).textureID=void 0!==t?t:"tDiffuse",e instanceof n.ShaderMaterial?(s.uniforms=e.uniforms,s.material=e):e&&(s.uniforms=n.UniformsUtils.clone(e.uniforms),s.material=new n.ShaderMaterial({defines:Object.assign({},e.defines),uniforms:s.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader})),s.fsQuad=new a.T(s.material),s;throw new TypeError("Cannot call a class as a function")}return t=i,(e=[{key:"render",value:function(e,t,r){this.uniforms[this.textureID]&&(this.uniforms[this.textureID].value=r.texture),this.fsQuad.material=this.material,this.renderToScreen?e.setRenderTarget(null):(e.setRenderTarget(t),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil)),this.fsQuad.render(e)}},{key:"dispose",value:function(){this.material.dispose(),this.fsQuad.dispose()}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),i}(a.w)},699:(e,t,r)=>{function n(e){return(n="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})(e)}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function s(e,t,r){return t&&i(e.prototype,t),r&&i(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function o(){return(o="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=c(e)););return e}(e,t);if(n)return(n=Object.getOwnPropertyDescriptor(n,t)).get?n.get.call(arguments.length<3?e:r):n.value}).apply(this,arguments)}function l(e,t){return(l=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function c(e){return(c=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}r.d(t,{M:()=>g,j:()=>u});var u=function(e){var t=i;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&l(t,e);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,a=c(e);if(r=t?(r=c(this).constructor,Reflect.construct(a,arguments,r)):a.apply(this,arguments),a=this,r&&("object"===n(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==a)return a;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(i);function i(){var e,t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:document.createElement("div");return a(this,i),(e=r.call(this)).isCSS2DObject=!0,e.element=t,e.element.style.position="absolute",e.element.style.userSelect="none",e.element.setAttribute("draggable",!1),e.addEventListener("removed",(function(){this.traverse((function(e){e.element instanceof Element&&null!==e.element.parentNode&&e.element.parentNode.removeChild(e.element)}))})),e}return s(i,[{key:"copy",value:function(e,t){return o(c(i.prototype),"copy",this).call(this,e,t),this.element=e.element.cloneNode(!0),this}}]),i}((t=r(8881)).Object3D),h=new t.Vector3,d=new t.Matrix4,p=new t.Matrix4,f=new t.Vector3,m=new t.Vector3,g=s((function e(){var t,r,n,i,s=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},o=(a(this,e),this),l={objects:new WeakMap},c=void 0!==s.element?s.element:document.createElement("div");function u(e,t){return f.setFromMatrixPosition(e.matrixWorld),m.setFromMatrixPosition(t.matrixWorld),f.distanceToSquared(m)}c.style.overflow="hidden",this.domElement=c,this.getSize=function(){return{width:t,height:r}},this.render=function(e,t){!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),null===t.parent&&!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),d.copy(t.matrixWorldInverse),p.multiplyMatrices(t.projectionMatrix,d),function e(t,r,a){var s;t.isCSS2DObject&&(h.setFromMatrixPosition(t.matrixWorld),h.applyMatrix4(p),s=!0===t.visible&&-1<=h.z&&h.z<=1&&!0===t.layers.test(a.layers),t.element.style.display=1==s?"":"none",1==s&&(t.onBeforeRender(o,r,a),(s=t.element).style.transform="translate(-50%,-50%) translate("+(h.x*n+n)+"px,"+(-h.y*i+i)+"px)",s.parentNode!==c&&c.appendChild(s),t.onAfterRender(o,r,a)),s={distanceToCameraSquared:u(a,t)},l.objects.set(t,s));for(var d=0,f=t.children.length;d<f;d++)e(t.children[d],r,a)}(e,e,t);for(var r=function(e){var t=[];return e.traverse((function(e){e.isCSS2DObject&&t.push(e)})),t}(e).sort((function(e,t){return e.renderOrder!==t.renderOrder?t.renderOrder-e.renderOrder:l.objects.get(e).distanceToCameraSquared-l.objects.get(t).distanceToCameraSquared})),a=r.length,s=0,f=r.length;s<f;s++)r[s].element.style.zIndex=a-s},this.setSize=function(e,a){n=(t=e)/2,i=(r=a)/2,c.style.width=e+"px",c.style.height=a+"px"}}))},3693:(e,t,r)=>{r.d(t,{P7:()=>v,cp:()=>g,lX:()=>x});var n=r(8881);function a(e){return(a="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})(e)}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function o(e,t,r){return t&&s(e.prototype,t),r&&s(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function l(){return(l="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=d(e)););return e}(e,t);if(n)return(n=Object.getOwnPropertyDescriptor(n,t)).get?n.get.call(arguments.length<3?e:r):n.value}).apply(this,arguments)}function c(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&&u(e,t)}function u(e,t){return(u=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function h(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=d(e);if(r=t?(r=d(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===a(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function d(e){return(d=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var p=new n.Vector3,f=new n.Quaternion,m=new n.Vector3,g=function(){c(t,n.Object3D);var e=h(t);function t(){var r,n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:document.createElement("div");return i(this,t),(r=e.call(this)).isCSS3DObject=!0,r.element=n,r.element.style.position="absolute",r.element.style.pointerEvents="auto",r.element.style.userSelect="none",r.element.setAttribute("draggable",!1),r.addEventListener("removed",(function(){this.traverse((function(e){e.element instanceof Element&&null!==e.element.parentNode&&e.element.parentNode.removeChild(e.element)}))})),r}return o(t,[{key:"copy",value:function(e,r){return l(d(t.prototype),"copy",this).call(this,e,r),this.element=e.element.cloneNode(!0),this}}]),t}(),v=function(){c(t,g);var e=h(t);function t(r){return i(this,t),(r=e.call(this,r)).isCSS3DSprite=!0,r.rotation2D=0,r}return o(t,[{key:"copy",value:function(e,r){return l(d(t.prototype),"copy",this).call(this,e,r),this.rotation2D=e.rotation2D,this}}]),t}(),b=new n.Matrix4,y=new n.Matrix4,x=o((function e(){var t,r,n,a,s=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},o=(i(this,e),this),l={camera:{fov:0,style:""},objects:new WeakMap},c=void 0!==s.element?s.element:document.createElement("div"),u=(c.style.overflow="hidden",this.domElement=c,document.createElement("div"));function h(e){return Math.abs(e)<1e-10?0:e}function d(e){return"matrix3d("+h((e=e.elements)[0])+","+h(-e[1])+","+h(e[2])+","+h(e[3])+","+h(e[4])+","+h(-e[5])+","+h(e[6])+","+h(e[7])+","+h(e[8])+","+h(-e[9])+","+h(e[10])+","+h(e[11])+","+h(e[12])+","+h(-e[13])+","+h(e[14])+","+h(e[15])+")"}function g(e){return"translate(-50%,-50%)matrix3d("+h((e=e.elements)[0])+","+h(e[1])+","+h(e[2])+","+h(e[3])+","+h(-e[4])+","+h(-e[5])+","+h(-e[6])+","+h(-e[7])+","+h(e[8])+","+h(e[9])+","+h(e[10])+","+h(e[11])+","+h(e[12])+","+h(e[13])+","+h(e[14])+","+h(e[15])+")"}u.style.transformStyle="preserve-3d",u.style.pointerEvents="none",c.appendChild(u),this.getSize=function(){return{width:t,height:r}},this.render=function(e,t){var r=t.projectionMatrix.elements[5]*a,i=(l.camera.fov!==r&&(c.style.perspective=t.isPerspectiveCamera?r+"px":"",l.camera.fov=r),!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),null===t.parent&&!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),t.isOrthographicCamera&&(i=-(t.right+t.left)/2,s=(t.top+t.bottom)/2),t.isOrthographicCamera?"scale("+r+")translate("+h(i)+"px,"+h(s)+"px)"+d(t.matrixWorldInverse):"translateZ("+r+"px)"+d(t.matrixWorldInverse)),s=i+"translate("+n+"px,"+a+"px)";l.camera.style!==s&&(u.style.transform=s,l.camera.style=s),function e(t,r,n,a){var i,s,c;t.isCSS3DObject&&(i=!0===t.visible&&!0===t.layers.test(n.layers),t.element.style.display=1==i?"":"none",1==i&&(t.onBeforeRender(o,r,n),i=t.isCSS3DSprite?(b.copy(n.matrixWorldInverse),b.transpose(),0!==t.rotation2D&&b.multiply(y.makeRotationZ(t.rotation2D)),t.matrixWorld.decompose(p,f,m),b.setPosition(p),b.scale(m),b.elements[3]=0,b.elements[7]=0,b.elements[11]=0,b.elements[15]=1,g(b)):g(t.matrixWorld),s=t.element,void 0!==(c=l.objects.get(t))&&c.style===i||(c={style:s.style.transform=i},l.objects.set(t,c)),s.parentNode!==u&&u.appendChild(s),t.onAfterRender(o,r,n)));for(var h=0,d=t.children.length;h<d;h++)e(t.children[h],r,n,a)}(e,e,t,i)},this.setSize=function(e,i){n=(t=e)/2,a=(r=i)/2,c.style.width=e+"px",c.style.height=i+"px",u.style.width=e+"px",u.style.height=i+"px"}}))},6608:(e,t,r)=>{r.d(t,{C:()=>n});var n={uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:"\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",fragmentShader:"\n\n\t\tuniform float opacity;\n\n\t\tuniform sampler2D tDiffuse;\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tgl_FragColor = texture2D( tDiffuse, vUv );\n\t\t\tgl_FragColor.a *= opacity;\n\n\n\t\t}"}},4091:(e,t,r)=>{r.d(t,{Vs:()=>function(e,t){if(t===n.TrianglesDrawMode)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),e;if(t!==n.TriangleFanDrawMode&&t!==n.TriangleStripDrawMode)return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",t),e;var r=e.getIndex();if(null===r){var a=[],i=e.getAttribute("position");if(void 0===i)return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),e;for(var s=0;s<i.count;s++)a.push(s);e.setIndex(a),r=e.getIndex()}var o=r.count-2,l=[];if(t===n.TriangleFanDrawMode)for(var c=1;c<=o;c++)l.push(r.getX(0)),l.push(r.getX(c)),l.push(r.getX(c+1));else for(var u=0;u<o;u++)u%2==0?(l.push(r.getX(u)),l.push(r.getX(u+1)),l.push(r.getX(u+2))):(l.push(r.getX(u+2)),l.push(r.getX(u+1)),l.push(r.getX(u)));return l.length/3!=o&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles."),(t=e.clone()).setIndex(l),t.clearGroups(),t},qf:()=>function(e){for(var t,r,i=1<arguments.length&&void 0!==arguments[1]&&arguments[1],s=null!==e[0].index,o=new Set(Object.keys(e[0].attributes)),l=new Set(Object.keys(e[0].morphAttributes)),c={},u={},h=e[0].morphTargetsRelative,d=new n.BufferGeometry,p=0,f=0;f<e.length;++f){var m,g,v=e[f],b=0;if(s!=(null!==v.index))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+f+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(m in v.attributes){if(!o.has(m))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+f+'. All geometries must have compatible attributes; make sure "'+m+'" attribute exists among all geometries, or in none of them.'),null;void 0===c[m]&&(c[m]=[]),c[m].push(v.attributes[m]),b++}if(b!==o.size)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+f+". Make sure all geometries have the same number of attributes."),null;if(h!==v.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+f+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(g in v.morphAttributes){if(!l.has(g))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+f+". .morphAttributes must be consistent throughout all geometries."),null;void 0===u[g]&&(u[g]=[]),u[g].push(v.morphAttributes[g])}if(i){var y=void 0;if(s)y=v.index.count;else{if(void 0===v.attributes.position)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+f+". The geometry must have either an index or a position attribute"),null;y=v.attributes.position.count}d.addGroup(p,y,f),p+=y}}if(s){for(var x=0,w=[],S=0;S<e.length;++S){for(var M=e[S].index,T=0;T<M.count;++T)w.push(M.getX(T)+x);x+=e[S].attributes.position.count}d.setIndex(w)}for(t in c){var _=a(c[t]);if(!_)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the "+t+" attribute."),null;d.setAttribute(t,_)}for(r in u){var E=u[r][0].length;if(0===E)break;d.morphAttributes=d.morphAttributes||{},d.morphAttributes[r]=[];for(var D=0;D<E;++D){for(var k=[],O=0;O<u[r].length;++O)k.push(u[r][O][D]);var P=a(k);if(!P)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the "+r+" morphAttribute."),null;d.morphAttributes[r].push(P)}}return d}});var n=r(8881);function a(e){for(var t,r,a,i=0,s=0;s<e.length;++s){var o=e[s];if(o.isInterleavedBufferAttribute)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. InterleavedBufferAttributes are not supported."),null;if((t=void 0===t?o.array.constructor:t)!==o.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if((r=void 0===r?o.itemSize:r)!==o.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if((a=void 0===a?o.normalized:a)!==o.normalized)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;i+=o.array.length}for(var l=new t(i),c=0,u=0;u<e.length;++u)l.set(e[u].array,c),c+=e[u].array.length;return new n.BufferAttribute(l,r,a)}}},__webpack_module_cache__={};function __webpack_require__(e){var t=__webpack_module_cache__[e];return void 0!==t||(t=__webpack_module_cache__[e]={exports:{}},__webpack_modules__[e](t,t.exports,__webpack_require__)),t.exports}__webpack_require__.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return __webpack_require__.d(t,{a:t}),t},__webpack_require__.d=(e,t)=>{for(var r in t)__webpack_require__.o(t,r)&&!__webpack_require__.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},__webpack_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),__webpack_require__.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var __webpack_exports__={};return(()=>{__webpack_require__.d(__webpack_exports__,{default:()=>r});var e=__webpack_require__(8624),t=__webpack_require__(2677);const r={RunScene:t.ZP,Utils:t.cQ,ModelEx:t.ch,MaterialEx:t.al,TextureEx:t.Az,Three:t.Sf,ThreeEx:{TransformControls:e.Ys},Bus:t.Gc}})(),__webpack_exports__=__webpack_exports__.default,__webpack_exports__})()));
|